/* ==========================================================================
   Trips — design system (SPEC §10). A calm, legible transit board.
   Public Sans for UI; IBM Plex Mono for travel data (times, PNRs, berths,
   coordinates) — anything read aloud on a platform at 01:00 gets .mono.

   COMPONENT CLASSES — views should use these, not invent new ones.

   Utilities   .mono  .muted  .faint  .small  .label (mono caps caption)
               .stack (vertical rhythm)  .cluster (wrapping row)  .spacer
               [hidden] always hides.
   Layout      .view (a mounted view's root)  .section-title (h2/h3 with rule)
               .group-heading (sticky date heading inside a list)
               .empty (centred empty / loading state)  .footer-note (build no.)
   Itinerary   li.row.leg-row (.past = departed, dimmed) > .leg-time (.leg-clock .leg-zone)
               + .row-main (.leg-tags .leg-home)
   Board       .board  > .board-label  .board-row  .board-time  .board-zone
               .board-route  .board-countdown  .board-meta  .board-empty
               (always dark, both themes — it is the departure board)
   Cards/lists .card (.card.flush = no padding, for lists)
               ul.list > li.row  > .row-main (.row-title .row-sub)  .row-end
               li.row.done (struck-through)  li.row.tappable (button-like)
               .row-title.cluster (title text + a .tag that wraps cleanly)
   Badges      .badge + .soon (amber, ≤3 days) | .overdue (red) | .later (neutral)
               .tag (outlined mono tag on legs)
   Chips       .chips (horizontal scroller) > button.chip[aria-pressed="true"]
   Segmented   .segmented > button[aria-pressed="true"]
   Buttons     .btn  .btn.primary  .btn.danger  .btn.ghost  .btn.small  .btn.block
               .icon-btn (44px square, put an <svg> or glyph inside)
               .fab (round "+" button above the tab bar)
   Forms       form.form > label.field (.field-label, control, .field-hint)
               .field-row (two fields side by side)  label.check (checkbox row)
               .form-error  .form-warn  .form-actions
               (dom.js field()/input()/select()/textarea() produce these)
   Sheets      dialog.sheet > .sheet-head (.sheet-title) + .sheet-body;
               .sheet-actions for button rows (dom.js openSheet/confirmSheet)
   Banners     .banners > .banner + .danger | .warn | .info, .banner-action
   Readout     .readout (huge copyable mono text, e.g. "52.3676, 4.9041")
   Feedback    .toast-region > .toast   .update-bar   .ptr / .ptr-button
   Theme       html[data-theme="light"|"dark"] overrides prefers-color-scheme.
   ========================================================================== */

/* ---------- fonts (self-hosted, OFL — see fonts/*-OFL.txt) ---------- */

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/PublicSans-latin-var.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/IBMPlexMono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/IBMPlexMono-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */

:root {
  color-scheme: light;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg: #f4f2ec;          /* warm platform-paper */
  --surface: #ffffff;
  --surface-2: #e9e6dc;
  --surface-raised: #ffffff; /* selected segment: always lighter than --surface-2 */
  --ink: #15181c;
  --ink-2: #4a515b;
  --ink-3: #767c86;
  --line: #d9d5c8;
  --accent: #1747c9;      /* signal blue */
  --accent-ink: #ffffff;
  --soon: #8a5300;
  --soon-bg: #fbecc8;
  --overdue: #b3261e;
  --overdue-bg: #fadcd7;
  --danger-solid: #b3261e;
  --danger-ink: #ffffff;
  --ok: #1d7a49;

  --board-bg: #121519;
  --board-ink: #f3efe4;
  --board-dim: #8d939c;
  --board-line: #2a2f36;
  --board-amber: #ffb627;

  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 16px rgba(20, 22, 26, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --appbar-h: 56px;
  --tabbar-h: 58px;
  --maxw: 720px;
  --gutter: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --pad-l: max(var(--gutter), var(--safe-l));
  --pad-r: max(var(--gutter), var(--safe-r));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #20252d;
    --surface-raised: #353c47;
    --ink: #ece8de;
    --ink-2: #a7adb6;
    --ink-3: #7c828c;
    --line: #2a3038;
    --accent: #8fb0ff;
    --accent-ink: #0f1216;
    --soon: #ffc45c;
    --soon-bg: rgba(255, 182, 39, .15);
    --overdue: #ff8b7e;
    --overdue-bg: rgba(255, 107, 91, .16);
    --danger-solid: #d8463b;
    --danger-ink: #ffffff;
    --ok: #5fd39a;
    --board-bg: #07090b;
    --board-line: #1f242a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #20252d;
  --surface-raised: #353c47;
  --ink: #ece8de;
  --ink-2: #a7adb6;
  --ink-3: #7c828c;
  --line: #2a3038;
  --accent: #8fb0ff;
  --accent-ink: #0f1216;
  --soon: #ffc45c;
  --soon-bg: rgba(255, 182, 39, .15);
  --overdue: #ff8b7e;
  --overdue-bg: rgba(255, 107, 91, .16);
  --danger-solid: #d8463b;
  --danger-ink: #ffffff;
  --ok: #5fd39a;
  --board-bg: #07090b;
  --board-line: #1f242a;
  --shadow: none;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- utilities ---------- */

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: .875rem; }
.label {
  font: 600 .72rem/1.2 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stack > * + * { margin-top: 12px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }

/* ---------- app shell ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--appbar-h) + var(--safe-t));
  padding: var(--safe-t) var(--pad-r) 0 var(--pad-l);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.appbar > * { flex-shrink: 0; }
.trip-switch {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 8px;
  margin-left: -8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
  cursor: pointer;
}
.trip-switch:active { background: var(--surface-2); }
.trip-name {
  max-width: 100%;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-name::after { content: ' \25BE'; color: var(--ink-3); font-size: .8em; }
.trip-dates { font-size: .78rem; color: var(--ink-2); }
.trip-dates:empty { display: none; }

.net {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 .7rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.net::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.net.offline {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soon-bg);
  color: var(--soon);
}
.net.offline::before { background: var(--soon); }

.main {
  max-width: var(--maxw);
  margin: 0 auto;
  /* tab bar + FAB (16px above it, 56px tall) + 16px gap: the last card clears the "+" */
  padding: 16px var(--pad-r) calc(var(--tabbar-h) + var(--safe-b) + 88px) var(--pad-l);
}
.view > * + * { margin-top: 16px; }

.banners {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}
.banners:not(:empty) { padding-top: 12px; }
.banners > * + * { margin-top: 8px; }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
@media (min-width: 760px) {
  .tabbar { padding-left: calc(50vw - var(--maxw) / 2); padding-right: calc(50vw - var(--maxw) / 2); }
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tabbar-h);
  color: var(--ink-3);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::before {
  content: '';
  position: absolute;
  top: -1px;
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* ---------- section headings ---------- */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 .75rem/1.2 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.group-heading {
  position: sticky;
  top: calc(var(--appbar-h) + var(--safe-t));
  z-index: 5;
  padding: 10px 16px 6px;
  background: var(--bg);
  font: 600 .78rem/1.2 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- departure board ---------- */

.board {
  position: relative;
  padding: 18px 20px 20px;
  border-radius: var(--radius);
  background: var(--board-bg);
  color: var(--board-ink);
  overflow: hidden;
}
.board > * + * { margin-top: 10px; }
.board-label {
  font: 600 .72rem/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--board-amber);
}
.board-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.board-time {
  font: 600 clamp(3.4rem, 17vw, 5.75rem)/.95 var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: -0.03em;
}
.board-zone {
  padding: 3px 7px;
  border: 1px solid var(--board-line);
  border-radius: 6px;
  font: 600 .85rem/1 var(--mono);
  letter-spacing: .08em;
  color: var(--board-dim);
}
.board-route { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.board-countdown {
  font: 600 1.1rem/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--board-amber);
}
.board-meta {
  padding-top: 10px;
  border-top: 1px solid var(--board-line);
  font: 400 .85rem/1.5 var(--mono);
  color: var(--board-dim);
}
.board-empty { font: 400 1rem/1.4 var(--mono); color: var(--board-dim); }

/* ---------- cards & lists ---------- */

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
}
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { margin-top: 2px; font-size: .85rem; color: var(--ink-2); overflow-wrap: anywhere; }
.row-end { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.row.done .row-title { color: var(--ink-3); text-decoration: line-through; font-weight: 400; }
.row.tappable { cursor: pointer; }
.row.tappable:active { background: var(--surface-2); }
.row input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }

/* ---------- badges, tags ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font: 600 .74rem/1.1 var(--mono);
  white-space: nowrap;
}
.badge.later { background: var(--surface-2); color: var(--ink-2); }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.overdue { background: var(--overdue-bg); color: var(--overdue); }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 600 .7rem/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
/* Title + tag (Papers "Personal"): 8px after the text, no indent when the tag wraps. */
.row-title.cluster { gap: 2px 8px; }

/* ---------- chips & segmented ---------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* 7px block padding (5px of it pulled back by the margin) leaves room inside
     the scroller for the chips' 44px hit area, which it would otherwise clip. */
  margin: -5px calc(-1 * var(--pad-r)) -5px calc(-1 * var(--pad-l));
  padding: 7px var(--pad-r) 7px var(--pad-l);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative;
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
/* Compact 34px pill, 44px hit area. */
.chip::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}
.segmented > button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.segmented > button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.danger { background: var(--danger-solid); border-color: transparent; color: var(--danger-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.small { position: relative; min-height: 34px; padding: 0 12px; font-size: .875rem; }
/* Compact 34px button, 44px hit area (keeps the update bar and rows from growing). */
.btn.small::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.btn.block { display: flex; width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-size: 1.1rem;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.fab {
  position: fixed;
  z-index: 15;
  right: max(var(--pad-r), calc(50vw - var(--maxw) / 2 + var(--gutter)));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  cursor: pointer;
}

/* ---------- forms ---------- */

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: .8rem; color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input, .field select, .field textarea, input.input, select.input, textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem/1.3 var(--sans);   /* 16px: stops iOS zoom-on-focus */
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field input[type="date"], .field input[type="time"] { font-family: var(--mono); }
/* .mono beats the sans font above: document numbers need 0/O and 1/I distinct. */
.field .mono, .input.mono { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.form-error { color: var(--overdue); font-size: .9rem; font-weight: 600; }
.form-warn { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--soon-bg); color: var(--soon); font-size: .9rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- sheets ---------- */

dialog.sheet {
  width: 100%;
  max-width: var(--maxw);
  max-height: calc(100dvh - var(--safe-t) - 24px);
  margin: auto auto 0;
  padding: 0 0 var(--safe-b);
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .22s ease-out; }
dialog.sheet::backdrop { background: rgba(8, 10, 12, .5); }
.sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px var(--pad-r) 8px var(--pad-l);
}
.sheet-head::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--line);
}
.sheet-title { flex: 1; font-size: 1.15rem; }
.sheet-body { overflow-y: auto; padding: 8px var(--pad-r) 20px var(--pad-l); overscroll-behavior: contain; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- banners, update bar, toast ---------- */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
}
.banner.danger { background: var(--danger-solid); color: var(--danger-ink); }
.banner.warn { background: var(--soon-bg); color: var(--soon); }
.banner.info { background: var(--surface-2); color: var(--ink); }
.banner-action { margin-left: auto; flex-shrink: 0; }
.banner.danger .banner-action { color: inherit; }

.update-bar {
  position: fixed;
  z-index: 30;
  top: calc(var(--safe-t) + var(--appbar-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - var(--pad-l) - var(--pad-r)), calc(var(--maxw) - 2 * var(--gutter)));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 12px;
  background: var(--board-bg);
  color: var(--board-ink);
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.update-bar > span { flex: 1; }
.update-bar > span::before { content: '\25CF  '; color: var(--board-amber); }

.toast-region {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  width: min(calc(100% - var(--pad-l) - var(--pad-r)), 480px);
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--board-bg);
  color: var(--board-ink);
  font-size: .9rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
  transition: opacity .25s ease;
}
.toast.leaving { opacity: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- pull to refresh ---------- */

.ptr {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--pull, 0px);
  overflow: hidden;
  font: 600 .75rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ptr.busy { height: 40px; transition: height .15s ease; }
.ptr-button { display: none; }
@media (hover: hover) and (pointer: fine) {
  .ptr { height: auto; min-height: 34px; justify-content: flex-end; gap: 12px; }
  .ptr-button { display: inline-flex; }
}

/* ---------- itinerary legs ---------- */

.leg-row { align-items: flex-start; }
.leg-time {                     /* fixed column: every title starts at the same x */
  flex: 0 0 4.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.leg-clock { font-size: 1.45rem; font-weight: 600; line-height: 1.1; color: var(--ink); }
.leg-zone {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .08em;
  color: var(--ink-2);
}
.leg-tags { margin-top: 6px; gap: 6px; }
.leg-home { color: var(--ink-3); }
.leg-row.past { opacity: .55; }
@media (max-width: 380px) {
  .leg-time { flex-basis: 4.25rem; }
  .leg-clock { font-size: 1.3rem; }
}

/* ---------- misc components ---------- */

.empty { padding: 48px 16px; text-align: center; }
.empty > * + * { margin-top: 12px; }
.empty .btn { margin-top: 20px; }

.readout {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font: 600 clamp(1.4rem, 7vw, 2.2rem)/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.footer-note {
  padding: 24px 0 8px;
  text-align: center;
  font: 400 .75rem/1.4 var(--mono);
  color: var(--ink-3);
}

/* ---------- sign-in ---------- */

.signin { max-width: 420px; margin: 8vh auto 0; }
.signin > * + * { margin-top: 16px; }
.signin-brand {
  padding: 22px 22px 26px;
  border-radius: var(--radius);
  background: var(--board-bg);
  color: var(--board-ink);
}
.signin-brand .board-label { margin-bottom: 10px; }
.signin-title { font-size: clamp(3rem, 16vw, 4.5rem); font-weight: 600; line-height: .95; letter-spacing: .04em; }

/* ---------- motion ---------- */

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