/* Commuter — "Midnight Flash" design system.
 *
 * The single source of truth for the app's identity. This file is blocking and
 * SW-precached, so it paints BEFORE the Tailwind Play CDN has evaluated. That
 * ordering matters: the CDN compiles asynchronously and only once
 * document.body exists, so there is always at least one frame with no Tailwind
 * CSS at all. Anything load-bearing (page background, base type, surfaces,
 * component shapes) lives here; tailwind-theme.js is an ergonomics layer that
 * exposes these same tokens as utility classes.
 *
 * Conventions:
 *   - No colour literal belongs outside this file.
 *   - Warm-tinted neutrals (hue ~40-60), never blue-grey, never pure #000/#fff.
 *   - Exactly one glowing element per screen. Destructive actions never glow.
 *   - Motion is expo-out. Never bounce or elastic.
 */

:root {
  color-scheme: dark;

  /* ── surfaces ─────────────────────────────────────────────────────────── */
  --bg-void: #0A0908;      /* scrim, PWA splash */
  --bg-sunken: #0E0C0A;    /* inputs, wells */
  --bg-base: #14110F;      /* the page — the anchor of the whole palette */
  --bg-raised: #1C1815;    /* cards */
  --bg-overlay: #262220;   /* sheets, toast */
  --line: #2A2521;         /* hairline */
  --line-strong: #3A332C;

  /* ── ink (contrast ratios measured against --bg-base) ─────────────────── */
  --ink: #F5F0E8;          /* primary   15.5:1 */
  --ink-muted: #A39A8E;    /* secondary  7.2:1 */
  --ink-faint: #6E655B;    /* tertiary   3.9:1 — >=18px or non-semantic only */

  /* ── signal: the one accent. Primary action + "on route". ─────────────── */
  --signal: #D7F23C;       /* 14.6:1 on base */
  --signal-hi: #E4FA6B;    /* hover */
  --signal-lo: #B8D122;    /* pressed */
  --signal-ink: #14110F;   /* text ON signal */
  --signal-dim: rgb(215 242 60 / 0.14);
  --signal-edge: rgb(215 242 60 / 0.32);

  /* ── semantics. Always paired with an icon or label, never colour alone. ─ */
  --warn: #FFB020;         /* pending, off-route   9.9:1 */
  --warn-dim: rgb(255 176 32 / 0.14);
  --danger: #FF6B5A;       /* warm coral, not rose — rose reads blue-cold
                              against a warm charcoal base.   6.2:1 */
  --danger-dim: rgb(255 107 90 / 0.12);
  --inert: #6E655B;        /* deactivated, cancelled */

  /* ── elevation. On dark UI a hairline plus an inset highlight does the
       work; the glow is reserved for the single primary action. ─────────── */
  --sh-card:
    inset 0 1px 0 rgb(255 255 255 / 0.04),
    0 6px 18px -10px rgb(10 9 8 / 0.85);
  --sh-raised:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 14px 34px -18px rgb(10 9 8 / 0.9);
  --sh-overlay: 0 -26px 64px -26px rgb(10 9 8 / 0.95);
  --glow:
    0 0 0 1px rgb(215 242 60 / 0.35),
    0 10px 30px -8px rgb(215 242 60 / 0.5);
  --glow-still:
    0 0 0 1px rgb(215 242 60 / 0.22),
    0 6px 16px -8px rgb(215 242 60 / 0.28);
  --focus-ring: 0 0 0 2px var(--bg-base), 0 0 0 4px rgb(215 242 60 / 0.75);

  /* ── radii ────────────────────────────────────────────────────────────── */
  --r-xs: 0.375rem;
  --r-sm: 0.625rem;
  --r-md: 0.875rem;
  --r-lg: 1.25rem;
  --r-xl: 1.75rem;
  --r-pill: 999px;

  /* ── rhythm ───────────────────────────────────────────────────────────── */
  --gutter: clamp(1rem, 4.5vw, 1.5rem);
  --tap: 2.75rem;          /* 44px — WCAG 2.5.5 / Apple HIG minimum */
  --tap-lg: 3.25rem;       /* 52px — primary CTA */
  --measure: 34rem;

  /* ── safe areas. Every one of these resolves to 0 unless the viewport meta
       carries viewport-fit=cover. All three shells set it. ──────────────── */
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);

  /* ── bottom chrome. The tab bar sits on the floor; the driver console's
       dispatch bar stacks directly on top of it. ────────────────────────── */
  --tabbar-h: 3.5rem;      /* 56px */
  --dispatch-h: 4rem;      /* 64px */
  --chrome-bottom: calc(var(--tabbar-h) + var(--sa-b));

  /* ── type ─────────────────────────────────────────────────────────────── */
  --font-sans: Archivo, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --fs-hero: clamp(3.5rem, 24vw, 4.5rem);
  --fs-display: clamp(1.75rem, 8vw, 2.5rem);
  --fs-title: clamp(1.25rem, 5.5vw, 1.5rem);
  --fs-heading: 1.0625rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;

  /* ── motion ───────────────────────────────────────────────────────────── */
  --dur-1: 90ms;
  --dur-2: 160ms;
  --dur-3: 260ms;
  --dur-4: 420ms;
  --dur-glow: 2600ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);        /* expo-out */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ── layers ───────────────────────────────────────────────────────────── */
  --z-bar: 20;
  --z-sheet: 50;
  --z-toast: 60;
}

/* ── reset ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Setting the background on <html> is what kills the white flash on every
   cross-page tap. The dark background used to be a Tailwind class on <body>,
   which only applies once the CDN's JIT has run. */
html {
  background: var(--bg-base);
  -webkit-text-size-adjust: 100%;
  /* Nothing may widen the document past the device: the fixed tab bar spans
     the layout viewport, so any horizontal overflow pushes it off screen. */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-base);
  color: var(--ink);
  /* Declared on body, not html: Tailwind Preflight appends after this file and
     sets a font-family on html, but a declaration on body always beats a value
     inherited from html regardless of source order. */
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  font-stretch: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* App-like viewport: scrolling only. Double-tap zoom on plain content is
     off; controls already carry touch-action: manipulation. */
  touch-action: pan-x pan-y;
  overflow-x: hidden;
  overflow-x: clip;
}

/* ── typography ─────────────────────────────────────────────────────────── */

/* Archivo is one variable family carrying two typographic voices. The display
   voice is the wide, heavy end of the width axis — it reads like a rail
   departure board. Face selection is deterministic because CSS resolves
   font-stretch before font-weight, so never set font-stretch ad hoc. */
.display {
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.hero-num {
  font-weight: 800;
  font-stretch: 125%;
  font-size: var(--fs-hero);
  line-height: 0.86;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Tabular figures stop digits jittering when a live-updating value re-renders. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.eyebrow {
  font-size: var(--fs-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

/* ── focus. Buttons had no visible focus indicator at all before this. ──── */

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}

.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;
}

/* ── controls ───────────────────────────────────────────────────────────── */

button,
[role="button"],
.btn,
.icon-btn,
.link-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: var(--tap);
  padding-inline: 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn--block {
  width: 100%;
}

.btn--lg {
  min-block-size: var(--tap-lg);
  font-size: 1.0625rem;
}

.btn--sm {
  min-block-size: var(--tap);
  padding-inline: 0.75rem;
  font-size: var(--fs-small);
}

.btn--primary {
  background: var(--signal);
  color: var(--signal-ink);
}

.btn--primary:hover:not(:disabled) {
  background: var(--signal-hi);
}

.btn--primary:active:not(:disabled) {
  background: var(--signal-lo);
}

.btn--primary:disabled {
  background: var(--line-strong);
  color: var(--ink-faint);
  opacity: 1;
}

.btn--secondary {
  background: var(--bg-raised);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg-overlay);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-muted);
}

.btn--ghost:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.04);
  color: var(--ink);
}

/* Destructive: outline only. A filled danger button competes with the primary
   action, and a glowing one would invite the tap we least want to encourage. */
.btn--danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-dim);
}

/* The glow lives on a pseudo-element so the pulse animates opacity, not
   box-shadow — animating a shadow repaints every frame. */
.btn--glow {
  box-shadow: var(--glow-still);
}

.btn--glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--glow);
  opacity: 0;
  pointer-events: none;
  animation: pulse-glow var(--dur-glow) var(--ease-in-out) infinite;
}

.btn--glow:disabled {
  box-shadow: none;
}

.btn--glow:disabled::after {
  animation: none;
  opacity: 0;
}

/* A 44x44 hit area wrapping a smaller visual chip: compact rows stay compact
   without dropping below the minimum target size. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-inline-size: var(--tap);
  min-block-size: var(--tap);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}

.icon-btn > * {
  pointer-events: none;
}

.icon-btn:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.05);
  color: var(--ink);
}

.icon-btn:disabled {
  border-color: var(--line);
  color: var(--line-strong);
  cursor: not-allowed;
}

.icon-btn--bare {
  border-color: transparent;
}

/* Low visual weight, full-size target. Replaces the 12px text links that used
   to carry sign-out and edit-profile. */
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-block-size: var(--tap);
  padding-inline: 0.5rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-muted);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-out);
}

.link-btn:hover {
  color: var(--ink);
}

.link-btn--danger:hover {
  color: var(--danger);
}

/* ── inputs. The 16px floor is not cosmetic: iOS Safari zooms the viewport
     when a text control below 16px receives focus. ──────────────────────── */

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  font-family: inherit;
  font-size: max(1rem, 1em);
  color: var(--ink);
  background: var(--bg-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  min-block-size: var(--tap-lg);
  padding: 0.75rem 0.875rem;
  width: 100%;
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

/* The native date/time pickers render a light glyph by default on dark UI. */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

label {
  display: block;
  margin-block-end: 0.375rem;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink-muted);
}

/* ── address search suggestions (lib/places.js typeahead). Anchored under
     the input; each row clears the 44px tap floor and the 16px type floor. ─ */

.suggest {
  position: absolute;
  z-index: 30;
  background: var(--bg-overlay);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-raised);
  max-block-size: 18.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.suggest__item {
  display: flex;
  align-items: center;
  inline-size: 100%;
  min-block-size: var(--tap);
  padding: 0.625rem 0.875rem;
  font-size: var(--fs-body);
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}

.suggest__item + .suggest__item {
  border-top: 1px solid var(--line);
}

.suggest__item:hover,
.suggest__item--active {
  background: var(--signal-dim);
}

.suggest__text {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.suggest__hint {
  padding: 0.75rem 0.875rem;
  font-size: var(--fs-small);
  color: var(--ink-faint);
}

/* ── surfaces ───────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
}

.card--flat {
  background: var(--bg-sunken);
  box-shadow: none;
}

.well {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

/* ── chips ──────────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.6875rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.chip--sm {
  padding: 0.1875rem 0.5rem;
  font-size: var(--fs-micro);
}

.chip svg {
  width: 1em;
  height: 1em;
  flex: none;
}

.chip--neutral {
  background: rgb(255 255 255 / 0.06);
  color: var(--ink-muted);
}

.chip--signal {
  background: var(--signal-dim);
  color: var(--signal);
}

.chip--warn {
  background: var(--warn-dim);
  color: var(--warn);
}

.chip--danger {
  background: var(--danger-dim);
  color: var(--danger);
}

.chip--inert {
  background: rgb(255 255 255 / 0.05);
  color: var(--inert);
}

/* The stop-number tile: a numbered marker that reads as a map pin, and the one
   place the oversized-numeral direction carries real information. */
.stop-tile {
  display: grid;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: var(--r-md);
  background: var(--signal-dim);
  color: var(--signal);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1.5rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── page scaffolding ───────────────────────────────────────────────────── */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--sa-t);
  padding-inline: max(var(--gutter), var(--sa-l)) max(var(--gutter), var(--sa-r));
}

/* Screens that render with the tab bar visible must reserve its height, plus
   the dispatch bar's where one exists. */
.app--tabbar {
  padding-bottom: calc(var(--chrome-bottom) + 1rem);
}

.app--dispatch {
  padding-bottom: calc(var(--chrome-bottom) + var(--dispatch-h) + 1rem);
}

/* Full-bleed gate screens: auth, pending, claim, error. No navigation is
   possible from these, so they carry no tab bar. */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--sa-t) + 2rem) max(var(--gutter), var(--sa-l))
    calc(var(--sa-b) + 2rem) max(var(--gutter), var(--sa-r));
}

.gate__inner {
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
}

/* ── tab bar. Lives in the HTML shell rather than #app so it paints before the
     module runs and survives every innerHTML swap. ──────────────────────── */

#tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-bar);
  display: none;
  background: rgb(20 17 15 / 0.92);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--line);
  padding-bottom: var(--sa-b);
  padding-inline: max(0px, var(--sa-l)) max(0px, var(--sa-r));
}

#tabbar[data-ready="1"] {
  display: block;
}

.tabbar__row {
  display: flex;
  align-items: stretch;
  block-size: var(--tabbar-h);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  min-block-size: var(--tap);
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-out);
}

.tab svg {
  width: 1.25rem;
  height: 1.25rem;
}

.tab:hover {
  color: var(--ink-muted);
}

.tab[aria-current="page"] {
  color: var(--signal);
}

/* A dot rather than a number: the count is on the destination screen, and a
   badge here would be one more thing to keep in sync. */
.tab__dot {
  position: absolute;
  margin-block-start: -1.125rem;
  margin-inline-start: 0.875rem;
  inline-size: 0.375rem;
  block-size: 0.375rem;
  border-radius: var(--r-pill);
  background: var(--warn);
}

/* Tapping a page tab is a real document load. Dimming plus a progress hairline
   makes the 200-400ms read as an intentional transition rather than a stall. */
body.is-navigating .app,
body.is-navigating .gate {
  opacity: 0.55;
  transition: opacity var(--dur-3) var(--ease-out);
}

body.is-navigating::before {
  content: "";
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 2px;
  background: var(--signal);
  z-index: var(--z-toast);
  transform-origin: left;
  animation: progress-slide 1.4s var(--ease-out) infinite;
}

/* ── dispatch bar (driver console only) ─────────────────────────────────── */

#actions {
  position: fixed;
  inset-inline: 0;
  bottom: var(--chrome-bottom);
  z-index: var(--z-bar);
  background: rgb(20 17 15 / 0.94);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--line);
  padding: 0.625rem max(var(--gutter), var(--sa-l)) 0.625rem
    max(var(--gutter), var(--sa-r));
}

.dispatch__row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 0.5rem;
  max-width: var(--measure);
  margin-inline: auto;
}

/* ── bottom sheet. Mounted on document.body, never #app, so an #app re-render
     underneath cannot destroy an open form. ─────────────────────────────── */

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgb(10 9 8 / 0.72);
  animation: fade-in var(--dur-2) var(--ease-out) both;
}

.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: calc(var(--z-sheet) + 1);
  display: flex;
  flex-direction: column;
  /* svh, not vh: under mobile browser chrome, vh would push the sheet's own
     actions below the fold. */
  max-block-size: 85svh;
  background: var(--bg-overlay);
  border-top: 1px solid var(--line-strong);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-overlay);
  animation: sheet-up var(--dur-3) var(--ease-out) both;
}

.sheet__grabber {
  display: block;
  inline-size: 2.25rem;
  block-size: 0.25rem;
  margin: 0.625rem auto 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem var(--gutter) 0.5rem;
}

.sheet__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem var(--gutter) calc(var(--sa-b) + 1.5rem);
}

/* ── toast. Cleared above the bottom chrome so it is never hidden behind it. ─ */

#commuter-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--chrome-bottom) + 1rem);
  z-index: var(--z-toast);
  max-inline-size: calc(100vw - 2rem);
  padding: 0.6875rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-overlay);
  color: var(--ink);
  font-size: var(--fs-small);
  box-shadow: var(--sh-raised);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out);
}

#commuter-toast[data-tone="success"] {
  border-color: var(--signal-edge);
}

#commuter-toast[data-tone="warn"] {
  border-color: rgb(255 176 32 / 0.4);
}

#commuter-toast[data-tone="error"] {
  border-color: rgb(255 107 90 / 0.4);
}

/* ── route rail ─────────────────────────────────────────────────────────── */

.rail {
  display: block;
  width: 100%;
  overflow: visible;
}

.rail-leg {
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-linecap: round;
}

.rail-leg--unknown {
  stroke: var(--line);
  stroke-dasharray: 2 5;
}

/* The bypass segment on a declined request: the route visibly goes around you. */
.rail-leg--bypass {
  stroke: var(--danger);
  stroke-dasharray: 4 5;
  opacity: 0.65;
}

.rail-leg--active {
  stroke: var(--signal);
  stroke-width: 2.5;
}

.rail-node {
  fill: var(--bg-base);
  stroke: var(--line-strong);
  stroke-width: 2;
}

.rail-node--origin {
  fill: var(--ink-muted);
  stroke: none;
}

.rail-node--stop {
  fill: var(--bg-raised);
  stroke: var(--line-strong);
}

.rail-node--you {
  fill: var(--signal);
  stroke: none;
}

.rail-node--dest {
  fill: var(--ink);
  stroke: none;
}

.rail-node--ghost {
  fill: none;
  stroke: var(--line-strong);
  stroke-dasharray: 3 3;
}

.rail-halo {
  fill: var(--signal);
  opacity: 0.16;
  animation: halo-pulse var(--dur-glow) var(--ease-in-out) infinite;
}

.rail-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.rail-sub,
.rail-meta {
  fill: var(--ink-faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.rail-order {
  fill: var(--ink-muted);
  font-size: 9.5px;
  font-weight: 700;
}

.rail-order--on-signal {
  fill: var(--signal-ink);
}

.rail-chip {
  fill: rgb(255 255 255 / 0.06);
  stroke: none;
}

.rail-chip--ok {
  fill: var(--signal-dim);
}

.rail-chip--warn {
  fill: var(--warn-dim);
}

.rail-chip-text {
  fill: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rail-chip--ok + .rail-chip-text {
  fill: var(--signal);
}

.rail-chip--warn + .rail-chip-text {
  fill: var(--warn);
}

/* ── list rows ──────────────────────────────────────────────────────────── */

.row {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
}

.row[data-offroute="true"] {
  border-color: rgb(255 176 32 / 0.45);
  background: linear-gradient(0deg, var(--warn-dim), var(--warn-dim)), var(--bg-raised);
}

/* Reordering re-renders the whole list, so the moved row would otherwise
   appear to teleport. A brief flash marks where it landed. */
.row--flash {
  animation: row-flash var(--dur-4) var(--ease-out) both;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.25rem 0.25rem;
}

/* ── day strip ──────────────────────────────────────────────────────────── */

.daystrip {
  display: flex;
  gap: 0.5rem;
  /* Never wider than its column: it is a flex item on the driver console,
     and a flex item's default min-width can let its contents widen it past
     the container — which would widen the page and push the fixed tab bar
     off screen. Chips are flex:none, so this scrolls internally instead. */
  max-inline-size: 100%;
  min-inline-size: 0;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-block-end: 0.25rem;
}

.daystrip::-webkit-scrollbar {
  display: none;
}

.day {
  scroll-snap-align: center;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  inline-size: 3.5rem;
  min-block-size: var(--tap-lg);
  padding-block: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--ink-muted);
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}

.day__dow {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day__num {
  font-size: 1.125rem;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.day[aria-pressed="true"] {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--signal-ink);
}

/* Locked-out days (weekends, commute-complete): stay visible so the strip
   reads continuously, but clearly not selectable. Placed after the pressed
   state so a dimmed day never looks armed. Token-only (AGENTS.md rule 8);
   the base .day sizing keeps the ≥44×44 touch target intact. */
.day:disabled,
.day[data-off] {
  background: var(--bg-sunken);
  border-color: var(--line);
  color: var(--ink-faint);
  cursor: not-allowed;
}

/* ── skeletons ──────────────────────────────────────────────────────────── */

.skel {
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    rgb(255 255 255 / 0.04) 25%,
    rgb(255 255 255 / 0.08) 37%,
    rgb(255 255 255 / 0.04) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── entrance motion. One orchestrated reveal beats scattered micro-motion. ─ */

.rise {
  animation: rise-in var(--dur-3) var(--ease-out) both;
}

.rise-1 { animation-delay: 40ms; }
.rise-2 { animation-delay: 80ms; }
.rise-3 { animation-delay: 120ms; }
.rise-4 { animation-delay: 160ms; }

/* ── keyframes ──────────────────────────────────────────────────────────── */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes sheet-up {
  from { transform: translate3d(0, 100%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes halo-pulse {
  0%, 100% { opacity: 0.1; transform: scale(0.94); }
  50% { opacity: 0.22; transform: scale(1.06); }
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

@keyframes row-flash {
  from { background-color: var(--signal-dim); }
  to { background-color: transparent; }
}

@keyframes progress-slide {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(0.7); }
  100% { transform: scaleX(1); }
}

/* ── cross-document view transitions ────────────────────────────────────────
 * Navigation between the three shells is a real document load. Chrome captures
 * the new document's FIRST rendering opportunity, so this is only safe because
 * each shell ships a static skeleton inside #app — without it we would
 * cross-fade into a blank page, which is worse than no transition at all.
 * Progressive enhancement: unsupported browsers just navigate.
 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

::view-transition-old(root) {
  animation: fade-out var(--dur-2) var(--ease-out) both;
}

::view-transition-new(root) {
  animation: fade-in var(--dur-3) var(--ease-out) both;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ── reduced motion. The glow itself is identity, so it stays — as a static
     shadow. Only the pulse and the decorative animations are suppressed. ── */

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

  .btn--glow::after {
    animation: none;
    opacity: 1;
  }

  .rail-halo {
    animation: none;
    opacity: 0.16;
  }

  .skel {
    animation: none;
  }

  ::view-transition-group(*),
  ::view-transition-image-pair(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
