/* ============================================================================
   ONSET — Design System
   Tokens first, components second. Everything themable via CSS custom
   properties so mobile (phone frames) and web (page chrome) share one system.
   ========================================================================== */

/* ---------- 1. Tokens: dark (default, set-ready) ---------- */
:root {
  color-scheme: dark;

  --bg:            #111315;
  --surface:       #1B1E21;
  --surface-2:     #16191B;
  --surface-3:     #262A2C;
  --page:          #0E1012;
  /* The surface the device sits on at desktop width. Darker than the app so
     the screen reads as lit, the way the design has it. */
  --studio:        #0A0B0C;

  /* Muted levels are tuned for contrast, not just for looks: t2/t3 clear AA
     for body copy on --surface, t4 stays tertiary for decorative metadata. */
  --t1: #F5F6F4;
  --t2: rgba(245, 246, 244, .62);
  --t3: rgba(245, 246, 244, .50);
  --t4: rgba(245, 246, 244, .38);

  --hairline:      rgba(255, 255, 255, .08);
  --hairline-2:    rgba(255, 255, 255, .14);
  --hover:         rgba(255, 255, 255, .06);

  /* accent — "act on this now" */
  --accent:        #B7F34A;
  --accent-hi:     #C9F776;
  --accent-ink:    #111315;
  --accent-text:   #B7F34A;
  --accent-soft:   rgba(183, 243, 74, .12);
  --accent-line:   rgba(183, 243, 74, .40);

  /* green — live / confirmed */
  --green:         #43C779;
  --green-text:    #43C779;
  --green-soft:    rgba(67, 199, 121, .09);
  --green-dim:     rgba(67, 199, 121, .42);
  --green-line:    rgba(67, 199, 121, .35);

  /* yellow — something changed */
  --yellow:        #F5B942;
  --yellow-ink:    #111315;
  --yellow-text:   #F5B942;
  --yellow-soft:   rgba(245, 185, 66, .10);
  --yellow-line:   rgba(245, 185, 66, .33);

  /* red — urgent / emergency */
  --red:           #E63946;
  --red-ink:       #FFFFFF;
  --red-text:      #FF654F;
  --red-soft:      #241A1D;
  --red-line:      rgba(230, 57, 70, .30);

  /* blue — information */
  --blue:          #4D8DFF;
  --blue-text:     #7FAEFF;

  --device-bezel:  #000;
  --device-shadow: 0 40px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .07);
  --status-ink:    #FFFFFF;

  --r-card: 8px;
  --r-lg:   18px;
  --r-pill: 999px;

  --display: 'Space Grotesk', 'Avenir Next', system-ui, sans-serif;
  --ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --s: 1; /* phone scale */
}

/* ---------- 2. Tokens: light ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:            #F3F4F0;
  --surface:       #FFFFFF;
  --surface-2:     #F1F3ED;
  --surface-3:     #E4E7DF;
  --page:          #E9EBE5;
  --studio:        #DFE2DA;

  --t1: #14171A;
  --t2: rgba(20, 23, 26, .70);
  --t3: rgba(20, 23, 26, .60);
  --t4: rgba(20, 23, 26, .52);

  --hairline:      rgba(20, 23, 26, .10);
  --hairline-2:    rgba(20, 23, 26, .18);
  --hover:         rgba(20, 23, 26, .05);

  --accent:        #A9E22F;
  --accent-hi:     #BCEE55;
  --accent-ink:    #10130C;
  --accent-text:   #4B7300;
  --accent-soft:   rgba(120, 178, 0, .14);
  --accent-line:   rgba(120, 178, 0, .45);

  --green:         #1E9455;
  --green-text:    #14713F;
  --green-soft:    rgba(30, 148, 85, .10);
  --green-dim:     rgba(30, 148, 85, .40);
  --green-line:    rgba(30, 148, 85, .32);

  --yellow:        #E9A21B;
  --yellow-ink:    #241A00;
  --yellow-text:   #855102;
  --yellow-soft:   rgba(233, 162, 27, .16);
  --yellow-line:   rgba(196, 132, 8, .42);

  --red:           #D0212F;
  --red-ink:       #FFFFFF;
  --red-text:      #AC1B27;
  --red-soft:      #FCEFF0;
  --red-line:      rgba(208, 33, 47, .28);

  --blue:          #2563EB;
  --blue-text:     #1D4FD0;

  --device-bezel:  #C9CCC4;
  --device-shadow: 0 40px 80px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .12);
  --status-ink:    #000000;
}

/* ---------- 3. Reset / base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page);
  color: var(--t1);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; color: inherit; }

:where(a) { color: var(--accent-text); }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 4. Typography primitives ---------- */

.label {
  font: 600 11px/1 var(--ui);
  letter-spacing: .20em;
  text-transform: uppercase;
  color: var(--t3);
}

.label-sm {
  font: 600 10.5px/1 var(--ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--t3);
}

.tag {
  font: 600 10px/1 var(--ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--t4);
  white-space: nowrap;
}

.display   { font: 600 68px/.86 var(--display); letter-spacing: -.01em; }
.display-m { font: 600 44px/1 var(--display); }
.display-s { font: 600 32px/1 var(--display); }
.h-screen  { font: 600 28px/1 var(--display); letter-spacing: .02em; }
.h-card    { font: 600 22px/1.2 var(--display); }
.body      { font: 400 13px/1.5 var(--ui); color: var(--t2); }
.body-sm   { font: 400 12.5px/1.45 var(--ui); color: var(--t3); }

.muted { color: var(--t3); }
.strike { text-decoration: line-through; color: var(--t4); }

/* ---------- 5. Page chrome ---------- */



















/* ---------- 6. Controls ---------- */
.seg {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  width: max-content;
}

.seg button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  background: transparent;
  color: var(--t2);
  font: 600 12px/1 var(--ui);
  letter-spacing: .10em;
  text-transform: uppercase;
  transition: background .12s ease, color .12s ease;
}

.seg button:hover { background: var(--hover); }

.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.seg.seg-sm { padding: 3px; gap: 5px; }

.seg.seg-sm button {
  padding: 6px 13px;
  font-size: 11px;
  color: var(--t3);
}

.seg.seg-sm button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--t1);
}

.chip {
  padding: 8px 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline-2);
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  font: 600 11.5px/1 var(--ui);
  letter-spacing: .10em;
  text-transform: uppercase;
  transition: background .12s ease;
}

.chip:hover { background: var(--hover); }

.chip[aria-pressed="true"] {
  border-color: var(--chip-c, var(--accent));
  background: color-mix(in srgb, var(--chip-c, var(--accent)) 14%, transparent);
  color: var(--chip-t, var(--accent-text));
}






/* ---------- 7. Device frame ---------- */
.phone-wrap {
  width: calc(402px * var(--s));
  height: calc(874px * var(--s));
  flex: none;
}

.phone {
  width: 402px;
  height: 874px;
  border-radius: 48px;
  overflow: hidden;
  position: relative;
  background: var(--device-bezel);
  box-shadow: var(--device-shadow);
  transform: scale(var(--s));
  transform-origin: top left;
}

.island {
  position: absolute;
  top: 11px; left: 50%;
  transform: translateX(-50%);
  width: 126px; height: 37px;
  border-radius: 24px;
  background: #000;
  z-index: 50;
}

.statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 21px 34px 0;
  color: var(--status-ink);
  pointer-events: none;
}

.statusbar .clock {
  font: 590 17px/22px -apple-system, 'SF Pro Text', system-ui, sans-serif;
  letter-spacing: .01em;
}

.statusbar .icons { display: flex; align-items: center; gap: 7px; }

.home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 139px; height: 5px;
  border-radius: 100px;
  background: color-mix(in srgb, var(--status-ink) 55%, transparent);
  z-index: 60;
  pointer-events: none;
}

.app {
  position: absolute;
  inset: 0;
  background: var(--bg);
  font-family: var(--ui);
  color: var(--t1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 56px 18px 100px;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar { width: 0; height: 0; }

.scroll.no-tabbar { padding-bottom: 34px; }

/* ---------- 8. Cards & rows ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 18px;
}

.card + .card,
.card + .grid,
.grid + .card { margin-top: 12px; }

.card.pad-lg { padding: 20px; }

.card.tint-green { background: var(--green-soft); border-color: var(--green-line); }
.card.tint-yellow { background: var(--yellow-soft); border-color: var(--yellow-line); }
.card.tint-red { background: var(--red-soft); border-color: var(--red-line); }

.tile {
  background: var(--surface-2);
  border-radius: var(--r-card);
  padding: 11px 13px;
}

.grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-12 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Grid tracks are 1fr, but children default to min-width:auto and a long
   unbreakable value ("14°→23°") widens its own column. Pin them to 0. */
.grid > *, .grid-12 > * { min-width: 0; }

.stack  { display: flex; flex-direction: column; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 13px;
  color: inherit;
  font-family: inherit;
}

button.row, .row.is-action {
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

button.row:hover, .row.is-action:hover {
  background: var(--hover);
  border-color: var(--hairline-2);
}

.row-title { font: 600 15px/1.2 var(--ui); }
.row-sub   { font: 400 12.5px/1.35 var(--ui); color: var(--t3); margin-top: 2px; }
.row-main  { flex: 1; min-width: 0; }

.avatar {
  width: 40px; height: 40px;
  border-radius: var(--r-card);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 14px/1 var(--display);
  color: var(--t2);
  flex: none;
}

.avatar.lg { width: 54px; height: 54px; font-size: 19px; }

.mini-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-card);
  border: none;
  background: var(--surface-3);
  color: var(--t1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s ease;
}

.mini-btn:hover { background: var(--accent); color: var(--accent-ink); }
.mini-btn svg { display: block; }

/* ---------- 9. Buttons ---------- */
.btn {
  width: 100%;
  min-height: 52px;
  border-radius: var(--r-card);
  border: 1px solid transparent;
  cursor: pointer;
  font: 700 14px/1 var(--ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); }

.btn-ghost {
  background: transparent;
  border-color: var(--hairline-2);
  color: var(--t1);
  min-height: 46px;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .10em;
}

.btn-ghost:hover { background: var(--hover); }

.btn-warn {
  background: var(--yellow-soft);
  border-color: var(--yellow-line);
  color: var(--yellow-text);
  min-height: 46px;
  font-size: 12.5px;
  font-weight: 600;
}

.btn-warn:hover { background: color-mix(in srgb, var(--yellow) 22%, transparent); }

.btn-confirm {
  background: transparent;
  border-color: var(--green-line);
  color: var(--green-text);
}

.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--surface-3);
  color: var(--t4);
  cursor: not-allowed;
  border-color: transparent;
}

.btn[disabled]:hover { background: var(--surface-3); }

.btn-link {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--accent-text);
  font: 600 12px/1 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.btn-link:hover { color: var(--accent-hi); text-decoration: underline; }

/* ---------- 10. Status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--r-pill);
  font: 600 10.5px/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill i { width: 6px; height: 6px; border-radius: 99px; background: currentColor; display: block; }

.pill.live   { color: var(--green-text); border: 1px solid var(--green-line); background: var(--green-soft); }
.pill.late   { color: var(--yellow-text); border: 1px solid var(--yellow-line); background: var(--yellow-soft); }
.pill.offline{ color: var(--t3); border: 1px solid var(--hairline-2); background: var(--surface-2); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--yellow);
  color: var(--yellow-ink);
  font: 700 12px/1 var(--ui);
  flex: none;
}

/* ---------- 11. Today: hero blocks ---------- */
.now-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--green);
}

.big-time {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 6px;
}

.big-time .aside {
  padding-bottom: 8px;
  font: 500 13px/1.35 var(--ui);
  color: var(--t3);
}

.split {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* ---------- 12. Day strip / timeline ---------- */
.strip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}

.strip-row:hover { background: var(--hover); }

.strip-row .t { width: 46px; font: 600 15px/1 var(--display); flex: none; }
.strip-row .dot { width: 7px; height: 7px; border-radius: 99px; flex: none; background: var(--t4); }
.strip-row .l { flex: 1; font: 500 14px/1.3 var(--ui); }
.strip-row .g { font: 600 10.5px/1 var(--ui); letter-spacing: .13em; }

.tl-item { display: flex; gap: 14px; }

.tl-time {
  width: 52px;
  padding-top: 14px;
  font: 600 17px/1 var(--display);
  text-align: right;
  flex: none;
  color: var(--t2);
}

.tl-spine {
  width: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
}

.tl-dot {
  width: 11px; height: 11px;
  border-radius: 99px;
  margin-top: 14px;
  box-sizing: border-box;
  border: 2px solid var(--t4);
  background: var(--bg);
  flex: none;
}

.tl-line { flex: 1; width: 1px; background: var(--hairline-2); }

.tl-body { flex: 1; padding: 10px 0 14px; min-width: 0; }

.tl-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 12px 13px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: background .12s ease;
}

.tl-card:hover { background: var(--hover); }
.tl-card .tl-title { font: 600 17px/1.2 var(--display); letter-spacing: .02em; }
.tl-card .tl-sub { font: 400 12.5px/1.5 var(--ui); color: var(--t3); margin-top: 3px; }

.tl-item.is-now .tl-dot { background: var(--green); border-color: var(--green); }
.tl-item.is-now .tl-time { color: var(--green-text); }
.tl-item.is-now .tl-card { background: var(--green-soft); border-color: var(--green-line); }
.tl-item.is-next .tl-dot { border-color: var(--accent); }
.tl-item.is-done .tl-dot { background: var(--t4); border-color: var(--t4); }
.tl-item.is-done .tl-time { color: var(--t4); }
.tl-item.is-done .tl-title { color: var(--t3); }

/* ---------- 13. Tab bar ---------- */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 88px;
  padding: 8px 6px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--hairline);
  display: flex;
  z-index: 20;
}

.tabbar button {
  flex: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 0;
  color: var(--t3);
  transition: color .12s ease;
}

.tabbar button:hover { color: var(--t1); }
.tabbar button[aria-current="page"] { color: var(--accent-text); }
.tabbar button svg { display: block; }
.tabbar button span { font: 600 10px/1 var(--ui); letter-spacing: .11em; }

/* ---------- 14. Sheets ---------- */
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  z-index: 30;
  border: none;
  padding: 0;
  cursor: pointer;
  animation: fade .16s ease;
}

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 86%;
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--hairline-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 12px 18px 30px;
  animation: rise .2s cubic-bezier(.22, 1, .36, 1);
}

.sheet::-webkit-scrollbar { width: 0; }
.sheet.danger { background: var(--red-soft); border-top-color: var(--red-line); }

.grabber {
  width: 38px; height: 4px;
  border-radius: 99px;
  background: var(--hairline-2);
  margin: 0 auto 16px;
}

.sheet-title { font: 600 22px/1 var(--display); letter-spacing: .02em; }
.sheet-sub { font: 400 12.5px/1.4 var(--ui); color: var(--t3); margin-top: 6px; }

@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.change {
  background: var(--surface-2);
  border-radius: var(--r-card);
  padding: 13px;
}

.change .delta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.change .from { font: 600 19px/1 var(--display); color: var(--t4); text-decoration: line-through; }
.change .arrow { font: 600 15px/1 var(--ui); color: var(--t4); }
.change .to { font: 600 22px/1 var(--display); color: var(--yellow-text); }

/* ---------- 15. Comms ---------- */
.ptt {
  width: 100%;
  margin-top: 18px;
  height: 76px;
  border-radius: var(--r-card);
  cursor: pointer;
  font: 700 15px/1 var(--ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  background: var(--surface-3);
  border: 1px solid var(--hairline-2);
  color: var(--t1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background .1s ease, color .1s ease;
}

.ptt:hover { background: var(--hover); }

.ptt.is-live {
  background: var(--red);
  border-color: var(--red);
  color: var(--red-ink);
}

/* ---------- 16. Search ---------- */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-card);
  padding: 12px 14px;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--t1);
  font: 500 16px/1.2 var(--ui);
  padding: 2px 0;
}

.searchbar input::placeholder { color: var(--t4); }
.searchbar input:focus { outline: none; }
.searchbar svg { color: var(--t3); flex: none; }

.answer-src {
  font: 400 12px/1.5 var(--ui);
  color: var(--t3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

.dashed {
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed var(--hairline-2);
  border-radius: var(--r-card);
  font: 400 12.5px/1.55 var(--ui);
  color: var(--t3);
}

/* ---------- 17. Production ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 14px;
}

.stat .n { font: 600 27px/1 var(--display); }
.stat .k { font: 500 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--t3); margin-top: 5px; }

.ackbars { display: flex; gap: 3px; margin-top: 14px; }
.ackbars i { flex: 1; height: 26px; border-radius: 2px; display: block; }

.legend { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; font: 500 12px/1 var(--ui); color: var(--t2); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: block; }

.progress-steps { display: flex; gap: 5px; margin-bottom: 18px; }
.progress-steps i { flex: 1; height: 3px; border-radius: 9px; background: var(--hairline-2); display: block; }
.progress-steps i.on { background: var(--accent); }

/* ---------- 18. Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-pill);
  padding: 11px 20px;
  font: 500 13.5px/1.3 var(--ui);
  color: var(--t1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  animation: rise .18s ease;
  max-width: 90vw;
}

.toast b { color: var(--accent-text); font-weight: 600; }

/* ---------- 19. Utilities ---------- */
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-22 { margin-top: 22px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-18 { margin-bottom: 18px; }
.mb-20 { margin-bottom: 20px; }
.flex-1 { flex: 1; min-width: 0; }
.relative { position: relative; overflow: hidden; }
.c-accent { color: var(--accent-text); }
.c-green  { color: var(--green-text); }
.c-yellow { color: var(--yellow-text); }
.c-red    { color: var(--red-text); }
.c-t3     { color: var(--t3); }
.text-c   { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 20. Responsive ---------- */

/* The device frame shrinks as the window does, until the app simply becomes
   the window. Below 900 px the shell rules take over entirely (§28). */
@media (max-width: 1300px) { :root { --s: .92; } }
@media (max-width: 1100px) { :root { --s: .84; } }
@media (max-width: 860px)  { :root { --s: .78; } }

/* Below tablet the segmented controls go full-width with equal-width,
   wrapping labels — German terms are ~2× the English ones and would otherwise
   push the page into horizontal scroll. */
@media (max-width: 700px) {
  .seg { width: 100%; }

  .seg button {
    flex: 1;
    min-width: 0;
    padding: 9px 6px;
    font-size: 10.5px;
    letter-spacing: .04em;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 520px) { :root { --s: .74; } }

/* ---------- 21. Additions used by the screen renderers ---------- */

/* Full-height column inside a scroll area — lets a screen pin its primary
   action to the bottom while the content above scrolls naturally. */
.screen-col {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* A card that is itself the tap target. Buttons need the font/appearance
   reset that div-based cards get for free. */
button.card {
  font-family: inherit;
  color: inherit;
  display: block;
  width: 100%;
  text-align: left;
}

.card.is-action {
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

.card.is-action:hover {
  background: var(--hover);
  border-color: var(--hairline-2);
}

/* Cards used as grid cells must not inherit the sibling margin rule. */
.grid-12 > .card + .card,
.grid > .card + .card { margin-top: 0; }

/* Search input: strip the WebKit search decorations. */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- 22. Native hand-off, switches, update bar ---------- */

/* A row whose body is one tap target and whose trailing icons are others.
   Nested <button> is invalid HTML, so the row itself stays a <div>. */
.row-split { padding: 0; gap: 0; }

.row-tap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  border-radius: var(--r-card) 0 0 var(--r-card);
  transition: background .12s ease;
}

.row-tap:hover { background: var(--hover); }
.row-split > span:last-child { padding-right: 13px; }

/* Hand-off tiles: call / message / WhatsApp / mail, copy / share / remind. */
.act-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.act-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 4px;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--t1);
  cursor: pointer;
  font: 600 10.5px/1.2 var(--ui);
  letter-spacing: .03em;
  text-align: center;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.act-tile:hover { background: var(--hover); border-color: var(--hairline-2); }
.act-tile svg { display: block; }
.act-tile.is-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.act-tile.is-primary:hover { background: var(--accent-hi); }
.act-tile.is-on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }

/* Switch. Locked categories render dimmed and refuse the tap — production
   -critical notifications are not a preference. */
.switch {
  width: 44px; height: 26px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-2);
  position: relative;
  flex: none;
  transition: background .15s ease, border-color .15s ease;
}

.switch i {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 99px;
  background: var(--t2);
  display: block;
  transition: transform .15s ease, background .15s ease;
}

.switch.is-on { background: var(--accent); border-color: transparent; }
.switch.is-on i { transform: translateX(18px); background: var(--accent-ink); }
.switch.is-locked { opacity: .5; }

.toggle-row[aria-disabled="true"] { cursor: default; }
.toggle-row[aria-disabled="true"]:hover { background: var(--surface); border-color: var(--hairline); }

/* Update bar — sits under the top bar, never auto-applies. */
.updatebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 32px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-line);
  flex-wrap: wrap;
}

.updatebar-icon { color: var(--accent-text); display: flex; flex: none; }
.updatebar-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 180px; }
.updatebar-text b { font: 600 13.5px/1.3 var(--ui); }
.updatebar-text span { font: 400 12.5px/1.35 var(--ui); color: var(--t2); }

@media (max-width: 700px) {
  .updatebar { padding: 12px 18px; }
  .act-grid { gap: 6px; }
  .act-tile { min-height: 60px; font-size: 10px; }
}

/* A settings row is label + value + chevron on one line. Both text runs must
   be able to shrink and break, or a long compound word (German is full of
   them) pushes the row wider than the phone. */
.row-main { min-width: 0; overflow-wrap: anywhere; }
.row > .body-sm { min-width: 0; overflow-wrap: anywhere; }

/* ---------- 23. Motivbesichtigung — tour planner (production, desktop) ---- */

.planner {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.35fr);
  gap: 20px;
  align-items: start;
}

.planner-col { min-width: 0; }

.motiv {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 14px;
}

.motiv + .motiv { margin-top: 10px; }
.motiv-name { font: 600 16px/1.25 var(--display); letter-spacing: .01em; }

.motiv-note {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: var(--r-card);
  background: var(--surface-2);
  font: 400 12.5px/1.5 var(--ui);
  color: var(--t2);
}

/* Status is never colour alone — the word is the label. */
.tag.status-interessant { color: var(--accent-text); }
.tag.status-besichtigt  { color: var(--blue-text); }
.tag.status-freigegeben { color: var(--green-text); }
.tag.status-verworfen   { color: var(--t4); }

.ops { display: flex; gap: 14px; margin-top: 9px; flex-wrap: wrap; }

.ops .op {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 500 11.5px/1 var(--ui);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ops .op b { font: 700 13px/1 var(--ui); }

.split-note {
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: var(--r-card);
  background: var(--yellow-soft);
  border: 1px solid var(--yellow-line);
  color: var(--yellow-text);
  font: 500 12px/1.45 var(--ui);
}

/* ---- the tour itself ---- */

.planner-tour {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 16px;
}

.leg-anchor {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-card);
  background: var(--surface-3);
  font: 500 13px/1.35 var(--ui);
  color: var(--t2);
}

.leg-time { font: 600 16px/1 var(--display); color: var(--t1); flex: none; min-width: 46px; }

.leg-travel {
  padding: 6px 0 6px 14px;
  font: 500 11.5px/1 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
}

.leg {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 13px 14px;
}

.leg.has-conflict { border-color: var(--yellow-line); }

.leg-head { display: flex; align-items: baseline; gap: 12px; }
.leg-name { flex: 1; min-width: 0; font: 600 17px/1.25 var(--display); }
.leg-tools { display: flex; gap: 5px; flex: none; }

.leg-tools .mini-btn {
  width: 30px; height: 30px;
  font: 600 15px/1 var(--ui);
}

.leg-tools .mini-btn[disabled] { opacity: .35; cursor: not-allowed; }
.leg-tools .mini-btn[disabled]:hover { background: var(--surface-3); color: var(--t1); }

.leg-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font: 400 12.5px/1.4 var(--ui);
  color: var(--t2);
  flex-wrap: wrap;
}

.leg-contact > span { flex: 1; min-width: 140px; }
.leg-contact .mini-btn { width: 30px; height: 30px; }

.leg-same {
  margin-top: 8px;
  font: 500 12px/1.4 var(--ui);
  color: var(--accent-text);
}

.leg-slots { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.slot-chip { padding: 6px 11px; font-size: 10.5px; }

.leg-timeinput {
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-card);
  border: 1px solid var(--accent-line);
  background: var(--surface-2);
  color: var(--t1);
  font: 600 13px/1 var(--display);
}

.leg-times {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--hairline);
  flex-wrap: wrap;
  font: 400 12px/1.4 var(--ui);
  color: var(--t3);
}

.leg-times b { color: var(--t1); font-weight: 600; }

.leg-warn {
  margin-top: 9px;
  padding: 8px 11px;
  border-radius: var(--r-card);
  font: 500 12.5px/1.45 var(--ui);
}

.leg-warn.is-late { background: var(--yellow-soft); border: 1px solid var(--yellow-line); color: var(--yellow-text); }
.leg-warn.is-idle { background: var(--surface-2); border: 1px solid var(--hairline-2); color: var(--t2); }

.findings {
  margin: 0;
  padding: 12px 14px 12px 30px;
  border-radius: var(--r-card);
  background: var(--yellow-soft);
  border: 1px solid var(--yellow-line);
  font: 500 13px/1.6 var(--ui);
  color: var(--yellow-text);
}

.findings li.ok { color: var(--green-text); }
.findings:has(li.ok:only-child) { background: var(--green-soft); border-color: var(--green-line); }

@media (max-width: 900px) {
  .planner { grid-template-columns: 1fr; }
}

/* ---------- 24. Print — the sheet that ends up on the clipboard ---------- */

#printDoc { display: none; }

@media print {
  /* Only the dispo goes on paper. */
  body > *:not(#printDoc) { display: none !important; }

  #printDoc { display: block !important; }

  @page { size: A4 portrait; margin: 14mm 12mm; }

  html, body {
    background: #fff !important;
    color: #000 !important;
  }

  .pd { font: 400 10pt/1.4 var(--ui); color: #000; }

  .pd-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16pt;
    border-bottom: 1.5pt solid #000;
    padding-bottom: 6pt;
  }

  .pd-kicker { font: 700 8pt/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; }
  .pd h1 { margin: 3pt 0 0; font: 700 17pt/1.15 var(--display); }

  /* Version and minute, large enough to argue with: a printout is a snapshot,
     and on set someone will hold it up against a newer one. */
  .pd-version {
    text-align: right;
    font: 400 8.5pt/1.45 var(--ui);
    flex: none;
  }

  .pd-version b { display: block; font: 700 11pt/1.2 var(--ui); }
  .pd-version span { display: block; }

  .pd-meta { margin-top: 8pt; font-size: 9.5pt; }
  .pd-meta div + div { margin-top: 2pt; }

  .pd-party { margin-top: 6pt; font-size: 9pt; }
  .pd-party span { display: inline-block; margin-right: 10pt; }

  .pd-table {
    width: 100%;
    margin-top: 10pt;
    border-collapse: collapse;
    font-size: 9pt;
  }

  .pd-table th {
    text-align: left;
    font: 700 8pt/1 var(--ui);
    letter-spacing: .1em;
    text-transform: uppercase;
    border-bottom: .75pt solid #000;
    padding: 0 6pt 3pt 0;
  }

  .pd-table td {
    vertical-align: top;
    padding: 6pt 6pt 6pt 0;
    border-bottom: .5pt solid #999;
  }

  /* A row must not break across pages — half a location is worse than none. */
  .pd-table tr { break-inside: avoid; page-break-inside: avoid; }
  .pd-table thead { display: table-header-group; }

  .pd-time { white-space: nowrap; font-weight: 700; width: 22mm; }
  .pd-ep { width: 14mm; }

  .pd-foot { margin-top: 10pt; font-size: 9pt; border-top: .75pt solid #000; padding-top: 5pt; }
}

/* ---------- 25. Callsheet builder ---------- */

.bld-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.bld-starts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bld-hint { margin: -6px 0 14px; }

.bld {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
}

.bld-main { min-width: 0; }

.bld-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: -1px;
}

.bld-tabs::-webkit-scrollbar { height: 0; }

.bld-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-bottom-color: transparent;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  font: 600 12.5px/1 var(--ui);
  letter-spacing: .04em;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}

.bld-tab:hover { background: var(--hover); color: var(--t1); }

.bld-tab[aria-current="true"] {
  background: var(--surface);
  border-color: var(--hairline);
  border-bottom-color: var(--surface);
  color: var(--t1);
}

/* Count, not just colour — the number says how much is wrong. */
.bld-tab .dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  font: 700 10px/1 var(--ui);
  font-style: normal;
}

.bld-tab .dot.is-block { background: var(--red); color: var(--red-ink); }
.bld-tab .dot.is-warn { background: var(--yellow); color: var(--yellow-ink); }

.bld-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0 var(--r-card) var(--r-card) var(--r-card);
  padding: 18px;
}

.bld-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.bld-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bld-field.is-wide { grid-column: span 2; }

.bld-label {
  font: 600 10.5px/1.2 var(--ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--t3);
}

/* 44 px tall: this gets filled in on a tablet on the bonnet of a car. */
.bld-input {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline-2);
  background: var(--surface-2);
  color: var(--t1);
  font: 400 15px/1.3 var(--ui);
  width: 100%;
  min-width: 0;
}

.bld-input:focus { outline: 2px solid var(--accent-text); outline-offset: 1px; border-color: transparent; }
textarea.bld-input { resize: vertical; line-height: 1.45; }
select.bld-input { appearance: none; cursor: pointer; }

.bld-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font: 400 13.5px/1.4 var(--ui);
  color: var(--t2);
  cursor: pointer;
}

.bld-check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.bld-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  background: var(--surface-2);
}

.bld-row + .bld-row { margin-top: 10px; }
.bld-row-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.bld-del { flex: none; margin-top: 20px; }

/* ---- review panel ---- */

.bld-review {
  position: sticky;
  top: 78px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 16px;
}

.bld-meter { margin-bottom: 14px; }

.bld-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 8px;
}

.bld-bar i { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }

.bld-issues { border-radius: var(--r-card); padding: 12px 13px; }
.bld-issues + .bld-issues { margin-top: 10px; }
.bld-issues.is-block { background: var(--red-soft); border: 1px solid var(--red-line); }
.bld-issues.is-warn { background: var(--yellow-soft); border: 1px solid var(--yellow-line); }
.bld-issues.is-ok { background: var(--green-soft); border: 1px solid var(--green-line); }
.bld-issues ul { margin: 8px 0 0; padding: 0; list-style: none; }
.bld-issues li + li { margin-top: 6px; }

.findings-jump {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 5px 0;
  cursor: pointer;
  color: var(--t1);
  font: 400 12.5px/1.45 var(--ui);
  border-radius: 4px;
}

.findings-jump:hover { color: var(--accent-text); }

.jump-to {
  display: block;
  margin-top: 2px;
  font: 600 10px/1 var(--ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
}

@media (max-width: 1000px) {
  .bld { grid-template-columns: 1fr; }
  .bld-review { position: static; }
}

@media (max-width: 700px) {
  .bld-field.is-wide { grid-column: span 1; }
  .bld-grid, .bld-row-fields { grid-template-columns: 1fr; }
  .bld-row { flex-direction: column; }
  .bld-del { margin-top: 0; align-self: flex-end; }
  .bld-panel { padding: 14px; }
}

/* Arm/confirm for the destructive "start over" chips. */
.bld-arm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border-radius: var(--r-pill);
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  font: 500 12px/1 var(--ui);
  color: var(--red-text);
  flex-wrap: wrap;
}

.chip.is-danger {
  border-color: var(--red);
  background: var(--red);
  color: var(--red-ink);
}

.chip.is-danger:hover { background: var(--red-text); }

/* ---------- 26. Touch targets ---------- */

/* 23 px was too small even for a mouse — a jump link in the review list is a
   primary control, not a footnote. */
.findings-jump { min-height: 36px; padding: 8px 0; }

/* 25 px was below comfortable even with a mouse. */
.slot-chip { min-height: 32px; }

/* Baseline hit area even with a mouse. The compact segmented control was
   23 px tall, which is smaller than the text it contains is wide. */
.chip { min-height: 34px; }
.seg button { min-height: 34px; }
.seg.seg-sm button { min-height: 32px; }

/* ---------- 26. Touch ---------- */

/* These mouse baselines MUST stay above the touch block. A media query adds no
   specificity, so `.chip { 34px }` written afterwards simply wins, and
   `.seg.seg-sm button` outranks `.seg button` wherever it sits. Not theory:
   measured on a phone, the 44 px block was live and the segmented controls
   were still 32 px, because those four lines came after it.

   On a touch device every control gets the full 44 px, because this is filled
   in on a tablet held in one hand on a location. Desktop keeps its density: a
   production manager at a desk with a mouse does not want 44 px chips.

   `pointer` describes the PRIMARY pointer only. A tablet with a keyboard case,
   a Surface, a touchscreen laptop all report `fine`, and every touch target
   would quietly collapse to its mouse size on exactly the devices a production
   manager carries between the desk and the set. `any-pointer` asks the
   question that matters: is a finger available at all. */
@media (pointer: coarse), (any-pointer: coarse) {
  .chip,
  .seg button,
  .seg.seg-sm button,
  .bld-tab,
  .slot-chip,
  .btn-link,
  .findings-jump { min-height: 44px; }

  .chip, .slot-chip { padding-inline: 14px; }

  .mini-btn,
  .leg-tools .mini-btn,
  .leg-contact .mini-btn { width: 44px; height: 44px; }

  /* Found by measuring on a phone, not by reading the file: these three set an
     explicit `height`, so no `min-height` rule above could ever reach them.
     The tour planner's time fields matter most — they are filled in in a car
     between locations, which is the whole point of the planner. */
  .leg-timeinput { height: 44px; }

  .bld-del { margin-top: 16px; }

  /* Roomier rows: a fingertip is 8–10 mm, a row separator is 1 px. */
  .row { padding: 15px 14px; }
  .strip-row { padding: 11px 0; }
  .tabbar button { padding: 10px 0; }
}


/* ---------- 27. Narrow-width corrections ---------- */

/* Flex and grid children default to min-width:auto, so one long unbreakable
   word ("Kreuzfahrtterminal") widens its whole row. These are the places a
   375 px phone actually hit. */
.planner, .planner-col, .bld, .bld-main { min-width: 0; }
.leg-head, .leg-name, .leg-anchor, .motiv-name { min-width: 0; overflow-wrap: anywhere; }
.leg-contact > span { overflow-wrap: anywhere; }

/* Date and time inputs carry an intrinsic minimum width in WebKit that
   ignores width:100%. */
.bld-input { min-width: 0; }
input[type="date"].bld-input,
input[type="time"].bld-input { min-width: 0; max-width: 100%; }

@media (max-width: 520px) {
  .planner-tour { padding: 12px; }
  .bld-panel { padding: 13px; }
  .leg { padding: 12px; }
  .leg-times { gap: 10px 14px; font-size: 11.5px; }
  .leg-travel { padding-left: 8px; }
  .bld-topbar { gap: 10px; }
  .bld-starts { width: 100%; }

  /* The section tabs stay a horizontally scrolling strip rather than wrapping
     into four rows of chrome above a one-field form. No negative margin —
     that pushed the strip 13 px past its parent on both sides. */
  .bld-tabs { padding-inline: 0; }
}

/* ---------- 28. Grid tracks that can actually shrink ---------- */

/* auto-fit with a fixed minimum cannot go below that minimum, so a 140 px
   track on a 360 px phone forces the row wider than the screen.
   min(140px, 100%) lets the track collapse when the container is narrower —
   which removes the need for a breakpoint at all. */
.bld-grid,
.bld-row-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}

/* Date and time inputs carry an intrinsic minimum in WebKit (the picker
   indicator plus dd.mm.yyyy). Give them their own row rather than letting
   them push the form off the screen. */
@media (max-width: 520px) {
  .bld-grid,
  .bld-row-fields { grid-template-columns: 1fr; }
  .bld-field.is-wide { grid-column: span 1; }
}

/* The tour header puts a title next to a long button ("Besichtigungs-Dispo
   drucken"). Below 520 px there is no room for both on one line. */
@media (max-width: 520px) {
  .planner-tour > .between { flex-wrap: wrap; }
  .planner-tour > .between > .btn { width: 100%; }
  .planner-tour > .between > div { min-width: 0; }
}

/* Paper size follows the shoot's country, set on <html> before printing. */
@media print {
  :root[data-paper="Letter"] { }
}
@page { size: A4 portrait; margin: 14mm 12mm; }

/* Three tiles across on a 402 px phone leaves ~100 px per label. Spanish
   ("Maquillaje", "Estacionamiento") needs to break; the tracking that makes
   these labels legible is what pushes them over. */
.tile .label-sm { overflow-wrap: anywhere; letter-spacing: .1em; }

/* Row actions sit together and wrap rather than stacking full-width. */
.bld-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bld-actions .btn { width: auto; padding: 0 16px; }

/* Relative nudges: the operation a running day is actually made of. */
.nudge { display: flex; gap: 4px; flex-wrap: wrap; }
.nudge .chip { padding: 0 10px; min-width: 44px; justify-content: center; }

/* The paste dialog is a builder control, so it opens over the builder rather
   than inside the phone mockup. */
.bld-modal { position: fixed; inset: 0; z-index: 200; display: flex;
             align-items: center; justify-content: center; padding: 20px; }

.bld-modal-back { position: absolute; inset: 0; border: none; padding: 0;
                  background: rgba(0, 0, 0, .55); cursor: pointer; }

.bld-modal-body { position: relative; width: min(560px, 100%); max-height: 86vh; overflow-y: auto; }

/* Inside the modal the sheet is a plain card, not a phone bottom sheet. */
.bld-modal .sheet { position: static; border-radius: var(--r-card);
                    border: 1px solid var(--hairline-2); max-height: none; }
.bld-modal .grabber { display: none; }

/* ---------- 28. App shell ---------- */

/* This is the app, not a page about the app. On a phone the crew screen IS
   the viewport — no device frame around a device, no page scrolling behind
   it. On a desktop the same screen sits in a frame on the studio background,
   because a 402 px column stretched to 1600 px is not a wider app, it is a
   broken one. */
#app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  box-sizing: border-box;
  background: var(--studio);
}

@media (max-width: 900px), (display-mode: standalone) {
  #app { padding: 0; align-items: stretch; }

  /* The bezel, the notch and the home indicator are a drawing of a phone.
     On an actual phone they are a drawing of a phone on a phone. */
  .phone-wrap { width: 100%; height: 100dvh; }
  .phone {
    width: 100%; height: 100dvh;
    border-radius: 0;
    transform: none;
    box-shadow: none;
    background: var(--bg);
  }
  .phone .island, .phone .statusbar, .phone .home-indicator { display: none; }

  /* The 56 px at the top existed to clear the drawn status bar. With that gone
     it is 56 px of nothing above the production name — measured on a phone,
     where it pushed the day's first real number below the fold. */
  .scroll { padding-top: max(14px, env(safe-area-inset-top)); }

  /* A fixed 88 px bar plus the gesture inset squeezes the labels out of their
     own bar: on the emulator the icons showed and the words did not. Height
     follows content, and the inset is added to it rather than eaten from it. */
  .tabbar {
    height: auto;
    padding: 8px 6px max(8px, env(safe-area-inset-bottom));
  }
  .scroll { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ---------- 29. Full views ---------- */

/* Work that needs the whole screen: building a call sheet, planning a recce.
   These are done at a desk as often as on a phone, so they take the viewport
   rather than being squeezed into the frame. */
.view {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--page);
  display: flex;
  flex-direction: column;
}

.view-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex: none;
}

.view-bar h1 {
  margin: 0;
  font: 600 17px/1.2 var(--display);
  letter-spacing: .01em;
}

/* The back control points back. Without this the chevron points into the
   screen, which reads as "forward" and is the wrong promise. */
.view-bar .btn-link svg { transform: rotate(180deg); }
.view-bar .btn-link { gap: 4px; }

.view-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 64px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .view-bar { padding: 10px 14px; }
  .view-body { padding: 16px 14px 56px; }
}

/* The freshness pill is a control, not a label: it opens the sheet that
   explains how current the sheet in your hand is. */
.pill.is-tap {
  cursor: pointer;
  font: inherit;
  min-height: 30px;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (pointer: coarse), (any-pointer: coarse) { .pill.is-tap { min-height: 44px; } }

/* ---------- 30. Long-language corrections ---------- */

/* A `.between` row puts a title beside a status tag. The tag is nowrap, so a
   long title pushes it straight out of the card — which is what Russian did:
   «Сцена 24 · ИНТ мастерская, ночь» is half again the width of the English,
   and ОТСНЯТО left the frame. The title yields, the tag never does; a status
   that is cut off is worse than a title that wraps. */
.tl-card .between { gap: 10px; align-items: flex-start; }
.tl-card .tl-title { min-width: 0; overflow-wrap: anywhere; }
.tl-card .tag { flex: none; padding-top: 3px; }

/* Four urgency chips forced onto one line with flex:1. "Emergency" did not fit
   even in English, and «Экстренно» made it obvious. They wrap now, and the
   label is never cut: an urgency you cannot read is the one case where
   truncation is not a cosmetic problem. */
.prio-chip {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 10px;
  letter-spacing: .06em;
  white-space: normal;
  text-align: center;
}
