/* Stopwatch AKL — "timetable paper" theme.
   Paper-grey page, navy ink, harbour-blue for anything tappable,
   bus-stop-flag yellow reserved for "your stop" / "next departure". */

:root {
  color-scheme: light;
  --paper: #e9eef2;
  --surface: #ffffff;
  --surface-2: #f3f6f8;
  --surface-3: #e2e8ed;
  --line: #cdd6dd;
  --line-soft: #e3e9ee;
  --ink: #13212c;
  --ink-2: #3e4f5c;
  --ink-3: #6b7c89;
  --accent: #0a5f86;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 95, 134, .09);
  --flag: #ffc629;
  --flag-ink: #13212c;
  --good: #17834a;   --good-ink: #136c3d;  --good-bg: #e2f2e8;
  --warning: #e59a00; --warn-ink: #8f5600; --warn-bg: #fcefd2;
  --critical: #d2402f; --bad-ink: #a92c1f; --bad-bg: #fbe4e1;
  --serious: #7a52c7; --early-ink: #5f3aa8; --early-bg: #eee7fa;
  --grid: #e3e9ee;
  --series-1: #0a5f86;
  /* aliases used by the script */
  --bg: var(--paper); --surface-1: var(--surface);
  --text-primary: var(--ink); --text-secondary: var(--ink-2); --text-muted: var(--ink-3);
  --critical-ink: var(--bad-ink);

  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cond: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --lift: 0 1px 2px rgba(19, 33, 44, .06), 0 12px 32px rgba(19, 33, 44, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0d1820;
    --surface: #14232e;
    --surface-2: #1a2b37;
    --surface-3: #223543;
    --line: #2b3f4d;
    --line-soft: #1f3240;
    --ink: #e6eef3;
    --ink-2: #b5c4cf;
    --ink-3: #8597a4;
    --accent: #5db7de;
    --accent-ink: #0d1820;
    --accent-soft: rgba(93, 183, 222, .13);
    --good: #3fb874;   --good-ink: #6fd39b;  --good-bg: rgba(63, 184, 116, .15);
    --warning: #f2b33d; --warn-ink: #f6c769; --warn-bg: rgba(242, 179, 61, .14);
    --critical: #e5574d; --bad-ink: #f4897f; --bad-bg: rgba(229, 87, 77, .16);
    --serious: #a07fe6; --early-ink: #bfa6f2; --early-bg: rgba(160, 127, 230, .16);
    --grid: #1f3240;
    --series-1: #5db7de;
    --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 36px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num, .time { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 22px;
  padding: 10px max(24px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px 8px 8px 2px; background: var(--flag); color: var(--flag-ink); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font: 700 22px/1 var(--cond); letter-spacing: .01em; }
.brand-sub { display: none; }
.nav { display: flex; gap: 2px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--r-md); color: var(--ink-2); font-weight: 600; font-size: 15px; }
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.topbar .search { flex: 1; max-width: 460px; margin-left: auto; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); position: relative; }
.status.ok .dot { background: var(--good); }
.status.ok .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; animation: ping 2.4s ease-out infinite; }
.status.stale .dot { background: var(--warning); }
.status.err .dot { background: var(--critical); }
@keyframes ping { 0% { transform: scale(.6); opacity: .7 } 100% { transform: scale(1.7); opacity: 0 } }
.pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--flag); color: var(--flag-ink); }

.demo-banner { max-width: 1160px; margin: 16px auto 0; width: calc(100% - 48px); padding: 10px 14px; border-radius: var(--r-md); font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); }
.demo-banner strong { color: var(--ink); }

main { max-width: 1160px; margin: 0 auto; padding: 8px 24px 96px; }

/* ---------- search ---------- */
.search { position: relative; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 0 12px; height: 42px; transition: border-color .15s; }
.search-box:focus-within { border-color: var(--accent); background: var(--surface); }
.search-box svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.search-box input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 15px; min-width: 0; }
.search-box input::placeholder { color: var(--ink-3); }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.search.big .search-box { height: 60px; border-radius: 14px; padding: 0 18px; background: var(--surface); border: 2px solid var(--ink); }
.search.big .search-box svg { width: 22px; height: 22px; color: var(--ink); }
.search.big .search-box input { font-size: 18px; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--lift); overflow: hidden; z-index: 1200; }
.result { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; }
.result + .result { border-top: 1px solid var(--line-soft); }
.result.active, .result:hover { background: var(--accent-soft); }
.result .name { flex: 1; font-weight: 600; }
.result .code { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.result-empty { padding: 14px; color: var(--ink-3); font-size: 14px; }

.mode { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--ink-2); }
.mode svg { width: 17px; height: 17px; }
.mode.train { background: var(--accent); color: var(--accent-ink); }
.mode.ferry { background: #127a6a; color: #fff; }

/* ---------- home ---------- */
.hero { padding: 48px 0 8px; max-width: 760px; }
.hero h1 { font: 700 clamp(38px, 6vw, 64px)/.98 var(--cond); letter-spacing: -.005em; margin: 0 0 14px; }
.hero p { color: var(--ink-2); margin: 0 0 26px; max-width: 54ch; font-size: 18px; }
.hero-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.hint { font-size: 14px; color: var(--ink-3); }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 44px 0 14px; flex-wrap: wrap; }
.section-title h2 { font: 700 28px/1.1 var(--cond); margin: 0; }
.section-title .muted { font-size: 14px; }

.saved-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.saved { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.saved-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 3px solid var(--flag); }
.saved-head .name { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-head .code { font-size: 13px; color: var(--ink-3); }
.saved-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.saved-row:last-child { border-bottom: 0; }
.saved-row .dest { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.saved-row .when { text-align: right; line-height: 1.1; }
.saved-row .when b { font: 600 22px/1 var(--cond); }
.saved-row .when small { display: block; font-size: 12px; font-weight: 600; }
.saved-empty { padding: 18px 14px; color: var(--ink-3); font-size: 14px; }
.saved-foot { margin-top: auto; padding: 10px 14px; font-size: 14px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.saved.tip { background: transparent; border-style: dashed; padding: 22px 24px; justify-content: center; color: var(--ink-2); grid-column: 1 / -1; }
.saved.tip strong { color: var(--ink); font-size: 17px; }
.saved.tip p { margin: 4px 0 0; max-width: 60ch; }
.saved.tip b { color: var(--ink); }
.saved-note { padding: 8px 14px; font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); }
.saved-tools { display: none; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.editing .saved-tools { display: flex; }
.editing .saved { outline: 2px dashed var(--line); outline-offset: 3px; }
.title-actions { display: inline-flex; align-items: center; gap: 14px; }

/* ---------- dashboard ---------- */
.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.two { grid-template-columns: 1.45fr 1fr; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 17px; font-weight: 700; }
.card .sub { font-size: 14px; color: var(--ink-3); margin: 0 0 16px; }
.tile { position: relative; padding-top: 18px; }
.tile .label { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.tile .value { font: 700 46px/1 var(--cond); margin-top: 8px; letter-spacing: -.01em; }
.tile .value small { font: 600 18px var(--sans); color: var(--ink-3); margin-left: 0; letter-spacing: 0; }
.tile .foot { font-size: 14px; color: var(--ink-3); margin-top: 8px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.footer-note { margin-top: 36px; font-size: 13.5px; color: var(--ink-3); max-width: 70ch; }

/* ---------- stop page ---------- */
.stop-head { display: flex; align-items: center; gap: 16px; padding: 30px 0 4px; flex-wrap: wrap; }
.stop-head .mode { width: 52px; height: 52px; border-radius: 12px 12px 12px 3px; }
.stop-head .mode svg { width: 28px; height: 28px; }
.stop-head .mode.bus { background: var(--flag); color: var(--flag-ink); }
.stop-head h1 { margin: 0; font: 700 clamp(30px, 4.4vw, 44px)/1.02 var(--cond); }
.stop-head .meta { color: var(--ink-2); font-size: 15px; margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.stop-head .grow { flex: 1; min-width: 220px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.on { background: var(--flag); border-color: var(--flag); color: var(--flag-ink); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: var(--bad-ink); }
.btn:disabled { opacity: .45; cursor: default; }
.linkish { background: none; border: 0; padding: 0; margin-left: 6px; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); font-size: 14.5px; }
.notice b { color: var(--warn-ink); }
.axis-note { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.map-fab button.busy { opacity: .55; }

.tabs { display: flex; gap: 6px; margin: 22px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 4px 12px; margin-right: 18px; cursor: pointer; border: 0; background: none; color: var(--ink-3); font-weight: 600; font-size: 16px; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

/* departure board */
.board { padding: 0; overflow: hidden; }
.board-head, .dep { display: grid; grid-template-columns: 74px minmax(0, 1fr) 84px 140px 116px; gap: 16px; align-items: center; padding: 0 22px; }
.board-head { font-size: 13px; color: var(--ink-3); font-weight: 600; padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dep { padding-top: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.dep:last-child { border-bottom: 0; }
.dep .dest { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep .extra { font-size: 13.5px; color: var(--ink-3); margin-top: 1px; display: flex; gap: 12px; flex-wrap: wrap; }
.dep .sched { color: var(--ink-2); font-size: 15px; }
.dep .due { text-align: right; }
.dep .due .big { font: 700 30px/1 var(--cond); }
.dep .due .big small { font: 600 15px var(--sans); color: var(--ink-2); margin-left: 3px; }
.dep .due .at { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.dep.cancelled .dest, .dep.cancelled .due .big { color: var(--ink-3); text-decoration: line-through; }
.dep.cancelled { background: var(--bad-bg); }
.departed .dep { color: var(--ink-2); }
.departed .dep .dest { font-weight: 600; }
.usual { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.usual .bar { width: 44px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; flex: none; }
.usual .bar span { display: block; height: 100%; border-radius: 3px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 34px; padding: 0 9px; border-radius: var(--r-sm); font: 700 20px/1 var(--cond); letter-spacing: .01em; background: var(--ink); color: var(--paper); white-space: nowrap; }
.badge.sm { min-width: 44px; height: 26px; font-size: 16px; border-radius: 5px; }

.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; padding: 4px 10px 4px 8px; border-radius: 999px; white-space: nowrap; }
.status-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.s-good { color: var(--good-ink); background: var(--good-bg); }
.s-warning { color: var(--warn-ink); background: var(--warn-bg); }
.s-critical { color: var(--bad-ink); background: var(--bad-bg); }
.s-serious { color: var(--early-ink); background: var(--early-bg); }
.s-neutral { color: var(--ink-2); background: var(--surface-3); }

.empty { padding: 36px 22px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.seg, .daypills { display: inline-flex; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button, .seg a, .daypills a { border: 0; background: none; padding: 7px 13px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 14.5px; font-weight: 600; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.seg button:hover, .seg a:hover, .daypills a:hover { color: var(--ink); background: var(--surface-2); }
.seg .on, .daypills a.on { background: var(--ink); color: var(--paper); }
.daypills a small { display: none; }
select { font: inherit; font-size: 14.5px; font-weight: 600; height: 42px; padding: 0 36px 0 13px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%236b7c89' stroke-width='1.8' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--ink); appearance: none; max-width: 100%; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 600; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table td.wrap { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--accent-soft); }
.inline-meter { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inline-meter .meter { width: 72px; margin: 0; height: 6px; }
.scroll-x { overflow-x: auto; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 12px; font-family: var(--sans); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--ink-3); stroke-width: 1; }
.chart .bar { fill: var(--series-1); pointer-events: none; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .bar { opacity: .75; }
.chart-empty { height: 200px; display: grid; place-items: center; color: var(--ink-3); font-size: 15px; border: 1.5px dashed var(--line); border-radius: var(--r-md); text-align: center; padding: 0 20px; }
.tooltip { position: fixed; z-index: 2000; pointer-events: none; background: var(--ink); color: var(--paper); border-radius: var(--r-md); padding: 10px 12px; font-size: 13.5px; box-shadow: var(--lift); min-width: 160px; }
.tooltip .tt-title { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 18px; opacity: .85; }
.tooltip .tt-row b { opacity: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- services flow ---------- */
.crumbs { font-size: 14.5px; color: var(--ink-3); margin: 0 0 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--accent); font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--line); }
.svc-list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.svc { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.svc:last-child { border-bottom: 0; }
.svc:hover { background: var(--accent-soft); }
.svc-main { flex: 1; min-width: 0; }
.svc-name { font-weight: 700; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-heads { font-size: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { font-size: 26px; color: var(--ink-3); line-height: 1; }
.svc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.svc-head h2 { margin: 0; font: 700 30px/1.05 var(--cond); }
.note { font-size: 14.5px; color: var(--ink-2); margin: 0 0 18px; max-width: 78ch; }
.hour-row { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.hour-lbl { font: 700 20px/1 var(--cond); color: var(--ink-3); padding-top: 12px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 8px; }
.ttile { position: relative; display: block; background: var(--surface); border: 1.5px solid var(--line-soft); border-radius: var(--r-md); padding: 10px 12px; }
.ttile:hover { border-color: var(--accent); }
.ttile.next { border-color: var(--flag); box-shadow: inset 0 0 0 1.5px var(--flag); }
.next-tag { position: absolute; top: 9px; right: 9px; font-size: 12px; font-weight: 700; color: var(--flag-ink); background: var(--flag); padding: 1px 7px; border-radius: 5px; }
.tt-time { font: 700 24px/1.05 var(--cond); }
.tt-dest { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-tag { display: inline-block; margin: 3px 0 1px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 5px; }
.tt-meta { font-size: 13px; color: var(--ink-2); margin-top: 5px; }
.tt-bar { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.tt-bar span { display: block; height: 100%; border-radius: 3px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; margin-top: 7px; }
.spark i { display: block; width: 7px; border-radius: 2px 2px 0 0; }

/* ---------- map page ---------- */
body.map-mode main { max-width: none; padding: 0; }
body.map-mode .demo-banner, body.map-mode .footer-note { display: none; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 430px; height: calc(100dvh - var(--topbar-h, 61px)); }
#map { height: 100%; width: 100%; background: var(--surface-3); }
.map-wrap { position: relative; min-width: 0; z-index: 0; isolation: isolate; }
.map-panel { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; }
.panel-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.panel-head h2 { margin: 0; font: 700 26px/1.05 var(--cond); }
.panel-head .meta { color: var(--ink-2); font-size: 14px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.panel-head .row { display: flex; gap: 12px; align-items: flex-start; }
.panel-head .row .mode { margin-top: 3px; }
.panel-head .row .mode.bus { background: var(--flag); color: var(--flag-ink); }
.panel-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.panel-actions .btn { height: 38px; font-size: 14px; padding: 0 13px; }
.panel-close { margin-left: auto; border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 20px; line-height: 1; flex: none; }
.panel-sec { padding: 14px 20px 6px; font-size: 14px; color: var(--ink-3); font-weight: 600; display: flex; justify-content: space-between; }
.panel-sec span:first-child { color: var(--ink); font-weight: 700; font-size: 15px; }
.prow { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.prow .badge { min-width: 50px; height: 30px; font-size: 17px; }
.prow .dest { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .times { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.prow .times b { color: var(--ink); font-weight: 600; }
.prow .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.prow .eta { font: 700 24px/1 var(--cond); }
.prow .eta small { font: 600 13px var(--sans); color: var(--ink-2); margin-left: 2px; }
.prow.cancelled .dest, .prow.cancelled .eta { text-decoration: line-through; color: var(--ink-3); }
.panel-empty { padding: 44px 30px; color: var(--ink-3); text-align: center; }
.panel-empty svg { width: 46px; height: 46px; color: var(--ink-3); margin-bottom: 8px; }
.panel-empty strong { display: block; color: var(--ink); font-size: 19px; margin-bottom: 6px; }
.legend { display: flex; flex-direction: column; gap: 9px; margin: 22px auto 0; text-align: left; width: max-content; font-size: 14px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 10px; }
.legend i { display: inline-block; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.leaflet-container { font: inherit; background: var(--surface-3); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--lift) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 88%, transparent) !important; color: var(--ink-3); font-size: 11px; }
.leaflet-control-attribution a { color: var(--ink-2); }
.leaflet-tooltip.stop-tip { background: var(--ink); color: var(--paper); border: 0; border-radius: 7px; box-shadow: var(--lift); font-size: 13px; font-weight: 600; padding: 5px 9px; }
.leaflet-tooltip.stop-tip::before { display: none; }
.map-fab { position: absolute; z-index: 500; right: 12px; bottom: 28px; display: flex; flex-direction: column; gap: 8px; }
.map-fab button { width: 44px; height: 44px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; box-shadow: var(--lift); }
.map-fab button svg { width: 20px; height: 20px; }
.map-hint { position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; box-shadow: var(--lift); pointer-events: none; transition: opacity .2s; white-space: nowrap; }

/* ---------- phone tab bar ---------- */
.tabbar { display: none; }

@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: calc(100dvh - var(--topbar-h, 61px) - 64px); }
  .map-panel { border-left: 0; border-top: 1px solid var(--line); max-height: 54dvh; }
  .map-panel.collapsed { max-height: 0; border-top: 0; }
  .map-fab { bottom: 16px; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 14px; }
  .topbar .nav { display: none; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  body.home .topbar .search { display: none; }
  .filters .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .filters .seg a { flex: 1 1 auto; text-align: center; max-width: none; white-space: normal; }
  .dep .extra .veh { display: none; }
  .status { margin-left: auto; font-size: 12.5px; }
  main { padding: 4px 14px 100px; }
  .demo-banner { width: calc(100% - 28px); }
  .hero { padding: 28px 0 0; }
  .hero p { font-size: 16px; }
  .card { padding: 16px; }
  .tile .value { font-size: 40px; }
  .board-head { display: none; }
  .dep { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "b d due" "b u due"; row-gap: 2px; padding: 13px 14px; gap: 12px; }
  .dep .badge { grid-area: b; align-self: start; min-width: 50px; height: 30px; font-size: 17px; }
  .dep .main { grid-area: d; }
  .dep .sched, .dep .chipcol { display: none; }
  .dep .due { grid-area: due; }
  .dep .due .big { font-size: 26px; }
  .hour-row { grid-template-columns: 1fr; gap: 6px; }
  .hour-lbl { padding-top: 0; }
  .tgrid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .saved-grid { grid-template-columns: 1fr; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1150;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .on { color: var(--accent); }
}
@media (min-width: 721px) { .dep .chip-inline { display: none; } }
.mode.bus { background: var(--flag); color: var(--flag-ink); }
.two { align-items: start; }
.table td.r { white-space: nowrap; }
.tab .short { display: none; }
@media (max-width: 720px) { .tab .long { display: none; } .tab .short { display: inline; } .tab { margin-right: 10px; } }
.tt-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.usual { flex-wrap: wrap; row-gap: 2px; }

/* keep the page from shifting sideways when a scrollbar appears */
html { scrollbar-gutter: stable; }
.dep .extra .veh { font-style: normal; }
.dep .extra span:has(> .veh) { display: contents; }

/* ---------- Services and Stops pages ---------- */
.page-head { padding: 30px 0 6px; }
.page-head h1 { margin: 0; font: 700 clamp(34px, 5vw, 52px)/1 var(--cond); }
.page-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 62ch; }
.filter-box { position: relative; margin: 20px 0 4px; max-width: 560px; }
.filter-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--ink-3); pointer-events: none; }
.filter-box input { width: 100%; height: 50px; padding: 0 16px 0 44px; font: inherit; font-size: 16.5px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); }
.filter-box input:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.msec .section-title { margin-top: 30px; }
.rgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.rcard, .scard { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.rcard:hover, .scard:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rcard .badge { flex: none; min-width: 52px; text-align: center; }
.rc-main, .sc-main { display: flex; flex-direction: column; min-width: 0; }
.rc-name, .sc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-sub, .sc-sub { font-size: 13px; color: var(--ink-3); }
.sgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.scard .mode { flex: none; }
.result.route .badge { min-width: 44px; text-align: center; }

/* ---------- route page: stop line + floating map ---------- */
.route-head { display: flex; align-items: center; gap: 16px; padding: 4px 0 6px; flex-wrap: wrap; }
.route-head .badge { font-size: 26px; padding: 10px 14px; border-radius: 12px; min-width: 76px; text-align: center; }
.route-head h1 { margin: 0; font: 700 clamp(28px, 4.2vw, 42px)/1.04 var(--cond); }
.route-head .meta { color: var(--ink-2); font-size: 15px; margin-top: 6px; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.route-head .grow { flex: 1; min-width: 240px; }
.route-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 46%); gap: 28px; align-items: start; margin-top: 18px; }
.route-map-card { position: sticky; top: calc(var(--topbar-h, 61px) + 18px); order: 2; height: min(600px, calc(100dvh - var(--topbar-h, 61px) - 40px));
  border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3);
  box-shadow: 0 2px 4px rgba(19, 33, 44, .08), 0 22px 48px -12px rgba(19, 33, 44, .28); isolation: isolate; }
#routeMap { position: absolute; inset: 0; }
.route-map .leaflet-tile-pane { filter: grayscale(1) contrast(.92) brightness(1.06); opacity: .62; }
.route-map.leaflet-container { background: #eef1f3; }
.rm-legend { position: absolute; z-index: 500; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); font-size: 13.5px; font-weight: 600; box-shadow: var(--lift); max-width: calc(100% - 24px); }
.rm-line { width: 26px; height: 6px; border-radius: 3px; background: var(--rc); box-shadow: 0 0 0 2px #fff; flex: none; }
.line-list { list-style: none; margin: 0; padding: 0; order: 1; }
.ls a { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center;
  padding: 11px 14px 11px 50px; border-radius: var(--r-md); min-height: 56px; }
.ls a::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 6px; background: var(--rc); }
.ls.first a::before { top: 50%; }
.ls.last a::before { bottom: 50%; }
.ls .pip { position: absolute; left: 15px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--surface); border: 4px solid var(--rc); z-index: 1; transition: transform .12s; }
.ls.first .pip, .ls.last .pip { width: 24px; height: 24px; margin-top: -12px; left: 12px; background: var(--rc); border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--rc); }
.ls-name { font-weight: 600; grid-column: 1; }
.ls-sub { grid-column: 1; font-size: 13px; color: var(--ink-3); display: flex; gap: 10px; }
.ls-sub b { color: var(--ink-2); font-weight: 600; }
.ls .chev { grid-column: 2; grid-row: 1 / span 2; color: var(--ink-3); font-size: 22px; }
.ls a:hover, .ls.hi a { background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }
.ls a:hover .pip, .ls.hi .pip { transform: scale(1.25); }

/* ---------- route at one stop ---------- */
.stop-link { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.stop-link:hover { border-color: var(--accent); }
.stop-link .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sl-name { font: 700 26px/1.1 var(--cond); }
.sl-sub { font-size: 14px; color: var(--ink-3); }
.stop-link .btn { flex: none; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 86px; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.tchip b { font: 600 20px/1.1 var(--cond); }
.tchip small { font-size: 12px; color: var(--ink-3); }
.tchip.next { border: 2px solid var(--flag); box-shadow: 0 0 0 3px color-mix(in srgb, var(--flag) 30%, transparent); }
.tchip .nx { color: var(--ink); font-weight: 700; }

@media (min-width: 721px) and (max-width: 1100px) { .topbar .status-text { display: none; } }
@media (max-width: 860px) {
  .route-layout { grid-template-columns: 1fr; gap: 16px; }
  .route-map-card { position: relative; top: 0; order: 0; height: 300px; border-radius: 18px; }
  .line-list { order: 1; }
}

/* ---------- live vehicles on maps ----------
   The background map is always light, so vehicle markers use fixed light-map colours.
   A vehicle is a "puck" (mode colour) with a nose pointing where it's heading; zoomed in,
   a white tag beside it carries the route number and a dot for how late it's running. */
.veh-icon { background: none; border: 0; }
.veh { position: absolute; left: 0; top: 0; }
.veh .puck { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--vc);
  border: 2.5px solid #fff; box-sizing: border-box; box-shadow: 0 1px 4px rgba(19, 33, 44, .45); }
.veh .nose { position: absolute; left: 50%; top: 50%; width: 31px; height: 31px; margin: -15.5px 0 0 -15.5px; pointer-events: none; }
/* the arrow: a white triangle with the coloured one on top (cheaper than a CSS filter on hundreds of markers) */
.veh .nose::before, .veh .nose::after { content: ""; position: absolute; left: 50%; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.veh .nose::before { top: -3.5px; margin-left: -7px; border-left-width: 7px; border-right-width: 7px; border-bottom: 10px solid #fff; }
.veh .nose::after { top: -1px; margin-left: -5px; border-bottom: 7px solid var(--vc); }
.veh .vlab { position: absolute; left: 12px; top: -12px; height: 24px; display: flex; align-items: center; gap: 5px; padding: 0 8px 0 13px;
  background: #fff; color: #13212c; font: 700 15px/1 var(--cond); letter-spacing: .01em; border-radius: 0 7px 7px 0; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(19, 33, 44, .35); border-left: 0; }
.veh .vst { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px #fff; }
.veh.m3 .puck { width: 16px; height: 16px; left: -8px; top: -8px; }
.veh.dim { opacity: .3; }
.veh.sel .puck { width: 26px; height: 26px; left: -13px; top: -13px; border-width: 3px; }
.veh.sel .nose { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
.veh.sel .nose::before { margin-left: -8px; border-left-width: 8px; border-right-width: 8px; border-bottom-width: 11px; top: -3.5px; }
.veh.sel .nose::after { margin-left: -6px; border-left-width: 6px; border-right-width: 6px; border-bottom-width: 8px; }
.veh.sel .vlab { left: 15px; height: 28px; top: -14px; font-size: 17px; }
.veh.sel .puck::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--vc); opacity: .5; animation: vping 1.8s ease-out infinite; }
@keyframes vping { from { transform: scale(.6); opacity: .7; } to { transform: scale(1.5); opacity: 0; } }
.leaflet-marker-icon.veh-icon:hover { z-index: 3000 !important; }

/* Filters: on PC a compact strip at the top of the right-hand panel; on phones a card over the map */
.map-layout { position: relative; grid-template-rows: auto minmax(0, 1fr); }
.map-layout > .map-wrap { grid-column: 1; grid-row: 1 / span 2; }
.map-layout > .map-panel { grid-column: 2; grid-row: 2; }
.live-card { grid-column: 2; grid-row: 1; background: var(--surface); color: var(--ink); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 14px 10px; }
.lc-head { display: none; align-items: center; gap: 9px; width: 100%; padding: 10px 12px; border: 0; background: none; color: inherit; cursor: pointer; font: 700 15.5px var(--sans); text-align: left; }
.lc-icon { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.lc-title { white-space: nowrap; }
.lc-sum { margin-left: auto; color: var(--ink-3); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.live-card.filtered .lc-sum { color: var(--ink); background: var(--flag); padding: 1px 8px; border-radius: 999px; }
.lc-chev { width: 18px; height: 18px; flex: none; color: var(--ink-3); transition: transform .15s; }
.live-card.open .lc-chev { transform: rotate(180deg); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); flex: none; box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: livep 2s infinite; display: inline-block; }
@keyframes livep { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.lc-togs { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-tog { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 8px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink-3); cursor: pointer; font: 600 14px var(--sans); white-space: nowrap; }
.lc-tog i { width: 10px; height: 10px; border-radius: 50%; background: transparent; box-shadow: 0 0 0 1.5px var(--line) inset; flex: none; }
.lc-tog b { font: 700 15px/1 var(--cond); color: var(--ink-3); }
.lc-tog[aria-pressed="true"] { border-color: var(--vc); color: var(--ink); }
.lc-tog[aria-pressed="true"] i { background: var(--vc); box-shadow: none; }
.lc-tog[aria-pressed="true"] b { color: var(--ink-2); }
.lc-tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-card.filtered .lc-tog[data-m] { opacity: .5; }
.lc-route { display: flex; gap: 6px; margin-top: 8px; }
.lc-route input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); font: 500 14.5px var(--sans); }
.lc-route input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-chips:not(:empty) { margin-top: 8px; }
.lc-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 999px; border: 0; background: var(--ink); color: var(--paper); font: 700 15px var(--cond); cursor: pointer; }
.lc-chip span { font: 600 16px/1 var(--sans); opacity: .7; }
.lc-chip.clear { background: none; color: var(--accent); font: 600 13.5px var(--sans); padding: 0 6px; }
.lc-err:not(:empty) { margin-top: 6px; color: var(--bad-ink); font-size: 13px; font-weight: 600; }
.lc-note { margin: 7px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.35; }
.lc-note:empty { display: none; }

/* a trip: status line, facts, stops with left/expected times */
.trk-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.here-line { font-weight: 600; font-size: 15px; }
.trk-facts { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13.5px; color: var(--ink-3); }
.trk-facts:empty { display: none; }
.occ { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; }
.occ-bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.occ-bars b { width: 4px; border-radius: 1px; background: var(--line); }
.occ-bars b:nth-child(1) { height: 5px; } .occ-bars b:nth-child(2) { height: 8px; } .occ-bars b:nth-child(3) { height: 12px; }
.occ-bars b.on { background: var(--ink-2); }
.occ.o3 .occ-bars b.on, .occ.o4 .occ-bars b.on, .occ.o5 .occ-bars b.on { background: var(--warning); }
.trk-list .ls a { grid-template-columns: minmax(0, 1fr) auto; min-height: 52px; padding-top: 8px; padding-bottom: 8px; }
.trk-list .ls-time { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.trk-list .ls-time b { font: 700 19px/1.1 var(--cond); }
.trk-list .ls-time small { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.trk-list .ls-time s { margin-right: 3px; }
.trk-list .ls-sub b { font-weight: 700; }
.trk-list .ls.passed a::before { background: #b5c0c8; }
.trk-list .ls.passed .pip { border-color: #b5c0c8; width: 14px; height: 14px; margin-top: -7px; left: 17px; border-width: 3px; }
.trk-list .ls.passed.first .pip, .trk-list .ls.passed.last .pip { background: #b5c0c8; box-shadow: 0 0 0 2px #b5c0c8; width: 20px; height: 20px; margin-top: -10px; left: 14px; }
.trk-list .ls.passed .ls-name, .trk-list .ls.passed .ls-time b { color: var(--ink-3); font-weight: 500; }
.trk-list .ls.next a::before { background: linear-gradient(#b5c0c8 0 50%, var(--rc) 50%); }
.trk-list .ls.here a { background: color-mix(in srgb, var(--flag) 18%, var(--surface)); box-shadow: 0 0 0 1.5px var(--flag) inset; }
.trk-list .ls.here .pip { background: var(--flag); border-color: #13212c; }
.tag-here { background: var(--flag); color: var(--flag-ink) !important; padding: 0 6px; border-radius: 4px; }
.tag-next { color: var(--accent) !important; }
.ls-veh { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 50px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-height: 34px; }
.ls-veh::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 6px; background: linear-gradient(#b5c0c8 0 50%, var(--rc) 50%); }
.ls-veh .vpip { position: absolute; left: 12px; top: 50%; margin-top: -12px; width: 24px; height: 24px; border-radius: 50%; background: var(--vc); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(19, 33, 44, .4), 0 0 0 0 var(--vc); z-index: 1; animation: vpip 2s infinite; }
@keyframes vpip { 0% { box-shadow: 0 1px 4px rgba(19, 33, 44, .4), 0 0 0 0 color-mix(in srgb, var(--vc) 50%, transparent); } 70%, 100% { box-shadow: 0 1px 4px rgba(19, 33, 44, .4), 0 0 0 9px transparent; } }
.trk-list.in-panel { padding: 0 6px; }

/* rows you can tap to follow a trip */
.tappable { cursor: pointer; }
.dep.tappable:hover, .prow.tappable:hover { background: var(--surface-2); }
.dep.tappable:focus-visible, .prow.tappable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.track-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--good-ink); font-weight: 600; }
.track-hint .live-dot { width: 8px; height: 8px; }

/* the floating trip tracker */
body.trk-open { overflow: hidden; }
.trk-wrap { position: fixed; inset: 0; z-index: 3000; }
.trk-backdrop { position: absolute; inset: 0; background: rgba(9, 18, 25, .5); animation: trkfade .18s ease-out; }
.trk { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1140px, calc(100vw - 48px)); height: min(800px, calc(100dvh - 48px));
  background: var(--paper); border-radius: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); display: flex; flex-direction: column; overflow: hidden; animation: trkin .22s ease-out; }
@keyframes trkfade { from { opacity: 0; } }
@keyframes trkin { from { opacity: 0; transform: translate(-50%, -47%); } }
.trk-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px 14px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.trk-title { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: flex-start; }
.trk-title .badge { font-size: 24px; height: 42px; min-width: 64px; border-radius: 10px; flex: none; }
.trk-title .grow { flex: 1; min-width: 0; }
.trk-head h2 { margin: 0; font: 700 clamp(24px, 3vw, 32px)/1.05 var(--cond); }
.trk-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, 1fr); }
.trk-map { position: relative; margin: 14px 0 14px 14px; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: #eef1f3; isolation: isolate;
  box-shadow: 0 2px 4px rgba(19, 33, 44, .08), 0 18px 40px -14px rgba(19, 33, 44, .3); }
#trkMap { position: absolute; inset: 0; }
.trk-tools { position: absolute; z-index: 500; right: 12px; bottom: 26px; display: flex; gap: 8px; }
.trk-btn { height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; box-shadow: var(--lift); }
.trk-btn:hover { border-color: var(--ink-3); }
.trk-side { overflow-y: auto; padding: 10px 10px 24px 8px; overscroll-behavior: contain; }

@media (max-width: 720px) {

  .trk { left: 0; right: 0; bottom: 0; top: auto; transform: none; width: auto; height: calc(100dvh - 28px); border-radius: 20px 20px 0 0; animation: trkup .24s ease-out; }
  @keyframes trkup { from { transform: translateY(30px); opacity: 0; } }
  .trk-head { padding: 14px 14px 12px 16px; }
  .trk-title .badge { font-size: 20px; height: 36px; min-width: 52px; }
  .trk-body { grid-template-columns: 1fr; grid-template-rows: 40dvh minmax(0, 1fr); }
  .trk-map { margin: 10px 10px 0; border-radius: 16px; }
  .trk-side { padding: 6px 4px 30px 0; }
}
.legend .lg-veh { position: relative; }
.legend .lg-veh .veh { position: relative; display: inline-block; width: 22px; height: 18px; flex: none; }
.legend .lg-veh .veh .puck { left: 3px; top: 1px; }
.vlab-demo { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; background: #fff; color: #13212c; font: 700 14px/1 var(--cond); border-radius: 6px; box-shadow: 0 1px 3px rgba(19, 33, 44, .3); flex: none; }
.vlab-demo .vst { width: 8px; height: 8px; border-radius: 50%; }

/* Graphics drawn on the CPU (no hardware acceleration): drop the shadows and looping animations,
   which are what make panning and zooming lag there. */
.lite-gfx .veh .puck, .lite-gfx .veh .vlab, .lite-gfx .ls-veh .vpip { box-shadow: none; }
.lite-gfx .veh .vlab { outline: 1px solid rgba(19, 33, 44, .28); }
.lite-gfx .veh .puck { border-color: #fff; outline: 1px solid rgba(19, 33, 44, .35); }
.lite-gfx .veh.sel .puck::after, .lite-gfx .live-dot, .lite-gfx .ls-veh .vpip { animation: none; }
.lite-gfx .live-card, .lite-gfx .trk { box-shadow: 0 0 0 1px var(--line); }
.lite-gfx .trk-backdrop { animation: none; }

/* phones and narrow windows: the filters float over the map as a fold-away card */
@media (max-width: 860px) {
  .map-layout { grid-template-rows: 1fr auto; }
  .map-layout > .map-wrap { grid-row: 1; }
  .map-layout > .map-panel { grid-column: 1; grid-row: 2; }
  .map-wrap .leaflet-control-zoom { display: none; }
  .live-card { position: absolute; z-index: 600; grid-column: 1; grid-row: 1; top: 10px; left: 10px; width: min(300px, calc(100% - 20px)); padding: 0;
    border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); overflow: hidden; }
  .lc-head { display: flex; }
  .lc-body { display: none; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
  .live-card.open .lc-body { display: block; }
}
