/* Anything marked hidden stays hidden, whatever display a class gives it. */
[hidden] { display: none !important; }

@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #f2f4f7; --card: #ffffff; --field: #f2f4f7; --ink: #0e1116; --muted: #4f5763; --faint: #626b79; --line: #e3e6eb;
  /* edges that must read as edges (3:1 on card and field): input borders, the route still to run */
  --edge: #7f8794;
  --accent: #2346d8; --accent-strong: #2346d8; --accent-ink: #1a35a8; --accent-soft: #e6ebfb; --on-accent: #ffffff;
  /* inks at 5.4:1 or better on their own -bg tints, so alert text passes AA */
  --good: #13703a; --warn: #8a5300; --bad: #a8380a; --danger: #b91c1c; --info: #1a35a8; --soft: #f2f4f7;
  --good-bg: #e3f4e8; --warn-bg: #fef3c7; --bad-bg: #fdebdd; --info-bg: #e6ebfb;
  --hero: #0e1116; --hero-ink: #ffffff; --hero-muted: #b4bac4; --hero-line: #262b33;
  /* chips and marks on the hero, which is dark in both schemes */
  --chip-ink: #0e1116; --chip-good: #86efac; --chip-warn: #fcd34d; --chip-bad: #fb923c; --live-on: #4ade80;
  /* the unit drawing's plate inside the unit hero */
  --plate: #ffffff; --plate-ink: #4f5763;
  --first-bg: #fbf3d5; --first-ink: #7a5b00;
  --knob: #ffffff; --scrim: rgba(14, 17, 22, .7); --on-scrim: #ffffff;
  /* map markers sit on light map tiles in both schemes */
  --map-you: #2346d8; --map-train: #0e1116; --map-ring: #ffffff;
  --you: #2346d8;
  --shadow: 0 1px 2px rgba(14, 17, 22, .06);
  --r: 20px; --r-sm: 14px;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d11; --card: #161a21; --field: #0f1217; --ink: #eceef2; --muted: #a3aab5; --faint: #7d8590; --line: #262b33;
    --edge: #6b7482;
    --accent: #8ea2f5; --accent-strong: #3b5bdb; --accent-ink: #a9b8f8; --accent-soft: #1c2547; --on-accent: #ffffff;
    --good: #4ade80; --warn: #fbbf24; --bad: #fb923c; --danger: #f87171; --info: #a9b8f8; --soft: #262b33;
    --good-bg: #0f2a1a; --warn-bg: #3a2c0e; --bad-bg: #3b1e0e; --info-bg: #1c2547;
    --hero: #1e2430; --hero-ink: #ffffff; --hero-muted: #b4bac4; --hero-line: #2f3644;
    --plate: #2a3140; --plate-ink: #b4bac4;
    --first-bg: #3a2c0e; --first-ink: #fcd34d;
    --you: #8ea2f5;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--display); letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
main { padding: 0 16px 40px; max-width: 560px; margin: 0 auto; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; text-align: center; margin: 14px 8px 0; }
.small-text { font-size: 13px; margin-top: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row h2 { margin: 0; }
.card > .row:first-child { margin-bottom: 12px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; max-width: 560px; margin: 0 auto; padding: 14px 20px 6px; padding-top: max(14px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-strong); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); }

.intro { padding: 18px 4px 18px; }
.intro h1 { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; }
.intro p { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 16px; background: var(--line); }
.tabs button { min-height: 44px; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.trips { margin: 0 0 12px; }
.trips .chip { background: var(--card); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .trips .chip { box-shadow: inset 0 0 0 1px var(--line); } }
.trips .chip.saved { background: var(--accent-soft); color: var(--accent-ink); }
#saveTrip { align-self: center; }
.deps-info { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 10px; }
.deps-info[hidden] { display: none; }
.deps-info .dot.on { background: var(--good); box-shadow: none; animation: none; }
.deps-also { margin: 0 0 12px; }
.deps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dep { width: 100%; text-align: left; color: var(--ink); background: var(--card); border-radius: var(--r); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .dep { border: 1px solid var(--line); } }
.dep .t { grid-row: span 2; font-family: var(--display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dep .to { font-weight: 600; font-size: 15px; }
.dep .sub { font-size: 13px; color: var(--muted); }
.dep .late { white-space: nowrap; }
.dep .t s { display: block; font-family: "Inter", sans-serif; font-size: 12px; font-weight: 400; color: var(--muted); text-align: center; }
.dep .plat { grid-row: span 2; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.dep .plat b { display: block; font-family: var(--display); font-size: 22px; color: var(--ink); }
.repay h2 { margin-bottom: 6px; }
.repay p { margin: 0 0 12px; font-size: 15px; }
.repay .row { justify-content: flex-start; flex-wrap: wrap; }
.repay a.secondary { display: inline-flex; align-items: center; text-decoration: none; padding: 0 16px; border-radius: var(--r-sm); min-height: 44px; }
.claims summary { padding: 0; min-height: 44px; }
.claims-list { list-style: none; margin: 8px 0 0; padding: 0; }
.claims-list li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.claims-list li span { color: var(--muted); }
.share { margin: 0 0 10px; }
.open-app { display: flex; align-items: center; justify-content: center; text-decoration: none; border-radius: var(--r-sm); margin-top: 10px; }
.open-app[hidden] { display: none; }
body.meet #notMine, body.meet [data-back], body.meet #shareBtn, body.meet #trainCard { display: none; }
body.meet .actions { display: none; }

.admin { margin-top: 8px; box-shadow: inset 0 0 0 2px var(--accent); }
.admin h2 { margin-bottom: 4px; }

/* evidence pack */
.ev-record { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 15px; }
.ev-record dt { color: var(--muted); font-size: 13px; font-weight: 600; padding-top: 2px; }
.ev-record dd { margin: 0; font-variant-numeric: tabular-nums; }
.ev-files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 12px; }
.ev-files:empty { display: none; }
.ev-file { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--field); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--muted); padding: 6px; }
.ev-file img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ev-file .rm { position: absolute; top: 4px; right: 4px; min-height: 32px; width: 32px; padding: 0; border-radius: 50%; background: var(--scrim); color: var(--on-scrim); font-size: 18px; line-height: 1; }
.ev-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.file-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: var(--r-sm); cursor: pointer; position: relative; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; margin-top: 8px; border: 0; border-radius: var(--r-sm); background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); resize: vertical; }
textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.ev-link { display: flex; align-items: center; justify-content: center; text-decoration: none; border-radius: var(--r-sm); text-align: center; padding: 0 10px; }
#evShare { margin-top: 4px; }
#evidence .actions { margin-top: 10px; grid-template-columns: 1fr; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .card { border: 1px solid var(--line); } }
.icon-tile { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.loc { display: flex; align-items: center; gap: 14px; padding: 16px; }
.loc-title { font-weight: 600; font-size: 15px; }

/* form */
.fields { display: flex; flex-direction: column; gap: 18px; padding: 16px; }
.field { display: block; position: relative; }
.plan-body .field { margin-top: 14px; }
.plan-body .field:first-child { margin-top: 4px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.label em { font-style: normal; font-weight: 400; }
input { width: 100%; font: inherit; font-size: 16px; font-weight: 500; height: 52px; padding: 0 14px; margin-top: 8px; border: 0; border-radius: var(--r-sm); background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); transition: box-shadow .15s; }
input::placeholder { color: var(--faint); font-weight: 400; }
input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips:empty { display: none; }
.chip { font: inherit; font-size: 13px; font-weight: 500; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--field); color: var(--ink); cursor: pointer; }
.chip:first-child { background: var(--accent-soft); color: var(--accent-ink); }
.chip small { color: inherit; opacity: .75; font-size: 12px; }

details.plan { padding: 0; }
summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 16px; font-weight: 600; font-size: 15px; }
summary::-webkit-details-marker { display: none; }
.sum-main { display: flex; align-items: center; gap: 12px; }
.sum-main svg, .chev { color: var(--muted); flex-shrink: 0; }
.chev { transition: transform .15s; }
details[open] .chev { transform: rotate(90deg); }
.plan-body { padding: 0 16px 16px; }

.suggest { list-style: none; margin: 4px 0 0; padding: 6px; border-radius: var(--r-sm); background: var(--card); position: absolute; left: 16px; right: 16px; z-index: 5; box-shadow: 0 12px 32px rgba(14, 17, 22, .18); border: 1px solid var(--line); }
.suggest li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 10px; cursor: pointer; }
.suggest li:hover { background: var(--field); }
.suggest li b { font-weight: 600; }
.suggest li .muted { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .04em; }
#find { position: relative; }

/* buttons */
button { font: inherit; cursor: pointer; border: 0; border-radius: var(--r-sm); min-height: 44px; padding: 0 16px; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { width: 100%; min-height: 56px; border-radius: 18px; background: var(--accent-strong); color: var(--on-accent); font-size: 17px; font-weight: 600; box-shadow: 0 8px 20px rgba(35, 70, 216, .25); }
.primary:disabled { opacity: .7; }
.secondary { background: var(--card); color: var(--ink); font-weight: 600; min-height: 52px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .secondary { border: 1px solid var(--line); } }
.soft { background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.link { background: none; color: var(--accent); font-weight: 600; padding: 0 2px; }
.wide { width: 100%; margin-top: 10px; }
.find-actions { padding-top: 6px; }
.msg { min-height: 1.4em; margin: 10px 4px 0; color: var(--danger); font-weight: 500; }
.msg.info { color: var(--muted); font-weight: 400; }
.msg:empty { min-height: 0; margin: 0; }
.retry { display: block; margin: 10px 4px 0; }
/* Validation sits under its own field, where the eye (and the keyboard) already is. */
.field-err { display: block; margin: 6px 2px 0; color: var(--danger); font-size: 14px; font-weight: 500; }
input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }
.primary.busy { opacity: 1; display: flex; align-items: center; justify-content: center; gap: 10px; }
.primary.busy::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .primary.busy::before { animation-duration: 3s; } }
.danger { color: var(--danger); }

/* candidates */
.candidates { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-direction: column; gap: 12px; }
.cand { width: 100%; text-align: left; color: var(--ink); background: var(--card); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .cand { border: 1px solid var(--line); } }
.cand.best { box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(35, 70, 216, .12); }
.cand-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.cand-tag { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cand.best .cand-tag { color: var(--accent); }
.cand-title { font-size: 17px; font-weight: 600; line-height: 1.3; }
.cand-sub { font-size: 14px; color: var(--muted); margin-top: -6px; }
.cand-foot { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
.cand-lbl { display: block; font-size: 12px; color: var(--muted); }
.cand-time { display: block; font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cand-conf { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; font-weight: 600; }
.bar { display: block; width: 120px; height: 6px; border-radius: 999px; background: var(--field); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--faint); }
.cand.best .bar span { background: var(--accent); }

/* hero */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 24px; padding: 20px; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 16px; }
.hero-top { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
.hero-top .svc { width: 100%; }
/* One line whatever the pill says: a long "No signal since" must not push the link down. */
.hero-tools { display: flex; flex-wrap: nowrap; gap: 8px; max-width: 100%; }
.hero-tools .live { min-width: 0; }
#liveText { overflow: hidden; text-overflow: ellipsis; }
.hero-link { flex-shrink: 0; }
.live.stale { background: var(--chip-warn); color: var(--chip-ink); }
.svc-sub { font-size: 13px; color: var(--hero-muted); }
.svc-title { font-size: 17px; font-weight: 600; line-height: 1.3; margin-top: 4px; }
.live { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--hero-muted); white-space: nowrap; padding: 6px 10px; border-radius: 999px; background: var(--hero-line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hero-muted); }
.dot.on { background: var(--live-on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live-on) 20%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dot.on { animation: none; } }
.hero-rule { height: 1px; background: var(--hero-line); }
.hero-label { font-size: 13px; color: var(--hero-muted); }
#nextPlatNote:not(:empty)::before { content: " · "; }
.at-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--hero-line); margin-bottom: 12px; }
.at-chip[hidden] { display: none; }
.at-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--chip-warn); }
.hero.at .hero-label { color: var(--chip-warn); font-weight: 600; }
.when { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hero-muted); }
.when:empty { display: none; }
.hero-name { font-size: 20px; font-weight: 600; line-height: 1.25; margin-top: 4px; }
.hero-timeline { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.hero-big .when { margin-bottom: 4px; }
/* Platform: the other fact you need on the platform, so it sits beside the time at display size. */
.hero-plat { padding-left: 16px; border-left: 1px solid var(--hero-line); }
.hero-plat .when { margin-bottom: 4px; }
.hero-plat-num { font-family: var(--display); font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
/* With a platform there is no room beside it at phone width: the delay goes underneath, in a row. */
.hero-timeline.has-plat { align-items: flex-end; }
.hero-timeline.has-plat .hero-delay { flex-basis: 100%; flex-direction: row; align-items: center; gap: 10px; }
.hero-time { font-family: var(--display); font-size: 64px; line-height: 1; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hero-delay { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hero .stat-delay span { display: inline-block; font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: var(--chip-ink); }
.hero .stat-delay .good { background: var(--chip-good); }
.hero .stat-delay .warn { background: var(--chip-warn); }
.hero .stat-delay .bad { background: var(--chip-bad); }
.hero .stat-delay .unknown { background: var(--hero-line); color: var(--hero-ink); }
.hero .sched { font-size: 13px; color: var(--hero-muted); }
/* Old data: the facts stay but stop looking live. */
.hero.stale .hero-time, .hero.stale .hero-plat-num { opacity: .45; }
.hero.ended .hero-label, .hero.ended .hero-timeline, .hero.ended #notMineHero { display: none; }
/* Opening a train: a loading hero, not a stack of empty cards. */
#status.loading .card, #status.loading #notices, #status.loading #shareBtn, #status.loading .actions, #status.loading #alerts { display: none; }
.hero.loading .hero-timeline, .hero.loading #notMineHero { display: none; }
.hero-skel { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.hero-skel span { display: block; height: 24px; width: 60%; border-radius: 8px; background: color-mix(in srgb, var(--hero-ink) 14%, transparent); animation: pulse 1.6s infinite; }
.hero-skel span + span { height: 56px; width: 45%; }
@media (prefers-reduced-motion: reduce) { .hero-skel span { animation: none; } }
#status.arrived #destCard, #status.arrived #notMineHero, #status.arrived .alerts-card, #status.arrived #notMine { display: none; }
/* Not tracking: drop what claims to be live or acts on the train; keep the route for reference. */
#status.ended #alerts, #status.ended #destCard, #status.ended #connCard, #status.ended #journeyCard,
#status.ended .alerts-card, #status.ended #shareBtn, #status.ended .actions { display: none; }
/* A link that never found its train: nothing to show but the way out. */
#status.expired .card, #status.expired #notices, #status.expired .svc { display: none; }
.hero-retry { display: block; margin: 12px auto 0; min-height: 40px; }
.hero-end p { margin: 6px 0 14px; font-size: 15px; color: var(--hero-muted); }
.hero-end .primary { box-shadow: none; }
.sched:empty { display: none; }

/* destination */
.dest-row { display: flex; align-items: center; gap: 12px; }
.dest-plat { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.dest-plat b { display: block; font-family: var(--display); font-size: 30px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.dest-name { font-size: 17px; font-weight: 600; margin-top: 4px; }
.dest-sub { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-top: 2px; font-size: 13px; font-weight: 600; }
.dest-sub .sched { color: var(--muted); font-weight: 400; }
.dest-time { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); } .unknown { color: var(--muted); }
.alert { border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; font-size: 15px; font-weight: 500; line-height: 1.4; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }

/* station notices */
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .notice { border: 1px solid var(--line); } }
.notice svg { flex-shrink: 0; color: var(--accent); margin-top: 2px; }
.notice b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.notice p { margin: 4px 0 0; font-size: 15px; line-height: 1.4; }

/* review fixes: hero link, notices, map controls */
.hero-link { min-height: 32px; padding: 0 12px; border-radius: 999px; background: transparent; color: var(--hero-muted); font-size: 12px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--hero-line); }
body.meet .hero-link { display: none; }
.notice p.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice .open p.clamp, .notice div.open p.clamp { -webkit-line-clamp: unset; display: block; }
.notice .more-notes { min-height: 32px; padding: 0; margin-top: 2px; font-size: 14px; }
/* MapLibre's controls have their own sizes: keep the app's 44px button rule off them */
.mapview .maplibregl-ctrl button { min-height: 0; padding: 0; border-radius: 0; }
.mapview .maplibregl-ctrl-group button { width: 36px; height: 36px; }
.mapview .maplibregl-ctrl-attrib-button { width: 24px; height: 24px; background-repeat: no-repeat; background-position: center; }
#alertBtn.primary { width: auto; margin-top: 0; font-size: 16px; min-height: 48px; box-shadow: none; }

/* unit spotting */
.back-link { min-height: 44px; padding: 0 4px; margin-top: 4px; font-size: 15px; }
.units-entry { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; color: var(--ink); }
.units-entry-glyph { width: 64px; flex-shrink: 0; color: var(--muted); }
.units-entry-glyph svg, .uc-glyph svg { display: block; width: 100%; height: auto; }
.units-entry b { display: block; font-size: 15px; }
.unit-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.unit-stats div { background: var(--card); border-radius: 16px; padding: 14px 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .unit-stats div { border: 1px solid var(--line); } }
.unit-stats b { display: block; font-family: var(--display); font-size: 26px; }
.unit-stats span { font-size: 12px; color: var(--muted); }
.unit-sort { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.unit-sort button { min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.unit-sort button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.unit-classes { display: flex; flex-direction: column; gap: 12px; }
.uc { padding: 16px; }
.uc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.uc-glyph { width: 84px; flex-shrink: 0; color: var(--muted); }
.uc-head b { display: block; font-family: var(--display); font-size: 17px; }
.uc-head span { font-size: 12px; color: var(--muted); }
.uc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-chips button { min-height: 32px; padding: 0 10px; border-radius: 999px; background: var(--field); color: var(--ink); font-family: var(--display); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.uc-chips button small { font-family: Inter, sans-serif; font-weight: 500; color: var(--muted); font-size: 12px; }
.uc-chips button.new { background: var(--good-bg); color: var(--good); }
.uc-chips button.new small { color: var(--good); font-size: 10px; font-weight: 700; }
.units-foot { margin: 14px 4px 0; }
.units-foot .link { min-height: 0; padding: 0; font-size: 13px; }
.unit-hero h1 { margin: 4px 0 0; font-family: var(--display); font-size: 44px; line-height: 1; letter-spacing: -.03em; }
.unit-hero .uh-sub { font-size: 13px; color: var(--hero-muted); }
.unit-hero .uh-train { background: var(--plate); border-radius: 14px; padding: 10px 10px 6px; color: var(--plate-ink); }
.unit-hero .uh-train svg { display: block; width: 100%; height: auto; }
.unit-hero .uh-seats { display: grid; text-align: center; font-size: 11px; color: var(--plate-ink); margin-top: 2px; }
.unit-hero .uh-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.unit-hero .uh-stats b { display: block; font-family: var(--display); font-size: 22px; }
.unit-hero .uh-stats span { font-size: 12px; color: var(--hero-muted); }
.unit-rides .ur { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 52px; border-top: 1px solid var(--line); }
.unit-rides .ur:first-child { border-top: 0; }
.unit-rides .ur > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); }
.unit-rides .ur b { display: block; font-size: 14px; font-weight: 600; }
.unit-rides .ur small { font-size: 12px; color: var(--muted); }
.unit-rides .ur small.first { color: var(--good); font-weight: 600; }
.unit-rides .hc { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--muted); }
.unit-rides .more { width: 100%; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--accent); font-weight: 600; }
.unit-spot { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.unit-spot[hidden] { display: none; }
.us-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); text-align: left; min-height: 48px; }
.us-row .id { font-family: var(--display); font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card); color: var(--ink); }
.us-row .txt { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.us-row .txt small { display: block; font-size: 13px; font-weight: 500; opacity: .85; }
.us-row.repeat { background: var(--accent-soft); color: var(--accent-ink); }
.us-row.new { background: var(--good-bg); color: var(--good); }
.us-row.new .star { width: 34px; height: 34px; border-radius: 10px; background: var(--good); color: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.us-row.planned { background: var(--field); color: var(--muted); }

/* coach diagram (mini trains) */
.mini-train { margin-top: 4px; color: var(--muted); }
.mini-train svg { display: block; width: 100%; height: auto; }
.coach-icons { display: grid; gap: 2px; margin-top: 4px; min-height: 16px; }
.coach-icons > div { display: flex; justify-content: center; align-items: center; gap: 2px; flex-wrap: wrap; }
.coach-icons span { font-size: 9px; font-weight: 700; padding: 1px 3px; border-radius: 3px; background: var(--field); color: var(--muted); line-height: 1.3; }
.coach-icons .t1 { background: var(--first-bg); color: var(--first-ink); }
.coach-icons .acc { background: var(--info-bg); color: var(--info); }
.coach-icons .out { text-decoration: line-through; }
.coach-icons .seats { background: none; padding: 0; font-weight: 600; font-size: 10px; }
.coach-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.coach-key span { display: inline-flex; align-items: center; gap: 6px; }
.coach-key i { display: inline-block; width: 16px; height: 9px; border-radius: 3px; }

/* coaches (old boxes, unused) */
.small-r { font-size: 13px; }
.coaches { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 8px; margin-top: 8px; }
.coach { flex: 1 0 44px; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.coach-body { position: relative; width: 100%; height: 56px; border-radius: 8px; background: var(--field); overflow: hidden; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; box-shadow: inset 0 0 0 1.5px var(--line); }
.coach:first-child .coach-body { border-radius: 18px 8px 8px 8px; }
.coach-body.first { box-shadow: inset 0 0 0 2px var(--accent); }
.coach-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent-soft); }
.coach-fill.busy { background: var(--bad-bg); }
.coach-fill.mid { background: var(--warn-bg); }
.coach-num { position: relative; font-family: var(--display); font-weight: 700; font-size: 15px; }
.coach-tags { display: flex; gap: 3px; min-height: 18px; font-size: 10px; font-weight: 700; }
.coach-tags span { padding: 1px 4px; border-radius: 4px; background: var(--field); color: var(--muted); }
.coach-tags .t1 { background: var(--accent-soft); color: var(--accent-ink); }
.coach-tags .out { text-decoration: line-through; }
.coach-tags .acc { background: var(--info-bg); color: var(--info); }
.front-row { margin-top: 10px; }
.coach-load { font-size: 11px; color: var(--muted); min-height: 14px; }
.front-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); }
.front-row .front { color: var(--accent); }
.train-note { font-size: 14px; margin: 8px 0 0; }
select { width: 100%; font: inherit; font-size: 16px; height: 52px; padding: 0 12px; margin-top: 8px; border: 0; border-radius: var(--r-sm); background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); }
select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

/* connection */
.conn-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.conn-head h2 { margin: 0; }
.conn-head span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn-best { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-sm); background: var(--field); }
.conn-best.warn, .conn-best.bad { background: var(--bad-bg); }
.conn-best .t { font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.conn-best { flex-wrap: wrap; }
.conn-mid { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; }
.conn-best .badge { margin-left: auto; }
.conn-mid b { font-size: 15px; font-weight: 600; }
.conn-mid span { font-size: 13px; color: var(--muted); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad); color: var(--card); }
.conn-alt { list-style: none; margin: 8px 0 0; padding: 0; }
.conn-alt li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.conn-alt li:first-child { border-top: 0; }
.conn-alt .t { font-family: var(--display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; width: 52px; }
.conn-alt .to { flex: 1; min-width: 0; }
.conn-alt .m { font-size: 13px; font-weight: 600; }
.conn-alt .m.good { color: var(--accent-ink); }
.conn-note { font-size: 13px; margin: 10px 0 0; }

/* calling points */
.points { list-style: none; margin: 0; padding: 0; position: relative; }
.points li { display: grid; grid-template-columns: 20px 1fr auto; gap: 14px; align-items: center; min-height: 48px; padding: 4px 0; position: relative; }
.points li::before { content: ""; position: absolute; left: 8.5px; top: 0; bottom: 0; width: 3px; border-radius: 2px; background: var(--line); }
.points li:first-child::before { top: 50%; } .points li:last-child::before { bottom: 50%; }
.points li.passed::before { background: var(--faint); opacity: .5; }
.points .node { width: 12px; height: 12px; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 2.5px var(--faint); justify-self: center; z-index: 1; }
.points .passed .node { background: var(--faint); box-shadow: none; opacity: .6; }
.points .passed .nm, .points .passed .tm { color: var(--muted); }
.points .is-next { margin: 0 -10px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--accent-soft); min-height: 56px; grid-template-columns: 20px 1fr auto; }
.points .is-next::before { left: 18.5px; }
.points .is-next .node { width: 14px; height: 14px; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.points .is-next .nm { font-weight: 700; }
.points .is-dest .node { border-radius: 4px; background: var(--ink); box-shadow: none; width: 14px; height: 14px; }
.points .is-dest .nm { font-weight: 700; }
.points .is-dest .nm::after { content: "You get off"; display: block; color: var(--accent); font-weight: 600; font-size: 13px; }
body.meet .points .is-dest .nm::after { content: "Arriving here"; }
.points .cancelled .nm { color: var(--danger); }
.points .cancelled .nm { text-decoration: line-through; color: var(--bad); }
.points .is-here .node { width: 16px; height: 16px; border-radius: 5px; background: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 18%, transparent); opacity: 1; }
.points .is-here .nm, .points .is-here .tm { color: var(--ink); }
.points .is-here .nm { font-weight: 700; }
.points .is-here .nm::after { content: "Train at platform"; display: block; color: var(--accent); font-weight: 600; font-size: 13px; }
.points .is-here.is-dest .nm::after { content: "Train at platform · you get off"; }
body.meet .points .is-here.is-dest .nm::after { content: "Train at platform"; }
.points .is-dest .node { border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 3px var(--accent); width: 14px; height: 14px; }
.points .nm { font-size: 15px; }
.points .tm { text-align: right; font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; display: flex; flex-direction: column-reverse; align-items: flex-end; line-height: 1.2; }
.points .tm s { color: var(--muted); font-family: "Inter", sans-serif; font-weight: 400; font-size: 12px; }
.points .plat { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }

/* route strip */
.route-card .row { margin-bottom: 4px; }
.route-card h2 { margin: 0; }
.strip { margin-top: 6px; cursor: pointer; }
.strip svg { width: 100%; height: auto; display: block; }
.strip .trk { stroke: var(--edge); stroke-width: 6; stroke-linecap: round; }
.strip .trk.approx { stroke-dasharray: 2 6; }
.strip .trk.done { stroke: var(--accent); stroke-width: 6; }
.strip .stn { fill: var(--card); stroke: var(--faint); stroke-width: 2; }
.strip .stn.passed { fill: var(--faint); }
.strip .stn.next { stroke: var(--accent); stroke-width: 2.5; }
.strip .stn.cancelled { stroke: var(--bad); }
.strip .lbl { font-size: 11px; fill: var(--muted); font-family: "Inter", sans-serif; }
.strip .lbl.strong { fill: var(--ink); font-weight: 600; }
.strip .train rect { fill: var(--ink); stroke: var(--card); stroke-width: 2; }
.strip .you { fill: var(--you); stroke: var(--card); stroke-width: 2; }
.strip .you-halo { fill: var(--you); opacity: .2; }
.strip .you-lbl { fill: var(--you); font-weight: 600; }
.strip-info { font-size: 14px; margin-top: 4px; }

/* full map */
body.map-open { overflow: hidden; }
.mapview { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.mapview[hidden] { display: none; }
#map { flex: 1; }
.map-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.map-bar .small { margin: 0; }
.map-you { width: 16px; height: 16px; border-radius: 50%; background: var(--map-you); border: 3px solid var(--map-ring); box-shadow: 0 0 0 6px color-mix(in srgb, var(--map-you) 25%, transparent); }
.map-train { width: 22px; height: 14px; border-radius: 5px; background: var(--map-train); border: 2px solid var(--map-ring); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.map-label { background: var(--map-train); color: var(--map-ring); font: 600 12px "Inter", system-ui, sans-serif; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }

/* alerts */
.alerts-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.alerts-row .grow { flex: 1 1 200px; }
#alertBtn { flex: 1 0 100%; min-height: 48px; }
.alerts-card h2 { margin: 0; }
#alertBtn.on { background: var(--good-bg); color: var(--good); }
.switch-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--faint); position: relative; cursor: pointer; transition: background .15s; box-shadow: none; padding: 0; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch-row input:checked { background: var(--accent-strong); }
.switch-row input:checked::after { transform: translateX(18px); }
.switch-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row b { display: block; font-size: 15px; font-weight: 600; }
.switch-row .muted { display: block; font-size: 13px; margin-top: 2px; }
.hint { margin-top: 12px; background: var(--info-bg); color: var(--info); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; }

/* journey graph */
.jg svg { width: 100%; height: auto; display: block; }
.jg text { font-family: "Inter", sans-serif; }
.jg-grid { stroke: var(--line); stroke-width: 1; }
.jg-row { stroke: var(--line); stroke-width: 1.5; }
.jg-tick { font-size: 10.5px; fill: var(--muted); }
.jg-stn { font-size: 11px; fill: var(--muted); }
.jg-stn.end { fill: var(--ink); font-weight: 600; }
.jg-now { stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 3 3; }
.jg-now-lbl { font-size: 10.5px; fill: var(--accent); font-weight: 600; }
.jg-other { stroke: var(--faint); stroke-width: 1.25; opacity: .45; }
.jg-missed { stroke: var(--bad); stroke-width: 1.25; opacity: .35; stroke-dasharray: 3 3; }
.jg-cancel { stroke: var(--bad); stroke-width: 1.5; opacity: .6; }
.jg-x { font-size: 12px; fill: var(--bad); }
.jg-plan { stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; }
.jg-fb { stroke: var(--warn); stroke-width: 2.25; stroke-dasharray: 5 4; stroke-linecap: round; }
.jg-change { stroke-width: 3.5; stroke-linecap: round; }
.jg-change.fb { stroke-width: 2.25; stroke-dasharray: 5 4; }
.jg-change.good { stroke: var(--good); } .jg-change.warn { stroke: var(--warn); } .jg-change.bad { stroke: var(--bad); }
.jg-margin { font-size: 10.5px; font-weight: 600; }
.jg-margin.good { fill: var(--good); } .jg-margin.warn { fill: var(--warn); } .jg-margin.bad { fill: var(--bad); }
.jg-you { fill: var(--you); stroke: var(--card); stroke-width: 2; }
.jg-arr { font-size: 10.5px; fill: var(--warn); font-weight: 600; }
.jg-arr.plan { fill: var(--accent); }
.jg-legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.jg-legend .k { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--accent); margin-left: 6px; }
.jg-legend .k:first-child { margin-left: 0; }
.jg-legend .k.fb { border-top: 2px dashed var(--warn); }
.jg-legend .k.other { border-top: 1.5px solid var(--faint); opacity: .6; }
.jg-list { margin: 10px 0 0; padding-left: 18px; font-size: 14px; }
.jg-list li { margin-bottom: 4px; }
.jg-list .fb { color: var(--muted); }
.jg-list .bad { color: var(--bad); }

/* second design pass */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.status-back { margin-top: 0; }
body.meet .status-back, body.meet #destCard, body.meet #connCard, body.meet #journeyCard { display: none; }
.svc-title, .hero-name, .dest-name, .uc-head b { overflow-wrap: anywhere; }
.trips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 36px; }
/* bigger hit areas without bigger chips: 36/32 px visuals, 44 px targets */
.chip, .uc-chips button, .unit-sort button, .ev-file .rm, .hero-link { position: relative; }
.chip::after, .unit-sort button::after { content: ""; position: absolute; inset: -4px 0; }
.uc-chips button::after, .hero-link::after { content: ""; position: absolute; inset: -6px 0; }
.ev-file .rm::after { content: ""; position: absolute; inset: -6px; }
.us-row.new .star { color: var(--bg); }
.conn-best[data-band="warn"], .conn-best[data-band="bad"] { background: var(--warn-bg); }
.conn-alt .m.good { color: var(--good); }
.train-facts { margin: 10px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.train-facts li { margin: 2px 0; }
.coach-icons .num { background: none; padding: 0; color: var(--ink); font-family: var(--display); font-size: 10px; }
.coach-icons .load { display: inline-flex; align-items: flex-end; gap: 1px; height: 10px; padding: 0; background: none; }
.coach-icons .load i { display: block; width: 2px; background: var(--line); border-radius: 1px; }
.coach-icons .load i:nth-child(1) { height: 4px; } .coach-icons .load i:nth-child(2) { height: 6px; }
.coach-icons .load i:nth-child(3) { height: 8px; } .coach-icons .load i:nth-child(4) { height: 10px; }
.coach-icons .load i.on { background: var(--muted); }
.coach-icons > div { flex-direction: column; justify-content: flex-start; gap: 2px; }
.unit-hero .uh-caption { font-size: 11px; color: var(--plate-ink); text-align: center; margin-top: 2px; }
.unit-rides .ur { padding: 8px 0; }
