/* Unified application stylesheet: shared layout, controls, railway scenes and responsive states. */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
:root { color-scheme: dark; --mono: 'IBM Plex Mono',monospace; --display: 'Source Sans 3',Arial,sans-serif; --sans: 'Source Sans 3',Arial,sans-serif; --bg: #17181c; --surface: #202228; --raised: #2b2e36; --line: #484e59; --control-line: #737e8e; --text: #f5f6f8; --muted: #c0c6d0; --subtle: #aeb7c5; --red: #f1505c; --brand-cercanias: #f1505c; --brand-cercanias-light: #f4323f; --action-red: #b81e25; --green: #93d4ae; --amber: #f5ca7a; --reserved: #98dce8; --focus: #ffda8a; --danger-text: #ffb8bf; --radius: 6px; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 var(--sans); }
button, input, select { font: inherit; }
button, a, input, select { outline-offset: 4px; }
button { cursor: pointer; color: var(--text); border: 1px solid var(--line); }
button.primary:hover { background: #ff8c91; }
button.ghost { background: transparent; }
input, select { max-width: 100%; }
input[type=number] { width: 80px; }
input[type=checkbox] { accent-color: var(--red); }
h1, h2, h3, p { margin: 0; }
h1 { font: 600 30px/1.1 var(--display); }
h2 { font: 600 26px/1.2 var(--display); }
h3 { font: 600 18px/1.3 var(--sans); }
small { color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.eyebrow { text-transform: uppercase; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); white-space: nowrap; }
.badge { display: inline-block; white-space: nowrap; }
.dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; display: inline-block; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: grid; }
.divider { border-top: 1px solid var(--line); }
.button-row { display: flex; flex-wrap: wrap; }
.metric { font-family: var(--mono); font-size: 23px; font-weight: 500; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
#boot { height: 100vh; display: grid; place-content: center; color: var(--muted); }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; }
.brand small { display: block; }
.transport { display: flex; align-items: center; gap: 15px; }
.timebox { display: flex; align-items: center; }
.timebox strong { font: 500 25px var(--mono); }
.timebox small { display: block; }
.speedbuttons { display: flex; border: 1px solid var(--line); overflow: hidden; }
.speedbuttons button { border: 0; border-radius: 0; font: 11px var(--mono); }
.play { font-weight: 600; }
.top-actions button { font-size: 11px; padding: 7px 10px; }
.shell { display: grid; }
.sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.nav { display: flex; align-items: center; background: none; text-align: left; }
.nav-footer { margin-top: auto; color: var(--muted); }
.nav-footer button { width: 100%; }
.nav-footer p { margin-top: 6px; }
.page-title { display: flex; justify-content: space-between; }
.status-pill { display: flex; align-items: center; gap: 7px; color: var(--green); font: 10px var(--mono); }
.kpis { display: grid; }
.kpi .row { justify-content: space-between; margin-bottom: 7px; }
.kpi small { display: block; }
.operation { display: grid; align-items: start; }
.panel { border: 1px solid var(--line); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.mapbox { position: relative; overflow: hidden; }
.mapbox svg { width: 100%; height: 100%; user-select: none; touch-action: none; }
.map-controls { position: absolute; }
.map-controls button { font: 12px var(--mono); }
.map-note { position: absolute; font: 9px var(--mono); }
.map-legend { flex-wrap: wrap; display: flex; font: 10px var(--sans); border-top: 1px solid var(--line); }
.station { cursor: pointer; }
.station text { fill: #a8b5c7; font: 11px var(--sans); paint-order: stroke; stroke: #151619; stroke-width: 4; stroke-linejoin: round; }
.station .major { fill: #e4eaf3; font-weight: 650; font-size: 13px; }
.station.selected text { fill: var(--amber); }
.train-marker { cursor: pointer; }
.train-marker text { fill: #141518; font: 600 9px var(--mono); }
.track { fill: none; stroke: #83414e; stroke-width: 3; stroke-linecap: round; }
.track.occupied { stroke: #f1858a; stroke-width: 4; }
.track.closed { stroke: #f2b65b; stroke-dasharray: 6 5; stroke-width: 4; }
.inspector h2 { margin: 6px 0 8px; }
.inspector .train-art { margin: 12px 0; }
.inspector .field { display: flex; justify-content: space-between; border-bottom: 1px solid #35373e; }
.inspector .field span:last-child { text-align: right; }
.inspector .button-row button { flex: 1; }
.progress { height: 4px; background: #2c3848; border-radius: 3px; overflow: hidden; margin: 7px 0; }
.progress i { display: block; height: 100%; background: var(--green); }
.route-callout { border-top: 1px solid var(--line); }
.route-callout p { color: var(--muted); }
.operations-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.mini-row { display: grid; border-top: 1px solid #35373e; align-items: center; }
.mini-row:first-child { border-top: 0; }
.events { overflow: auto; }
.event-danger { color: #ff9ba4; }
.event-warn { color: var(--amber); }
.event-success { color: var(--green); }
.banner { margin-bottom: 14px; display: flex; align-items: center; border: 1px solid #6c4e35; }
.banner button { margin-left: auto; flex-shrink: 0; }
.content-head { display: flex; justify-content: space-between; }
.content-head p { max-width: 680px; }
.cards { display: grid; }
.card { border: 1px solid var(--line); }
.card p { color: var(--muted); margin-top: 7px; }
.card .metric { margin: 12px 0 2px; display: block; }
.train-art { width: 100%; height: 56px; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); margin: 16px 0; }
.stats-grid span { display: block; color: var(--muted); }
.subtabs { display: flex; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { text-transform: uppercase; border-bottom: 1px solid var(--line); }
.data-table td { border-bottom: 1px solid #35373e; white-space: nowrap; }
.section-gap { margin-top: 22px; }
.two-col { display: grid; }
.notice { border: 1px solid #424650; margin: 14px 0; }
.notice strong { color: var(--text); }
.band-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.band-row small { display: block; }
.band-row label { display: flex; align-items: center; font-family: var(--mono); }
.depot-yard { display: grid; }
.parking { height: 65px; display: grid; align-content: center; text-align: center; font: 11px var(--mono); border: 1px solid #344255; border-radius: 5px; }
.timeline { position: relative; display: grid; gap: 14px; padding-left: 24px; }
.timeline:before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 1px; }
.future-card { position: relative; display: flex; background: var(--surface); border: 1px solid var(--line); }
.future-card:before { content: ''; position: absolute; left: -22px; top: 28px; width: 8px; height: 8px; background: #718095; border: 3px solid var(--bg); border-radius: 50%; }
.future-card p { color: var(--muted); margin-top: 4px; }
.future-card .lock { margin-left: auto; color: var(--muted); font: 10px var(--mono); text-align: right; }
.future-card .lock strong { display: block; color: var(--amber); font: 11px var(--sans); max-width: 260px; }
.sources { max-width: 850px; }
.sources p, .sources li { margin: 10px 0; }
.sources h3 { margin-top: 24px; }
.sources a { overflow-wrap: anywhere; }
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow: auto; }
.modal { width: min(980px,100%); overflow: auto; border: 1px solid #555964; box-shadow: 0 20px 100px #0009; }
.modal.small { max-width: 600px; }
.modal-header { border-bottom: 1px solid var(--line); display: flex; align-items: start; justify-content: space-between; }
.modal-header p { color: var(--muted); max-width: 650px; }
.modal-footer { border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.setup-grid { display: grid; }
.setup-train { display: grid; align-items: center; border-bottom: 1px solid var(--line); }
.setup-train small { display: block; }
.stepper { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); }
.setup-summary { border: 1px solid #424650; align-self: start; }
.setup-summary .metric { margin: 12px 0 6px; display: block; font-size: 27px; }
.setup-summary label { display: block; }
.setup-summary select { width: 100%; }
.setup-error { margin-top: 12px; }
.intro-route { margin-bottom: 12px; }
.keyboard { color: var(--muted); padding: 6px 0; }
.alert-item { border: 1px solid #68454c; margin-bottom: 12px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); box-shadow: 0 5px 30px #0008; z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
.hide { display: none !important; }
@media (max-width:1200px) {
  .transport { gap: 9px; }
  .metric, .kpi .metric { font-size: 20px; }
}
@media (max-width:950px) {
  .nav span, .sidebar .eyebrow, .nav-footer { display: none; }
  .nav { justify-content: center; }
  .modal-footer .row { display: block; }
}
@media (max-width:650px) {
  .topbar { flex-wrap: wrap; }
  .brand { display: none; }
  .transport { width: 100%; justify-content: space-between; }
  .page-title h1 { font-size: 25px; }
  .page-title .status-pill { display: none; }
  .operations-footer { grid-template-columns: 1fr; }
  .setup-train .train-art { display: none; }
  .future-card .lock { display: none; }
  .map-note { display: none; }
}
.legend-double { display: inline-block; border-top: 2px solid var(--red); border-bottom: 2px solid var(--red); vertical-align: middle; }
.train-marker path, .train-marker text { pointer-events: none; }
/* Geographic control map: screen-size labels, metric rolling stock. */
.mapbox { cursor: grab; }
.mapbox:active { cursor: grabbing; }
.map-controls { display: flex; align-items: center; flex-wrap: wrap; }
.zoom-slider { display: flex; align-items: center; gap: 8px; border: 1px solid #4c505a; font: 11px var(--mono); }
.zoom-slider input { min-width: 60px; cursor: pointer; padding: 0; }
.map-compass { position: absolute; right: 16px; top: 17px; display: flex; flex-direction: column; align-items: center; font: 12px var(--mono); color: #b7c7d5; }
.map-compass span { font-size: 26px; }
.map-scale { position: absolute; color: #b5c5d4; font: 11px var(--mono); }
#scale-ruler { border: solid #b5c5d4; border-width: 0 1px 2px; height: 7px; margin-bottom: 5px; }
.map-note { right: 14px; left: auto; }
.geo-station, .map-depot { cursor: pointer; }
.geo-station text, .map-depot text, .train-marker .train-code { font-family: var(--sans); paint-order: stroke; stroke: #151619; stroke-linejoin: round; }
.geo-station text { pointer-events: none; }
.map-depot text { fill: #d0d2d8; font-size: 12px; stroke-width: 3px; }
.map-depot .sub { font-size: 10px; }
.train-marker .train-code { fill: #e4e9ee; font: 11px var(--mono); stroke-width: 3px; }
.train-marker.selected rect { stroke-width: unset; stroke: unset; }
.top-car { pointer-events: none; }
.map-legend #map-follow-state { color: var(--amber); }
.platform-shape, .switch-marker { cursor: pointer; }
.switch-marker:hover path { stroke: white; stroke-width: 2; }
.platform-choice { display: block; color: var(--muted); padding: 10px 0; }
.platform-choice select { width: 100%; margin-top: 6px; }
.map-note button { padding: 2px 4px; font: 9px var(--mono); border: 0; background: transparent; }
.geo-station text { paint-order: stroke; stroke: #151619; }
.sources .data-table td { vertical-align: top; }
.sources .data-table td p { margin: 0 0 6px; }
.map-note { padding: 4px 6px; }
.line-stations { padding-left: 22px; margin-top: 12px; }
.line-stations button { text-align: left; }
.subtabs .badge { margin-right: 6px; }
/* Separate the route selector from operational actions. */
.assignment-control { display: flex; flex-direction: column; align-items: stretch; gap: 8px; white-space: normal; min-width: 0; }
.assignment-control>span { color: var(--muted); }
.assignment-control select { width: 100%; max-width: 100%; min-width: 0; padding: 10px 12px; }
.data-table td.fleet-actions { width: 37%; white-space: normal; vertical-align: top; }
.fleet-actions .assignment-control { max-width: 430px; }
.fleet-actions .fleet-action-buttons { display: flex; flex-wrap: wrap; margin: 0; align-items: center; }
.fleet-action-buttons button { margin: 0; }
.fleet-actions small { display: block; max-width: 430px; margin: 8px 0 12px; line-height: 1.5; }
.inspector .assignment-control { margin: 14px 0; }
.tutorial-intro { color: var(--muted); margin: 0 0 20px; }
.tutorial-steps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); list-style: none; margin: 0; padding: 0; }
.tutorial-step { display: flex; align-items: flex-start; }
.tutorial-number { flex: 0 0 32px; font: 20px var(--mono); }
.tutorial-step h2, .tutorial-reference h2 { margin: 0 0 10px; }
.tutorial-step p, .tutorial-reference p { color: var(--muted); margin: 0; }
.tutorial-step strong, .tutorial-reference strong { color: var(--text); font-weight: 500; }
.tutorial-step button { margin-top: 16px; }
.tutorial-reference { margin-top: 18px; }
@media (max-width:1000px) {
  .tutorial-steps { grid-template-columns: 1fr; }
}
/* Dispatch orders and campaign requirements stay separated from action buttons. */
.order-form { display: grid; margin: 20px 0; }
.order-form label { display: grid; }
.order-form select { width: 100%; }
.expansion-requirements { display: grid; max-width: 440px; }
.expansion-requirements .field { gap: 18px; }
.expansion-requirements small { line-height: 1.6; color: var(--muted); }
.expansion-requirements p { line-height: 1.6; }
/* Control desk identity — references and adaptation recorded in research/visual. */
h1 { font-weight: 600; }
h2 { font-weight: 600; }
h3 { font-weight: 600; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.brand { flex-shrink: 0; }
.renfe-symbol { width: 36px; height: 36px; object-fit: contain; }
.cercanias-symbol { width: 22px; height: 22px; object-fit: contain; }
.brand-divider { height: 34px; width: 1px; background: #d7d7d9; margin: 0 3px; }
.brand strong { display: block; line-height: 1.15; font-weight: 600; }
.brand small { margin-top: 5px; text-transform: uppercase; }
.topbar button.primary { background: var(--action-red); color: #fff; border-color: var(--action-red); }
.topbar button.primary:hover { background: #971820; }
.topbar .transport { gap: 16px; }
.timebox { padding: 0 16px; border-left: 1px solid #d7d7d9; gap: 18px; }
.timebox strong { font-size: 26px; letter-spacing: -.8px; line-height: 1.1; }
.timebox .eyebrow, .timebox small { color: #5b5c63; font-size: 10px; }
.speedbuttons { border-color: #c8c9cd; border-radius: 3px; }
.speedbuttons button { font-size: 11px; min-width: 37px; min-height: 34px; padding: 7px; }
.speedbuttons .active { color: #fff; background: #33353d; }
.speedbuttons .active:hover:not(:disabled) { background: #454851; }
.play { min-width: 114px; }
.nav svg { flex-shrink: 0; }
.nav-footer .chip { font-family: var(--mono); letter-spacing: .4px; background: none; }
.nav-footer button { white-space: normal; }
.status-pill { border: 1px solid var(--line); white-space: nowrap; }
.kpis { border: 1px solid var(--line); overflow: hidden; background: var(--line); }
.kpi { border: 0; border-radius: 0; }
.kpi .metric { letter-spacing: -.8px; }
.panel-head h3 { letter-spacing: .1px; }
.mapbox { min-height: 440px; height: calc(100dvh - 370px); max-height: 1000px; }
.map-controls { bottom: auto; max-width: calc(100% - 75px); }
.zoom-slider input { accent-color: var(--brand-cercanias); width: 96px; }
.map-scale { bottom: 20px; left: 18px; }
.map-note { bottom: 16px; background: #151619ed; border: 1px solid #3d3f47; border-radius: 3px; }
.legend-double { width: 18px; height: 7px; border-color: #c61c30; margin-right: 5px; }
.legend-double.line-c2 { border-color: #008b45; }
.legend-swatch { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; }
.legend-swatch.reserved { background: var(--reserved); }
.legend-swatch.incident { background: var(--amber); height: 6px; border: 1px dashed #151619; }
.inspector { max-height: calc(100dvh - 240px); overflow: auto; }
.inspector>.panel-head { position: sticky; top: 0; z-index: 1; }
.inspector h2 { overflow-wrap: anywhere; }
.inspector .field { gap: 12px; }
.inspector .field>span { min-width: 0; }
.inspector .field>span:last-child { font-variant-numeric: tabular-nums; }
.inspector .button-row button { white-space: normal; }
.inspector-photo { margin: 14px 0 16px; overflow: hidden; border: 1px solid var(--line); background: #111317; }
.photo-image-link { display: block; background: #0b0d10; }
.inspector-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: contain; }
.inspector-photo figcaption { padding: 8px 10px; font-size: 11px; line-height: 1.45; }
.photo-caption, .photo-credit { display: block; }
.photo-caption { margin-bottom: 4px; }
.photo-credit { overflow-wrap: anywhere; }
.photo-credit a { color: #c6ddeb; text-decoration: underline; text-underline-offset: 2px; }
.photo-image-link:focus-visible { outline: 2px solid #79c7d5; outline-offset: -3px; }
.photo-unavailable { display: grid; place-items: center; min-height: 100px; padding: 16px; color: #aeb5bf; font-size: 12px; text-align: center; }
.line-selector { display: flex; align-items: stretch; flex-wrap: wrap; margin: 0 0 16px; }
.line-selector button { border: 1px solid var(--line); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.line-selector .badge { margin: 0; min-width: 35px; text-align: center; }
.line-selector .all-lines { font-weight: 700; }
.line-selector button:not(:disabled):hover { background: #34363d; border-top-color: #777b85; border-left-color: #777b85; border-right-color: #777b85; }
.line-selector button:disabled { opacity: 1; cursor: not-allowed; }
.map-legend [data-legend-line] { border-color: var(--legend-line-color,#737780); }
#header-transport:empty { display: none; }
.map-transport-dock { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--line); cursor: default; }
.map-transport-dock .transport { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; width: auto; order: initial; }
.map-transport-dock .timebox { border: 0; padding: 0 4px 0 0; gap: 8px; }
.map-transport-dock .timebox strong { font: 500 19px var(--mono); letter-spacing: -.6px; color: var(--text); }
.map-transport-dock .timebox small { color: var(--muted); white-space: nowrap; }
.map-transport-dock .timebox .eyebrow, .map-transport-dock .transport-label { display: none; }
.map-transport-dock .play { display: grid; place-items: center; padding: 4px; border-radius: 4px; }
.map-transport-dock .speedbuttons { border-radius: 4px; }
.map-transport-dock .speedbuttons button { font: 10px var(--mono); }
@media (max-width:760px) {
  .topbar:has(#header-transport:empty) { min-height: 72px; height: auto; }
  #header-transport:not(:empty) { order: 3; width: 100%; }
}
@media (max-width:600px) {
  .map-transport-dock .timebox small { display: none; }
}
.badge { background: #c61c30; color: #fff; font: 700 13px var(--sans); text-align: center; }
.subtabs>button { border-radius: 3px; }
.data-table td:first-child { font-family: var(--mono); }
.assignment-control select, .platform-choice select { line-height: 1.3; }
.fleet-action-buttons { gap: 8px; }
.banner { line-height: 1.5; }
.tutorial-number { padding-top: 6px; }
.tutorial-reference p+p { margin-top: 12px; }
@media (min-width:1650px) {
  .mapbox { min-height: 440px; }
}
@media (max-width:1250px) {
  .renfe-symbol { width: 30px; height: 30px; }
  .timebox { gap: 12px; padding: 0 10px; }
  .topbar .transport { gap: 10px; }
  .mapbox { min-height: 440px; }
}
@media (max-width:1050px) {
  .top-actions button { padding: 6px 8px; }
  .timebox .eyebrow { display: none; }
  .sidebar .eyebrow { font-size: 9px; }
}
@media (max-width:950px) {
  .nav-footer { display: grid; gap: 5px; }
  .nav-footer .chip { display: none; }
  .nav-footer button { margin: 0; }
  .inspector { max-height: 420px; }
  .mapbox { min-height: 460px; }
  .top-actions { display: flex; }
  .brand small { display: block; }
}
@media (max-width:760px) {
  .topbar { flex-wrap: wrap; }
  .brand { display: flex; }
  .transport { order: 3; width: 100%; justify-content: space-between; }
  .top-actions { margin-left: auto; }
  .timebox { border: 0; padding: 0; }
  .timebox strong { font-size: 22px; }
  .play { min-width: 98px; }
  .page-title h1 { font-size: 24px; }
  .page-title .status-pill { display: none; }
  .mapbox { height: 460px; min-height: 460px; }
  .setup-train .train-art { display: none; }
  .subtabs>button { text-align: left; }
  .future-card { flex-wrap: wrap; }
}
/* Focus mode fills the viewport while keeping both operating panels visible. */
body.map-fullscreen { overflow: hidden; }
body.map-fullscreen .topbar, body.map-fullscreen .sidebar, body.map-fullscreen .page-title, body.map-fullscreen #kpis, body.map-fullscreen #pause-banner, body.map-fullscreen .keyboard, body.map-fullscreen .line-selector, body.map-fullscreen .operations-footer { display: none; }
body.map-fullscreen .shell { position: fixed; inset: 0; display: block; min-height: 0; height: 100dvh; z-index: 5; }
body.map-fullscreen .workspace { padding: 0; height: 100dvh; min-width: 0; }
body.map-fullscreen #content { height: 100%; min-height: 0; }
body.map-fullscreen .operation { display: grid; grid-template-columns: minmax(0,1fr) minmax(240px,320px); height: 100%; gap: 0; min-height: 0; grid-template-rows: minmax(0,1fr); align-items: stretch; }
body.map-fullscreen .operation>.panel:first-child { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; border-radius: 0; }
body.map-fullscreen .mapbox { flex: 1 1 0; height: 0; min-height: 0; max-height: none; }
body.map-fullscreen #network { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
body.map-fullscreen .operation>.panel:first-child>.panel-head { flex-shrink: 0; }
body.map-fullscreen .inspector { height: 100%; max-height: none; overflow: auto; border-radius: 0; }
body.map-fullscreen .map-legend { flex-shrink: 0; }
@media (max-width:760px) {
  body.map-fullscreen .operation { grid-template-columns: minmax(0,1fr) 220px; }
  body.map-fullscreen .map-controls { max-width: calc(100% - 20px); }
  body.map-fullscreen .map-compass { display: none; }
}
/* Toma el control: railway scene and instruments share one driving workstation. */
body.driving-mode #kpis, body.driving-mode .keyboard, body.driving-mode .page-title, body.driving-mode #pause-banner { display: none; }
body.driving-mode .workspace { padding: 14px 20px; }
.driving-workbench { border: 1px solid #3b444a; overflow: hidden; min-width: 0; }
.driving-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.driving-service-id { display: flex; align-items: center; gap: 12px; }
.driving-service-id>.badge { font-size: 15px; min-width: 46px; text-align: center; }
.driving-heading h2 { font: 600 19px var(--mono); margin: 0; }
.driving-heading h2 span { font: 400 13px var(--sans); margin-left: 8px; }
.driving-status { display: flex; align-items: center; gap: 10px; border-top: 1px solid #394348; border-bottom: 1px solid #394348; min-height: 41px; flex-wrap: wrap; }
.driving-status-dot { border-radius: 50%; flex-shrink: 0; }
.driving-status.attention .driving-status-dot { background: #e8bc73; }
.driving-layout { display: grid; grid-template-columns: minmax(0,1fr) 282px; min-width: 0; height: clamp(460px,57vh,720px); }
.driving-visual-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.driving-destination { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2.4fr) minmax(0,1fr); align-items: center; gap: 12px; flex-shrink: 0; min-width: 0; }
.driving-station-heading { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; grid-row: 1; align-items: center; gap: 12px; min-width: 0; text-align: center; }
.driving-station-context { grid-column: 1; text-align: left; font: 10px var(--mono); color: var(--muted); letter-spacing: .08em; }
.driving-station-sign { grid-column: 2; justify-self: center; display: block; width: fit-content; max-width: 100%; box-sizing: border-box; padding: 7px 24px 9px; border: 1px solid #d54b54; border-radius: 2px; background: var(--action-red); color: #fff; font-size: clamp(22px,2.3vw,34px); font-weight: 700; line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; }
.driving-station-sign.is-depot { background: var(--raised); border-color: var(--control-line); }
.driving-destination-meta { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.driving-destination-meta small { font-size: 12px; color: var(--muted); }
.driving-destination-meta strong { order: -1; flex-shrink: 0; font: 500 14px var(--mono); }
.driving-camera-tools { display: flex; align-items: center; border-top: 1px solid #303d43; flex-shrink: 0; }
.driving-camera-tools>span { flex: 1; }
.driving-camera-tools button { white-space: nowrap; }
.driving-scene { position: relative; flex: 1; min-height: 0; isolation: isolate; background: #161f21; overflow: hidden; }
#driving-world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; }
#driving-labels { font-family: var(--sans); pointer-events: none; }
.driving-scene-caption { position: absolute; inset: 12px 14px auto; display: flex; justify-content: space-between; gap: 14px; font: 10px var(--mono); color: #b9cdcf; pointer-events: none; }
.driving-scene-caption>span:first-child { background: #142024dd; border: 1px solid #405153; border-radius: 4px; padding: 5px 8px; height: fit-content; }
#driving-scene-scale { display: flex; flex-direction: column; gap: 5px; text-align: right; text-shadow: 0 1px #000; }
#driving-scene-scale:after { content: ''; display: block; width: var(--ruler-width,80px); height: 5px; border: solid #a0bec1; border-width: 0 1px 1px; }
.driving-scene-legend { position: absolute; left: 12px; bottom: 27px; display: flex; gap: 12px; flex-wrap: wrap; color: #b7c9c9; background: #142024d9; padding: 4px 7px; font-size: 9px; border-radius: 3px; pointer-events: none; }
.driving-scene-legend span { display: flex; gap: 5px; align-items: center; }
.driving-scene-legend i { width: 12px; height: 2px; background: #74d2d7; }
.driving-scene-legend .braking { background: #e8bc73; height: 4px; }
.driving-scene-legend .stop { background: #f6dc9f; width: 2px; height: 8px; }
.driving-attribution { position: absolute; bottom: 6px; right: 12px; font-size: 9px; color: #a9b9ba; text-decoration: none; background: #142024cc; padding: 1px 5px; }
.driving-console { border-left: 1px solid #3b444a; overflow: auto; min-width: 0; }
.driving-instruments { display: flex; align-items: center; gap: 4px; margin: -10px -5px 0; }
.driving-speed { width: 190px; max-width: 72%; }
.driving-speed svg { display: block; width: 100%; height: auto; }
.driving-limit { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 65px; text-align: center; }
.driving-limit>span { font: 9px var(--mono); color: var(--muted); letter-spacing: 1px; }
.driving-limit>strong { display: grid; place-items: center; width: 61px; height: 61px; border: 5px solid #d82030; border-radius: 50%; background: #f6f6f4; color: #18191b; font: 700 23px var(--mono); }
.driving-limit small { color: var(--muted); }
.driving-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
.driving-metric { border: 1px solid #37414d; min-width: 0; }
.driving-metric>span { display: block; }
.driving-metric strong { font: 500 23px var(--mono); overflow-wrap: anywhere; }
.driving-metric strong small { display: block; font: 10px var(--sans); margin-top: 2px; }
.driving-approach { margin-top: 14px; }
.driving-approach strong { font: 11px var(--mono); }
.approach-ruler { position: relative; height: 20px; margin: 10px 6px 6px; background: repeating-linear-gradient(90deg,#59616b 0 1px,transparent 1px 10%); border-bottom: 1px solid #59616b; }
.approach-ruler i { position: absolute; bottom: 0; transform: translateX(-50%); width: 6px; height: 14px; background: #d6eeee; box-shadow: 0 0 8px #70cecf66; }
.approach-zone { position: absolute; inset: 0 0 0 96.8%; background: #e8bc734d; border: 1px solid #e8bc73; }
.approach-ruler b { position: absolute; right: 0; height: 100%; border-right: 2px solid #f5d394; }
.driving-passengers { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin: 14px 0; }
.driving-passengers strong { font: 16px var(--mono); }
.driving-passengers progress { width: 100%; appearance: none; border: 0; border-radius: 3px; overflow: hidden; }
.driving-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.driving-summary .driving-metric strong { font-size: 16px; }
.driving-last-stop { padding: 11px 0 0; display: flex; flex-direction: column; gap: 5px; }
.driving-last-stop>span { font: 9px var(--mono); }
.driving-last-stop>strong { font: 22px var(--mono); }
.driving-last-stop strong small { font-size: 11px; }
.driving-controls-bar { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #4d575e; border-bottom: 1px solid #4d575e; position: sticky; bottom: 0; z-index: 2; flex-shrink: 0; }
#driving-transport-dock .transport { gap: 12px; }
#driving-transport-dock .speedbuttons { display: none; }
#driving-transport-dock .timebox { border: 0; padding: 0; }
#driving-transport-dock .timebox>div { display: none; }
.driving-journey { min-width: 0; flex-shrink: 0; }
.driving-journey-title { display: flex; align-items: center; gap: 10px; }
.driving-journey-title strong { margin-left: auto; text-align: right; }
.driving-line-progress { display: block; width: 100%; height: 20px; margin: 7px 0 0; overflow: visible; }
.driving-stations { position: relative; display: flex; list-style: none; padding: 0 0 7px; margin: 0; overflow: auto; scrollbar-width: thin; gap: 0; }
.driving-stations li { position: relative; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid #54606c; }
.driving-stations .station-dot { position: absolute; left: 9px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #687583; }
.driving-stations .current { border-color: var(--journey-color); }
.driving-stations .current .station-dot { background: #fff; box-shadow: 0 0 0 3px var(--journey-color); }
.driving-stations .behind { border-color: var(--journey-color); }
.driving-secondary { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #303b45; flex-wrap: wrap; flex-shrink: 0; }
.driving-secondary button { background: transparent; }
.driving-reference { display: grid; grid-template-columns: 260px 1fr; border-top: 1px solid #38444d; flex-shrink: 0; }
.driving-reference h3 { color: #ebeeee; margin: 0 0 8px; }
.driving-reference p { margin: 8px 0; }
.driving-reference a { color: #b8daec; text-decoration: underline; }
body.driving-fullscreen .topbar, body.driving-fullscreen .sidebar { display: none; }
body.driving-fullscreen .shell { position: fixed; inset: 0; display: block; height: 100dvh; min-height: 0; z-index: 5; }
body.driving-fullscreen .workspace { padding: 0; height: 100%; }
body.driving-fullscreen #content { height: 100%; min-height: 0; }
body.driving-fullscreen .driving-workbench { display: flex; flex-direction: column; height: 100%; border-radius: 0; overflow: auto; }
body.driving-fullscreen .driving-heading, body.driving-fullscreen .driving-status { flex-shrink: 0; }
body.driving-fullscreen .driving-layout { flex: 1; min-height: 280px; height: auto; }
body.driving-fullscreen .driving-stations { max-height: 64px; }
@media (min-width:1600px) {
  .driving-layout { grid-template-columns: minmax(0,1fr) 310px; }
  .driving-speed { width: 205px; }
}
@media (max-width:1100px) {
  body.driving-mode .workspace { padding: 10px; }
  .driving-layout { grid-template-columns: minmax(0,1fr) 250px; }
  .driving-controls-bar>button { font-size: 10px; }
}
@media (max-width:800px) {
  .driving-layout { grid-template-columns: minmax(0,1fr) 218px; }
  .driving-limit>strong { width: 51px; height: 51px; font-size: 20px; }
  .driving-instruments { gap: 0; }
  .driving-limit { min-width: 52px; }
}
@media (max-width:600px) {
  .driving-layout { display: flex; flex-direction: column; height: auto; }
  .driving-visual-panel { height: 440px; flex-shrink: 0; }
  .driving-console { border-left: 0; border-top: 1px solid #3b444a; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow: visible; }
  .driving-metrics { margin: 0; align-self: center; }
  .driving-instruments { margin: 0; }
  .driving-approach, .driving-passengers { margin: 0; align-self: center; }
  .driving-last-stop { padding: 0; }
  #driving-transport-dock .transport { gap: 8px; }
  .driving-reference { grid-template-columns: 1fr; }
  .driving-heading h2 span { display: block; margin: 2px 0; }
  body.driving-fullscreen .driving-layout { height: auto; overflow: visible; }
  body.driving-fullscreen .driving-console { display: grid; }
  body.driving-fullscreen .driving-visual-panel { height: calc(100dvh - 340px); min-height: 260px; }
  body.driving-fullscreen .driving-journey { display: none; }
  body.driving-fullscreen .driving-layout { flex: 1; }
  body.driving-fullscreen .driving-visual-panel { flex: 1; }
}
@media (prefers-reduced-motion:reduce) {
  .driving-workbench * { scroll-behavior: auto; transition: none; }
}
/* Pilot 3D: WebGL sits inside the existing persistent driving viewport. */
.driving-3d-host { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.driving-3d-host canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; pointer-events: auto; }
.driving-3d-host canvas:active { cursor: grabbing; }
.pilot-load-state { position: absolute; z-index: 3; left: 50%; top: 45%; transform: translate(-50%,-50%); max-width: 90%; padding: 15px 20px; background: #17242eea; border: 1px solid #69838c; border-radius: 4px; color: #e6eff0; text-align: center; }
.pilot-load-state[hidden] { display: none; }
.pilot-3d-note { position: absolute; bottom: 30px; left: 12px; font-size: 10px; line-height: 1.5; background: #1a2b34d9; padding: 5px 8px; color: #d8e6e8; border-radius: 4px; pointer-events: none; }
.pilot-labels { position: absolute; inset: 0; pointer-events: none; }
.pilot-labels span { position: absolute; transform: translate(-50%,-100%); padding: 4px 8px; white-space: nowrap; font: 11px var(--sans); color: #e5f1f2; background: #17262ddd; border: 1px solid #577782; border-radius: 3px; }
.pilot-labels .next { border-color: #e8bc73; color: #ffe1a3; }
.pilot-message { flex-shrink: 0; }
.driving-attribution { z-index: 3; }

.driving-overspeed { display: flex; flex-wrap: wrap; align-items: center; border-left: 5px solid #efbd58; flex-shrink: 0; }
.driving-overspeed strong { letter-spacing: .04em; }
.driving-overspeed.severe, .driving-overspeed.critical { border: 2px solid #ff6279; border-left-width: 7px; padding: 14px 16px; }
.driving-overspeed.severe strong, .driving-overspeed.critical strong { font-size: 16px; color: #fff; }
/* Schematic cab frame: controls remain in the shared driving instruments. */
.pilot-cab { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pilot-cab[hidden] { display: none; }
.pilot-cab-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.cab-view .pilot-3d-note { top: 35px; bottom: auto; left: 6%; font-size: 9px; }
.driving-scene:has(.cab-view) .driving-attribution { top: 8px; bottom: auto; right: 6%; }
/* Shared interface system. Railway geometry, line colours and scene materials
   remain in their own renderers; this file owns the application chrome. */
body { font-size: 15px; line-height: 1.55; }
::selection { background: #f5ca7a; color: #17181c; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.5px; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.3px; }
h3 { font-size: 17px; line-height: 1.35; }
small { font-size: 12px; line-height: 1.5; }
a { color: #bce4f0; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .09em; }
.metric, .mono, .timebox, .data-table { font-variant-numeric: tabular-nums; }
.metric { letter-spacing: -.6px; }
.button-row { gap: 8px; align-items: center; }
.button-row button { font-size: 13px; }
.stack { gap: 16px; }
.divider { margin: 20px 0; }
/* Focus stays visible on the light masthead and on dark operating surfaces. */
:where(button,a,input,select,textarea,[tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.topbar :where(button,a,input,select):focus-visible { outline-color: #702082; }
.speedbuttons:focus-within { overflow: visible; }
.speedbuttons button:focus-visible { position: relative; z-index: 1; outline-offset: 1px; }
.table-wrap:focus-visible, .driving-stations:focus-visible { outline-offset: -3px; }
svg [role="button"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: 12px; z-index: 50; padding: 12px 18px; background: #fff; color: #17181c; border: 2px solid #702082; border-radius: var(--radius); font-weight: 600; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); outline: 3px solid #702082; outline-offset: 2px; }
button, input, select, textarea { border-radius: var(--radius); font-size: 14px; }
button { min-height: 40px; padding: 8px 14px; border-color: var(--control-line); background: var(--raised); line-height: 1.35; transition: background-color .12s,border-color .12s; }
button:hover:not(:disabled) { background: #3b404b; border-color: #b7c1d0; }
button:active:not(:disabled) { background: #454b57; }
button.primary { color: #fff; background: var(--action-red); border-color: var(--red); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #971820; border-color: #ff8790; }
button.danger { color: var(--danger-text); border-color: #d57986; background: #38272d; }
button.danger:hover:not(:disabled) { background: #512d36; border-color: #ffb8bf; }
button:disabled, button.primary:disabled, button.primary:disabled:hover { opacity: 1; background: #25272d; color: #aeb4c0; border-color: #515763; cursor: not-allowed; }
input, select, textarea { min-height: 40px; padding: 9px 11px; border: 1px solid var(--control-line); background: #17191e; color: var(--text); line-height: 1.4; }
input:hover, select:hover, textarea:hover { border-color: #aab5c5; }
input[type="number"] { width: 86px; font-family: var(--mono); font-size: 14px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand-cercanias); vertical-align: middle; margin-right: 6px; }
input[type="range"] { min-height: 26px; accent-color: var(--brand-cercanias); }
input::placeholder, textarea::placeholder { color: var(--subtle); }
kbd { background: #17191e; color: var(--text); border: 1px solid var(--control-line); border-bottom-width: 2px; border-radius: 4px; font: 500 12px var(--mono); padding: 2px 6px; }
/* Masthead, navigation and information hierarchy. */
.topbar { height: auto; min-height: 80px; padding: 14px 24px; gap: 20px; background: #fafaf8; color: #24262c; border-bottom: 4px solid var(--brand-cercanias-light); }
.brand { gap: 12px; }
.brand strong { font-size: 22px; letter-spacing: -.4px; }
.brand small { font-size: 11px; letter-spacing: .04em; color: #555b65; }
.topbar button { min-height: 40px; background: #fff; color: #24262c; border: 1px solid #737a86; border-radius: var(--radius); font-size: 13px; }
.topbar button:hover:not(:disabled) { background: #e8eaee; border-color: #505966; }
.topbar .speedbuttons { border-color: #737a86; }
.topbar .speedbuttons button { border: 0; }
.topbar .speedbuttons button.active { background: #30343c; color: #fff; }
.topbar .timebox { border-color: #bfc3cb; }
.topbar .timebox small, .topbar .timebox .eyebrow { color: #555b65; font-size: 11px; }
.topbar .timebox strong { font-size: 25px; }
.top-actions { gap: 8px; flex-shrink: 0; }
.shell { grid-template-columns: 194px minmax(0,1fr); min-height: calc(100dvh - 80px); }
.sidebar { padding: 24px 12px; background: #1c1e23; gap: 6px; border-color: var(--line); }
.sidebar>nav { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
#mode-navigation { display: flex; flex-direction: column; gap: 6px; }
.sidebar .eyebrow { padding: 0 12px; margin-bottom: 10px; }
.nav { min-height: 46px; border: 1px solid transparent; border-radius: var(--radius); padding: 11px 12px; font-size: 14px; color: var(--muted); gap: 10px; }
.nav:hover:not(:disabled) { background: #2b2e36; border-color: #737e8e; color: #fff; }
.nav.active { background: #3a272f; color: #fff; box-shadow: inset 3px 0 var(--brand-cercanias); border-color: #68515c; border-radius: var(--radius); font-weight: 600; }
.nav svg { width: 19px; height: 19px; }
.nav-footer { padding: 24px 0 0; font-size: 12px; }
.nav-footer .chip { font-size: 10px; border-color: var(--line); margin: 0 8px 8px; }
.nav-footer button { min-height: 40px; margin-top: 8px; padding: 8px 10px; font-size: 13px; text-align: left; }
.workspace { padding: 24px; min-width: 0; }
.page-title { gap: 16px; margin-bottom: 20px; align-items: center; }
.page-title p, .content-head p { font-size: 14px; line-height: 1.6; margin-top: 6px; color: var(--muted); }
.page-title .eyebrow { color: var(--subtle); }
.status-pill { font-size: 11px; line-height: 1.5; letter-spacing: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface); border-color: var(--line); }
.content-head { gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.kpis { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; border-color: var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.kpi { min-height: 108px; padding: 16px 18px; background: var(--surface); }
.kpi .eyebrow { font-size: 11px; letter-spacing: .05em; }
.kpi .metric { font-size: 26px; line-height: 1.3; }
.kpi small { font-size: 12px; line-height: 1.5; margin-top: 6px; }
.panel, .card { border-color: var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: none; }
.panel-head { min-height: 52px; padding: 12px 16px; gap: 12px; background: #282b32; border-color: var(--line); flex-wrap: wrap; }
.panel-head>.row { flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-head small { font-size: 12px; }
.card { padding: 22px; }
.card h3 { font-size: 18px; }
.card p, .content-head p, .notice { font-size: 14px; }
.cards { gap: 16px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.two-col { gap: 20px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.stats-grid { gap: 12px; font-size: 13px; }
.stats-grid span { font-size: 12px; margin-bottom: 4px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 4px; letter-spacing: 0; }
.chip.neutral { background: #2b2e36; color: var(--muted); border-color: var(--control-line); }
.chip.green { background: #21392f; color: var(--green); border-color: #6a9c81; }
.chip.amber { background: #3b3120; color: var(--amber); border-color: #b4975e; }
.chip.red { background: #42272f; color: var(--danger-text); border-color: #c17c88; }
.badge { font-size: 13px; line-height: 1.4; border-radius: 4px; padding: 4px 8px; min-width: 40px; }
/* The same control language in the map, inspector and fleet. */
.line-selector { gap: 8px; margin-bottom: 16px; }
.line-selector button { min-height: 46px; gap: 8px; padding: 8px 10px; background: var(--surface); border-color: var(--control-line); border-bottom: 3px solid transparent; font-size: 13px; }
.line-selector .line-filter.active { background: #333740; border-color: #b7c1d0; border-bottom-color: var(--line-color); box-shadow: inset 0 -1px var(--line-color); }
.line-selector .all-lines { font-size: 12px; letter-spacing: .02em; }
.line-selector .all-lines.active { background: #333740; border-color: #b7c1d0; border-bottom-color: #fff; }
.line-selector button:disabled { color: #b4bac5; background: #22242a; border-color: #515763; }
.line-selector .unavailable-line .badge { background: #535b68 !important; color: #fff !important; }
.line-availability { font-size: 11px; color: #c0c6d0; }
.operation { grid-template-columns: minmax(0,1fr) 328px; gap: 16px; }
.mapbox { background: #151619; }
.map-controls { gap: 6px; top: 12px; left: 12px; }
.map-controls button, .zoom-slider { min-height: 36px; border-color: var(--control-line); border-radius: var(--radius); background: #292c33f5; font-size: 12px; }
.map-controls button { padding: 7px 10px; }
.zoom-slider { padding: 4px 9px; }
.map-controls input { padding: 0; }
.map-note { font-size: 11px; color: var(--muted); }
.map-note a { color: #bce4f0; text-decoration: underline; }
.map-note button { font-size: 11px; color: var(--text); min-height: 28px; }
.map-legend { gap: 10px 16px; padding: 12px 14px; background: var(--surface); font-size: 12px; color: var(--muted); border-color: var(--line); }
.map-legend button { min-height: 32px; font-size: 12px; padding: 4px 8px; }
.map-transport-dock { padding: 8px 12px; background: #202228f5; border-color: var(--control-line); }
.map-transport-dock .transport { gap: 10px; }
.map-transport-dock .timebox strong { font-size: 20px; }
.map-transport-dock .timebox small { font-size: 11px; }
.map-transport-dock .play { width: 36px; min-width: 36px; min-height: 36px; font-size: 16px; }
.map-transport-dock .speedbuttons { border-color: var(--control-line); }
.map-transport-dock .speedbuttons button { min-height: 34px; min-width: 38px; font-size: 12px; padding: 6px; }
.map-transport-dock .speedbuttons button.active { background: #eef0f5; color: #17181c; font-weight: 600; }
.mapbox .map-scale { bottom: 72px; }
.mapbox .map-note { bottom: 68px; }
.inspector { scrollbar-gutter: stable; }
.inspector>.panel-head { background: #282b32; }
.inspector .panel-body { padding: 18px; }
.inspector h2 { font-size: 23px; line-height: 1.25; }
.inspector .field { padding: 10px 0; font-size: 13px; border-color: var(--line); }
.inspector .button-row { gap: 8px; margin-top: 16px; }
.inspector .button-row button { min-height: 40px; padding: 8px 10px; font-size: 13px; }
.inspector .notice { font-size: 13px; padding: 12px; line-height: 1.6; }
.route-callout { padding: 16px 18px; background: #282b32; font-size: 13px; border-color: var(--line); }
.route-callout p { margin-top: 6px; }
.photo-caption { color: var(--text); font-size: 12px; }
.photo-credit { color: var(--muted); font-size: 11px; line-height: 1.6; }
.photo-image-link:focus-visible { outline-color: var(--focus); }
.inspector-photo { border-radius: var(--radius); }
.subtabs { gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.subtabs>button { font-size: 14px; min-height: 44px; padding: 10px 14px; }
.subtabs .active { background: #34313a; color: #fff; border-color: #b7c1d0; border-bottom: 3px solid var(--brand-cercanias); padding-bottom: 8px; }
.table-wrap { scrollbar-gutter: stable; overscroll-behavior-x: contain; }
.data-table { font-size: 14px; }
.data-table th { background: #282b32; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; padding: 14px 18px; border-color: var(--line); }
.data-table td { padding: 16px 18px; border-color: #414650; }
.data-table td:first-child { font-size: 13px; }
.data-table tbody tr:hover { background: #292c33; }
.data-table td small { font-size: 12px; }
.data-table button { min-height: 38px; padding: 8px 11px; font-size: 13px; }
.data-table td.fleet-actions { min-width: 350px; padding: 20px; }
.assignment-control, .platform-choice { font-size: 13px; line-height: 1.5; }
.assignment-control select, .platform-choice select { font-size: 14px; min-height: 42px; }
.fleet-actions .assignment-control { margin-bottom: 16px; gap: 8px; }
.fleet-actions .fleet-action-buttons { gap: 10px; }
.fleet-action-buttons button { min-height: 40px; padding: 8px 12px; }
.band-row { padding: 18px; gap: 20px; flex-wrap: wrap; }
.band-row label { font-size: 13px; gap: 10px; }
.band-row small { margin-top: 4px; }
.line-stations button { min-height: 36px; padding: 6px 8px; font-size: 13px; }
.mini-row { padding: 12px 16px; font-size: 13px; gap: 10px; grid-template-columns: 56px minmax(0,1fr) auto; border-color: #414650; }
.events .mini-row { grid-template-columns: 52px minmax(0,1fr); }
.events { max-height: 220px; }
.keyboard { font-size: 12px; line-height: 1.6; margin-top: 12px; }
/* Notices, configuration and reference material. */
.notice { background: #292c33; color: var(--muted); border-color: var(--line); border-left: 3px solid #99a4b6; border-radius: var(--radius); padding: 14px 16px; line-height: 1.6; }
.banner { font-size: 14px; border-radius: var(--radius); padding: 12px 16px; gap: 12px; flex-wrap: wrap; background: #3b3120; border-color: #b4975e; color: var(--amber); }
.banner.info { background: #292c33; border-color: var(--control-line); color: var(--text); }
.alert-item { padding: 18px; border-radius: var(--radius); border-color: #9c8054; border-left: 4px solid var(--amber); background: #302b24; }
.alert-item>.row { flex-wrap: wrap; }
.alert-item p { font-size: 14px; line-height: 1.65; color: var(--muted); margin: 10px 0 14px; }
.overlay { padding: 24px; background: #090a0de0; backdrop-filter: blur(3px); }
.modal { max-height: calc(100dvh - 48px); border-radius: 8px; background: var(--surface); border-color: var(--control-line); border-top: 4px solid var(--brand-cercanias); overscroll-behavior: contain; scrollbar-gutter: stable; }
.modal-header { padding: 24px 28px; gap: 20px; border-color: var(--line); }
.modal-header h2 { font-size: 27px; line-height: 1.25; margin: 6px 0 8px; }
.modal-header p, .modal-header small { font-size: 14px; }
.modal-header>button { min-width: 40px; min-height: 40px; font-size: 21px; flex-shrink: 0; }
.modal-body { padding: 24px 28px; line-height: 1.65; }
.modal-footer { padding: 18px 28px; gap: 16px; flex-wrap: wrap; background: #282b32; border-color: var(--line); }
.modal-footer button.primary { min-height: 44px; }
.setup-grid { gap: 24px; grid-template-columns: minmax(0,1fr) 290px; }
.game-mode-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.game-mode-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.game-mode-card>button:first-child { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; flex: 1; padding: 24px; border-top: 3px solid var(--brand-cercanias); text-align: left; background: var(--raised); white-space: normal; }
.game-mode-card>button:first-child:hover { background: #343038; border-color: var(--brand-cercanias); }
.game-mode-card strong { font-size: 25px; line-height: 1.2; color: #fff; }
.game-mode-card span:not(.eyebrow) { font-size: 15px; line-height: 1.6; }
.game-mode-card small { margin-top: auto; color: var(--muted); font-size: 12px; }
.setup-save-note { margin: 24px 0 0; color: var(--muted); font-size: 13px; }
.driving-setup-grid label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.driving-setup-grid select { width: 100%; min-height: 44px; }
.driving-setup-grid .setup-summary label:first-child { margin-top: 0; }
.driving-setup-model h3 { margin: 12px 0 4px; font-size: 20px; }
.driving-setup-model p { margin-top: 4px; color: var(--muted); }
.driving-route-summary { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.driving-route-summary strong { font-size: 17px; line-height: 1.4; }
.driving-route-summary>span:last-child { font-size: 12px; color: var(--muted); }
.setup-summary { display: block; padding: 20px; background: #282b32; border-color: var(--line); border-radius: var(--radius); }
.setup-summary label { font-size: 14px; line-height: 1.5; margin-top: 18px; }
.setup-summary select { margin-top: 8px; }
.setup-summary .notice { font-size: 13px; margin-bottom: 0; }
.setup-summary small { display: block; margin-top: 6px; }
.setup-train { grid-template-columns: 100px minmax(0,1fr) 108px; gap: 14px; padding: 16px 0; }
.setup-train strong { font-size: 15px; }
.setup-train small { font-size: 12px; }
.stepper { gap: 8px; font-size: 14px; }
.stepper button { min-width: 36px; min-height: 40px; padding: 6px 8px; font-size: 18px; }
.setup-error { font-size: 14px; color: var(--danger-text); }
.intro-route { font: 12px var(--mono); letter-spacing: .03em; color: var(--muted); }
.order-form { gap: 20px; }
.order-form label { gap: 8px; font-size: 14px; }
.order-form select { min-height: 42px; }
.depot-yard { gap: 10px; padding: 20px; grid-template-columns: repeat(5,minmax(0,1fr)); }
.parking { min-height: 70px; color: #b5bdc9; border-color: #737e8e; background: repeating-linear-gradient(0deg,transparent 0,transparent 15px,#383d46 16px,#383d46 18px,transparent 19px),#17191e; font-size: 12px; }
.parking.owned { color: var(--green); border-color: #6a9c81; }
.parking.reserved { color: var(--danger-text); border-color: #c17c88; background-color: #39262e; }
.timeline:before { background: var(--control-line); }
.future-card { padding: 22px; gap: 20px; align-items: flex-start; border-color: var(--line); border-radius: var(--radius); }
.future-card p { font-size: 14px; line-height: 1.6; }
.future-card .lock { font-size: 12px; line-height: 1.6; }
.future-card .lock strong { font-size: 13px; }
.expansion-requirements { gap: 12px; margin: 18px 0; }
.expansion-requirements p { font-size: 13px; }
.tutorial-guide { max-width: 1180px; }
.tutorial-intro { font-size: 14px; line-height: 1.7; }
.tutorial-steps { gap: 18px; }
.tutorial-step { padding: 24px; gap: 18px; }
.tutorial-number { flex-basis: 32px; font-size: 20px; line-height: 1.5; color: var(--text); border-top: 3px solid var(--brand-cercanias); }
.tutorial-step h2, .tutorial-reference h2 { font-size: 21px; margin-bottom: 12px; }
.tutorial-step p, .tutorial-reference p { font-size: 15px; line-height: 1.75; }
.tutorial-step button { min-height: 40px; font-size: 14px; }
.tutorial-reference { padding: 24px; }
.sources p, .sources li { font-size: 14px; line-height: 1.75; color: var(--muted); }
#toast { padding: 14px 20px; border: 1px solid #aeb7c5; border-left: 4px solid var(--action-red); border-radius: var(--radius); background: #f5f6f8; color: #24262c; font-size: 14px; width: max-content; max-width: min(650px,calc(100vw - 32px)); line-height: 1.6; }
/* Driving belongs to the same workstation. Colour is reserved for status,
   route identity and the rendered world rather than a second UI palette. */
.driving-workbench { border-color: var(--line); background: var(--bg); border-radius: var(--radius); }
.driving-heading, .driving-controls-bar { background: #282b32; border-color: var(--control-line); }
.driving-heading { padding: 14px 18px; }
.driving-heading h2 { font-size: 20px; }
.driving-heading h2 span { font-size: 14px; color: var(--muted); }
.driving-heading small { font-size: 12px; color: var(--muted); }
.driving-heading button { font-size: 13px; }
.standalone-driving #kpis, .standalone-driving .keyboard, .standalone-driving .speedbuttons { display: none; }
.driving-heading .driving-run-title { font: 600 20px var(--sans); margin: 0 0 4px; }
.driving-service-id>div>strong { display: block; font: 500 14px var(--mono); margin-bottom: 4px; }
.driving-legacy-banner { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 18px; background: #3b3120; color: var(--amber); border-bottom: 1px solid var(--line); font-size: 13px; }
.driving-empty { padding: 24px; }
.driving-empty button { margin: 8px 8px 0 0; }
.driving-status { background: #24362e; border-color: #526b5e; padding: 10px 18px; font-size: 13px; }
.driving-status>strong { font-size: 13px; color: #bcebcf; }
.driving-status>span:last-child { color: #d0dad4; font-size: 13px; }
.driving-status-dot { width: 8px; height: 8px; background: var(--green); }
.driving-status.attention { background: #3b3120; border-color: #9e8351; }
.driving-status.attention strong { color: var(--amber); }
.driving-status.danger { background: #42272f; border-color: #bd7581; }
.driving-status.danger strong { color: var(--danger-text); }
.driving-destination { padding: 10px 18px; background: var(--surface); }
.driving-camera-tools { padding: 8px 12px; background: #282b32; border-color: var(--line); gap: 6px; flex-wrap: wrap; }
.driving-camera-tools button { min-height: 36px; padding: 7px 10px; border-color: var(--control-line); background: var(--surface); font-size: 12px; }
.driving-camera-tools button[aria-pressed="true"] { background: #422a33; border-color: #f18e99; color: #fff; box-shadow: inset 0 -2px var(--brand-cercanias); }
.driving-camera-tools button:disabled { background: #25272d; color: #aeb4c0; border-color: #515763; }
.driving-console { padding: 14px; background: var(--surface); border-color: var(--line); scrollbar-gutter: stable; }
.driving-limit>span, .driving-limit small { font-size: 11px; }
.driving-limit>strong { border-color: var(--action-red); }
.driving-metric { padding: 10px; background: #191b20; border-color: var(--line); border-radius: var(--radius); }
.driving-metric>span { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 6px; }
.driving-metric strong { font-size: 22px; }
.driving-metric strong small { font-size: 11px; line-height: 1.5; color: var(--muted); }
.driving-approach { font-size: 11px; color: var(--muted); }
.driving-approach strong { font-size: 12px; color: var(--text); }
.driving-approach.near strong { color: var(--amber); }
.driving-passengers { font-size: 13px; color: var(--muted); }
.driving-passengers strong { color: var(--text); }
.driving-passengers small { font-size: 12px; color: var(--muted); }
.driving-passengers progress { height: 6px; background: var(--line); accent-color: var(--green); }
.driving-passengers progress::-webkit-progress-bar { background: var(--line); }
.driving-passengers progress::-webkit-progress-value { background: var(--green); }
.driving-passengers progress::-moz-progress-bar { background: var(--green); }
.driving-summary .driving-metric { padding: 8px; }
.driving-summary .driving-metric>span { font-size: 11px; }
.driving-last-stop { font-size: 13px; color: var(--muted); padding-top: 14px; }
.driving-last-stop>span { font-size: 11px; color: var(--muted); }
.driving-last-stop>strong { color: var(--text); }
.driving-last-stop strong small { color: var(--muted); }
.driving-controls-bar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
.driving-controls-bar>button { display: inline-flex; align-items: center; }
#driving-transport-dock .timebox>strong { font-size: 22px; color: var(--text); }
#driving-transport-dock button { min-height: 40px; font-size: 13px; padding: 8px 12px; }
.driving-journey { padding: 14px 18px 0; background: var(--surface); }
.driving-journey-title { font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.driving-journey-title>span:nth-child(2) { display: inline; }
.driving-journey-title strong { font-size: 12px; color: var(--text); }
.driving-journey-title .badge { font-size: 12px; min-width: 38px; padding: 3px 6px; }
.driving-stations { padding-bottom: 12px; scrollbar-color: var(--control-line) var(--surface); }
.driving-stations li { min-width: 122px; max-width: 122px; padding: 12px 8px 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.driving-stations .behind { color: #aeb7c5; }
.driving-stations .current { color: #fff; font-weight: 600; }
.driving-stations li small { font-size: 11px; color: var(--amber); min-height: 16px; }
.driving-secondary { padding: 12px 18px; border-color: var(--line); }
.driving-secondary>span { display: block; font-size: 12px; color: var(--muted); }
.driving-secondary button { font-size: 12px; padding: 8px 10px; min-height: 38px; }
.driving-secondary button[data-a="driving-announcements"][aria-pressed="true"] { border-color: var(--brand-cercanias); color: #fff; box-shadow: inset 0 -2px var(--brand-cercanias); }
.driving-reference { padding: 22px; gap: 24px; border-color: var(--line); font-size: 14px; color: var(--muted); background: var(--surface); }
.driving-reference p { line-height: 1.7; }
.pilot-message { font-size: 13px; line-height: 1.6; padding: 10px 14px; background: #3b3120; color: var(--amber); }
.driving-overspeed { font-size: 14px; padding: 12px 18px; background: #49381e; border-color: #e5ba6c; color: #ffe0a5; gap: 8px 18px; }
.driving-overspeed strong { font-size: 14px; }
.driving-overspeed.severe, .driving-overspeed.critical { background: #5b2530; color: #ffe6e9; border-color: #ff9eae; }
.driving-overspeed.critical { border-left-width: 6px; }
/* Reflow keeps labels and critical controls available at narrow widths and
   browser zoom. Only the map and data tables require two-dimensional panning. */
@media (min-width:1700px) {
  .workspace { padding: 28px 32px; }
  .shell { grid-template-columns: 208px minmax(0,1fr); }
  .operation { grid-template-columns: minmax(0,1fr) 348px; }
  .driving-layout { grid-template-columns: minmax(0,1fr) 310px; }
}
@media (max-width:1250px) {
  .topbar { padding: 12px 18px; gap: 12px; flex-wrap: wrap; }
  .shell { grid-template-columns: 180px minmax(0,1fr); }
  .workspace { padding: 20px; }
  .brand strong { font-size: 20px; }
  .brand small { font-size: 11px; }
  .operation { grid-template-columns: minmax(0,1fr) 300px; }
  .kpi { padding: 14px; }
  .kpi .metric { font-size: 23px; }
  .cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .driving-layout { grid-template-columns: minmax(0,1fr) 260px; }
}
@media (max-width:1050px) {
  .shell { display: block; }
  .sidebar { display: flex; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 16px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
  .sidebar>nav { flex-direction: row; align-items: center; flex: 0 0 auto; }
  #mode-navigation { flex-direction: row; flex-shrink: 0; }
  .sidebar nav>.eyebrow { display: none; }
  .nav { flex-shrink: 0; min-height: 44px; padding: 10px 12px; gap: 8px; justify-content: flex-start; }
  .nav span { display: inline; }
  .nav.active { box-shadow: inset 0 -3px var(--brand-cercanias); }
  .nav-footer { display: flex; margin: 0 0 0 8px; padding: 0 0 0 12px; gap: 8px; align-items: center; border-left: 1px solid var(--line); flex-shrink: 0; }
  .nav-footer .chip { display: none; }
  .nav-footer button { margin: 0; padding: 10px 12px; width: auto; font-size: 13px; white-space: nowrap; min-height: 44px; }
  .brand-divider, .renfe-symbol { display: block; }
  .operation { grid-template-columns: minmax(0,1fr) 290px; }
  .inspector { max-height: 650px; }
  .inspector .panel-body { padding: 16px; }
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .setup-summary { display: block; }
}
@media (max-width:800px) {
  .operation { grid-template-columns: minmax(0,1fr); }
  .inspector { max-height: none; }
  .topbar .brand { display: flex; }
  .topbar .brand small { display: block; }
  .brand strong { font-size: 19px; }
  .brand { gap: 8px; }
  .brand-divider { margin: 0; height: 30px; }
  .renfe-symbol { width: 30px; height: 30px; }
  #header-transport:not(:empty) { order: 3; width: 100%; }
  #header-transport .transport { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
  .topbar .timebox { border: 0; padding: 0; }
  .top-actions { display: flex; margin-left: auto; }
  .page-title { align-items: flex-start; }
  .page-title h1 { font-size: 25px; }
  .page-title p { font-size: 14px; }
  .mapbox { min-height: 480px; height: 60dvh; }
  .content-head { gap: 12px; }
  .cards { grid-template-columns: 1fr; }
  .future-card { flex-wrap: wrap; }
  .future-card .lock { display: block; width: 100%; text-align: left; margin: 0; }
  .future-card .lock strong { max-width: none; }
  .depot-yard { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .operations-footer { grid-template-columns: 1fr; }
  .driving-layout { height: auto; display: flex; flex-direction: column; }
  .driving-visual-panel { min-height: 470px; height: 62dvh; }
  .driving-destination { display: block; }
  .driving-station-heading { display: flex; flex-direction: column; gap: 5px; }
  .driving-station-context { text-align: center; }
  .driving-destination-meta { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 8px; text-align: left; }
  .driving-destination-meta strong { order: 0; }
  .driving-console { border-left: 0; border-top: 1px solid var(--line); overflow: visible; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; align-items: center; }
  .driving-instruments { grid-row: span 2; margin: 0; }
  .driving-speed { max-width: 70%; width: 190px; }
  .driving-metrics { margin: 0; }
  .driving-approach, .driving-passengers { margin: 0; }
  .driving-summary, .driving-last-stop { align-self: start; }
  .driving-heading .button-row button { font-size: 12px; }
  .driving-controls-bar>button { font-size: 13px; }
  .driving-reference { grid-template-columns: 1fr; }
  .driving-reference .inspector-photo { max-width: 360px; }
  body.driving-fullscreen .driving-layout { flex: 0 0 auto; min-height: 0; }
  body.driving-fullscreen .driving-visual-panel { height: 60dvh; min-height: 360px; }
  body.driving-fullscreen .driving-stations { max-height: none; }
  body.driving-fullscreen .driving-journey { display: block; }
}
@media (min-width:801px) and (max-height:850px) {
  body.driving-fullscreen .driving-heading { padding: 10px 12px; }
  body.driving-fullscreen .driving-status { padding: 8px 12px; }
  body.driving-fullscreen .driving-secondary { padding: 6px 12px; }
  body.driving-fullscreen .driving-secondary>span { display: none; }
}
@media (max-width:540px) {
  .game-mode-choices { grid-template-columns: minmax(0,1fr); }
  .game-mode-card>button:first-child { padding: 20px; gap: 12px; }
  .topbar { padding: 12px; gap: 10px; }
  .brand { flex: 1 1 100%; }
  .top-actions { margin-left: 0; }
  .top-actions button { min-height: 40px; }
  .workspace { padding: 16px 12px; }
  .page-title { flex-wrap: wrap; }
  .kpi { padding: 12px; }
  .kpi .row { flex-wrap: wrap; gap: 6px; }
  .kpi .metric { font-size: 21px; }
  .kpi .eyebrow { font-size: 10px; }
  .kpi .chip { font-size: 10px; padding: 2px 5px; }
  .line-selector button { min-height: 44px; font-size: 12px; }
  .line-selector .line-filter { justify-content: flex-start; flex-wrap: wrap; }
  .map-controls { max-width: calc(100% - 24px); }
  .map-compass { display: none; }
  .map-transport-dock { padding: 8px; }
  .map-transport-dock .transport { gap: 8px; }
  .map-transport-dock .speedbuttons button { min-width: 34px; padding: 5px; font-size: 11px; }
  .mapbox .map-scale { bottom: 112px; }
  .map-note { display: none; }
  .map-legend { font-size: 11px; }
  .overlay { padding: 10px; }
  .modal { max-height: calc(100dvh - 20px); }
  .modal-header, .modal-body, .modal-footer { padding: 18px; }
  .modal-header h2 { font-size: 24px; }
  .modal-footer { align-items: stretch; flex-direction: column; }
  .setup-train { grid-template-columns: minmax(0,1fr) 108px; }
  .setup-train .train-art { display: none; }
  .setup-summary { padding: 16px; }
  .band-row label { width: 100%; justify-content: space-between; }
  .tutorial-step { padding: 20px; gap: 14px; }
  .tutorial-number { flex-basis: 25px; font-size: 18px; }
  .driving-heading, .driving-secondary { padding: 12px; }
  .driving-heading h2 span { display: block; margin: 4px 0 0; }
  .driving-destination { padding: 12px; }
  .driving-station-sign { padding: 7px 14px 9px; font-size: 22px; }
  .driving-destination-meta small { font-size: 11px; }
  .driving-console { grid-template-columns: minmax(0,1fr); }
  .driving-instruments { grid-row: auto; justify-content: center; }
  .driving-visual-panel { min-height: 430px; }
  .driving-controls-bar { gap: 8px; padding: 10px; }
  #driving-transport-dock { flex: 1; }
  .driving-controls-bar .transport { order: initial; width: auto; gap: 8px; }
  .driving-journey-title strong { width: 100%; margin: 0; text-align: left; }
  body.map-fullscreen .operation { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(240px,60%) minmax(0,1fr); }
  body.map-fullscreen .inspector { min-height: 0; border-top: 2px solid var(--control-line); }
  body.map-fullscreen .inspector .panel-body { padding: 10px; }
  body.map-fullscreen .inspector h2 { font-size: 18px; }
  body.map-fullscreen .inspector .field { flex-wrap: wrap; font-size: 12px; }
  body.map-fullscreen .inspector .field>span:last-child { text-align: left; }
  body.map-fullscreen .map-controls { left: 6px; top: 6px; gap: 4px; max-width: calc(100% - 12px); }
  body.map-fullscreen .map-controls button { font-size: 11px; padding: 6px; min-height: 34px; }
  body.map-fullscreen .zoom-slider { width: 100%; font-size: 11px; }
  body.map-fullscreen .zoom-slider input { width: 100%; min-width: 0; }
  body.map-fullscreen .map-legend { max-height: 120px; overflow: auto; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
@media (forced-colors:active) {
  button, input, select, textarea, .panel, .card, .modal { border: 1px solid ButtonText; }
  .nav.active, .subtabs .active, [aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
  :where(button,a,input,select,[tabindex]):focus-visible { outline: 3px solid Highlight; }
  .badge { border: 1px solid CanvasText; }
  .skip-link { border-color: Highlight; }
}

.driving-doors{padding:12px;border:1px solid var(--border,#49515b);border-radius:6px;background:#192126;display:grid;gap:9px}.driving-doors small{color:#c4cbd0;line-height:1.45}.door-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px}.door-buttons button{padding:10px 7px;min-height:42px}.door-buttons button:last-child{grid-column:1/-1}.driving-doors .ghost{font-size:13px}.driving-console{overflow-y:auto}

/* Keep the warning slot mounted so its appearance cannot replace the live scene. */
.driving-overspeed[hidden] { display: none; }

/* Unified driver's desk. Live scene and transport remain mounted while panels toggle. */
.driver-workstation .driving-heading { display: grid; grid-template-columns: 215px minmax(0,1fr); padding: 8px 14px; gap: 16px; }
.driver-workstation .driving-heading h2 { font: 600 14px var(--sans); margin: 0 0 3px; }
.driver-workstation .driving-service-id { gap: 10px; min-width: 0; }
.driver-workstation .driving-service-id .badge { min-width: 38px; font-size: 13px; }
.driver-workstation .driving-service-id>div>strong { font-size: 12px; margin-bottom: 3px; }
.driver-workstation .driving-heading small { font-size: 11px; }
.driver-workstation .driving-destination { padding: 0; background: transparent; grid-template-columns: minmax(70px,1fr) minmax(0,3fr) minmax(100px,1fr); }
.driver-workstation .driving-station-sign { font-size: clamp(22px,2vw,30px); padding: 5px 18px 7px; }
.driver-workstation .driving-station-context { font-size: 9px; }
.driver-workstation .driving-layout { display: block; height: clamp(220px,calc(100dvh - 560px),540px); min-height: 220px; }
.driver-workstation .driving-visual-panel { height: 100%; min-height: 0; }
.driver-workstation .pilot-message[hidden], .driver-extra-panel[hidden] { display: none; }
.driver-workstation .driving-console { position: relative; display: block; padding: 9px 12px 8px; overflow: visible; border: 1px solid #56626a; border-top: 7px solid #48555d; border-radius: 50% 50% 0 0 / 16px 16px 0 0; background: linear-gradient(100deg,#242d33,#38444c 47%,#242d33); box-shadow: inset 0 3px 3px #8b989d66,inset 0 -8px 14px #11191e80; flex: 0 0 auto; }
.driver-console-toolbar { display: flex; align-items: center; gap: 18px; padding: 3px 8px 8px; background: transparent; }
.driver-console-title { font: 600 10px var(--sans); color: #d4dae2; letter-spacing: .12em; }
.driver-console-toolbar>.button-row { margin: 0 0 0 auto; gap: 6px; }
.driver-console-toolbar button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.driver-console-toolbar #driving-transport-dock { flex: 0 0 auto; }
.driver-console-toolbar #driving-transport-dock .timebox>strong { font-size: 23px; }
.driver-console-toolbar #driving-transport-dock button { min-height: 38px; padding: 7px 12px; }
.driver-console-feedback { margin: 0 5px; border: 1px solid #111a20; border-radius: 4px; overflow: hidden; }
.driver-workstation .driving-status { padding: 5px 12px; min-height: 30px; gap: 8px; }
.driver-workstation .driving-status>strong, .driver-workstation .driving-status>span:last-child { font-size: 12px; }
.driver-workstation .driving-overspeed { padding: 7px 14px; font-size: 12px; gap: 6px 14px; border-width: 0 0 1px 4px; }
.driver-workstation .driving-overspeed strong { font-size: 12px; }
.driver-console-main { display: grid; grid-template-columns: minmax(210px,.85fr) minmax(260px,1.1fr) minmax(280px,1.1fr); gap: 14px; padding: 10px 5px 8px; }
.driver-console-main>section { padding: 10px 14px; min-width: 0; border: 5px solid #171e23; border-radius: 8px; background: #101b20; box-shadow: 0 1px 0 #637079,inset 0 0 0 1px #54656c; }
.driver-console-main h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 8px; font: 600 12px var(--sans); color: #f2f4f7; }
.driver-console-main h3 small { font-size: 10px; font-weight: 400; color: var(--muted); }
.driver-workstation .driving-instruments { display: flex; justify-content: center; gap: 12px; margin: -5px 0 0; grid-row: auto; }
.driver-workstation .driving-speed { width: 126px; max-width: 65%; }
.driver-workstation .driving-limit { gap: 4px; min-width: 60px; }
.driver-workstation .driving-limit>strong { width: 52px; height: 52px; font-size: 21px; border-width: 4px; }
.driver-workstation .driving-limit>span, .driver-workstation .driving-limit small { font-size: 10px; }
.driver-next-limit, .driver-braking-distance { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 11px; color: var(--muted); }
.driver-next-limit { border-top: 1px solid var(--line); padding-top: 6px; }
.driver-next-limit strong, .driver-braking-distance strong { font: 500 12px var(--mono); color: #f2f4f7; }
.cab-combined-control {
 display: grid;
 grid-template-columns: 48px auto minmax(0,1fr);
 align-items: center;
 gap: 8px;
}
.cab-lever-slot {
 display: grid;
 place-items: center;
 border: 1px solid #69777f;
 border-radius: 6px;
 background: linear-gradient(90deg,#172229,#303c43 49%,#172229);
 box-shadow: inset 0 2px 5px #000a;
}
#drive-lever {
 appearance: none;
 writing-mode: vertical-lr;
 direction: rtl;
 width: 44px;
 height: 102px;
 margin: 0;
 border: 0;
 border-radius: 5px;
 background: linear-gradient(#0b1014,#0b1014) center / 8px calc(100% - 16px) no-repeat,
             repeating-linear-gradient(to bottom,#76818a 0 1px,transparent 1px 10.75px) center / 18px 87px no-repeat;
 cursor: grab;
 touch-action: none;
}
#drive-lever:active { cursor: grabbing; }
#drive-lever:disabled { opacity: .65; cursor: default; }
#drive-lever::-webkit-slider-thumb {
 appearance: none;
 width: 37px;
 height: 16px;
 border: 1px solid #a4b0b8;
 border-radius: 4px;
 background: repeating-linear-gradient(#44525b 0 2px,#283139 2px 4px);
 box-shadow: 0 3px 4px #000b;
}
#drive-lever::-moz-range-thumb {
 width: 35px;
 height: 14px;
 border: 1px solid #a4b0b8;
 border-radius: 4px;
 background: repeating-linear-gradient(#44525b 0 2px,#283139 2px 4px);
 box-shadow: 0 3px 4px #000b;
}
.cab-lever-scale { display: grid; align-content: space-between; min-height: 94px; font-size: 11px; color: var(--muted); }
.cab-lever-scale [data-active="true"] { color: var(--text); font-weight: 700; }
.cab-lever-readout { justify-self: center; min-width: 0; }
.cab-lever-readout strong { display: block; font: 600 13px var(--sans); margin-bottom: 5px; }
.cab-lever-readout [data-effort="1"] { color: var(--green); }
.cab-lever-readout [data-effort="-1"] { color: var(--amber); }
#drive-lever-help { display: flex; flex-wrap: wrap; gap: 5px 8px; font-size: 11px; }
#drive-lever-help span { white-space: nowrap; }
#drive-lever-help kbd { border-radius: 3px; padding: 0 4px; }
.driver-braking-distance { margin-top: 8px; }
.driver-workstation .driving-approach { margin: 8px 0 0; }
.driver-workstation .driving-approach .row { font-size: 10px; }
.driver-workstation .driving-approach strong, .driver-workstation .driving-approach small { font-size: 10px; }
.driver-workstation .approach-ruler { height: 12px; margin: 5px 6px; }
.driver-workstation .driving-doors { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.driver-workstation .driving-doors>.row { font-size: 12px; gap: 8px; padding: 9px 10px; border: 4px solid #151e24; border-radius: 5px; background: #101b20; box-shadow: 0 1px 0 #69777e,inset 0 0 0 1px #52646b; }
.driver-workstation .driving-doors>.row>strong { display: flex; align-items: center; gap: 8px; }
.driver-workstation .driving-doors>.row>strong:before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #87c9ad; box-shadow: 0 0 0 2px #122c22; }
.driver-workstation .driving-doors:not([data-door-phase="closed"])>.row>strong:before { background: #f5ca7a; box-shadow: 0 0 0 2px #3b3120; }
.driver-workstation .driving-doors>.row>span { font-size: 12px; text-align: right; }
.driver-workstation .driving-doors>small { font-size: 11px; line-height: 1.4; }
.driver-workstation .door-buttons { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.driver-workstation .door-buttons button { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 70px; padding: 3px 0; font-size: 11px; background: transparent; border-color: transparent; box-shadow: none; }
.driver-workstation .door-buttons button:last-child { grid-column: auto; }
.cab-switch-head { display: grid; place-items: center; width: 43px; height: 43px; border: 4px solid #a2adb1; border-radius: 50%; color: #effaf5; background: radial-gradient(circle at 40% 30%,#456e5b,#213f32); box-shadow: 0 0 0 2px #121b20,inset 0 2px 3px #c6e7d966,0 3px 4px #0009; }
.cab-switch-head svg { width: 25px; height: 25px; }
.is-close .cab-switch-head { color: #fff7db; background: radial-gradient(circle at 40% 30%,#90713c,#59401a); }
.driver-workstation .cab-pushbutton:hover:not(:disabled) .cab-switch-head { outline: 2px solid #ecf2f3; outline-offset: 2px; }
.driver-workstation .cab-pushbutton:active:not(:disabled) .cab-switch-head { transform: translateY(2px); box-shadow: 0 0 0 2px #121b20,inset 0 2px 5px #0009; }
.driver-workstation .cab-pushbutton:disabled { opacity: 1; border-color: transparent; color: #b0bac1; }
.cab-pushbutton:disabled .cab-switch-head { border-color: #667279; color: #b0bac1; background: #27343b; box-shadow: 0 0 0 2px #172127,inset 0 2px 3px #0008; }
.cab-pushbutton[data-lamp="on"] .cab-switch-head { border-color: #b3c4bc; color: #133b29; background: #8cdbac; box-shadow: 0 0 0 2px #14271e,inset 0 1px 3px #fff9,0 0 8px #8cdbac66; }
.cab-pushbutton.is-close[data-lamp="on"] .cab-switch-head { color: #4a3311; background: #f3cf80; box-shadow: 0 0 0 2px #332b18,inset 0 1px 3px #fff9,0 0 8px #f3cf8066; }
.cab-switch-label { line-height: 1.2; }
.driver-console-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 6px 5px 2px; border-top: 1px solid #73838c66; background: transparent; }
.driver-workstation .driving-camera-tools { border: 0; padding: 0; background: transparent; gap: 4px; flex-wrap: wrap; }
.driver-workstation .driving-camera-tools button, .driver-auxiliary-tools button { padding: 6px 8px; min-height: 34px; font-size: 11px; }
.driver-auxiliary-tools { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.driver-auxiliary-tools [aria-expanded="true"], .driver-auxiliary-tools [aria-pressed="true"] { background: #303e3b; border-color: #89c7ab; color: #e6fff1; }
.driver-auxiliary-tools .driver-test-trigger { color: var(--muted); background: transparent; border-color: var(--line); }
.driver-auxiliary-tools .driver-test-trigger:hover { color: var(--text); border-color: var(--control-line); }
.driver-auxiliary-tools .driver-test-trigger.active-test { color: var(--amber); border-color: var(--amber); }
.driving-test-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.driving-test-form label { display: grid; gap: 4px; min-width: 0; }
.driving-test-form select { width: 100%; min-height: 40px; }
.driving-test-form small { grid-column: 1/-1; color: var(--muted); }
.driving-test-form [hidden] { display: none; }
@media (max-width:480px) {
 .driving-test-form { grid-template-columns: 1fr; }
}
.driver-announcements-slot:empty { display: none; }
.driver-extra-panel { flex: 0 0 auto; border-top: 1px solid var(--line); }
.driver-workstation .driving-journey { padding: 10px 14px 0; }
.driver-service-report { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: start; gap: 20px; padding: 16px; }
.driver-service-report .driving-passengers { margin: 0; }
.driver-service-report .driving-last-stop { padding: 0; }
body.driving-fullscreen .driver-workstation .driving-layout { flex: 1 0 220px; min-height: 220px; height: auto; }
body.driving-fullscreen .driver-workstation .driving-visual-panel { height: 100%; min-height: 0; flex: 1; }
body.driving-fullscreen .driver-workstation .driving-console { flex: 0 0 auto; }
body.driving-fullscreen .driver-workstation .driving-stations { max-height: none; }
@media (max-width:1250px) {
 .driver-console-title { display: none; }
 .driver-console-main>section { padding: 10px 12px; }
 .driver-console-main { gap: 8px; }
 .driver-console-tools { gap: 6px; }
 .driver-auxiliary-tools { margin-left: 0; }
}
@media (max-width:900px) {
 .driver-workstation .driving-heading { grid-template-columns: 160px minmax(0,1fr); gap: 8px; }
 .driver-workstation .driving-service-id .badge { display: none; }
 .driver-workstation .driving-destination { grid-template-columns: minmax(0,1fr) 90px; gap: 8px; }
 .driver-workstation .driving-station-heading { display: flex; flex-direction: column; gap: 4px; grid-column: 1; }
 .driver-workstation .driving-station-context { text-align: center; }
 .driver-workstation .driving-destination-meta { grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; margin: 0; }
 .driver-workstation .driving-station-sign { font-size: 21px; }
 .driver-workstation .driving-destination-meta strong { order: -1; }
 .driver-workstation .driving-destination-meta small { font-size: 10px; }
 .driver-console-main { grid-template-columns: minmax(170px,.8fr) minmax(220px,1fr) minmax(240px,1fr); }
 .driver-console-toolbar { gap: 8px; flex-wrap: wrap; }
 .driver-console-toolbar>.button-row { flex-wrap: wrap; }
}
@media (max-width:760px) {
 .driver-console-main { grid-template-columns: minmax(0,1fr) minmax(0,1.3fr); }
 .driver-console-main .driving-doors { grid-column: 1 / -1; border-top: 1px solid #657680; }
 .driver-workstation .door-buttons { grid-template-columns: repeat(3,minmax(0,1fr)); }
 .driver-workstation .door-buttons button:last-child { grid-column: auto; }
 .driver-workstation .driving-layout { height: 40dvh; min-height: 240px; }
 .driver-workstation .driving-console { display: block; }
 .driver-service-report { grid-template-columns: 1fr; }
 .driver-workstation .driving-journey-title strong { width: auto; margin-left: auto; }
}
@media (max-width:480px) {
 .driver-workstation .driving-heading { display: block; }
 .driver-workstation .driving-service-id { margin-bottom: 8px; }
 .driver-workstation .driving-service-id .badge { display: block; }
 .driver-workstation .driving-heading h2, .driver-workstation .driving-heading small { display: none; }
 .driver-workstation .driving-service-id>div>strong { margin: 0; }
 .driver-workstation .driving-station-heading { align-items: flex-start; }
 .driver-workstation .driving-station-sign { font-size: 20px; padding: 6px 10px; }
 .driver-console-toolbar>.button-row { margin-left: 0; }
 .driver-console-main { grid-template-columns: minmax(0,1fr); }
 .driver-console-main>section { padding: 10px; }
 .driver-workstation .driving-instruments { justify-content: flex-start; }
 .driver-workstation .driving-doors { grid-column: auto; border-top: 0; }
 .driver-workstation .driving-doors>.row { flex-wrap: wrap; }
 .driver-workstation .driving-console { padding: 8px 6px; }
}

.driver-instrument-panel[data-warning="warning"] .driving-speed text:first-of-type { fill: #ffda80; }
.driver-instrument-panel:is([data-warning="severe"],[data-warning="critical"]) .driving-speed text:first-of-type { fill: #ff9eae; }

@media (forced-colors: active) {
 #drive-lever { appearance: auto; background: none; }
}
