:root {
  --bg: #07090d;
  --panel: #0e1218;
  --panel-2: #111720;
  --panel-3: #171f2a;
  --input: #090d12;
  --text: #f4f7fb;
  --muted: #98a3b1;
  --muted-2: #6d7887;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.16);
  --focus: #86b7ff;
  --nsl: #d42e12;
  --ewl: #009645;
  --nel: #9900aa;
  --ccl: #fa9e0d;
  --dtl: #005ec4;
  --tel: #9d5b25;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); line-height: 1.5; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.site-header { border-bottom: 1px solid var(--border); background: rgba(7,9,13,.94); }
.header-inner { width: min(1160px, calc(100% - 36px)); min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { font-size: 1.02rem; letter-spacing: -.02em; }
.brand-copy small { color: var(--muted); font-size: .78rem; }
.brand-mark { width: 31px; display: grid; gap: 4px; flex: 0 0 auto; }
.brand-mark i { display: block; height: 4px; border-radius: 999px; }
.brand-mark i:nth-child(1) { width: 22px; background: var(--nsl); }
.brand-mark i:nth-child(2) { width: 31px; background: var(--dtl); }
.brand-mark i:nth-child(3) { width: 17px; background: var(--ewl); }
.network-badges { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.network-badge, .route-line-pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-weight: 850; letter-spacing: -.02em; }
.network-badge { min-width: 40px; height: 27px; padding: 0 8px; color: white; font-size: .71rem; }
.NSL { --line: var(--nsl); } .EWL { --line: var(--ewl); } .NEL { --line: var(--nel); }
.CCL { --line: var(--ccl); } .DTL { --line: var(--dtl); } .TEL { --line: var(--tel); }
.network-badge.NSL, .route-line-pill.NSL { background: var(--nsl); }
.network-badge.EWL, .route-line-pill.EWL { background: var(--ewl); }
.network-badge.NEL, .route-line-pill.NEL { background: var(--nel); }
.network-badge.CCL, .route-line-pill.CCL { background: var(--ccl); color: #17110a; }
.network-badge.DTL, .route-line-pill.DTL { background: var(--dtl); }
.network-badge.TEL, .route-line-pill.TEL { background: var(--tel); }

.page-shell { width: min(1160px, calc(100% - 36px)); margin: 28px auto 64px; display: grid; gap: 18px; }
.planner-panel, .result-panel, .explorer-panel, .method-panel { border: 1px solid var(--border); border-radius: 20px; background: var(--panel); overflow: hidden; }
.planner-panel { padding: 30px; }
.planner-copy { max-width: 680px; }
.eyebrow { display: block; margin: 0 0 6px; color: var(--muted); font-size: .69rem; line-height: 1.2; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; }
h1, h2, h3 { margin: 0; letter-spacing: -.035em; }
.planner-copy h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.08; }
.planner-copy > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: .94rem; }

.route-form { margin-top: 25px; }
.journey-inputs { display: grid; grid-template-columns: minmax(0, 1fr) 50px minmax(0, 1fr); grid-template-areas: "from swap to"; gap: 12px; align-items: end; width: 100%; min-width: 0; }
#fromField { grid-area: from; }
#toField { grid-area: to; }
.swap-btn { grid-area: swap; }
.station-field { display: grid; gap: 7px; min-width: 0; width: 100%; }
.field-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 750; }
.field-label b { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #e8edf3; color: #0a0e13; font-size: .68rem; }
.station-field input { display: block; width: 100%; min-width: 0; max-width: 100%; height: 58px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--input); color: var(--text); padding: 0 16px; outline: none; font-size: 16px; -webkit-appearance: none; appearance: none; }
.station-field input::placeholder { color: #596473; }
.station-field input:focus, .time-input-shell:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(134,183,255,.12); }
.station-field input.invalid { border-color: #ff6b6b; }
.field-error { color: #ff9292; font-size: .72rem; }
.field-error:empty { display: none; }
.swap-btn { width: 50px; height: 50px; margin-bottom: 4px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--panel-3); cursor: pointer; font-size: 1.25rem; }
.swap-btn:hover { background: #202a37; }
button:focus-visible, summary:focus-visible { outline: 3px solid rgba(134,183,255,.35); outline-offset: 2px; }

.trip-options { display: grid; grid-template-columns: minmax(230px, .9fr) minmax(280px, 1fr) auto; align-items: end; gap: 14px; margin-top: 16px; }
.option-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .73rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.departure-control { min-width: 0; }
.departure-control label { display: block; }
.departure-control small { display: block; margin-top: 6px; color: var(--muted-2); font-size: .68rem; line-height: 1.35; }
.time-input-shell { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; min-height: 46px; border: 1px solid var(--border); border-radius: 11px; background: var(--input); overflow: hidden; }
.time-input-shell input { width: 100%; min-width: 0; height: 44px; border: 0; outline: none; background: transparent; color: var(--text); padding: 0 12px; font-size: 16px; color-scheme: dark; }
.time-input-shell button { height: 32px; margin-right: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-3); padding: 0 10px; color: var(--muted); cursor: pointer; font-size: .73rem; font-weight: 750; }
.mode-switch { margin: 0; padding: 0; border: 0; min-width: 0; }
.mode-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--input); }
.mode-options label { min-width: 0; cursor: pointer; }
.mode-options input { position: absolute; opacity: 0; pointer-events: none; }
.mode-options span { display: grid; place-items: center; min-height: 38px; border-radius: 8px; color: var(--muted); font-size: .79rem; font-weight: 750; text-align: center; }
.mode-options input:checked + span { background: #27313e; color: var(--text); }
.go-btn { min-height: 46px; border: 0; border-radius: 11px; background: #eef2f6; color: #090d12; padding: 0 19px; font-weight: 850; cursor: pointer; white-space: nowrap; }
.go-btn:hover { background: white; }
.quick-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 19px; color: var(--muted-2); font-size: .75rem; }
.quick-trip { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 10px; cursor: pointer; font-size: .74rem; }
.quick-trip:hover { border-color: var(--border-strong); color: var(--text); background: rgba(255,255,255,.03); }

.result-panel { padding: 28px 30px 30px; }
.result-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.journey-heading { min-width: 0; }
.result-topline h2 { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; font-size: clamp(1.25rem, 3vw, 1.65rem); }
.arrow { color: var(--muted-2); font-weight: 400; }
.result-mode, .quality-badge { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); padding: 6px 10px; font-size: .7rem; font-weight: 750; white-space: nowrap; }

.journey-clock { display: grid; grid-template-columns: minmax(120px,.8fr) minmax(180px,1.7fr) minmax(120px,.8fr); align-items: center; gap: 20px; margin-top: 22px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 16px; background: #0a0e13; }
.clock-point span, .clock-duration small { display: block; color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.clock-point strong { display: block; margin-top: 1px; font-size: clamp(1.75rem, 5vw, 2.45rem); line-height: 1.05; letter-spacing: -.055em; }
.clock-point small { display: block; margin-top: 4px; color: var(--muted-2); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock-arrive { text-align: right; }
.clock-duration { min-width: 0; text-align: center; }
.clock-duration > span { display: inline-block; margin-bottom: 6px; color: var(--text); font-size: .78rem; font-weight: 800; }
.clock-track { display: grid; grid-template-columns: 10px 1fr 10px; align-items: center; }
.clock-track i { width: 10px; height: 10px; border: 2px solid #dce3eb; border-radius: 50%; background: #0a0e13; }
.clock-track b { height: 2px; background: linear-gradient(90deg,var(--nsl),var(--dtl),var(--nel),var(--ewl)); opacity: .9; }
.clock-duration small { margin-top: 7px; }

.result-grid { display: grid; grid-template-columns: minmax(210px,1.5fr) repeat(3,minmax(110px,.72fr)); margin-top: 14px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.time-hero, .metric { min-width: 0; padding: 18px 20px; background: #0a0e13; }
.metric { border-left: 1px solid var(--border); }
.metric-label { display: block; color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.time-hero strong { display: block; margin-top: 2px; font-size: clamp(2.3rem, 7vw, 4rem); line-height: .98; letter-spacing: -.07em; }
.metric strong { display: block; margin-top: 7px; font-size: 1.3rem; letter-spacing: -.035em; }
.estimate-note { display: block; margin-top: 7px; color: var(--muted-2); font-size: .69rem; }
.route-ribbon { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.route-line-pill { min-width: 46px; height: 29px; padding: 0 9px; color: white; font-size: .73rem; }
.route-line-pill.CCL { color: #17110a; }
.ribbon-transfer { color: var(--muted-2); font-size: .77rem; }
.alternative-note { min-height: 17px; margin: 8px 0 0; color: var(--muted); font-size: .76rem; }

.timeline-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 23px; border-top: 1px solid var(--border); }
.timeline-heading h3 { font-size: 1.08rem; }
.timeline-range { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.route-steps { display: grid; gap: 10px; margin-top: 13px; }
.journey-leg { border: 1px solid var(--border); border-radius: 14px; background: #0a0e13; overflow: hidden; }
.leg-head { min-height: 55px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.leg-heading { min-width: 0; flex: 1; }
.leg-heading strong { display: block; font-size: .88rem; }
.leg-heading span { display: block; color: var(--muted); font-size: .73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-time { font-weight: 850; white-space: nowrap; font-size: .83rem; }
.station-list { display: grid; padding: 6px 13px 9px; }
.station-row { min-height: 43px; display: grid; grid-template-columns: 58px 15px minmax(0,1fr) auto; align-items: center; gap: 8px; position: relative; }
.station-row::before { content: ""; position: absolute; left: 72.5px; top: 0; bottom: 0; width: 2px; background: var(--leg-color,#667); opacity: .62; }
.station-row:first-child::before { top: 50%; }
.station-row:last-child::before { bottom: 50%; }
.station-clock { color: #c8d0da; font-size: .76rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.station-dot { width: 10px; height: 10px; border-radius: 50%; background: #0a0e13; border: 3px solid var(--leg-color,#667); z-index: 1; justify-self: center; }
.station-row:first-child .station-dot, .station-row:last-child .station-dot { width: 13px; height: 13px; background: var(--leg-color,#667); border-color: var(--leg-color,#667); }
.station-label { min-width: 0; }
.station-label strong { display: block; font-size: .84rem; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-label small { display: block; color: var(--muted-2); font-size: .68rem; }
.segment-minute { color: var(--muted-2); font-size: .68rem; white-space: nowrap; }
.transfer-leg { display: grid; grid-template-columns: 58px 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 12px 13px; border: 1px dashed var(--border-strong); border-radius: 13px; background: rgba(255,255,255,.02); }
.transfer-clock { color: #c8d0da; font-size: .75rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.transfer-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-3); color: var(--muted); }
.transfer-copy { min-width: 0; }
.transfer-copy strong { display: block; font-size: .84rem; }
.transfer-copy span { display: block; color: var(--muted); font-size: .71rem; }
.transfer-leg > b { white-space: nowrap; font-size: .8rem; }

.explorer-panel, .method-panel { background: var(--panel); }
.explorer-panel > summary, .method-panel > summary { list-style: none; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 24px; cursor: pointer; }
.explorer-panel > summary::-webkit-details-marker, .method-panel > summary::-webkit-details-marker { display: none; }
.explorer-panel > summary strong, .method-panel > summary strong { font-size: .96rem; }
.summary-action { color: var(--muted); font-size: .72rem; }
.explorer-panel[open] > summary, .method-panel[open] > summary { border-bottom: 1px solid var(--border); }
.explorer-content { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.section-heading h2, .info-panel h2 { font-size: 1.18rem; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; }
.line-tabs { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.line-tab { min-width: 43px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--input); color: var(--muted); font-size: .72rem; font-weight: 850; cursor: pointer; }
.line-tab.active { background: var(--tab-color); border-color: var(--tab-color); color: white; }
.line-tab.active[data-line="CCL"] { color: #17110a; }
.line-summary { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.line-summary > div { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.line-title { font-weight: 850; }
.line-summary p { max-width: 650px; margin: 0; color: var(--muted); font-size: .76rem; text-align: right; }
.quality-badge[data-quality="timetable-derived"] { border-color: rgba(70,190,120,.32); color: #82d9a3; }
.quality-badge[data-quality="schedule-calibrated"] { border-color: rgba(80,150,255,.32); color: #9ac2ff; }
.quality-badge[data-quality="modelled"] { border-color: rgba(250,158,13,.32); color: #ffc867; }
.path-tabs { display: flex; gap: 7px; margin-top: 14px; flex-wrap: wrap; }
.path-tab { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 10px; font-size: .72rem; cursor: pointer; }
.path-tab.active { background: var(--panel-3); color: var(--text); border-color: var(--border-strong); }
.line-strip { display: flex; align-items: center; min-height: 98px; margin-top: 15px; overflow-x: auto; padding: 10px 2px 16px; scrollbar-color: #394250 transparent; scrollbar-width: thin; }
.strip-station { width: 112px; flex: 0 0 112px; text-align: center; }
.strip-code { display: inline-grid; place-items: center; min-width: 41px; height: 25px; padding: 0 7px; border-radius: 6px; background: var(--strip-color); color: white; font-size: .68rem; font-weight: 850; }
.line-strip[data-line="CCL"] .strip-code { color: #17110a; }
.strip-station strong { display: block; margin-top: 7px; font-size: .7rem; line-height: 1.15; }
.strip-link { min-width: 52px; flex: 0 0 52px; display: grid; justify-items: center; gap: 4px; color: var(--muted-2); font-size: .64rem; }
.strip-link i { display: block; width: 100%; height: 3px; background: var(--strip-color); opacity: .9; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.info-panel { padding: 24px; min-width: 0; }
.info-panel + .info-panel { border-left: 1px solid var(--border); }
.info-panel p { color: var(--muted); font-size: .8rem; }
.info-panel strong { color: #dce2e9; }
.source-cards { display: grid; gap: 7px; margin-top: 14px; }
.source-card { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; background: #0a0e13; }
.source-card:hover { border-color: var(--border-strong); }
.source-card .route-line-pill { height: 26px; min-width: 43px; font-size: .66rem; }
.source-card strong { display: block; font-size: .76rem; }
.source-card small { display: block; color: var(--muted-2); font-size: .66rem; }
.source-card > span:last-child { color: var(--muted-2); }
.site-footer { width: min(1160px, calc(100% - 36px)); margin: -36px auto 32px; color: var(--muted-2); font-size: .69rem; }

@media (max-width: 900px) {
  .trip-options { grid-template-columns: 1fr 1fr; }
  .go-btn { grid-column: 1 / -1; width: 100%; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .time-hero { grid-column: 1 / -1; }
  .metric { border-left: 0; border-top: 1px solid var(--border); }
  .metric:nth-child(3) { border-left: 1px solid var(--border); }
  .section-heading, .line-summary { flex-direction: column; }
  .line-tabs { justify-content: flex-start; }
  .line-summary p { text-align: left; }
}

@media (max-width: 700px) {
  .header-inner { min-height: auto; padding: 14px 0; align-items: flex-start; flex-direction: column; gap: 10px; }
  .network-badges { justify-content: flex-start; }
  .page-shell { margin-top: 16px; gap: 12px; }
  .planner-panel, .result-panel { padding: 20px; border-radius: 16px; }
  .journey-inputs { grid-template-columns: minmax(0,1fr) 46px; grid-template-areas: "from from" "to swap"; row-gap: 10px; }
  .swap-btn { width: 46px; height: 46px; margin-bottom: 4px; transform: rotate(90deg); }
  .trip-options { grid-template-columns: 1fr; }
  .go-btn { grid-column: auto; min-height: 50px; }
  .journey-clock { grid-template-columns: 1fr auto 1fr; gap: 10px; padding: 17px 15px; }
  .clock-duration { align-self: center; }
  .clock-duration small { display: none; }
  .result-topline { flex-direction: column; }
  .timeline-heading { align-items: flex-start; flex-direction: column; }
  .info-grid { grid-template-columns: 1fr; }
  .info-panel + .info-panel { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 480px) {
  .header-inner, .page-shell, .site-footer { width: calc(100% - 24px); }
  .brand-copy small { display: none; }
  .network-badges { gap: 4px; }
  .network-badge { min-width: 34px; height: 24px; padding: 0 6px; font-size: .63rem; }
  .planner-panel, .result-panel { padding: 17px; }
  .planner-copy h1 { font-size: 1.7rem; }
  .planner-copy > p:last-child { font-size: .84rem; }
  .station-field input { height: 54px; }
  .quick-row > span { width: 100%; }
  .journey-clock { grid-template-columns: 1fr 74px 1fr; }
  .clock-point strong { font-size: 1.62rem; }
  .clock-point small { max-width: 110px; }
  .clock-arrive small { margin-left: auto; }
  .clock-track { grid-template-columns: 8px 1fr 8px; }
  .clock-track i { width: 8px; height: 8px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .time-hero { padding: 16px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 1.12rem; }
  .route-ribbon { gap: 6px; }
  .station-list { padding-left: 8px; padding-right: 8px; }
  .station-row { grid-template-columns: 48px 14px minmax(0,1fr); gap: 7px; }
  .station-row::before { left: 61px; }
  .segment-minute { display: none; }
  .station-clock { font-size: .7rem; }
  .station-label strong { font-size: .8rem; }
  .transfer-leg { grid-template-columns: 48px 31px minmax(0,1fr); padding: 11px 8px; gap: 7px; }
  .transfer-leg > b { grid-column: 3; font-size: .72rem; }
  .transfer-clock { font-size: .68rem; }
  .leg-head { padding: 10px 11px; }
  .leg-heading span { white-space: normal; line-height: 1.3; }
  .explorer-panel > summary, .method-panel > summary { padding: 15px 17px; }
  .summary-action { display: none; }
  .explorer-content, .info-panel { padding: 17px; }
  .source-card { grid-template-columns: 43px minmax(0,1fr); }
  .source-card > span:last-child { display: none; }
}

/* v0.4 — dynamic station search, wait simulation and interchange controls */
:root { --cgl: var(--ewl); }
button, input, select { font: inherit; }
.CGL { --line: var(--cgl); }
.network-badge.CGL, .route-line-pill.CGL { background: var(--cgl); }

.station-search { position: relative; min-width: 0; width: 100%; }
.station-search > input { width: 100%; }
.station-suggestions {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 7px);
  max-height: 310px; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border: 1px solid var(--border-strong); border-radius: 13px;
  background: #10161e; box-shadow: 0 18px 45px rgba(0,0,0,.42);
}
.station-suggestions[hidden] { display: none; }
.station-suggestion {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: minmax(0,1fr) auto;
  align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; text-align: left; cursor: pointer;
}
.station-suggestion:hover, .station-suggestion.active { background: var(--panel-3); }
.suggestion-name { min-width: 0; font-size: .88rem; font-weight: 760; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-codes { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.suggestion-code { min-width: 33px; height: 23px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 5px; background: var(--line); color: white; font-size: .63rem; font-weight: 850; }
.suggestion-code.CCL { color: #17110a; }

.trip-options {
  grid-template-columns: minmax(215px,1.1fr) minmax(130px,.55fr) minmax(190px,.85fr) minmax(255px,1.05fr) auto;
}
.wait-control, .je-control { min-width: 0; }
.wait-control small, .je-control small { display: block; margin-top: 6px; color: var(--muted-2); font-size: .68rem; line-height: 1.35; }
.number-input-shell { height: 46px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; border: 1px solid var(--border); border-radius: 11px; background: var(--input); overflow: hidden; }
.number-input-shell:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(134,183,255,.12); }
.number-input-shell input { width: 100%; min-width: 0; height: 44px; border: 0; outline: 0; padding: 0 12px; background: transparent; color: var(--text); font-size: 16px; }
.number-input-shell > span { padding-right: 12px; color: var(--muted); font-size: .75rem; }
.je-control select { width: 100%; min-width: 0; height: 46px; padding: 0 34px 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--input); color: var(--text); font-size: 16px; }

.result-grid { grid-template-columns: minmax(210px,1.5fr) repeat(4,minmax(92px,.68fr)); }
.wait-leg {
  display: grid; grid-template-columns: 58px 34px minmax(0,1fr) auto; align-items: center; gap: 9px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 13px; background: rgba(105,145,210,.055);
}
.wait-clock { color: #c8d0da; font-size: .75rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.wait-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-3); color: var(--focus); }
.wait-copy { min-width: 0; }
.wait-copy strong { display: block; font-size: .84rem; }
.wait-copy span { display: block; color: var(--muted); font-size: .71rem; }
.wait-leg > b { white-space: nowrap; font-size: .8rem; }
.transfer-leg.platform-a { border-style: solid; border-color: rgba(250,158,13,.34); background: rgba(250,158,13,.045); }

@media (max-width: 1080px) {
  .trip-options { grid-template-columns: 1fr 1fr; }
  .go-btn { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr 1fr; }
  .time-hero { grid-column: 1 / -1; }
  .result-grid .metric { border-top: 1px solid var(--border); border-left: 0; }
  .result-grid .metric:nth-child(odd) { border-left: 1px solid var(--border); }
}

@media (max-width: 700px) {
  .trip-options { grid-template-columns: 1fr; }
  .go-btn { grid-column: auto; }
  .station-suggestions { max-height: 245px; }
}

@media (max-width: 480px) {
  .station-suggestion { min-height: 52px; padding: 9px; }
  .suggestion-name { font-size: .84rem; white-space: normal; line-height: 1.2; }
  .suggestion-codes { max-width: 108px; }
  .wait-leg { grid-template-columns: 48px 31px minmax(0,1fr); padding: 10px 8px; gap: 7px; }
  .wait-leg > b { grid-column: 3; font-size: .72rem; }
  .wait-clock { font-size: .68rem; }
}
.station-suggestion-empty { padding: 13px 10px; color: var(--muted); font-size: .8rem; }
.planner-panel { position: relative; z-index: 2; overflow: visible; }

/* v0.5 — route-local wait controls, clearable search and directional cross-platform transfers */
.station-search > input {
  padding-right: 50px;
}
.station-search > input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.search-clear {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 8px;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}
.search-clear:hover { background: var(--panel-3); color: var(--text); }
.search-clear[hidden] { display: none; }

/* The planner only contains route-level settings. Interchange-specific controls
   live beside the interchange they affect in the result timeline. */
.trip-options {
  grid-template-columns: minmax(230px,.9fr) minmax(280px,1fr) auto;
}

.wait-adjust {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 98px;
}
.wait-adjust > span:first-child {
  color: var(--muted-2);
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.wait-adjust-shell {
  display: grid;
  grid-template-columns: 42px auto;
  align-items: center;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--input);
  overflow: hidden;
}
.wait-adjust-shell:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(134,183,255,.12);
}
.wait-adjust-shell input {
  width: 42px;
  min-width: 0;
  height: 32px;
  padding: 0 3px 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  text-align: right;
}
.wait-adjust-shell > span {
  padding: 0 8px 0 3px;
  color: var(--muted);
  font-size: .68rem;
}

.transfer-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
  min-width: 118px;
}
.transfer-actions > b {
  white-space: nowrap;
  font-size: .8rem;
}
.je-inline-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 28px;
  cursor: pointer;
  user-select: none;
}
.je-inline-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #222b36;
  transition: background .16s ease, border-color .16s ease;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d8dee6;
  transition: transform .16s ease;
}
.je-inline-toggle input:checked + .toggle-track {
  background: rgba(250,158,13,.28);
  border-color: rgba(250,158,13,.7);
}
.je-inline-toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.je-inline-toggle input:focus-visible + .toggle-track { outline: 3px solid rgba(134,183,255,.35); outline-offset: 2px; }
.toggle-label {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .trip-options { grid-template-columns: 1fr 1fr; }
  .go-btn { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 700px) {
  .trip-options { grid-template-columns: 1fr; }
  .go-btn { grid-column: auto; }
  .transfer-actions, .wait-adjust { justify-items: start; }
}

@media (max-width: 480px) {
  .search-clear { width: 36px; height: 36px; right: 7px; }
  .station-search > input { padding-right: 46px; }
  .wait-leg { grid-template-columns: 48px 31px minmax(0,1fr); }
  .wait-adjust { grid-column: 3; justify-items: start; min-width: 0; }
  .transfer-leg { grid-template-columns: 48px 31px minmax(0,1fr); }
  .transfer-actions { grid-column: 3; justify-items: start; min-width: 0; }
  .je-inline-toggle { justify-content: flex-start; }
}


/* v0.6 — quieter result UI + Bukit Panjang LRT */
:root { --bplrt: #748477; }
.BPLRT { --line: var(--bplrt); }
.network-badge.BPLRT, .route-line-pill.BPLRT { background: var(--bplrt); }

/* Only the three route-level controls remain in the planner. */
.trip-options { grid-template-columns: minmax(230px,.9fr) minmax(280px,1fr) auto; }

/* The result should read as the clock + useful numbers + timeline. */
.time-hero { align-content: center; }
.sources-content { padding: 20px 24px 24px; }
.sources-content .source-cards { margin-top: 0; grid-template-columns: repeat(2, minmax(0,1fr)); }
.sources-content .source-card { min-width: 0; }

@media (max-width: 1080px) {
  .trip-options { grid-template-columns: 1fr 1fr; }
  .go-btn { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 700px) {
  .trip-options { grid-template-columns: 1fr; }
  .go-btn { grid-column: auto; }
  .sources-content .source-cards { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .sources-content { padding: 14px 17px 17px; }
}

/* v0.7 — depart-at / arrive-by journey timing */
.time-control { display: grid; gap: 8px; }
.time-mode-switch { margin: 0; padding: 0; border: 0; min-width: 0; }
.time-mode-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.time-mode-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  width: 100%; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--input);
}
.time-mode-options label { min-width: 0; cursor: pointer; }
.time-mode-options input { position: absolute; opacity: 0; pointer-events: none; }
.time-mode-options span {
  min-height: 34px; display: grid; place-items: center; padding: 0 9px; border-radius: 7px;
  color: var(--muted); font-size: .73rem; font-weight: 800; white-space: nowrap;
}
.time-mode-options input:checked + span { background: var(--panel-3); color: var(--text); }
.time-mode-options input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.time-value-label { display: block; min-width: 0; }

@media (max-width: 700px) {
  .time-mode-options span { min-height: 40px; font-size: .78rem; }
}

/* v0.8 — optional CRL1/2 future-network simulation */
:root { --crl: #97c616; }
.CRL { --line: var(--crl); }
.network-badge.CRL, .route-line-pill.CRL { background: var(--crl); color: #11180a; }
.suggestion-code.CRL { color: #11180a; }
.line-tab.active[data-line="CRL"] { color: #11180a; }
.line-strip[data-line="CRL"] .strip-code { color: #11180a; }

.future-lines-toggle {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.future-lines-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.future-toggle-track {
  position: relative;
  width: 34px;
  height: 19px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #202833;
  transition: background .16s ease, border-color .16s ease;
}
.future-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #d9e0e7;
  transition: transform .16s ease;
}
.future-lines-toggle input:checked + .future-toggle-track {
  background: rgba(151,198,22,.24);
  border-color: rgba(151,198,22,.7);
}
.future-lines-toggle input:checked + .future-toggle-track::after { transform: translateX(15px); background: #dff3a9; }
.future-lines-toggle input:focus-visible + .future-toggle-track { outline: 3px solid rgba(134,183,255,.35); outline-offset: 2px; }
.future-toggle-copy { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.future-toggle-copy strong { color: var(--muted); font-size: .72rem; font-weight: 780; }
.future-toggle-copy small { color: var(--muted-2); font-size: .66rem; }

.future-comparison {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.future-comparison[hidden] { display: none; }
.future-comparison > span { color: #cdd5de; font-weight: 800; }
.future-comparison > small { color: var(--muted-2); font-size: .72rem; }

@media (max-width: 480px) {
  .future-lines-toggle { margin-top: 14px; }
  .future-toggle-copy { align-items: flex-start; flex-direction: column; gap: 0; }
}
.network-badge[hidden] { display: none; }


/* v1.0 — all three LRT systems + fully reactive planner */
:root { --lrt: #748477; }
.network-badge.SKLRT_E, .network-badge.SKLRT_W, .route-line-pill.SKLRT_E, .route-line-pill.SKLRT_W,
.network-badge.PGLRT_E, .network-badge.PGLRT_W, .route-line-pill.PGLRT_E, .route-line-pill.PGLRT_W { background: var(--lrt); }
.SKLRT_E, .SKLRT_W, .PGLRT_E, .PGLRT_W { --line: var(--lrt); }
.trip-options { grid-template-columns: minmax(230px,.9fr) minmax(280px,1fr); }
@media (max-width:900px) { .trip-options { grid-template-columns: 1fr 1fr; } }
@media (max-width:700px) { .trip-options { grid-template-columns: 1fr; } }

/* v1.1 — full A–Z station browser */
.station-suggestions {
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* v1.2 — first / last available service-boundary planner */
.service-mode-controls {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.journey-mode-switch,
.service-day-control {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.journey-mode-switch legend,
.service-day-control legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.journey-mode-options,
.service-day-options {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(max-content, 1fr);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input);
}
.journey-mode-options label,
.service-day-options label { cursor: pointer; min-width: 0; }
.journey-mode-options input,
.service-day-options input { position: absolute; opacity: 0; pointer-events: none; }
.journey-mode-options span,
.service-day-options span {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 760;
  white-space: nowrap;
}
.journey-mode-options input:checked + span,
.service-day-options input:checked + span { background: var(--panel-3); color: var(--text); }
.journey-mode-options input:focus-visible + span,
.service-day-options input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.service-day-control[hidden],
#normalTimeControl[hidden] { display: none !important; }
.boundary-wait {
  white-space: nowrap;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 760;
}
.service-boundary-note {
  color: var(--muted-2);
  font-size: .7rem;
}

@media (max-width: 700px) {
  .service-mode-controls { display: grid; grid-template-columns: 1fr; }
  .journey-mode-options,
  .service-day-options { width: 100%; grid-auto-columns: 1fr; }
  .journey-mode-options span,
  .service-day-options span { padding: 0 8px; white-space: normal; text-align: center; line-height: 1.15; }
}

@media (max-width: 420px) {
  .journey-mode-options span { font-size: .7rem; }
}

.future-lines-toggle[hidden] { display: none !important; }

/* v1.4 — GPS live-trip tracking */
.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.live-trip-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(93, 211, 139, .34);
  border-radius: 999px;
  background: rgba(55, 179, 105, .10);
  color: #a9e8c1;
  cursor: pointer;
  font-size: .7rem;
  font-weight: 820;
  white-space: nowrap;
}
.live-trip-btn:hover { background: rgba(55, 179, 105, .16); }
.live-trip-btn:disabled { opacity: .48; cursor: not-allowed; }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ed58e;
  box-shadow: 0 0 0 3px rgba(94, 213, 142, .11);
}

.live-trip-panel {
  margin-top: 14px;
  border: 1px solid rgba(94, 213, 142, .23);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(44, 133, 81, .10), rgba(10, 14, 19, .94) 52%);
  overflow: hidden;
}
.live-trip-panel[hidden] { display: none; }
.live-trip-main {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px 20px 15px;
}
.live-trip-status { min-width: 0; }
.live-trip-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #83dca6;
  font-size: .67rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .11em;
}
.live-trip-kicker i { width: 7px; height: 7px; border-radius: 50%; background: #5ed58e; }
.live-trip-status > strong {
  display: block;
  margin-top: 5px;
  font-size: 1.02rem;
  letter-spacing: -.025em;
}
.live-trip-status > small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
}
.live-trip-countdown { text-align: right; min-width: 112px; }
.live-trip-countdown > span {
  display: block;
  color: var(--muted);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.live-trip-countdown > strong {
  display: block;
  margin-top: 1px;
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.live-trip-countdown > small { display: block; margin-top: 4px; color: var(--muted); font-size: .69rem; }
.live-trip-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: .67rem;
}
.live-trip-footer > span.weak { color: #e9bd69; }
.live-trip-footer button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--muted);
  cursor: pointer;
  font-size: .68rem;
  font-weight: 760;
}
.live-trip-error {
  margin: 0;
  padding: 9px 20px 11px;
  border-top: 1px solid rgba(255, 105, 105, .18);
  color: #ff9999;
  background: rgba(185, 55, 55, .06);
  font-size: .7rem;
}
.live-trip-error[hidden] { display: none; }

.station-clock,
.transfer-clock,
.wait-clock { white-space: nowrap; }
.live-clock-value { font-variant-numeric: tabular-nums; }
.live-delay-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  margin-left: 3px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: .54rem;
  line-height: 1.35;
  font-weight: 900;
  vertical-align: 1px;
}
.live-delay-badge[hidden] { display: none; }
.live-delay-badge.late { color: #ff8888; background: rgba(255, 92, 92, .10); }
.live-delay-badge.early { color: #76dca0; background: rgba(72, 190, 120, .10); }
.station-row.live-passed { opacity: .55; }
.station-row.live-current .station-dot {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--leg-color,#667) 22%, transparent);
}
.station-row.live-current .station-label strong { color: #fff; }
.station-row.live-next .station-label strong { color: #dfe8f2; }

@media (max-width: 700px) {
  .result-actions { justify-content: flex-start; }
  .live-trip-main { grid-template-columns: minmax(0,1fr) auto; padding: 16px; gap: 12px; }
  .live-trip-footer { padding-left: 16px; }
}

@media (max-width: 480px) {
  .live-trip-main { grid-template-columns: 1fr; }
  .live-trip-countdown { text-align: left; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
  .live-trip-countdown > span { width: 100%; }
  .live-trip-countdown > strong { font-size: 1.4rem; }
  .live-trip-countdown > small { margin-top: 0; }
  .live-trip-footer { align-items: flex-start; flex-direction: column; padding: 10px 14px; }
  .live-trip-footer button { width: 100%; }
  .live-delay-badge { margin-left: 2px; padding: 0 2px; font-size: .5rem; }
}


/* v1.6 — first / last train leg indicators */
.service-boundary-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .62rem;
  line-height: 1;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.service-boundary-indicator.first { color: #55d98a; background: rgba(85,217,138,.10); }
.service-boundary-indicator.last { color: #ff6262; background: rgba(255,98,98,.10); }
@media (max-width: 560px) {
  .leg-head { flex-wrap: wrap; }
  .service-boundary-indicator { order: 3; margin-left: 56px; }
  .leg-time { margin-left: auto; }
}

/* v1.6.1 — keep train-leg headers readable on narrow screens.
   The service-boundary badge must not compete with the route description for
   horizontal space.  On phones the time + boundary badge occupy a dedicated
   right-hand column while the line pill and journey copy retain usable width. */
@media (max-width: 560px) {
  .leg-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "pill heading time"
      "pill heading boundary";
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    flex-wrap: initial;
  }

  .leg-head > .route-line-pill {
    grid-area: pill;
    align-self: center;
  }

  .leg-heading {
    grid-area: heading;
    min-width: 0;
  }

  .leg-heading strong,
  .leg-heading span {
    overflow-wrap: normal;
    word-break: normal;
  }

  .leg-heading span {
    white-space: normal;
    line-height: 1.35;
  }

  .leg-time {
    grid-area: time;
    justify-self: end;
    margin-left: 0;
    text-align: right;
  }

  .service-boundary-indicator {
    grid-area: boundary;
    order: initial;
    justify-self: end;
    margin-left: 0;
  }
}

@media (max-width: 390px) {
  .leg-head {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "pill heading"
      "time time"
      "boundary boundary";
  }
  .leg-time,
  .service-boundary-indicator {
    justify-self: start;
    margin-left: 56px;
  }
}

/* First / last train explorer */
.service-explorer-content { padding: 22px 24px 26px; }
.service-explorer-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.service-explorer-head h2 { margin: 0 0 5px; font-size: 1.28rem; }
.service-explorer-head p { margin: 0; color: var(--muted); font-size: .82rem; }
.service-explorer-switches { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.compact-segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); background: #090d12; border-radius: 10px; }
.compact-segmented button { min-height: 34px; border: 0; border-radius: 7px; padding: 0 12px; background: transparent; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 750; cursor: pointer; }
.compact-segmented button.active { background: #1a222c; color: var(--text); }
.service-line-tabs { margin-top: 18px; justify-content: flex-start; }
.service-schedule-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.service-subhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.service-subhead h3 { margin: 2px 0 0; font-size: 1rem; }
.service-direction-tabs { margin: 0; justify-content: flex-end; }
.service-pattern-count { color: var(--muted-2); font-size: .7rem; font-weight: 700; }

.service-direction-tabs { gap: 8px; }
.service-direction-tabs .service-pattern-tab { white-space: normal; line-height: 1.2; text-align: left; max-width: 100%; }
@media (max-width: 640px) {
  .service-direction-tabs .service-pattern-tab { flex: 1 1 calc(50% - 8px); min-width: min(180px, 100%); }
}
.service-schedule-list { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: #090d12; }
.service-schedule-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 14px; min-height: 48px; padding: 9px 13px; border-top: 1px solid var(--border); }
.service-schedule-row:first-child { border-top: 0; }
.service-schedule-header { min-height: 36px; color: var(--muted-2); background: #0c1117; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.service-station-cell { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.service-station-cell strong { min-width: 0; font-size: .8rem; overflow-wrap: anywhere; }
.service-station-cell small { color: var(--muted-2); font-size: .66rem; flex: 0 0 auto; }
.service-departure-time { font-variant-numeric: tabular-nums; font-size: .86rem; }
.service-pattern-list { display: grid; gap: 8px; }
.service-pattern-card { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: #090d12; }
.service-pattern-card > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; cursor: pointer; }
.service-pattern-card > summary::-webkit-details-marker { display: none; }
.service-pattern-card[open] > summary { border-bottom: 1px solid var(--border); }
.service-pattern-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.service-pattern-main > div { min-width: 0; }
.service-pattern-main strong { display: block; font-size: .8rem; white-space: normal; }
.service-pattern-main small { display: block; margin-top: 3px; color: var(--muted-2); font-size: .64rem; text-transform: capitalize; }
.service-pattern-time { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.service-pattern-time strong { display: block; font-size: .84rem; }
.service-pattern-time small { display: block; margin-top: 2px; color: var(--muted-2); font-size: .63rem; }
.service-pattern-body { padding: 10px 13px 13px; }
.service-pattern-source { margin: 0 0 9px; color: var(--muted-2); font-size: .66rem; line-height: 1.45; }
.pattern-stop-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pattern-stop-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--border); }
.pattern-stop-row:first-child { border-top: 0; }
.pattern-stop-row > span { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.pattern-stop-row > span strong { font-size: .74rem; }
.pattern-stop-row > span small { color: var(--muted-2); font-size: .62rem; }
.pattern-stop-row > strong { font-size: .74rem; font-variant-numeric: tabular-nums; }
.service-empty { margin: 0; padding: 16px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 11px; font-size: .78rem; }

@media (max-width: 720px) {
  .service-explorer-content { padding: 17px; }
  .service-explorer-head, .service-subhead { align-items: flex-start; flex-direction: column; }
  .service-explorer-switches { width: 100%; justify-content: flex-start; }
  .compact-segmented { width: 100%; }
  .compact-segmented button { flex: 1 1 0; min-width: 0; }
  .service-direction-tabs { justify-content: flex-start; width: 100%; }
  .service-pattern-card > summary { align-items: flex-start; }
  .service-pattern-main { align-items: flex-start; }
  .service-pattern-time { min-width: 72px; }
}

@media (max-width: 430px) {
  .service-pattern-card > summary { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .service-pattern-main .route-line-pill { min-width: 42px; }
  .service-station-cell { flex-direction: column; gap: 1px; }
  .pattern-stop-row > span { flex-direction: column; gap: 1px; }
}

/* v1.8 — GTFS schedule source */
.route-line-pill.gtfs-pill { background: #46515f; color: #fff; }

/* v1.10 — compact service-working browser */
.service-pattern-picker {
  margin: 2px 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #090d12;
  overflow: hidden;
}
.service-pattern-picker > summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  cursor: pointer;
}
.service-pattern-picker > summary::-webkit-details-marker { display: none; }
.service-pattern-picker[open] > summary { border-bottom: 1px solid var(--border); background: #0c1117; }
.service-picker-summary-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.service-picker-summary-text small {
  color: var(--muted-2);
  font-size: .61rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.service-picker-summary-text strong {
  min-width: 0;
  color: var(--text);
  font-size: .88rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.service-picker-summary-text > span {
  min-width: 0;
  color: var(--muted);
  font-size: .67rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.service-picker-time {
  color: var(--text);
  font-size: .95rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.service-picker-chevron { color: var(--muted-2); font-size: 1.05rem; transition: transform .16s ease; }
.service-pattern-picker[open] .service-picker-chevron { transform: rotate(180deg); }
.service-pattern-menu { padding: 10px; background: #070b0f; }
.service-pattern-group + .service-pattern-group { margin-top: 12px; }
.service-pattern-group-title {
  padding: 3px 7px 7px;
  color: var(--muted-2);
  font-size: .62rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.service-working-option {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.service-working-option + .service-working-option { margin-top: 3px; }
.service-working-option:hover { background: #0d131a; }
.service-working-option.active { background: #121a23; border-color: var(--border-strong); }
.service-working-route { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.service-working-route strong {
  min-width: 0;
  color: var(--text);
  font-size: .78rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.service-working-route small {
  min-width: 0;
  color: var(--muted-2);
  font-size: .64rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.service-working-option time {
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.service-schedule-list { margin-top: 14px; }

@media (max-width: 520px) {
  .service-pattern-picker > summary {
    grid-template-columns: auto minmax(0,1fr) auto;
    gap: 10px;
    padding: 11px 12px;
  }
  .service-picker-time { grid-column: 3; grid-row: 1; }
  .service-picker-chevron { display: none; }
  .service-picker-summary-text > span { display: none; }
  .service-working-option { min-height: 54px; padding: 9px 10px; }
  .service-pattern-menu { padding: 8px; }
}

/* v1.10 — all-day Schedule Explorer */
.schedule-explorer-content { padding: 24px; }
.schedule-explorer-head { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; }
.schedule-explorer-head h2 { margin:0 0 5px; font-size:1.28rem; }
.schedule-explorer-head p { margin:0; max-width:690px; color:var(--muted); font-size:.82rem; }
.schedule-disclaimer { display:grid; grid-template-columns:32px minmax(0,1fr); gap:12px; align-items:start; margin-top:18px; padding:13px 14px; border:1px solid rgba(134,183,255,.18); border-radius:13px; background:rgba(134,183,255,.055); }
.schedule-disclaimer-icon { width:28px; height:28px; display:grid; place-items:center; border:1px solid rgba(134,183,255,.30); border-radius:50%; color:#acd0ff; font-size:.78rem; font-weight:900; }
.schedule-disclaimer p { margin:0; color:var(--muted); font-size:.72rem; line-height:1.55; }
.schedule-disclaimer strong { color:#dce9f8; }
.schedule-line-tabs { margin-top:18px; justify-content:flex-start; }
.schedule-control-grid { display:grid; grid-template-columns:minmax(240px,.8fr) minmax(0,1.2fr); gap:14px; align-items:end; margin-top:18px; padding-top:18px; border-top:1px solid var(--border); }
.schedule-station-picker, .schedule-direction-control { min-width:0; }
.schedule-select-shell { position:relative; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; min-height:52px; border:1px solid var(--border-strong); border-radius:13px; background:#090d12; overflow:hidden; }
.schedule-station-code { display:grid; place-items:center; align-self:stretch; min-width:59px; padding:0 10px; background:var(--schedule-line-color,#46515f); color:#fff; font-size:.72rem; font-weight:900; }
.schedule-select-shell select { min-width:0; width:100%; height:50px; border:0; outline:0; appearance:none; -webkit-appearance:none; background:transparent; color:var(--text); padding:0 34px 0 13px; font:inherit; font-size:16px; }
.schedule-select-chevron { position:absolute; right:12px; color:var(--muted-2); pointer-events:none; }
.schedule-direction-tabs { display:flex; flex-wrap:wrap; gap:7px; min-height:52px; align-items:center; }
.schedule-direction-tab { min-height:42px; max-width:100%; border:1px solid var(--border); border-radius:999px; background:#090d12; color:var(--muted); padding:7px 12px; cursor:pointer; font:inherit; font-size:.72rem; font-weight:760; line-height:1.2; text-align:left; }
.schedule-direction-tab.active { border-color:color-mix(in srgb, var(--schedule-line-color,#86b7ff) 55%, white 0%); background:color-mix(in srgb, var(--schedule-line-color,#86b7ff) 16%, #090d12); color:var(--text); }
.schedule-overview { margin-top:20px; border:1px solid var(--border); border-radius:16px; background:#090d12; overflow:hidden; }
.schedule-overview-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:17px 18px 15px; }
.schedule-overview-heading h3 { font-size:1.08rem; }
.schedule-overview-heading p { margin:4px 0 0; color:var(--muted); font-size:.72rem; }
.schedule-source-legend { display:flex; align-items:center; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.schedule-legend-item { display:inline-flex; align-items:center; gap:6px; min-height:27px; padding:0 9px; border:1px solid var(--border); border-radius:999px; color:var(--muted); font-size:.64rem; font-weight:760; }
.schedule-legend-item i { width:7px; height:7px; border-radius:50%; background:#6e7a89; }
.schedule-legend-item.derived i { background:#ffb052; }
.schedule-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); border-top:1px solid var(--border); }
.schedule-kpis > div { min-width:0; padding:13px 15px; border-left:1px solid var(--border); }
.schedule-kpis > div:first-child { border-left:0; }
.schedule-kpis span { display:block; color:var(--muted-2); font-size:.62rem; font-weight:820; text-transform:uppercase; letter-spacing:.08em; }
.schedule-kpis strong { display:block; margin-top:4px; font-size:1.05rem; font-variant-numeric:tabular-nums; }
.service-pulse-section { margin-top:18px; padding:18px; border:1px solid var(--border); border-radius:16px; background:#090d12; }
.schedule-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.schedule-section-heading h3 { font-size:1rem; }
.schedule-section-heading p { margin:4px 0 0; color:var(--muted); font-size:.7rem; }
.schedule-section-heading.compact { align-items:end; }
.service-pulse-readout { flex:0 0 auto; min-height:30px; display:inline-flex; align-items:center; border:1px solid var(--border); border-radius:999px; padding:0 10px; color:var(--muted); font-size:.66rem; font-variant-numeric:tabular-nums; }
.service-pulse-chart { min-height:240px; margin-top:14px; }
.service-pulse-chart svg { display:block; width:100%; height:auto; min-height:220px; overflow:visible; touch-action:pan-y; }
.pulse-grid { stroke:rgba(255,255,255,.075); stroke-width:1; }
.pulse-axis-label { fill:var(--muted-2); font-size:11px; font-family:inherit; }
.pulse-area { opacity:.14; }
.pulse-line { fill:none; stroke-width:3; stroke-linejoin:round; stroke-linecap:round; }
.pulse-point { stroke:#090d12; stroke-width:2; }
.pulse-hit { fill:transparent; cursor:crosshair; }
.pulse-crosshair { stroke:rgba(255,255,255,.28); stroke-width:1; stroke-dasharray:3 4; pointer-events:none; }
.pulse-active-dot { stroke:#090d12; stroke-width:3; pointer-events:none; }
.schedule-data-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr); gap:16px; margin-top:18px; align-items:start; }
.departure-board-section, .frequency-table-section { min-width:0; padding:17px; border:1px solid var(--border); border-radius:16px; background:#090d12; }
.schedule-small-count { color:var(--muted-2); font-size:.68rem; font-weight:750; }
.departure-board { display:grid; gap:8px; margin-top:13px; }
.departure-hour { display:grid; grid-template-columns:54px minmax(0,1fr); gap:12px; align-items:start; padding:10px 0; border-top:1px solid var(--border); }
.departure-hour:first-child { border-top:0; padding-top:2px; }
.departure-hour-label { position:sticky; top:0; display:flex; flex-direction:column; color:var(--text); font-size:.88rem; font-weight:850; font-variant-numeric:tabular-nums; }
.departure-hour-label small { margin-top:1px; color:var(--muted-2); font-size:.58rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; }
.departure-minute-grid { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
.departure-chip { position:relative; min-width:51px; min-height:30px; display:inline-flex; align-items:center; justify-content:center; gap:5px; border:1px solid var(--border); border-radius:9px; background:#0c1117; color:#e7ecf3; padding:0 8px; font-size:.69rem; font-weight:780; font-variant-numeric:tabular-nums; }
.departure-chip.derived { border-color:rgba(255,176,82,.34); background:rgba(255,176,82,.07); color:#ffd39b; }
.departure-chip.derived::after { content:''; width:5px; height:5px; border-radius:50%; background:#ffb052; }
.departure-chip .chip-destination { color:var(--muted-2); font-size:.57rem; font-weight:650; }
.frequency-table-wrap { margin-top:13px; overflow-x:auto; }
.frequency-table { width:100%; border-collapse:collapse; font-size:.69rem; font-variant-numeric:tabular-nums; }
.frequency-table th { padding:8px 8px; color:var(--muted-2); font-size:.58rem; text-align:left; text-transform:uppercase; letter-spacing:.07em; border-bottom:1px solid var(--border); white-space:nowrap; }
.frequency-table td { padding:9px 8px; color:#d9e0e8; border-bottom:1px solid var(--border); white-space:nowrap; }
.frequency-table tr:last-child td { border-bottom:0; }
.frequency-table td:nth-child(n+2), .frequency-table th:nth-child(n+2) { text-align:right; }
.frequency-table .hour-peak td { color:#fff; background:rgba(255,255,255,.018); }
.schedule-empty { padding:28px 12px; text-align:center; color:var(--muted); font-size:.75rem; }

@media (max-width: 860px) {
  .schedule-control-grid, .schedule-data-grid { grid-template-columns:1fr; }
  .schedule-kpis { grid-template-columns:1fr 1fr; }
  .schedule-kpis > div:nth-child(3) { border-left:0; border-top:1px solid var(--border); }
  .schedule-kpis > div:nth-child(4) { border-top:1px solid var(--border); }
}

@media (max-width: 720px) {
  .schedule-explorer-content { padding:17px; }
  .schedule-explorer-head, .schedule-overview-heading, .schedule-section-heading { flex-direction:column; align-items:flex-start; }
  .schedule-explorer-head .compact-segmented { width:100%; }
  .schedule-source-legend { justify-content:flex-start; }
  .service-pulse-readout { align-self:stretch; justify-content:center; }
  .service-pulse-section, .departure-board-section, .frequency-table-section { padding:14px; }
  .service-pulse-chart { min-height:210px; overflow-x:auto; }
  .service-pulse-chart svg { min-width:620px; }
}

@media (max-width: 460px) {
  .schedule-disclaimer { grid-template-columns:1fr; }
  .schedule-disclaimer-icon { display:none; }
  .schedule-kpis { grid-template-columns:1fr 1fr; }
  .schedule-kpis > div { padding:11px 12px; }
  .schedule-kpis strong { font-size:.92rem; }
  .departure-hour { grid-template-columns:45px minmax(0,1fr); gap:8px; }
  .departure-chip { min-width:47px; padding:0 6px; }
  .schedule-direction-tab { flex:1 1 calc(50% - 7px); }
}

.boundary-model-note {
  margin-bottom: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  line-height: 1.45;
}
