:root {
  color-scheme: light;
  --ink: #18212c;
  --muted: #627080;
  --line: #dce2e8;
  --page: #f8fafb;
  --blue: #1766be;
  --green: #16803f;
  --red: #b42318;
}
* { box-sizing: border-box; letter-spacing: 0; }
html { scroll-padding-top: 90px; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--page); }
[hidden], body[data-signed-in="false"] [data-auth-only] { display: none !important; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, input, select { border-radius: 6px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 15px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-weight: 650; cursor: pointer; line-height: 1.35; }
button:hover { filter: brightness(.95); }
button.secondary { background: #fff; color: #324052; border-color: #cdd6df; }
button.ready { background: var(--green); border-color: var(--green); color: #fff; }
button.danger { background: #fff; color: var(--red); border-color: #efbcb6; }
button:disabled { cursor: not-allowed; background: #eef1f4; color: #8995a2; border-color: var(--line); filter: none; }
button.small { min-height: 36px; padding: 7px 10px; font-size: 12px; }
button.icon-button { width: 42px; min-width: 42px; height: 42px; padding: 0; flex: none; }
button.small.icon-button { width: 36px; min-width: 36px; height: 36px; }
button svg, summary svg, .account-link svg, .nav svg { width: 18px; height: 18px; flex: none; }
button[aria-busy="true"] svg { animation: spin 1s linear infinite; }
input, select { min-width: 0; width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd4de; color: var(--ink); background: #fff; font-weight: 450; }
input:disabled, select:disabled { background: #f0f3f5; color: #85929f; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--blue); padding: 0; margin: 0; flex: none; }
input[type="range"] { accent-color: var(--blue); padding: 0; border: 0; background: transparent; }
input[type="number"] { font-variant-numeric: tabular-nums; }
label { display: grid; gap: 6px; min-width: 0; font-size: 12px; color: #425164; font-weight: 600; }
fieldset { min-width: 0; }
:focus-visible { outline: 3px solid #79b7f2; outline-offset: 3px; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 80; padding: 12px; color: #fff; background: var(--blue); }
.skip-link:focus { top: 8px; }
.app-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; min-height: 76px; padding: 0 max(24px, calc((100% - 1240px)/2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; max-width: 100%; text-decoration: none; color: var(--ink); font-size: 16px; font-weight: 750; }
.brand-mark { color: var(--blue); width: 26px; height: 26px; flex: none; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav button { min-height: 76px; border: 0; border-radius: 0; padding: 0 15px; background: transparent; color: var(--muted); position: relative; white-space: nowrap; }
.nav button.active { color: var(--blue); background: #f2f7fd; }
.nav button.active::after { content: ""; position: absolute; bottom: 0; height: 3px; background: var(--blue); left: 15px; right: 15px; }
.nav-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; font-size: 11px; border-radius: 4px; color: #0f6931; background: #e1f1e6; }
.account-link { justify-self: end; display: inline-flex; align-items: center; gap: 7px; padding: 8px 0 8px 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.account-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.account-actions .account-link { padding-left: 0; }
.device-list { padding: 0; margin: 20px 0; list-style: none; }
.device-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.device-list h2 { margin: 0 0 6px; font-size: 16px; }
.device-list p { margin: 4px 0; }
.device-setting { display: flex; align-items: center; gap: 10px; padding: 18px 0; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 30px 24px 60px; }
.view-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.view-head h1 { font-size: 28px; font-weight: 700; line-height: 1.25; margin: 3px 0 0; }
.eyebrow { color: var(--muted); font-size: 12px; }
.view-head .action-row, .view-head .booking-controls { margin: 0; }
.journey-form { display: grid; grid-template-columns: minmax(320px, 2fr) minmax(190px, 1fr) 110px auto; gap: 14px; align-items: end; padding: 0 0 28px; border-bottom: 1px solid var(--line); }
.station-pair { display: grid; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr); align-items: end; gap: 8px; min-width: 0; }
.date-time-entry { display: flex; align-items: stretch; gap: 6px; position: relative; min-width: 0; }
.date-time-entry input[type="text"] { flex: 1; width: 0; }
.date-time-entry input[type="datetime-local"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.search { position: relative; min-width: 0; }
.hits { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 20px #14253615; }
.hit { padding: 10px 11px; cursor: pointer; border-bottom: 1px solid #edf1f4; }
.hit:hover { background: #edf5ff; }
.hit small { display: block; color: var(--muted); font-size: 10px; }
.msg { display: flex; align-items: center; gap: 8px; margin: 0 0 20px; padding: 11px 14px; border-left: 3px solid var(--blue); background: #edf4fc; overflow-wrap: anywhere; }
.msg:empty { display: none; }
.msg[data-state="error"] { color: #912018; background: #fff1ef; border-color: var(--red); }
.muted { color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 16px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.result-section { margin-top: 25px; }
.workflow-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.empty-state { padding: 44px 16px; display: grid; justify-items: center; gap: 10px; color: #6d7b8a; text-align: center; }
.empty-state svg { height: 32px; width: 32px; stroke-width: 1.5; color: #94a3b3; }
.empty-state h2 { margin: 0; font-size: 15px; font-weight: 500; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); }
.table-surface { width: 100%; overflow-x: auto; }
.table-surface:empty { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th { font-size: 11px; font-weight: 600; color: #667586; background: #edf1f5; text-transform: uppercase; white-space: nowrap; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
td { overflow-wrap: anywhere; }
.ticket-section { white-space: normal; overflow: visible; overflow-wrap: anywhere; padding: 3px 0; }
td[data-label="from / to"] { min-width: 130px; color: #26384c; font-weight: 600; }
td[data-label="date/time"] { min-width: 108px; font-variant-numeric: tabular-nums; }
td[data-label="train"] { min-width: 135px; font-weight: 600; }
td[data-label="route cost"], td[data-label="cost"] { font-weight: 600; font-variant-numeric: tabular-nums; }
td[data-label="action"] { min-width: 190px; }
td[data-label="action"] button { margin-bottom: 5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 4px; font-size: 11px; line-height: 1.5; font-weight: 650; white-space: nowrap; }
.free { color: #116329; background: #e0f2e6; }
.paid { color: #942c23; background: #fbe8e5; }
.split { color: #09558d; background: #e4f1fb; }
.current { color: #8b601a; background: #fcf0d2; }
.action-split { display: flex; align-items: flex-start; gap: 5px; }
.action-split > button { white-space: nowrap; }
.action-menu { position: relative; }
.action-menu summary { display: inline-flex; align-items: center; justify-content: center; list-style: none; width: 36px; height: 36px; cursor: pointer; border: 1px solid #cdd6df; border-radius: 6px; color: #425164; background: #fff; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu nav { display: grid; gap: 7px; padding: 8px 0 0; min-width: 115px; }
.action-menu nav button { width: 100%; }
.train-seat-action { display: flex; width: max-content; margin-top: 8px; font-size: 12px; }
.booking-controls, .action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.watch-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; margin: 0 0 24px; border: 1px solid #b8d7be; border-radius: 6px; background: #eff8f1; }
.watch-bar .booking-controls { margin: 0; }
.watch-bar.context-hidden { display: none; }
.watch-status { font-size: 13px; overflow-wrap: anywhere; }
.disclosure { border-bottom: 1px solid var(--line); padding: 0 0 16px; margin-top: 16px; }
.disclosure > summary { display: flex; align-items: center; gap: 9px; min-height: 42px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: "+"; color: var(--muted); margin-left: auto; font-weight: 500; font-size: 20px; }
.disclosure[open] > summary::after { content: "-"; }
.disclosure > summary .muted { margin-left: 4px; }
.disclosure[open] > summary { margin-bottom: 14px; }
.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
.seat-search-form { grid-template-columns: minmax(320px, 2fr) minmax(190px, 1fr) auto; }
.train-choice { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: end; gap: 16px; margin: 20px 0 0; }
.train-choice select { max-width: 100%; }
.seat-criteria { border: 0; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; }
.seat-criteria legend { color: #5f6d7c; margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.seat-criteria label { display: flex; gap: 8px; align-items: center; color: #354456; font-size: 13px; font-weight: 400; line-height: 1.4; }
.selection-toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.selection-toolbar label { min-width: 220px; max-width: 100%; }
.selection-count { font-size: 12px; color: var(--green); font-weight: 600; }
.seat-carriage-warning { color: #704300; background: #fff5db; border-left: 3px solid #ad7100; padding: 8px 12px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.rolling-seat-controls { margin: 15px 0 0; gap: 10px; }
#rollingSeatStart { width: 215px; max-width: 100%; }
#rollingSeatMessage { flex: 1 1 260px; min-width: 0; color: #285d3b; overflow-wrap: anywhere; }
#rollingSeatMessage[role="alert"] { color: var(--red); }
.seat-map-section .section-head { margin-bottom: 8px; }
.seat-map-section .section-head > .action-row { margin: 0; }
.stopped-seat-record { padding: 12px 0; border-bottom: 1px solid var(--line); }
.stopped-seat-record h3 { margin: 0; font-size: 14px; }
.stopped-seat-record p { margin: 6px 0; }
.map-range-options { margin: 4px 0; padding: 0 0 10px; }
.map-range-options .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seat-coach { padding: 18px 0; border-bottom: 1px solid var(--line); }
.seat-coach h3 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
.wagon-scroll { overflow: auto; max-width: 100%; background: #fff; border: 1px solid #c9d2dc; scrollbar-color: #9caebf #edf1f5; }
.wagon-scene { position: relative; background: #fff; }
.wagon-scene img { display: block; width: 100%; height: 100%; }
.wagon-seat { display: block; position: absolute; min-height: 0; padding: 0; border: 2px solid transparent; border-radius: 4px; background: transparent; color: #152321; font-size: 10px; }
.wagon-seat:hover { background: #ffffff14; filter: none; }
.wagon-seat[aria-pressed="true"] { border-color: var(--green); outline: 1px solid var(--green); }
.wagon-seat:disabled { background: transparent; color: #616b75; border-color: transparent; }
span.wagon-seat { cursor: default; }
.wagon-seat[data-selectable="false"] { color: #616b75; }
.wagon-seat[data-inspected="true"] { outline: 2px solid var(--blue); outline-offset: 2px; }
.seat-inspection { position: fixed; z-index: 45; bottom: 16px; right: 16px; width: min(420px, calc(100% - 32px)); max-height: 45dvh; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 4px 24px #142b2926; }
.seat-inspection .section-head { margin-bottom: 8px; }
.seat-inspection h2 { font-size: 16px; }
.seat-inspection p { margin: 6px 0; }
.seat-inspection .seat-range { padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.seat-watch-context { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.saved-seat-trains { margin: 20px 0; align-items: end; }
.saved-seat-trains label { flex: 1; min-width: 0; }
.watch-preferences-summary { color: var(--muted); }
.seat-watch-blocker { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin: 16px 0; background: #fff3dc; border-left: 3px solid #b76a16; }
.seat-watch-blocker > div { flex: 1 1 260px; min-width: 0; }
.seat-watch-blocker p { margin: 4px 0 0; overflow-wrap: anywhere; }
.wagon-seat small { position: absolute; bottom: 1px; left: 0; right: 0; font-size: 9px; line-height: 10px; }
.seat-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 16px 0; font-size: 11px; color: #586778; }
.seat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.seat-legend i { width: 15px; height: 15px; display: block; border: 1px solid #c6cdd5; border-radius: 2px; }
.rolling-row { padding: 18px 0; border-bottom: 1px solid var(--line); }
.rolling-row h3 { margin: 0 0 5px; font-size: 16px; }
.rolling-row p { margin: 7px 0; overflow-wrap: anywhere; }
.rolling-row .action-row { margin-bottom: 0; }
.hold-panel { margin-top: 14px; padding: 18px; border: 1px solid #b6d8c1; border-radius: 6px; background: #f3faf5; }
.hold-panel.is-error { border-color: #edc7c2; background: #fff6f4; }
.hold-expiry { font-variant-numeric: tabular-nums; }
.coach-card { padding: 16px 0; border-bottom: 1px solid var(--line); }
.coach-title { font-size: 15px; font-weight: 650; }
.coach-card .controls { margin: 12px 0 !important; }
.coach-card p { margin: 8px 0; }
.journey-date { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); margin: 8px 0; }
.pill.inactive { color: #54616d; background: #e8edf1; }
.is-inactive { color: var(--muted); background: #f0f3f5; }
.is-inactive .journey-date { color: #56616e; }
.hold-panel.is-inactive { border-color: var(--line); background: #f0f3f5; }
.coach-title[data-watch-state]::after { content: attr(data-watch-state); display: inline-block; margin-left: 10px; padding: 2px 7px; border-radius: 4px; background: #e8edf1; color: #54616d; font-size: 11px; font-weight: 600; }
.ticket-kind-section { padding: 18px 0 28px; }
.ticket-kind-section + .ticket-kind-section { border-top: 1px solid var(--line); }
.ticket-kind-section .muted { margin-bottom: 12px; }
.ticket-kind-section .section-head .muted { margin: 0; }
.sms-entry { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; padding: 12px 0; }
.sms-entry label { flex: 1 1 140px; }
.subnav { display: flex; gap: 4px; margin: 0 0 22px; border-bottom: 1px solid var(--line); }
.subnav button { min-height: 44px; color: #566577; background: transparent; border: 0; border-radius: 0; padding: 10px 16px; }
.subnav button.active { color: var(--blue); border-bottom: 2px solid var(--blue); }
.booking-group-row td { background: #fafcfe; }
.journey-coverage { margin: 8px 0 0; }
.current-ticket-segment { margin: 7px 0 0; font-weight: 400; }
.coverage-gap { color: var(--red); font-size: 12px; font-weight: 400; margin: 6px 0 0; }
.booking-child-row td { background: #fff; }
.current-ticket-row td { background: #fff8e6; }
.current-ticket-row td:first-child { border-left: 3px solid #b5822b; }
.table-surface > .muted { margin-bottom: 12px; }
.return-mode-banner { color: var(--red); background: #fff1ee; padding: 10px 12px; border-radius: 4px; margin: 10px 0; font-size: 13px; }
.schedule-toolbar { display: grid; grid-template-columns: minmax(200px, 1fr) 150px auto; gap: 18px; align-items: end; }
.schedule-toolbar .booking-controls { margin: 0; }
.schedule-graph { width: 100%; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.schedule-graph svg { display: block; width: 100%; height: 280px; touch-action: none; }
.curve-line { fill: none; stroke: var(--blue); stroke-width: 3; }
.vector-line { stroke: #8e9cad; stroke-width: 1.5; stroke-dasharray: 5 5; }
.grid-line { stroke: #e4e9ee; stroke-width: 1; }
.curve-handle { fill: var(--green); stroke: #fff; stroke-width: 3; cursor: grab; }
.curve-point { fill: var(--red); stroke: #fff; stroke-width: 2; cursor: grab; }
.curve-hit { fill: transparent; cursor: grab; }
.curve-hit:focus + .curve-point { stroke: var(--ink); stroke-width: 3; }
.schedule-graph text { font-size: 11px; fill: #627080; }
#schedulePreview { margin-top: 14px; }
.activity-panel { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.activity-panel > summary { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; font-weight: 600; min-height: 36px; list-style: none; }
.activity-panel > summary .muted { margin-left: auto; max-width: 65%; }
.activity-train { display: block; width: 100%; min-height: 0; margin-top: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 400; }
.activity-train:hover { background: #f3f3f3; }
.activity-train canvas { display: block; width: 100%; height: 136px; pointer-events: none; }
.activity-train-caption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 20px; padding: 10px 4px; font-size: 13px; }
.activity-train-caption > span { min-width: 0; overflow-wrap: anywhere; }
.activity-panel[data-presentation="train"] > .terminal { display: none; }
.activity-panel[data-status="error"] .activity-train-caption { color: var(--red); }
.terminal { margin-top: 12px; background: #171c22; color: #dce6e1; border-radius: 6px; overflow: hidden; }
.logs { white-space: pre-wrap; overflow: auto; max-height: min(55dvh, 640px); min-height: 42px; padding: 14px 16px; margin: 0; font: 12px/1.7 ui-monospace, monospace; overflow-wrap: anywhere; }
.request-stats { overflow-x: auto; border-top: 1px solid #3b4249; }
.request-stats summary { padding: 10px 16px; cursor: pointer; font-size: 11px; }
.stats { color: #d6e3eb; font: 11px ui-monospace, monospace; background: transparent; }
.stats th, .stats td { padding: 8px 10px; background: transparent; border: 0; color: inherit; text-align: center; }
.diagnostics { margin-top: 12px; color: var(--muted); font-size: 12px; }
.diagnostics > summary { cursor: pointer; padding: 6px 0; }
.diagnostics button { margin-top: 6px; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #16233480; padding: 20px; }
.ticket-modal { width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 22px; border-radius: 8px; background: #fff; box-shadow: 0 20px 70px #10233433; }
.ticket-modal-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ticket-modal-head h2 { font-size: 20px; margin: 0; }
.ticket-code-frame { display: grid; place-items: center; margin-bottom: 12px; }
.ticket-code-frame img { width: min(340px, 100%); height: auto; object-fit: contain; image-rendering: pixelated; }
.booking-info { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(0, 2fr); gap: 10px 16px; font-size: inherit; }
.booking-info dt, .booking-info dd { margin: 0; overflow-wrap: anywhere; }
.booking-info dt { color: #627080; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
#ticketCodeTcd { margin-top: 12px; }
.login-shell { max-width: 420px; margin: 60px auto; padding: 24px; }
.login-shell h1 { margin: 8px 0 26px; font-size: 28px; }
.login-shell form { display: grid; gap: 18px; }
.login-shell .back-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; }
.login-shell .error { color: var(--red); border-left: 3px solid var(--red); background: #fff1ee; padding: 12px; overflow-wrap: anywhere; }
.password-entry { display: flex; align-items: stretch; gap: 7px; }
.password-entry input { flex: 1; min-width: 0; }
.seat-overview-item { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); }
.seat-overview-item h3 { margin: 0 0 3px; font-size: 15px; }
.seat-overview-item p { margin: 4px 0; }
.stats-header { grid-template-columns: 1fr auto; }
.stats-totals { display: flex; flex-wrap: wrap; gap: 24px 48px; margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.stats-totals dt { color: var(--muted); font-size: 12px; }
.stats-totals dd { margin: 4px 0 0; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats-filters { display: grid; grid-template-columns: minmax(150px,2fr) minmax(130px,1fr) minmax(145px,1fr) minmax(145px,1fr) auto auto; align-items: end; gap: 12px; }
.stats-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.stats-table td { font-variant-numeric: tabular-nums; }
.stats-table small { display: block; color: var(--muted); }
@media (max-width: 1050px) { .stats-filters { grid-template-columns: repeat(2,minmax(0,1fr)) auto; } }
@media (max-width: 720px) {
  .stats-header.app-header { grid-template-columns: 1fr auto; min-height: 70px; padding: 14px 16px; }
  .stats-header .brand { font-size: 14px; }
  .stats-header .account-link { font-size: 12px; gap: 4px; padding-left: 0; }
  .stats-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats-totals { gap: 16px 24px; }
  .stats-table td[data-label="from / to"] { order: -1; }
}
[role="alert"] { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1050px) {
  .app-header { grid-template-columns: auto 1fr auto; gap: 12px; padding: 0 20px; }
  .nav { justify-content: center; gap: 0; }
  .nav button { padding: 0 10px; }
  .journey-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 95px; }
  .journey-form > button { grid-column: 3; }
  .seat-search-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .seat-search-form > button { grid-column: 2; }
  .seat-criteria { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 128px; }
  .app-header { grid-template-columns: 1fr auto; min-height: 0; padding: 12px 16px 0; row-gap: 8px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 24px; height: 24px; }
  .account-link { grid-column: 2; grid-row: 1; min-height: 36px; font-size: 12px; padding: 0; }
  .account-actions { grid-column: 2; grid-row: 1; gap: 10px; }
  .nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  body[data-signed-in="false"] .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav button { min-height: 58px; flex-direction: column; padding: 6px 4px; font-size: 12px; gap: 4px; min-width: 0; }
  .nav button.active::after { left: 8px; right: 8px; }
  .nav svg { width: 16px; height: 16px; }
  .nav-count { position: absolute; top: 4px; right: 7px; }
  .wrap { padding: 24px 16px 40px; }
  .view-head { margin-bottom: 20px; gap: 12px; }
  .view-head h1 { font-size: 25px; }
  .view-head > .booking-controls { width: 100%; }
  .journey-form, .seat-search-form { grid-template-columns: minmax(0, 1fr) 90px; gap: 14px 10px; }
  .station-pair { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); gap: 6px; }
  .station-pair .station-swap { width: 36px; min-width: 36px; height: 44px; }
  .journey-form > button, .seat-search-form > button { grid-column: 1 / -1; }
  .seat-search-form > label { grid-column: 1 / -1; }
  button, input, select { min-height: 44px; }
  button.small { min-height: 40px; }
  button.icon-button { width: 44px; min-width: 44px; height: 44px; }
  button.small.icon-button { width: 40px; min-width: 40px; height: 40px; }
  .date-time-entry { gap: 5px; }
  .controls, .train-choice, .map-range-options .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .train-choice > label, .train-choice > span { grid-column: 1 / -1; }
  .seat-criteria { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 10px; }
  .seat-criteria label { font-size: 12px; }
  .selection-toolbar label { flex: 1; min-width: 0; }
  #rollingSeatMessage { flex-basis: 100%; padding-top: 2px; }
  .rolling-seat-controls button { flex: 1 1 180px; }
  .disclosure > summary .muted { max-width: 48%; font-size: 11px; }
  .workflow-section { padding: 20px 0; }
  .schedule-toolbar { grid-template-columns: minmax(0, 1fr) 120px; }
  .schedule-toolbar .booking-controls { grid-column: 1 / -1; }
  .schedule-graph svg { height: 235px; }
  .activity-panel { margin-top: 25px; }
  .activity-panel > summary .muted { max-width: 58%; font-size: 11px; }
  .ticket-modal { padding: 18px; }
  .booking-info { font-size: 14px; gap: 10px 12px; }
  .table-surface .journey-table, .journey-table tbody { display: block; background: transparent; }
  .journey-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .journey-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; padding: 18px 0; border-bottom: 1px solid var(--line); background: transparent; }
  .journey-table td { border: 0; background: transparent; padding: 0; min-width: 0; font-size: 14px; }
  .journey-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 500; text-transform: uppercase; }
  .journey-table td[data-label="train"] { grid-column: 1 / -1; order: -3; font-size: 16px; }
  .journey-table td[data-label="train"]::before { display: none; }
  .journey-table td[data-label="from / to"] { grid-column: 1 / -1; order: -2; }
  .journey-table td[data-label="from / to"]::before { display: none; }
  .journey-table td[data-label="from / to"] > div { display: inline; }
  .journey-table td[data-label="from / to"] > div + div::before { content: " / "; color: #7d8c9e; padding: 0 5px; font-weight: 400; }
  .journey-table td.ordinal-cell { display: none; }
  .journey-table td.row-tools { order: -4; grid-column: 1 / -1; }
  .journey-table td.row-tools::before { display: none; }
  .journey-table td[data-label="ticket"], .journey-table td[data-label="action"], .journey-table td[data-label="next check"] { grid-column: 1 / -1; }
  .journey-table td[data-label="more info"]::before { content: "Details"; }
  .journey-table td[data-label="action"] button { margin: 0; }
  .journey-table td[data-label="action"] { display: flex; gap: 6px; flex-wrap: wrap; }
  .journey-table td[data-label="action"]::before { flex-basis: 100%; }
  .journey-table .booking-child-row { padding-left: 12px; border-left: 2px solid #bfd2e7; }
  .journey-table .current-ticket-row { background: #fff8e6; padding: 14px 10px; }
  .train-seat-action { display: inline-flex; margin-left: 10px; margin-top: 0; }
  .action-menu summary { min-height: 40px; width: 40px; }
}
@media (max-width: 380px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .app-header { padding-left: 12px; padding-right: 12px; }
  .nav button { padding: 0 6px; }
  .seat-criteria { grid-template-columns: 1fr; }
  .journey-form { grid-template-columns: minmax(0, 1fr) 78px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; }
}

/* Keep the footer below long content and at the viewport bottom on short pages. */
body.site-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.site-shell > .app-header { flex-shrink: 0; }
.site-shell > main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; width: 100%; margin-top: auto; border-top: 1px solid var(--line); background: #fff; }
.site-footer-inner { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 24px; display: flex; justify-content: flex-end; }
.site-footer a { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; color: var(--muted); font-size: 13px; font-weight: 550; text-decoration: none; }
.site-footer a:hover { color: var(--blue); text-decoration: underline; }
@media (max-width: 700px) { .site-footer-inner { padding: 16px; } }
