/* Reroute (formerly Plan B MVP v3) — editorial, layered-surface look from docs/design/design-system.md. Dark by default, derived Light theme. Large areas animate only transform and opacity. */

:root {
  /* Surfaces: base < surface < card < pop */
  --bg-void: #06070B; --bg-base: #090A0F; --bg-surface: #13151D; --bg-card: #181B24; --bg-pop: #1D212C;
  --border-subtle: rgba(255, 255, 255, 0.06); --border-strong: rgba(255, 255, 255, 0.12); --divider: rgba(255, 255, 255, 0.05);
  --border-focus: rgba(99, 102, 241, 0.8);
  --text-main: #F1F5F9; --text-muted: #94A3B8; --text-faint: #64748B;
  --accent: #6366F1; --accent-text: #A5B4FC; --accent-soft: rgba(99, 102, 241, 0.16); --accent-glow: rgba(99, 102, 241, 0.15); --on-accent: #FFFFFF;
  --success: #34D399; --success-text: #6EE7B7; --success-soft: rgba(52, 211, 153, 0.11); --on-success: #04281C;
  --error: #F87171; --error-text: #FCA5A5; --error-soft: rgba(248, 113, 113, 0.11); --on-error: #2A0A0A;
  --warning: #FBBF24; --warning-text: #FCD34D; --warning-soft: rgba(251, 191, 36, 0.11);
  --teal: #2DD4BF; --violet: #A78BFA;
  --fill: rgba(255, 255, 255, 0.04); --fill-strong: rgba(255, 255, 255, 0.09);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3); --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.55);
  --scrim: rgba(4, 5, 8, 0.62); --nav-bg: rgba(9, 10, 15, 0.82); --shimmer: rgba(255, 255, 255, 0.055); --knob: #E2E8F0;
  --seg-walk: #94A3B8; --seg-bus: #818CF8; --seg-rail: #FB923C; --seg-tram: #A78BFA; --seg-ferry: #2DD4BF; --seg-car: #64748B; --seg-rideshare: #F472B6;
  --chart: #6366F1; --chart-past: rgba(99, 102, 241, 0.42);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --push: cubic-bezier(0.72, 0, 0.28, 1); --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --spring: cubic-bezier(0.34, 1.32, 0.64, 1);
  --gutter: 24px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-void: #E4E7EF; --bg-base: #EEF0F5; --bg-surface: #F6F7FA; --bg-card: #FCFCFE; --bg-pop: #FDFDFF;
  --border-subtle: rgba(15, 18, 34, 0.07); --border-strong: rgba(15, 18, 34, 0.14); --divider: rgba(15, 18, 34, 0.06);
  --border-focus: rgba(79, 70, 229, 0.85);
  --text-main: #0F1222; --text-muted: #5B6478; --text-faint: #8A93A6;
  --accent: #4F46E5; --accent-text: #4338CA; --accent-soft: rgba(79, 70, 229, 0.1); --accent-glow: rgba(79, 70, 229, 0.14);
  --success: #047857; --success-text: #047857; --success-soft: rgba(4, 120, 87, 0.1); --on-success: #FFFFFF;
  --error: #B91C1C; --error-text: #B91C1C; --error-soft: rgba(185, 28, 28, 0.08); --on-error: #FFFFFF;
  --warning: #B45309; --warning-text: #B45309; --warning-soft: rgba(180, 83, 9, 0.1);
  --teal: #0F766E; --violet: #6D28D9;
  --fill: rgba(15, 18, 34, 0.04); --fill-strong: rgba(15, 18, 34, 0.09);
  --shadow-card: 0 1px 2px rgba(15, 18, 34, 0.04), 0 10px 30px rgba(15, 18, 34, 0.07); --shadow-pop: 0 18px 48px rgba(15, 18, 34, 0.18);
  --scrim: rgba(15, 18, 34, 0.4); --nav-bg: rgba(238, 240, 245, 0.84); --shimmer: rgba(255, 255, 255, 0.75); --knob: #FCFCFE;
  --seg-walk: #64748B; --seg-bus: #4F46E5; --seg-rail: #C2410C; --seg-tram: #6D28D9; --seg-ferry: #0F766E; --seg-car: #334155; --seg-rideshare: #BE185D;
  --chart: #4F46E5; --chart-past: rgba(79, 70, 229, 0.38);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; letter-spacing: -0.01em; color: var(--text-main); background: var(--bg-void);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overscroll-behavior: none;
}
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.scroll, .sheet-scroll, .settings-scroll, .ac-list { scrollbar-width: none; }
.scroll::-webkit-scrollbar, .sheet-scroll::-webkit-scrollbar, .settings-scroll::-webkit-scrollbar { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fine a, .hint a { position: relative; }
.fine a::before, .hint a::before { content: ""; position: absolute; inset: -15px -4px; }
.hint { font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.fine { font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

/* ── App shell: full screen on phones, centred 480 px column on desktop ───── */

.app {
  position: relative; display: flex; height: 100dvh; max-width: 480px; margin: 0 auto; overflow: hidden; background: var(--bg-base);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}
@media (min-width: 520px) { .app { border-inline: 1px solid var(--border-subtle); box-shadow: 0 0 80px rgba(0, 0, 0, 0.45); } }
.viewport { position: relative; flex: 1; min-width: 0; overflow: hidden; }

/* ── Pages and push transitions ──────────────────────────────────────────── */

.page { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg-base); overflow: hidden; }
.page.in-forward { animation: inFwd 380ms var(--push) both; z-index: 2; }
.page.out-forward { animation: outFwd 380ms var(--push) both; }
.page.in-back { animation: inBack 380ms var(--push) both; }
.page.out-back { animation: outBack 380ms var(--push) both; z-index: 2; }
.page.in-up { animation: inUp 460ms var(--ease-out) both; z-index: 3; }
.page.out-down { animation: outDown 340ms var(--push) both; z-index: 3; }
@keyframes inFwd { from { transform: translateX(100%); } to { transform: none; } }
@keyframes outFwd { from { transform: none; opacity: 1; } to { transform: translateX(-24%); opacity: 0.5; } }
@keyframes inBack { from { transform: translateX(-24%); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes outBack { from { transform: none; } to { transform: translateX(100%); } }
@keyframes inUp { from { transform: translateY(100%); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes outDown { from { transform: none; } to { transform: translateY(100%); } }

.scroll { flex: 1; overflow-y: auto; padding: 24px var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; }
.scroll.tight { padding-top: 16px; }

/* ── Navigation bar ──────────────────────────────────────────────────────── */

.navbar {
  min-height: 56px; flex-shrink: 0; position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 6px 16px;
  background: var(--nav-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--divider);
}
.navbar .side { display: flex; align-items: center; min-width: 0; }
.nav-back, .nav-action {
  display: flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding: 0 12px 0 4px; margin-left: -4px; background: none; border: 1px solid transparent; border-radius: 12px;
  color: var(--text-muted); font-size: 15px; font-weight: 500; transition: var(--transition-smooth);
}
.nav-action { padding: 0 14px; margin-right: -4px; color: var(--accent-text); font-weight: 600; justify-content: center; }
.nav-back:active, .nav-action:active, .icon-btn:active { transform: scale(0.98); background: var(--fill-strong); }
@media (hover: hover) { .nav-back:hover, .nav-action:hover { background: var(--fill); color: var(--text-main); } }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 14px; border: 1px solid var(--border-subtle); background: var(--bg-card); color: var(--text-main);
  display: inline-flex; align-items: center; justify-content: center; transition: var(--transition-smooth);
}
@media (hover: hover) { .icon-btn:hover { background: var(--bg-pop); border-color: var(--border-strong); } .icon-btn[data-action="open-settings"]:hover svg { transform: rotate(60deg); } }
.icon-btn svg { transition: transform 0.5s var(--spring); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.sticky {
  flex-shrink: 0; padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px;
  background: var(--nav-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--divider);
}
.btn {
  position: relative; overflow: hidden; width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid transparent; padding: 0 20px;
  font-size: 15px; font-weight: 600; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; transition: var(--transition-smooth);
}
.btn:active:not(:disabled) { transform: scale(0.98); opacity: 0.86; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--bg-card); color: var(--text-main); border-color: var(--border-subtle); }
.btn-success { background: var(--success); color: var(--on-success); }
.btn-inverse { background: var(--text-main); color: var(--bg-base); }
.btn-text { min-height: 44px; background: none; color: var(--text-muted); font-weight: 500; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-row .btn { min-height: 48px; }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled), .btn-success:hover:not(:disabled), .btn-inverse:hover:not(:disabled) { filter: brightness(1.08); }
  .btn-secondary:hover:not(:disabled) { background: var(--bg-pop); border-color: var(--border-strong); }
  .btn-text:hover:not(:disabled) { color: var(--text-main); background: var(--fill); }
}
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { box-shadow: 0 0 0 5px var(--accent-glow); }

/* ── Skeleton / shimmer loading (transform + opacity only) ───────────────── */

.skeleton, .is-loading { position: relative; overflow: hidden; }
.skeleton { background: var(--fill-strong); border-radius: 10px; }
.skeleton::after, .is-loading::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent); animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.is-loading { pointer-events: none; }
.btn.is-loading { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-glow); opacity: 1; }
.skel-chip { display: inline-block; width: 148px; height: 36px; border-radius: 18px; }
.skel-btn { width: 156px; height: 44px; border-radius: 14px; flex-shrink: 0; }
.skel-line { height: 12px; border-radius: 6px; margin: 4px 0; }
.skel-line.sm { height: 10px; }
.skel-line.w-30 { width: 30%; } .skel-line.w-40 { width: 40%; } .skel-line.w-60 { width: 60%; } .skel-line.w-80 { width: 80%; } .skel-line.w-100 { width: 100%; }
.skel-block { border-radius: 14px; }
.skel-tile { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; }
.skel-stack { display: flex; flex-direction: column; gap: 8px; }
.skel-card { padding: 20px; border-radius: 20px; background: var(--bg-surface); border: 1px solid var(--border-subtle); }
.skel-card .skel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.skel-card .skel-head > div:last-child { flex: 1; }
.skel-card .skel-block { height: 64px; margin-bottom: 16px; }
.map-skeleton { position: absolute; inset: 0; border-radius: 0; z-index: 400; display: flex; align-items: center; justify-content: center; color: var(--text-faint); }

/* ── Typography ──────────────────────────────────────────────────────────── */

.large-title { font-size: 30px; line-height: 1.12; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 12px; max-width: 14em; }
.subtitle { font-size: 15px; color: var(--text-muted); margin-bottom: 32px; line-height: 1.6; max-width: 32em; }
.section-header { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin: 0 0 12px 4px; }

/* ── Grouped rows ────────────────────────────────────────────────────────── */

.group { margin-bottom: 32px; }
.group-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-card); }
.group-footer { font-size: 13px; color: var(--text-muted); margin-top: 12px; padding: 0 4px; line-height: 1.5; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 12px 16px; background: transparent; position: relative; width: 100%; border: none; text-align: left;
  color: inherit; text-decoration: none; transition: var(--transition-smooth);
}
.row.top { align-items: flex-start; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 16px; left: 16px; height: 1px; background: var(--divider); }
.row + .row:has(> .row-icon)::before { left: 66px; }
button.row:active, a.row:active { transform: scale(0.98); background: var(--fill-strong); }
@media (hover: hover) { button.row:hover, a.row:hover { background: var(--fill); } }
.row-icon {
  --tone: var(--accent); width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.row-label { flex: 1; font-size: 15px; font-weight: 500; min-width: 0; }
.row-label small { display: block; font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.row-value { font-size: 14px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.row-value.strong { color: var(--text-main); font-weight: 500; }
.chev { color: var(--text-faint); flex-shrink: 0; display: flex; }
.row input[type="number"], .row input[type="datetime-local"], .row input[type="time"], .row select {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 0 12px; font-size: 16px; color: var(--text-main); min-height: 44px; transition: var(--transition-smooth);
}
.row input[type="number"] { width: 96px; text-align: right; }
.row:has(> input[type="datetime-local"]) { gap: 10px; }
.row:has(> input[type="datetime-local"]) .row-label { flex: 0 0 auto; }
.row input[type="datetime-local"] { flex: 1 1 0; min-width: 0; padding: 0 6px 0 10px; font-size: 15px; }
@media (max-width: 399px) { .row:has(> input[type="datetime-local"]) { flex-wrap: wrap; } .row input[type="datetime-local"] { flex-basis: 12em; min-width: 12em; } }
.row input:focus-visible, .row select:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.row input::placeholder, .form-stack input::placeholder, .panic-input::placeholder { color: var(--text-faint); }
.row > input[type="text"], .row > .clr-wrap > input, .place-input input { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: none; padding: 0; font-size: 16px; color: var(--text-main); }
.row > input[type="text"]:focus-visible, .row > .clr-wrap > input:focus-visible, .place-input input:focus-visible { outline: none; box-shadow: none; }
.field-row { flex-wrap: wrap; }
.place-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.place-name { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.field-row:focus-within { background: var(--fill); box-shadow: inset 0 0 0 1.5px var(--border-focus); }
.place-input { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.place-input label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); width: 44px; flex-shrink: 0; }
.place-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 16px 16px 66px; }

/* Stepper */
.stepper { display: flex; align-items: center; border-radius: 14px; overflow: hidden; background: var(--bg-card); border: 1px solid var(--border-subtle); }
.stepper button { width: 44px; height: 44px; border: none; background: none; color: var(--accent-text); display: flex; align-items: center; justify-content: center; transition: var(--transition-smooth); }
.stepper button:disabled { color: var(--text-faint); opacity: 0.5; cursor: default; }
.stepper button:active:not(:disabled) { transform: scale(0.98); background: var(--fill-strong); }
.stepper button:focus-visible { outline-offset: -2px; }
@media (hover: hover) { .stepper button:hover:not(:disabled) { background: var(--fill); } }
.stepper output { min-width: 68px; padding: 0 4px; text-align: center; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Switch with a springy knob (hit area extended to 56 x 44) */
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; }
.switch input { position: absolute; inset: -6px -2px; width: calc(100% + 4px); height: calc(100% + 12px); opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-strong); border: 1px solid var(--border-strong); transition: var(--transition-smooth); }
.switch .knob { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--knob); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.36s var(--spring); }
.switch input:checked ~ .track { background: var(--accent); border-color: transparent; }
.switch input:checked ~ .knob { transform: translateX(20px); background: #fff; }
.switch input:active ~ .knob { transform: scale(0.94); }
.switch input:checked:active ~ .knob { transform: translateX(20px) scale(0.94); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--border-focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-glow); }

/* Segmented control with a sliding thumb (44 px high) */
.segmented { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 2px; }
.segmented .thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; border-radius: 11px; background: var(--bg-card); border: 1px solid var(--border-strong); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); transition: transform 0.38s var(--spring); }
.segmented button { position: relative; z-index: 1; min-height: 40px; padding: 0 12px; border: none; border-radius: 11px; background: none; font-size: 13px; font-weight: 500; color: var(--text-muted); transition: var(--transition-smooth); white-space: nowrap; }
.segmented button::before { content: ""; position: absolute; inset: -2px 0; }
.segmented button[aria-pressed="true"] { color: var(--text-main); font-weight: 600; }
.segmented button:active { transform: scale(0.98); }
.segmented button:disabled { opacity: 0.45; cursor: default; }
.segmented button:focus-visible { outline-offset: -2px; }

/* Chips (hit area extended to 44 px) */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 6px var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border-subtle);
  background: var(--bg-card); color: var(--text-muted); font-size: 13px; font-weight: 500; white-space: nowrap; transition: var(--transition-smooth);
}
button.chip { min-height: 36px; }
button.chip::before { content: ""; position: absolute; inset: -4px -2px; }
button.chip:active { transform: scale(0.98); background: var(--fill-strong); }
@media (hover: hover) { button.chip:hover { border-color: var(--border-strong); color: var(--text-main); } }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-text); }
.chip.live { background: var(--success-soft); border-color: transparent; color: var(--success-text); }
.chip svg { flex-shrink: 0; }
.live-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--success); animation: ping 2s infinite ease-out; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 70%, 100% { transform: scale(2.8); opacity: 0; } }

/* Feedback banners: notices, errors, success. They fade and translate in, and out when dismissed. */
.feedback-banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; font-size: 13px; line-height: 1.5; font-weight: 500;
  background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warning-text); animation: fbIn 0.24s var(--ease-out) backwards; margin-bottom: 16px;
}
.feedback-banner svg { flex-shrink: 0; margin-top: 1px; }
.feedback-banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent-text); }
.feedback-banner.error { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 24%, transparent); color: var(--error-text); }
.feedback-banner.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 24%, transparent); color: var(--success-text); }
.feedback-banner.is-leaving { animation: fbOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes fbIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fbOut { to { opacity: 0; transform: translateY(-4px); } }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success-text); }
.badge.tight, .badge.warning { background: var(--warning-soft); color: var(--warning-text); }
.badge.error { background: var(--error-soft); color: var(--error-text); }
.badge.info { background: var(--accent-soft); color: var(--accent-text); }

/* ── Home ────────────────────────────────────────────────────────────────── */

.home-top { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.home-top .home-actions { margin-left: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { border-radius: 11px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-subtle); }
.wordmark { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; }
.wordmark span { color: var(--accent-text); }
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; padding: 28px 24px 24px; margin-bottom: 24px; min-height: 270px; display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); animation: rise 0.6s var(--ease-out) backwards;
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(70% 90% at 100% 0%, var(--accent-glow), transparent 70%); }
.hero-copy { margin-bottom: auto; }
.hero h1 { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; max-width: 9.5em; }
.hero h1 em { font-style: normal; color: var(--accent-text); }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 85%); mask-image: linear-gradient(90deg, transparent 30%, #000 85%); }
.hero-art .streets line { stroke: var(--border-strong); stroke-width: 5; stroke-linecap: round; }
.hero-art .river { fill: none; stroke: color-mix(in srgb, var(--teal) 18%, transparent); stroke-width: 14; stroke-linecap: round; }
.hero-art .direct { fill: none; stroke: var(--text-faint); stroke-width: 3; stroke-dasharray: 1 9; stroke-linecap: round; }
.hero-art .broken { stroke: var(--error); stroke-width: 4; stroke-linecap: round; }
.hero-art .detour-glow { fill: none; stroke: var(--accent-glow); stroke-width: 14; stroke-linecap: round; }
.hero-art .detour { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.hero-art .wipe { transform-box: fill-box; animation: wipe 1.5s 0.25s cubic-bezier(0.6, 0, 0.2, 1) backwards; }
@keyframes wipe { from { transform: translateX(-100%); } to { transform: none; } }
.hero-art .start { fill: var(--success); stroke: var(--bg-surface); stroke-width: 3.5; }
.hero-art .dest { fill: var(--text-main); }
.hero-art .dest-core { fill: var(--bg-surface); }
.hero-art .dest-ping { fill: none; stroke: var(--text-main); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 2.4s 1.6s ease-out infinite; opacity: 0; }
.hero-art .bus-dot circle { fill: var(--warning); stroke: var(--bg-surface); stroke-width: 2.5; }
.banner-chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 12px; font-weight: 600; color: var(--text-main);
  background: var(--fill-strong); border: 1px solid var(--border-subtle); transition: var(--transition-smooth);
}
button.banner-chip::before { content: ""; position: absolute; inset: -4px -2px; }
button.banner-chip:active { transform: scale(0.98); background: var(--accent-soft); }
@media (hover: hover) { button.banner-chip:hover { border-color: var(--border-strong); } }

/* Address suggestions */
.ac-list {
  position: absolute; z-index: 80; background: var(--bg-pop); border: 1px solid var(--border-strong); border-radius: 18px; overflow: hidden; padding: 6px 0;
  box-shadow: var(--shadow-pop); transform-origin: top center; animation: acIn 200ms var(--ease-out) both; max-height: 340px; overflow-y: auto;
}
.ac-list.above { transform-origin: bottom center; }
.ac-list.closing { animation: acOut 150ms ease both; }
@keyframes acIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes acOut { to { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.ac-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; cursor: pointer; animation: rise 260ms var(--ease-out) backwards; transition: var(--transition-smooth); }
.ac-item:hover, .ac-item.active { background: var(--fill-strong); }
.ac-item:active { transform: scale(0.98); }
.ac-icon { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--fill-strong); color: var(--text-muted); }
.ac-icon.transit { background: var(--accent-soft); color: var(--accent-text); }
.ac-icon.saved { background: var(--warning-soft); color: var(--warning-text); }
.ac-icon.location { background: var(--success-soft); color: var(--success-text); }
.ac-text { min-width: 0; display: flex; flex-direction: column; }
.ac-main { font-size: 15px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-main b { font-weight: 700; }
.ac-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ac-foot { font-size: 11px; color: var(--text-faint); text-align: right; padding: 8px 16px 4px; border-top: 1px solid var(--divider); margin-top: 4px; }
.ac-skel { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 52px; }
.ac-skel > div:last-child { flex: 1; }

.panic-btn {
  position: relative; width: 100%; border-radius: 20px; padding: 18px 20px; margin-bottom: 32px; display: flex; align-items: center; gap: 16px; text-align: left; color: var(--text-main);
  background: color-mix(in srgb, var(--error) 9%, var(--bg-surface)); border: 1px solid color-mix(in srgb, var(--error) 28%, transparent); transition: var(--transition-smooth);
}
.panic-btn:active { transform: scale(0.98); background: color-mix(in srgb, var(--error) 15%, var(--bg-surface)); }
@media (hover: hover) { .panic-btn:hover { border-color: color-mix(in srgb, var(--error) 45%, transparent); } }
.panic-icon { position: relative; width: 48px; height: 48px; border-radius: 14px; background: var(--error); color: var(--on-error); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.panic-icon::after { content: ""; position: absolute; inset: -6px; border-radius: 20px; border: 2px solid var(--error); opacity: 0; animation: ring 2.4s infinite ease-out; pointer-events: none; }
@keyframes ring { 0% { transform: scale(0.8); opacity: 0.7; } 80%, 100% { transform: scale(1.22); opacity: 0; } }
.panic-btn strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.panic-btn small { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

.tile-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-card); width: 100%; text-align: left; display: block; color: inherit; transition: var(--transition-smooth);
}
button.tile-card:active { transform: scale(0.98); background: var(--bg-card); }
@media (hover: hover) { button.tile-card:hover { border-color: var(--border-strong); } }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tile-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; }
.stat-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; align-items: end; }
.stat b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat:first-child b { font-size: 30px; }
.stat span { font-size: 12px; color: var(--text-muted); }
.alert-list-mini { display: flex; flex-direction: column; gap: 8px; }
.alert-list-mini p { font-size: 13px; line-height: 1.5; display: flex; align-items: flex-start; gap: 8px; }
.alert-list-mini .line-tag { flex-shrink: 0; }
.line-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--fill-strong); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sync-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 20px; margin-bottom: 32px; box-shadow: var(--shadow-card); }
.sync-body { display: flex; align-items: center; gap: 16px; }
.sync-body > div { flex: 1; min-width: 0; }
.sync-body .hint { display: block; }
.sync-body strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.sync-body .btn { width: auto; min-height: 44px; padding: 0 16px; flex-shrink: 0; }
.sync-card .feedback-banner { margin: 16px 0 0; }

/* ── Option cards ────────────────────────────────────────────────────────── */

.heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0 16px; }
.heading-row h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.heading-row p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.cards { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-card); animation: rise 420ms var(--ease-out) backwards; transition: var(--transition-smooth); }
.card:active { transform: scale(0.98); }
.card.best { border-color: color-mix(in srgb, var(--success) 38%, transparent); box-shadow: var(--shadow-card), 0 0 0 3px var(--success-soft); }
@media (hover: hover) { .card:hover { border-color: var(--border-strong); } .card.best:hover { border-color: color-mix(in srgb, var(--success) 55%, transparent); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card-body { display: block; width: 100%; text-align: left; background: none; border: none; padding: 20px 20px 0; color: inherit; transition: var(--transition-smooth); }
.card-body:active { background: var(--fill); }
.card-body:focus-visible { outline-offset: -3px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mode-tile { --tone: var(--seg-bus); width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent); }
.mode-tile.rideshare { --tone: var(--seg-rideshare); }
.mode-tile.rail { --tone: var(--seg-rail); }
.mode-tile.tram { --tone: var(--seg-tram); }
.mode-tile.ferry { --tone: var(--seg-ferry); }
.mode-tile.car { --tone: var(--text-muted); }
.mode-tile.mixed { --tone: var(--warning); }
.card-name { font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.arrival-box { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border-subtle); margin-bottom: 16px; }
.arrival-time { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.buffer { font-size: 13px; font-weight: 600; }
.buffer.good { color: var(--success-text); } .buffer.tight { color: var(--warning-text); } .buffer.late { color: var(--error-text); } .buffer.none { color: var(--text-muted); font-weight: 500; }
.stats { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; color: var(--text-muted); }
.stats b { color: var(--text-main); font-weight: 600; }
.stats .over b { color: var(--error-text); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; background: var(--fill-strong); color: var(--text-muted); font-size: 12px; font-weight: 500; }
.fact.good { background: var(--success-soft); color: var(--success-text); }
.fact.warn { background: var(--warning-soft); color: var(--warning-text); }
.fact.bad { background: var(--error-soft); color: var(--error-text); }
.tradeoff { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
.card-action {
  width: 100%; min-height: 52px; border: none; border-top: 1px solid var(--divider); background: none; color: var(--accent-text); font-size: 15px; font-weight: 600; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: var(--transition-smooth);
}
.card-action.quiet { font-weight: 500; color: var(--text-muted); }
.card-action:active { background: var(--fill-strong); }
.card-action:focus-visible { outline-offset: -3px; }
@media (hover: hover) { .card-action:hover { background: var(--fill); } }
.empty-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 28px 24px; margin-bottom: 16px; animation: fbIn 0.3s var(--ease-out) backwards; }
.empty-icon { --tone: var(--warning); width: 48px; height: 48px; border-radius: 14px; margin-bottom: 16px; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); display: flex; align-items: center; justify-content: center; }
.empty-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.empty-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; max-width: 30em; }
.why-rank { font-size: 12px; color: var(--text-muted); margin: 0 4px 16px; line-height: 1.5; }

/* ── Bottom sheet ────────────────────────────────────────────────────────── */

.sheet-backdrop { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop::before, .settings-backdrop::before { content: ""; position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 320ms ease; }
.sheet-backdrop.open::before, .settings-backdrop.open::before { opacity: 1; }
.sheet {
  position: relative; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-bottom: none; border-radius: 28px 28px 0 0; max-height: 92%; display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop); transform: translateY(105%); transition: transform 300ms cubic-bezier(0.4, 0, 1, 1);
}
.sheet-backdrop.open .sheet { transform: none; transition: transform 460ms var(--ease-out); }
.grabber { padding: 12px 0 4px; display: flex; justify-content: center; }
.grabber span { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 8px 24px 16px; }
.sheet-head h3 { flex: 1; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.sheet-scroll { overflow-y: auto; padding: 0 24px 16px; }
.sheet-scroll .group-card { background: var(--bg-card); box-shadow: none; }
.sheet-foot { padding: 16px 24px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--divider); }
.big-arrival { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 20px; margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.big-arrival .t { font-size: 38px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-arrival .d { font-size: 13px; color: var(--text-muted); text-align: right; line-height: 1.6; }
.check { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.check.ok { background: var(--success-soft); color: var(--success-text); } .check.no { background: var(--error-soft); color: var(--error-text); } .check.na { background: var(--fill-strong); color: var(--text-muted); }
.explain { border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; animation: fbIn 0.3s var(--ease-out) backwards; }
.explain.error { background: var(--error-soft); color: var(--error-text); }
.explain.warning { background: var(--warning-soft); color: var(--warning-text); }
.explain.success { background: var(--success-soft); color: var(--success-text); }
.explain h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.explain p { font-size: 14px; line-height: 1.55; }
.explain p + p { margin-top: 4px; }

/* ── Interactive map ─────────────────────────────────────────────────────── */

.map-wrap { position: relative; margin-bottom: 12px; border-radius: 18px; overflow: hidden; border: 1px solid var(--border-subtle); }
.map { height: 240px; background: var(--bg-card); }
.map-wrap.expanded { position: absolute; inset: 0; z-index: 70; margin: 0; border-radius: 0; border: none; animation: mapGrow 380ms var(--ease-out) both; }
.map-wrap.expanded .map { height: 100%; }
@keyframes mapGrow { from { opacity: 0.4; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.map-controls { position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--bg-pop); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); }
.map-controls button { width: 44px; height: 44px; border: none; background: none; color: var(--text-main); display: flex; align-items: center; justify-content: center; transition: var(--transition-smooth); }
.map-controls button + button { border-top: 1px solid var(--divider); }
.map-controls button:active { transform: scale(0.98); background: var(--fill-strong); }
.map-controls button:focus-visible { outline-offset: -3px; }
@media (hover: hover) { .map-controls button:hover { background: var(--fill); } }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--text-muted); margin: 0 4px 24px; }
.map-legend i { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.map-legend i.dot { width: 8px; height: 8px; border-radius: 50%; }
.map-legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; color: var(--seg-walk); }
.map-fail { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 13px; color: var(--text-muted); }
.leaflet-container { font-family: var(--font); background: var(--bg-card); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.88) saturate(0.6); }
.leaflet-control-attribution { font-size: 9px !important; background: rgba(238, 240, 245, 0.75) !important; color: #5B6478; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(9, 10, 15, 0.65) !important; color: #94A3B8; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #CBD5E1; }
.leaflet-popup-content-wrapper, .leaflet-tooltip { background: var(--bg-pop); color: var(--text-main); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); border-radius: 12px; }
.leaflet-popup-tip { background: var(--bg-pop); }
.leaflet-tooltip { padding: 6px 10px; }
.leaflet-control-attribution a { position: relative; }
.leaflet-control-attribution a::before { content: ""; position: absolute; inset: -17px -4px; }
.leaflet-tooltip::before { display: none; }
.pin-hit { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #F1F5F9; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); }
.pin.start { background: var(--success); } .pin.end { background: var(--error); } .pin.park { background: var(--accent); width: 12px; height: 12px; border-width: 2px; }

/* ── Next steps ──────────────────────────────────────────────────────────── */

.confirm { border-radius: 24px; padding: 24px; margin-bottom: 24px; background: color-mix(in srgb, var(--success) 8%, var(--bg-surface)); border: 1px solid color-mix(in srgb, var(--success) 22%, transparent); box-shadow: var(--shadow-card); animation: rise 420ms var(--ease-out) backwards; }
.confirm.warn { background: color-mix(in srgb, var(--warning) 8%, var(--bg-surface)); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.confirm .eyebrow { color: var(--success-text); }
.confirm.warn .eyebrow { color: var(--warning-text); }
.confirm h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 24px; line-height: 1.15; }
.confirm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
.confirm-grid span { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 2px; }
.confirm-grid b { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.timeline { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 24px 20px 20px; margin-bottom: 32px; box-shadow: var(--shadow-card); }
.step { display: flex; gap: 16px; }
.step-rail { display: flex; flex-direction: column; align-items: center; }
.step-num { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); font-size: 14px; font-weight: 600; }
.step-num.arrive { background: var(--success); color: var(--on-success); }
.step-line { width: 1px; flex: 1; background: var(--border-strong); margin: 6px 0; }
.step-body { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0 24px; min-width: 0; }
.step:last-child .step-body { padding-bottom: 0; }
.step-body .ic { flex-shrink: 0; margin-top: 2px; }
.step-body p { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.step-body small { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.watch-banner { display: flex; gap: 12px; align-items: flex-start; border-radius: 16px; padding: 16px; margin-bottom: 16px; background: var(--error-soft); border: 1px solid color-mix(in srgb, var(--error) 24%, transparent); color: var(--error-text); animation: fbIn 0.3s var(--ease-out) backwards; }
.watch-banner p { font-size: 14px; line-height: 1.5; }
.watch-banner .btn { min-height: 44px; font-size: 14px; margin-top: 12px; width: auto; display: inline-flex; }
.toast {
  pointer-events: none;
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 90; padding: 14px 16px; border-radius: 16px; background: var(--bg-pop); color: var(--text-main);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 500; display: flex; gap: 12px; align-items: center; animation: toastIn 360ms var(--ease-out) both;
}
.toast svg { color: var(--success); flex-shrink: 0; }
.toast.warning svg { color: var(--warning); }
.toast.leaving { animation: toastOut 240ms ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ── Panic mode ──────────────────────────────────────────────────────────── */

.page.panic { background: color-mix(in srgb, var(--error) 6%, var(--bg-base)); }
.panic-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 0 var(--gutter); }
.panic-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--error-text); display: flex; align-items: center; gap: 8px; }
.panic-exit { min-height: 44px; min-width: 44px; border: 1px solid var(--border-subtle); background: var(--bg-card); color: var(--text-main); border-radius: 14px; padding: 0 18px; font-size: 14px; font-weight: 600; transition: var(--transition-smooth); }
.panic-exit:active { transform: scale(0.98); background: var(--fill-strong); }
.panic h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; margin: 8px 0 16px; max-width: 9em; }
.panic .lead { font-size: 16px; color: var(--text-muted); line-height: 1.55; margin-bottom: 24px; }
.panic-field { position: relative; border-radius: 16px; margin-bottom: 12px; }
.panic-input { width: 100%; min-height: 56px; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg-card); color: var(--text-main); padding: 0 18px; font-size: 17px; transition: var(--transition-smooth); }
.panic-input:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.panic-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.panic-chip { min-height: 44px; border: 1px solid var(--border-subtle); border-radius: 22px; padding: 0 18px; background: var(--bg-card); color: var(--text-main); font-size: 14px; font-weight: 500; transition: var(--transition-smooth); }
.panic-chip:active { transform: scale(0.98); background: var(--fill-strong); }
.panic-by { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; font-size: 15px; color: var(--text-muted); }
.panic-by .panic-input { width: 150px; margin: 0; }
.actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.panic-go {
  width: 100%; min-height: 64px; border: 1px solid transparent; border-radius: 18px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--on-error); background: var(--error);
  display: flex; align-items: center; justify-content: center; text-decoration: none; transition: var(--transition-smooth);
}
.panic-go:active:not(:disabled) { transform: scale(0.98); opacity: 0.86; }
.panic-go.is-loading { background: var(--error-soft); color: var(--error-text); border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.panic-answer { background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); border-radius: 24px; padding: 24px; margin-bottom: 24px; animation: rise 460ms var(--ease-out) backwards; }
.panic-answer .when { font-size: 52px; font-weight: 600; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.panic-answer .when small { font-size: 14px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-left: 4px; }
.panic-answer .why { font-size: 14px; color: var(--success-text); margin-top: 12px; line-height: 1.55; }
.panic-answer .why.bad { color: var(--error-text); }
.panic-steps { list-style: none; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.panic-steps li { counter-increment: s; display: flex; gap: 16px; font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -0.02em; animation: rise 460ms var(--ease-out) backwards; }
.panic-steps li::before { content: counter(s); flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--text-main); color: var(--bg-base); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.panic-steps small { display: block; font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 2px; letter-spacing: 0; }

/* ── Impact dashboard ────────────────────────────────────────────────────── */

.kpis { margin-bottom: 32px; padding: 24px; border-radius: 24px; background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); }
.kpi span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); display: block; }
.kpi b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi small { font-size: 12px; color: var(--text-muted); }
.kpi.lead b { font-size: 48px; letter-spacing: -0.05em; line-height: 1.05; color: var(--success-text); }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--divider); }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); border-radius: 20px; padding: 20px 20px 12px; margin-bottom: 16px; position: relative; }
.chart-card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.chart-card p { font-size: 12px; color: var(--text-muted); margin: 2px 0 16px; }
.chart-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-card .bar { fill: var(--chart-past); transform-box: fill-box; transform-origin: 50% 100%; animation: grow 0.6s calc(var(--i, 0) * 50ms) var(--ease-out) backwards; transition: opacity 0.2s; }
.chart-card .bar.now { fill: var(--chart); }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
.chart-card .bar-hit { fill: transparent; cursor: default; }
.chart-card .bar-group:hover .bar, .chart-card .bar-group:focus .bar { opacity: 0.75; }
.chart-card .bar-group:focus-visible { outline: none; }
.chart-card .bar-group:focus-visible .bar-hit { stroke: var(--border-focus); stroke-width: 2; rx: 6; }
.chart-card .grid { stroke: var(--divider); stroke-width: 1; }
.chart-card .axis-label { fill: var(--text-muted); font-size: 10px; }
.chart-card .value-label { fill: var(--text-main); font-size: 10px; font-weight: 600; }
.chart-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: var(--bg-pop); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 12px; line-height: 1.4; color: var(--text-main); opacity: 0; transform: translate(-50%, -6px); transition: opacity 0.15s; white-space: nowrap; z-index: 5; }
.chart-tip.on { opacity: 1; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 16px; }
.data-table th, .data-table td { text-align: right; padding: 10px 4px; border-bottom: 1px solid var(--divider); font-variant-numeric: tabular-nums; }
.data-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.trip-row .row-label { font-size: 15px; }

/* ── Settings panel ──────────────────────────────────────────────────────── */

.settings-backdrop { position: absolute; inset: 0; z-index: 60; }
.settings-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%; background: var(--bg-base); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 320ms cubic-bezier(0.4, 0, 1, 1); box-shadow: -16px 0 40px rgba(0, 0, 0, 0.3);
}
.settings-backdrop.open .settings-panel { transform: none; transition: transform 460ms var(--ease-out); }
.settings-scroll { flex: 1; overflow-y: auto; padding: 24px var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px)); }
.settings-scroll .segmented { min-width: 190px; }
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 16px 66px; }

/* ── Ride board ──────────────────────────────────────────────────────────── */

.ride-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); border-radius: 20px; padding: 20px; margin-bottom: 16px; animation: rise 420ms var(--ease-out) backwards; }
.ride-card.mine { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: var(--shadow-card), 0 0 0 3px var(--accent-glow); }
.ride-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ride-head strong { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.ride-meta { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.ride-meta b { color: var(--text-main); font-weight: 600; }
.ride-meta svg { vertical-align: -2px; }
.seat-dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 4px; }
.seat-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.seat-dots i.taken { background: var(--fill-strong); }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-stack label { font-size: 12px; font-weight: 500; letter-spacing: 0.02em; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.form-stack input, .form-stack select { border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-card); min-height: 48px; padding: 0 14px; font-size: 16px; color: var(--text-main); transition: var(--transition-smooth); }
.form-stack input:focus-visible, .form-stack select:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── v3: weather, live status, vehicles, traffic ─────────────────────────── */

.home-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.on { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.flip { display: inline-flex; transform: scaleX(-1); }
.sim-tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; letter-spacing: 0; vertical-align: 1px; margin-left: 6px; }

.wx { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 22px; padding: 20px; margin-bottom: 32px; box-shadow: var(--shadow-card); animation: rise 0.6s 0.1s var(--ease-out) backwards; }
.wx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.wx-head .eyebrow { margin: 0; }
.wx-main { display: flex; align-items: center; gap: 16px; }
.wx-temp { font-size: 56px; font-weight: 600; letter-spacing: -0.06em; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-temp sup { font-size: 24px; letter-spacing: 0; vertical-align: 0.9em; margin-left: 2px; color: var(--text-muted); font-weight: 500; }
.wx-now { flex: 1; min-width: 0; }
.wx-now strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.wx-now span { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.wx-icon { --tone: var(--accent); width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.wx-warn { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning-text); animation: fbIn 0.3s var(--ease-out) backwards; }
.wx-warn svg { flex-shrink: 0; margin-top: 1px; }
.wx-warn b { display: block; font-size: 14px; font-weight: 600; }
.wx-warn > div > span { display: block; font-size: 13px; line-height: 1.5; margin-top: 2px; }
.wx-hours { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--divider); }
.wx-hour { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.wx-hour svg { color: var(--text-main); }
.wx-hour b { font-size: 15px; font-weight: 600; color: var(--text-main); letter-spacing: -0.02em; }
.wx-hour i { font-style: normal; color: var(--accent-text); font-size: 11px; font-weight: 600; min-height: 16px; }
.wx-foot { margin-top: 12px; }
.wx-skel { display: flex; flex-direction: column; gap: 14px; }
.wx-skel .skel-block { height: 56px; }

.rt { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.4; background: var(--fill-strong); color: var(--text-muted); white-space: nowrap; letter-spacing: 0; }
.rt::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.rt.on_time { background: var(--success-soft); color: var(--success-text); }
.rt.late { background: var(--warning-soft); color: var(--warning-text); }
.rt.late.major, .rt.cancelled { background: var(--error-soft); color: var(--error-text); }
.rt.early { background: var(--accent-soft); color: var(--accent-text); }
.rt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 13px; font-weight: 400; }
.rt-veh { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.live-age { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin: 0 4px 12px; min-height: 20px; }
.live-age.stale { color: var(--warning-text); }
.live-age.stale .live-dot, .live-age.stale .live-dot::after { background: var(--warning); }
.section-live { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-live .live-age { margin: 0 4px 12px 0; }

.veh-marker { z-index: 700; }
.leaflet-container:not(.leaflet-zoom-anim) .veh-glide, .leaflet-container:not(.leaflet-zoom-anim) .me-glide { transition: transform 1.2s linear; }
.veh-hit { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.veh { --tone: var(--seg-bus); position: relative; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tone); color: #fff; border: 2.5px solid #F1F5F9; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.veh svg { width: 15px; height: 15px; }
.veh-arrow { position: absolute; inset: -9px; transition: transform 1s linear; pointer-events: none; }
.veh-arrow::before { content: ""; position: absolute; top: 0; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom: 8px solid var(--tone); border-top: 0; }
.tev { --tone: var(--warning); width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--tone); color: #1C1303; border: 2.5px solid #F1F5F9; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.tev.closure { --tone: var(--error); color: #fff; }
.tev svg { width: 15px; height: 15px; }
.me-hit { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.me { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.me::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: var(--accent); opacity: 0; animation: ping 2.4s infinite ease-out; }
.me-arrow { position: absolute; inset: -14px; transition: transform 0.6s linear; display: none; pointer-events: none; }
.me-arrow.on { display: block; }
.me-arrow::before { content: ""; position: absolute; top: 0; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom: 10px solid var(--accent); border-top: 0; }

.row-label .tag { display: inline-block; padding: 1px 7px; margin-left: 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; letter-spacing: 0; vertical-align: 1px; }

/* ── v3: demo mode ──────────────────────────────────────────────────────── */

.demo-pill {
  position: absolute; z-index: 95; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; height: 32px; border-radius: 16px;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--accent-glow); animation: pillIn 0.3s var(--ease-out) backwards;
}
@keyframes pillIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translateX(-50%); } }
.demo-pill[hidden], .app[data-screen="nav"] .demo-pill { display: none; }
.demo-pill button { position: relative; height: 32px; border: none; background: none; color: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; display: flex; align-items: center; gap: 8px; transition: var(--transition-smooth); }
.demo-pill button::before { content: ""; position: absolute; inset: -6px -2px; }
.demo-pill button:active { transform: scale(0.98); opacity: 0.8; }
.demo-edit { padding: 0 6px 0 14px; border-radius: 16px 0 0 16px; }
.demo-exit { width: 32px; justify-content: center; border-radius: 0 16px 16px 0; border-left: 1px solid rgba(255, 255, 255, 0.28) !important; }
.demo-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.opt-group { margin-bottom: 24px; }
.opt-group > p { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-chips .chip { min-height: 40px; padding: 0 16px; }
.demo-master { margin-bottom: 24px; }
.demo-test { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.demo-test .feedback-banner { margin: 0; }

.cost-line { margin: 0 0 16px; border-radius: 16px; background: var(--bg-surface); border: 1px solid var(--border-subtle); overflow: hidden; }
.cost-toggle { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: none; border: none; text-align: left; font-size: 13px; color: var(--text-muted); transition: var(--transition-smooth); }
.cost-toggle span:first-of-type { flex: 1; }
.cost-toggle b { color: var(--text-main); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cost-toggle:active { background: var(--fill-strong); }
.cost-toggle .chev { transition: transform 0.25s var(--ease-out); }
.cost-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.cost-detail { padding: 0 16px 16px; animation: fbIn 0.24s var(--ease-out) backwards; }
.cost-detail .data-table { margin: 0 0 12px; }

.qr-card { position: relative; width: 100%; max-width: 280px; aspect-ratio: 1; border-radius: 24px; background: #fff; padding: 18px; margin-bottom: 20px; box-shadow: var(--shadow-card); overflow: hidden; }
.qr-card img { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 0.3s ease; }
.qr-card.ready img { opacity: 1; }
.qr-card:not(.ready)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(15, 18, 34, 0.08), transparent); transform: translateX(-100%); animation: shimmer 1.5s infinite linear; }
.share-url { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border-subtle); margin-bottom: 12px; }
.share-url code { flex: 1; min-width: 0; font-family: inherit; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-url .btn { width: auto; min-height: 44px; padding: 0 16px; flex-shrink: 0; }
.install-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; counter-reset: i; }
.install-steps li { counter-increment: i; display: flex; gap: 14px; align-items: center; font-size: 15px; line-height: 1.5; }
.install-steps li::before { content: counter(i); width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 14px; }
.install-steps svg { vertical-align: -4px; color: var(--accent-text); }
.bg-slot .feedback-banner { margin: 4px 16px 16px; }
.bg-slot .skel-stack { padding: 12px 16px 16px; }
.step-body .rt-line { margin-top: 6px; }

/* ── v3: live directions ────────────────────────────────────────────────── */

.page.nav { --peek: calc(124px + env(safe-area-inset-bottom, 0px)); }
.nav-map { position: absolute; z-index: 0; inset: 0 0 var(--peek) 0; background: var(--bg-card); }
.nav-top { position: absolute; z-index: 6; top: 12px; left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.nav-card { border-radius: 22px; background: color-mix(in srgb, var(--bg-surface) 94%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); }
.nav-stack { display: flex; flex-direction: column; gap: 8px; }
.nav-stack:empty { display: none; }
.nav-banner { display: flex; gap: 16px; align-items: center; padding: 16px; }
.nav-icon { --tone: var(--accent); width: 60px; height: 60px; border-radius: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--tone); color: #fff; }
.nav-icon.done { --tone: var(--success); color: var(--on-success); }
.nav-text { min-width: 0; flex: 1; }
.nav-dist { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.nav-instr { display: block; font-size: 16px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; margin-top: 2px; }
.nav-sub { display: block; font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.nav-sub .rt-line { margin-top: 6px; }
.nav-sim { align-self: flex-start; background: var(--bg-pop); color: var(--accent-text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-card); }
.nav-card .btn-row { padding: 0 16px 16px; }
.nav-card .btn-row .btn { min-height: 44px; font-size: 14px; }
.nav-notice { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.nav-notice .feedback-banner { margin: 0; }
.nav-notice .btn { min-height: 44px; font-size: 14px; }
.nav-skel { padding: 16px; display: flex; gap: 16px; align-items: center; }
.nav-skel > div:last-child { flex: 1; }
.nav-fabs { position: absolute; z-index: 6; right: 16px; bottom: calc(var(--peek) + 16px); display: flex; flex-direction: column; gap: 12px; }
.fab { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--bg-pop); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); color: var(--text-main); transition: var(--transition-smooth); }
.fab:active { transform: scale(0.98); background: var(--fill-strong); }
.fab.on { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.fab:focus-visible { box-shadow: 0 0 0 5px var(--accent-glow); }
.nav-sheet { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; height: min(74%, 580px); display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-bottom: none; border-radius: 28px 28px 0 0; box-shadow: var(--shadow-pop); transform: translateY(calc(100% - var(--peek))); transition: transform 420ms var(--ease-out); }
.nav-sheet.open { transform: none; }
.nav-grab { height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: none; background: none; width: 100%; }
.nav-grab span { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); }
.nav-eta { display: flex; align-items: center; gap: 16px; padding: 0 20px 16px; flex-shrink: 0; min-height: 64px; }
.nav-eta-main { flex: 1; min-width: 0; min-height: 44px; padding: 0; text-align: left; background: none; border: none; color: inherit; border-radius: 12px; }
.nav-eta-main:focus-visible { outline-offset: 4px; }
.nav-eta b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.nav-eta span { display: block; font-size: 13px; color: var(--text-muted); }
.nav-eta .live-age { margin: 2px 0 0; }
.nav-exit { width: auto; min-height: 48px; padding: 0 20px; flex-shrink: 0; color: var(--error-text); }
.nav-steps { flex: 1; overflow-y: auto; padding: 4px 16px calc(24px + env(safe-area-inset-bottom, 0px)); scrollbar-width: none; border-top: 1px solid var(--divider); }
.nav-steps::-webkit-scrollbar { display: none; }
.nav-step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 8px; position: relative; border-radius: 14px; }
.nav-step + .nav-step::before { content: ""; position: absolute; top: 0; left: 8px; right: 8px; height: 1px; background: var(--divider); }
.nav-step p { font-size: 15px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.nav-step small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.nav-step > div { flex: 1; min-width: 0; }
.nav-step.done { opacity: 0.5; }
.nav-step.current { background: var(--accent-soft); }
.nav-step.current::before, .nav-step.current + .nav-step::before { display: none; }

/* ── Refinements: Reroute ───────────────────────────────────────────────── */

/* Design-system interactive element (docs/design/design-system.md) and its accent-filled primary variant. */
.interactive-element {
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 0 20px; font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition-smooth);
}
.interactive-element:active { transform: scale(0.98); }
.interactive-element:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
@media (hover: hover) { .interactive-element:hover { background: var(--fill); border-color: var(--border-strong); } }
.interactive-element.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.interactive-element.primary:focus-visible { box-shadow: 0 0 0 3px var(--bg-base), 0 0 0 5px var(--border-focus); }
@media (hover: hover) { .interactive-element.primary:hover { background: var(--accent); filter: brightness(1.08); } }
.trip-btn { width: 100%; justify-content: flex-start; gap: 16px; min-height: 84px; padding: 18px 20px; border-radius: 20px; margin-bottom: 12px; text-align: left; box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 34%, transparent); }
.trip-icon { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.18); }
.trip-text { min-width: 0; }
.trip-text strong { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.trip-text small { display: block; font-size: 13px; font-weight: 400; margin-top: 2px; line-height: 1.4; opacity: 0.88; }
.trip-btn .chev { margin-left: auto; color: inherit; opacity: 0.9; }

.impact-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px 0 12px; border-radius: 14px; flex-shrink: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  color: var(--success-text); background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 26%, transparent); transition: var(--transition-smooth);
}
.impact-btn:active { transform: scale(0.98); background: color-mix(in srgb, var(--success) 20%, transparent); }
.impact-btn:focus-visible { box-shadow: 0 0 0 5px var(--accent-glow); }
@media (hover: hover) { .impact-btn:hover { border-color: color-mix(in srgb, var(--success) 50%, transparent); } }
@media (max-width: 389px) {
  .home-top { gap: 8px; }
  .brand { gap: 8px; }
  .brand svg { width: 32px; height: 32px; }
  .wordmark { font-size: 17px; }
  .impact-btn { padding: 0 10px 0 9px; gap: 4px; font-size: 13px; }
  .home-actions { gap: 4px; }
}

/* Clear (x) button on every text input. Hidden until the field has text; a 44 x 44 target around a 22 px dot. */
.clr-wrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.clr-wrap > input.clr-input { flex: 1; min-width: 0; width: 100%; padding-right: 36px; }
.clr {
  position: absolute; right: -8px; top: 50%; width: 44px; height: 44px; margin-top: -22px; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted);
  opacity: 0; visibility: hidden; transform: scale(0.8); transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.2s;
}
.clr-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--fill-strong); transition: var(--transition-smooth); }
.clr-wrap > input:not(:placeholder-shown) ~ .clr { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.clr-wrap > input:not(:placeholder-shown) ~ .clr:active { transform: scale(0.94); }
.clr:focus-visible { outline: none; }
.clr:focus-visible .clr-dot { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--border-focus); }
@media (hover: hover) { .clr:hover .clr-dot { background: var(--border-strong); color: var(--text-main); } }
.panic-field .clr, .form-stack .clr { right: 2px; }
.panic-field .clr-wrap > input { padding-right: 48px; }
.form-stack .clr-wrap > input { padding-right: 46px; }

/* CO₂ on option cards, above them and on next steps */
.co2-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; background: var(--fill); border: 1px solid var(--border-subtle); }
.co2-line.good { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.co2-line.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.co2-ic { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); background: var(--fill-strong); }
.co2-line.good .co2-ic { color: var(--success-text); background: color-mix(in srgb, var(--success) 18%, transparent); }
.co2-line.warn .co2-ic { color: var(--warning-text); background: color-mix(in srgb, var(--warning) 18%, transparent); }
.co2-text { flex: 1; min-width: 0; }
.co2-text b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.co2-line.good .co2-text b { color: var(--success-text); }
.co2-line.warn .co2-text b { color: var(--warning-text); }
.co2-text small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.badge.solid { background: var(--success); color: var(--on-success); }
.co2-summary { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0 0 16px; border-radius: 16px; background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 26%, transparent); color: var(--success-text); font-size: 14px; line-height: 1.5; animation: fbIn 0.3s var(--ease-out) backwards; }
.co2-summary svg { flex-shrink: 0; margin-top: 2px; }
.co2-summary b { font-weight: 600; }
.sheet-scroll .co2-line { margin-bottom: 16px; }

.impact-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 18px; margin-bottom: 16px; background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 26%, transparent); box-shadow: var(--shadow-card); animation: rise 420ms var(--ease-out) backwards; }
.impact-card > div { flex: 1; min-width: 0; }
.impact-ic { flex-shrink: 0; color: var(--success-text); margin-top: 1px; }
.impact-card b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; color: var(--success-text); line-height: 1.3; }
.impact-card small { display: block; font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.impact-card small strong { color: var(--text-main); font-weight: 600; }
.impact-card.neutral { background: var(--fill); border-color: var(--border-subtle); }
.impact-card.neutral b, .impact-card.neutral .impact-ic { color: var(--text-muted); }
.progress { height: 8px; border-radius: 4px; background: var(--fill-strong); margin-top: 12px; overflow: hidden; }
.progress span { display: block; width: 100%; height: 100%; border-radius: 4px; background: var(--success); transform-origin: left center; animation: barIn 0.7s var(--ease-out) backwards; }
@keyframes barIn { from { transform: scaleX(0); } }

/* Impact Dashboard: goal ring, equivalent distance, weekly streak, mode breakdown */
.goal-card { display: flex; gap: 20px; align-items: center; padding: 20px; border-radius: 24px; margin-bottom: 16px; background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); animation: rise 0.5s var(--ease-out) backwards; }
.ring-wrap { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.ring { display: block; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--fill-strong); stroke-width: 12; }
.ring-bar { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; }
.ring-bar.done { stroke: var(--success); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ring-center span { font-size: 12px; color: var(--text-muted); }
.goal-text { flex: 1; min-width: 0; }
.goal-text .eyebrow { margin-bottom: 6px; }
.goal-text h3 { font-size: 22px; letter-spacing: -0.03em; margin-bottom: 4px; }
.goal-card.reached .goal-text h3 { color: var(--success-text); }
.goal-text p:not(.eyebrow) { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.goal-text .btn-text { width: auto; min-height: 44px; margin: 4px 0 -8px -10px; padding: 0 10px; font-size: 14px; color: var(--accent-text); }
.equiv-card, .streak-card { padding: 20px; border-radius: 20px; margin-bottom: 16px; background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); animation: rise 0.5s 0.05s var(--ease-out) backwards; }
.equiv-card { display: flex; gap: 16px; align-items: flex-start; }
.equiv-ic, .streak-ic { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.equiv-ic { color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.equiv-big { font-size: 16px; line-height: 1.4; letter-spacing: -0.02em; margin-bottom: 8px; }
.equiv-big b { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.streak-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.streak-head .eyebrow { margin-bottom: 2px; }
.streak-head h3 { font-size: 22px; letter-spacing: -0.03em; }
.streak-ic { color: var(--text-faint); background: var(--fill-strong); }
.streak-ic.on { color: var(--warning-text); background: var(--warning-soft); }
.streak-weeks { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin: 16px 0 12px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.wk i { display: block; width: 100%; max-width: 34px; height: 28px; border-radius: 9px; background: var(--fill-strong); border: 1px solid var(--border-subtle); }
.wk.clean i { background: var(--success); border-color: transparent; }
.wk.drove i { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 45%, transparent); }
.wk.now i { outline: 2px solid var(--border-strong); outline-offset: 2px; }
.wk small { min-height: 12px; font-size: 10px; line-height: 1.2; color: var(--text-muted); white-space: nowrap; letter-spacing: 0; }
.row-label .share { display: block; height: 6px; border-radius: 3px; background: var(--fill-strong); margin-top: 8px; overflow: hidden; }
.row-label .share i { display: block; width: 100%; height: 100%; border-radius: 3px; background: var(--success); transform-origin: left center; animation: barIn 0.7s var(--ease-out) backwards; }
@media (max-width: 389px) { .ring-wrap { width: 108px; height: 108px; } .ring-center b { font-size: 24px; } .goal-card { gap: 16px; padding: 18px; } }

/* Saved place editor opens above the Settings panel */
.sheet-backdrop.above-settings { z-index: 65; }
.delete-btn { color: var(--error-text); }
.delete-btn.confirm { background: var(--error); color: var(--on-error); border-color: transparent; }
button.row:disabled { opacity: 0.45; cursor: default; }

/* Journey disrupted screen heading: weight and size contrast */
.panic h1 { max-width: none; font-size: 32px; }
.panic h1 span { display: block; margin-top: 8px; font-size: 21px; font-weight: 500; line-height: 1.25; letter-spacing: -0.02em; color: var(--text-muted); }

/* Reduced motion: no looping or large-area motion, one-shot entrances land instantly. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) *, :root:not([data-motion="full"]) *::before, :root:not([data-motion="full"]) *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  :root:not([data-motion="full"]) .skeleton::after, :root:not([data-motion="full"]) .is-loading::after, :root:not([data-motion="full"]) .live-dot::after, :root:not([data-motion="full"]) .panic-icon::after, .me::after { animation: none !important; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
:root[data-motion="reduced"] .skeleton::after, :root[data-motion="reduced"] .is-loading::after, :root[data-motion="reduced"] .live-dot::after, :root[data-motion="reduced"] .panic-icon::after, .me::after { animation: none !important; }
