/* theme.css — SKIN (operator) + semantic tokens + cockpit components.
   Dark/light is driven by [data-mode] (set from the destination's time of day),
   so it changes brightness while keeping the operator brand. Presentation scale
   (radius/shadow/font/hero/gallery) is defaulted here, overridden per tier in tiers.css. */

:root {
  /* Skin — set at runtime from the operator */
  --brand: #1a1a1a;
  --brand-2: #6b6b6b;
  --brand-ink: #ffffff;
  --brand-tint: color-mix(in srgb, var(--brand) 8%, var(--surface));

  /* Semantic (light defaults) */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #14161b;
  --text-dim: #626879;
  --line: #e5e8ec;
  --ok: #1f9d55;
  --warn: #c9770a;
  --danger: #d1382c;

  /* Presentation defaults (standard tier baseline) */
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20,22,30,.06), 0 8px 24px rgba(20,22,30,.05);
  --font-display: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-body: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --hero: 200px; --gallery: swipe; --motion: 200ms; --maxw: 720px;
}
:root[data-mode="dark"] {
  --bg: #0c0d10; --surface: #16181d; --surface-2: #1e2128;
  --text: #edeef2; --text-dim: #9aa1ad; --line: #292c34;
  --brand-tint: color-mix(in srgb, var(--brand) 20%, var(--surface));
}
@media (prefers-reduced-motion: reduce) { :root { --motion: 0ms; } * { animation: none !important; scroll-behavior: auto !important; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; line-height: 1.5; overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .4em; }
a { color: var(--brand); }
.dim { color: var(--text-dim); }
.ok { color: var(--ok); } .danger { color: var(--danger); } .center { text-align: center; }
.hidden { display: none !important; }
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }

/* ── Boot splash ── */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .35s; }
#boot.gone { opacity: 0; pointer-events: none; }
.boot-dot { width: 46px; height: 46px; border-radius: 14px; background: var(--brand, #4338ca); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }

/* ── Cockpit header (brand-as-accent, on surface) ── */
.chead { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.3) blur(12px); border-bottom: 1px solid var(--line); }
.chead::before { content: ""; display: block; height: 3px; background: var(--brand); }
.chead-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px 2px; }
.chead-op { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .82rem; letter-spacing: .01em; }
.chead-logo { height: 20px; border-radius: 5px; }
.chead-mark { width: 16px; height: 16px; border-radius: 5px; display: inline-block; }
.chead-clocks { display: flex; gap: 10px; }
.clk { font-size: .72rem; color: var(--text-dim); }
.clk b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.chead-nav { display: flex; align-items: center; gap: 8px; padding: 2px 12px 10px; }
.chev { flex: none; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.chev:disabled { opacity: .32; }
.chead-day { flex: 1; display: flex; flex-direction: column; align-items: center; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.cd-date { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.cd-sub { font-size: .76rem; color: var(--text-dim); }

/* ── Notice / update banner ── */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 16px; padding: 10px 14px; background: var(--brand-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .9rem; }
.notice button { border: 0; background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.offline-banner { display: none; text-align: center; padding: 8px; font-size: .85rem; background: var(--warn); color: #fff; }
body.is-offline .offline-banner { display: block; }

/* ── Now banner (the brand hero) ── */
.nowbanner { margin: 12px 16px 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow); }
.nb-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; opacity: .8; font-weight: 700; }
.nb-text { font-size: 1.02rem; font-weight: 600; margin-top: 2px; }
.nb-bar { margin-top: 10px; height: 5px; border-radius: 999px; background: #ffffff33; overflow: hidden; }
.nb-bar span { display: block; height: 100%; background: var(--brand-ink); border-radius: 999px; }

/* ── Timeline ── */
.timeline { padding: 8px 16px 6px; }
.empty { color: var(--text-dim); padding: 20px 0; text-align: center; }
.trow { display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
.rail { display: flex; flex-direction: column; align-items: center; padding-top: 14px; color: var(--text-dim); font-size: .74rem; }
.rail b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.rail i { font-style: normal; margin-top: 2px; }
.rail-line { flex: 1; width: 2px; background: var(--line); margin: 6px 0; border-radius: 2px; min-height: 20px; }
.trow.is-now .rail-line { background: var(--brand); }
.stop { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; margin: 8px 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: transform var(--motion); }
.stop:active { transform: scale(.99); }
.trow.is-now .stop { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent), var(--shadow); }
.trow.is-past .stop { opacity: .62; }
.stop .thumb { width: 66px; height: 66px; flex: none; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 26px; }
.stop .body { min-width: 0; flex: 1; }
.stop .cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); font-weight: 700; }
.stop .name { font-weight: 700; margin-top: 1px; }
.stop .note { font-size: .85rem; color: var(--text-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip { font-size: .74rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font-weight: 600; }
.chip.rate { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.chip.food { color: var(--brand); background: var(--brand-tint); }
.chip.hi { color: var(--brand-ink); background: var(--brand); }

/* Legs + NOW divider + past collapse */
.legrow { display: flex; align-items: center; gap: 8px; margin-left: 52px; padding: 6px 12px; color: var(--text-dim); font-size: .84rem; }
.legrow .leg-ic { opacity: .8; }
.nowdiv { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; }
.nowdiv::before, .nowdiv::after { content: ""; flex: 1; height: 1px; background: var(--brand); opacity: .5; }
.nowdiv span { font-size: .72rem; font-weight: 800; letter-spacing: .08em; color: var(--brand); }
.pastwrap { margin: 4px 0; }
.pastwrap summary { list-style: none; cursor: pointer; color: var(--text-dim); font-size: .85rem; font-weight: 600; padding: 8px 0 8px 52px; }
.pastwrap summary::-webkit-details-marker { display: none; }
.pastwrap summary::before { content: "▾ "; }

/* ── Section headers + wallet ── */
.sec-h { padding: 12px 16px 0; font-size: 1.05rem; }
.wallet { padding: 4px 16px; }
.doc, .addon { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0; box-shadow: var(--shadow); }
.addon-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.addon-l .thumb, .doc .thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.req-badge { color: var(--ok); font-weight: 700; font-size: .85rem; }

/* ── Emergency (collapsible, understated) ── */
.em-card { margin: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.em-card summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 13px 14px; font-weight: 600; }
.em-card summary::-webkit-details-marker { display: none; }
.em-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }
.em-title { flex: 1; }
.em-chev { color: var(--text-dim); transition: transform var(--motion); }
.em-card[open] .em-chev { transform: rotate(90deg); }
.em-body { padding: 0 14px 8px; }
.em-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.em-name { flex: 1; font-weight: 600; }
.em-num { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: .9rem; }
.em-call { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); flex: none; }
.em-ins { padding: 10px 0 2px; font-size: .82rem; color: var(--text-dim); border-top: 1px solid var(--line); }

/* ── Optional extra (obviously not part of the fixed plan) ── */
.extra { margin: 8px 0 8px 52px; padding: 11px 13px; background: var(--brand-tint); border: 1.5px dashed color-mix(in srgb, var(--brand) 50%, var(--line)); border-radius: var(--radius); cursor: pointer; }
.extra:active { transform: scale(.99); }
.extra-tag { display: inline-block; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin-bottom: 6px; }
.extra-row { display: flex; align-items: center; gap: 10px; }
.extra-body { flex: 1; min-width: 0; }
.extra-name { font-weight: 700; }
.extra-desc { font-size: .82rem; color: var(--text-dim); }
.extra-price { flex: none; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ── Address line + booking chip on cards ── */
.addr-line { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--text-dim); margin-top: 2px; }
.addr-line .ic-pin { flex: none; }
.chip.book { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, var(--surface)); }

/* drawer address + booking */
.dw-addr { display: flex; align-items: center; gap: 5px; color: var(--text-dim); font-size: .88rem; margin: 4px 0 8px; }
.dw-book { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.dw-book-t { font-size: .85rem; color: var(--text-dim); }

/* ── Location: soft pre-prompt + locate button + me dot ── */
.geo-prompt { position: absolute; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 1000; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 13px 14px; }
.geo-copy { font-size: .9rem; font-weight: 600; }
.geo-copy .dim { display: block; font-weight: 400; font-size: .78rem; margin-top: 2px; }
.geo-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.geo-acts .btn { min-height: 38px; padding: 0 16px; }
.geo-locate { position: absolute; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 1000; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; cursor: pointer; box-shadow: var(--shadow); }
.me-dot span { display: block; width: 16px; height: 16px; border-radius: 50%; background: #2b7fff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(43,127,255,.3); }

/* ── Trip overview ── */
.trip-hero { padding: 18px 16px 6px; }
.trip-hero h2 { font-size: 1.5rem; }
.trip-sub { color: var(--text-dim); }
.metrics { display: flex; gap: 10px; padding: 8px 16px; }
.metric { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--shadow); }
.metric b { display: block; font-size: 1.4rem; font-family: var(--font-display); }
.metric span { font-size: .76rem; color: var(--text-dim); }
.triplist { padding: 6px 16px; }
.triprow { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0; box-shadow: var(--shadow); cursor: pointer; color: var(--text); }
.tr-date { flex: none; width: 44px; text-align: center; }
.tr-date span { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; }
.tr-date b { display: block; font-size: 1.3rem; font-family: var(--font-display); }
.tr-body { flex: 1; min-width: 0; }
.tr-h { font-weight: 700; }
.tr-today { margin-left: 8px; font-size: .68rem; background: var(--brand); color: var(--brand-ink); padding: 2px 8px; border-radius: 999px; vertical-align: 1px; }
.tr-m { font-size: .84rem; color: var(--text-dim); }
.tr-chev { color: var(--text-dim); font-size: 20px; }

/* ── Tab bar + map FAB ── */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; max-width: var(--maxw); margin: 0 auto; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0; border: 0; background: transparent; color: var(--text-dim); font-size: .7rem; font-weight: 600; cursor: pointer; }
.tab[aria-current="true"] { color: var(--brand); }
.map-fab { position: fixed; right: 18px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 31; width: 52px; height: 52px; border-radius: 16px; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: pointer; }
@media (min-width: 760px) { .map-fab { right: calc(50% - var(--maxw)/2 + 18px); } }

/* ── Bottom sheets (drawer + map) ── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity var(--motion); z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer, .mapsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: var(--maxw); margin: 0 auto; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; transform: translateY(100%); transition: transform var(--motion); box-shadow: 0 -8px 40px rgba(0,0,0,.25); }
.drawer { max-height: 90vh; overflow-y: auto; }
.drawer.open, .mapsheet.open { transform: translateY(0); }
.grab { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 10px auto; }
.pad { padding: 0 18px calc(20px + env(safe-area-inset-bottom)); }
.pad h2 { font-size: 1.35rem; }
.lede { color: var(--text-dim); }
.ratesum { color: var(--warn); font-weight: 700; margin-bottom: 8px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 8px 0; }
.gallery img { height: var(--hero); border-radius: var(--radius-sm); scroll-snap-align: start; object-fit: cover; }
.credit { font-size: .72rem; color: var(--text-dim); }
#dmap { height: 180px; border-radius: var(--radius-sm); margin: 14px 0 4px; background: var(--surface-2); }
.field { display: block; margin: 8px 0; }
.field label { font-size: .82rem; color: var(--text-dim); }
.field input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 1rem; }
.qr { display: block; max-width: 200px; margin: 12px auto; border-radius: var(--radius-sm); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
#req-msg, #priv-msg { margin-top: 8px; }

.mapsheet { height: 74vh; display: flex; flex-direction: column; }
.mapsheet-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 18px 10px; font-weight: 700; }
.mapsheet-x { border: 0; background: var(--surface-2); color: var(--text); width: 32px; height: 32px; border-radius: 999px; cursor: pointer; }
#map-el { flex: 1; border-radius: 0 0 0 0; }
.pin span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 800; border: 2px solid var(--surface); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.pin-now span { background: var(--warn); animation: pinpulse 1.2s infinite; }
@keyframes pinpulse { 0%,100% { box-shadow: 0 2px 6px rgba(0,0,0,.4); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--warn) 40%, transparent); } }

/* ── Place guide (tier-gated content) ── */
.guideblock { margin-top: 4px; }
.gd-sec { margin-top: 16px; }
.gd-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 800; margin-bottom: 6px; }
.gd-p { color: var(--text); line-height: 1.55; margin: 0; }
.mustdo { list-style: none; margin: 0; padding: 0; }
.mustdo li { position: relative; padding: 6px 0 6px 20px; border-bottom: 1px solid var(--line); line-height: 1.45; }
.mustdo li:last-child { border-bottom: 0; }
.mustdo li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.mustdo.know li { color: var(--text-dim); }
.mustdo.know li::before { background: var(--warn); border-radius: 1px; }
.dish { display: flex; align-items: baseline; gap: 12px; padding: 8px 1px; border-bottom: 1px solid var(--line); }
.dish:last-child { border-bottom: 0; }
.dn { flex: 1; font-weight: 600; }
.dp { flex: none; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ── Day picker ── */
.daypick { display: flex; flex-direction: column; gap: 8px; }
.pk-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.pk-row.sel { border-color: var(--brand); }
.pk-row.today { background: var(--brand-tint); }
.pk-d { flex: none; width: 44px; text-align: center; }
.pk-d span { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; }
.pk-d b { display: block; font-size: 1.3rem; font-family: var(--font-display); }
.pk-h { font-weight: 700; }

.loading { padding: 70px 24px; text-align: center; color: var(--text-dim); }
.foot { padding: 20px 16px 30px; color: var(--text-dim); font-size: .78rem; text-align: center; }
.foot a { color: var(--text-dim); }
