:root {
  --ink: #221812;
  --ink-2: #2f2219;
  --ink-text: #e9dccb;
  --ink-muted: #a8957f;
  --leather: #9a5524;
  --leather-2: #b8692f;
  --tan: #d9a066;
  --bg: #f3eee6;
  --card: #fffdf9;
  --line: #e2d8c8;
  --line-2: #efe7da;
  --text: #261f18;
  --muted: #7b6e5f;
  --transit: #2c66a8;
  --station: #2f7a4c;
  --delayed: #b9770c;
  --accident: #b3261e;
  --runout: #6a3d9c;
  --done: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 25, 10, .06), 0 4px 14px rgba(40, 25, 10, .05);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--leather); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; font-weight: 700; color: var(--muted); letter-spacing: .3em; text-transform: uppercase; }

/* ---------- Auth screens ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink); color: var(--ink-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art svg.route { position: absolute; inset: auto -40px 40px -40px; width: calc(100% + 80px); opacity: .9; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: .18em; text-transform: uppercase; }
.brand img { width: 34px; height: 34px; }
.auth-art p.lead { font-size: 26px; line-height: 1.25; max-width: 420px; color: #f6eadb; margin: 0; font-weight: 600; }
.auth-art .fine { color: var(--ink-muted); font-size: 12px; max-width: 420px; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin: 0 0 24px; }
.secure-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 20px; font-size: 12px; color: var(--muted); }
.secure-note svg { flex: none; margin-top: 2px; }

/* ---------- Forms ---------- */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
label.f > span em { color: var(--accident); font-style: normal; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--leather-2); box-shadow: 0 0 0 3px rgba(184, 105, 47, .15); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--leather); margin-bottom: 10px; padding: 0; }
.form-error { background: #fbecea; color: var(--accident); border: 1px solid #f0c9c5; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.otp { font-family: var(--mono); font-size: 24px; letter-spacing: .4em; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f7f1e8; border-color: #d6c8b3; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--leather); border-color: var(--leather); color: #fff; }
.btn.primary:hover { background: #87481c; }
.btn.danger { color: var(--accident); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; padding: 11px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: var(--ink-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { font-size: 15px; padding: 4px 10px 18px; }
.side .brand img { width: 26px; height: 26px; }
.side .who { margin: 0 6px 14px; padding: 10px; border-radius: 8px; background: var(--ink-2); font-size: 12px; }
.side .who b { display: block; font-size: 13px; color: #fff; }
.side .who span { color: var(--ink-muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink-text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--ink-2); }
.nav a.on { background: var(--leather); color: #fff; }
.nav a svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.side .spacer { flex: 1; }
.side .foot { font-size: 11px; color: var(--ink-muted); padding: 8px 10px; display: flex; align-items: center; gap: 6px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #3aa66a; box-shadow: 0 0 0 3px rgba(58, 166, 106, .18); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.stack { display: grid; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.cols-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi.warn .v { color: var(--delayed); }
.kpi.bad .v { color: var(--accident); }
.kpi.blue .v { color: var(--transit); }
.kpi.green .v { color: var(--station); }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.in_transit { color: var(--transit); background: #e8f0fa; }
.pill.at_station { color: var(--station); background: #e6f3eb; }
.pill.completed { color: var(--done); background: #eef0f2; }
.pill.cancelled { color: var(--done); background: #eef0f2; }
.pill.delayed { color: var(--delayed); background: #fbf1df; }
.pill.accident { color: var(--accident); background: #fbe8e6; }
.pill.runout { color: var(--runout); background: #f0e9f8; }
.pill.overdue { color: #8a3b00; background: #ffe9d6; }
.plate { font-family: var(--mono); font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 4px; background: #fff7d6; border: 1px solid #e6d48a; color: #3a3000; letter-spacing: .03em; }

/* Corridor strip */
.strip { overflow-x: auto; padding: 16px 16px 10px; }
.strip-inner { display: flex; align-items: flex-start; min-width: 980px; position: relative; }
.strip-inner::before { content: ""; position: absolute; left: 24px; right: 24px; top: 25px; height: 4px; background: repeating-linear-gradient(90deg, #cdbfa9 0 10px, transparent 10px 16px); border-radius: 2px; }
.node { flex: 1; text-align: center; position: relative; cursor: pointer; padding: 0 2px; }
.node .dot { width: 34px; height: 34px; margin: 10px auto 6px; border-radius: 50%; background: var(--card); border: 2px solid #b8a68c; display: grid; place-items: center; font-weight: 700; font-size: 12px; position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.node.busy .dot { background: var(--station); color: #fff; border-color: var(--station); }
.node.flag .dot { box-shadow: 0 0 0 4px rgba(185, 119, 12, .3); }
.node.mine .dot { outline: 3px solid var(--leather); outline-offset: 2px; }
.node.scope .name { color: var(--leather); font-weight: 700; }
.node.out { opacity: .4; }
.node .name { font-size: 11px; font-weight: 600; line-height: 1.15; }
.node .sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.node .sub b { color: var(--transit); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* Map */
.map { position: relative; height: 520px; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); background: #e8e2d6; cursor: grab; touch-action: none; user-select: none; }
.map.dragging { cursor: grabbing; }
.map.small { height: 380px; }
.map .tiles, .map svg.ov { position: absolute; left: 0; top: 0; }
.map .tiles img { position: absolute; filter: saturate(.55) sepia(.18) brightness(1.02); }
.map.schematic .tiles { display: none; }
.map .ctrl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.map .ctrl .btn { width: 32px; height: 32px; padding: 0; background: rgba(255,253,249,.95); }
.map .attr { position: absolute; right: 6px; bottom: 4px; font-size: 10px; background: rgba(255,255,255,.75); padding: 1px 5px; border-radius: 3px; z-index: 3; }
.map .attr a { color: #333; }
svg.ov .road { fill: none; stroke: #7a3e14; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
svg.ov .road-casing { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
svg.ov .st { fill: var(--card); stroke: var(--ink); stroke-width: 2; cursor: pointer; }
svg.ov .st.busy { fill: var(--station); stroke: #fff; }
svg.ov .st.flag { fill: var(--delayed); stroke: #fff; }
svg.ov .st-n { font: 700 11px var(--sans); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
svg.ov .st-l { font: 600 11px var(--sans); fill: var(--ink); paint-order: stroke; stroke: rgba(255,255,255,.9); stroke-width: 3px; pointer-events: none; }
svg.ov .veh { stroke: #fff; stroke-width: 1.5; cursor: pointer; fill: var(--transit); }
svg.ov .veh.delayed { fill: var(--delayed); }
svg.ov .veh.accident { fill: var(--accident); }
svg.ov .veh.runout { fill: var(--runout); }
svg.ov .veh.overdue { fill: #e0691b; }
.map-tip { position: absolute; z-index: 4; background: var(--ink); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; pointer-events: none; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }

/* Station board */
.board { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 14px; align-items: start; }
.board .col.self { border: 2px solid var(--leather); }
.board .col .card-h { background: #faf5ec; border-radius: var(--radius) var(--radius) 0 0; }
.board .col.self .card-h { background: var(--leather); color: #fff; }
.board .col.self .card-h .muted { color: #f3dcc6; }
.sec { padding: 10px 14px 4px; }
.sec h3 { display: flex; justify-content: space-between; margin-bottom: 6px; }
.empty { color: var(--muted); font-size: 12px; padding: 6px 0 10px; font-style: italic; }
.veh-row { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
.veh-row .top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.veh-row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.veh-row .acts { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.veh-row.click { cursor: pointer; }
.veh-row.click:hover { border-color: #d6c8b3; }
.bar { height: 4px; background: var(--line-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--transit); width: 0; }
.bar.over > i { background: #e0691b; }
.dir { font-size: 11px; font-weight: 600; color: var(--muted); }

/* Tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #faf6ef; position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fbf7f0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 640px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 14px 28px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--muted); }
.timeline li.ARRIVED::before, .timeline li.REGISTERED::before { border-color: var(--station); background: var(--station); }
.timeline li.DEPARTED::before { border-color: var(--transit); background: var(--transit); }
.timeline li.DELAY::before { border-color: var(--delayed); background: var(--delayed); }
.timeline li.ACCIDENT::before { border-color: var(--accident); background: var(--accident); }
.timeline li.RUNOUT::before { border-color: var(--runout); background: var(--runout); }
.timeline li.COMPLETED::before { border-color: var(--ink); background: var(--ink); }
.timeline .h { font-weight: 650; }
.timeline .m { font-size: 12px; color: var(--muted); }

.route-prog { display: flex; align-items: center; overflow-x: auto; padding: 8px 2px 4px; gap: 0; }
.route-prog .rp { display: flex; flex-direction: column; align-items: center; min-width: 64px; position: relative; font-size: 10px; text-align: center; color: var(--muted); }
.route-prog .rp::before { content: ""; position: absolute; top: 6px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.route-prog .rp:first-child::before { display: none; }
.route-prog .rp.done::before { background: var(--station); }
.route-prog .rp i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c8baa4; background: #fff; z-index: 1; margin-bottom: 4px; }
.route-prog .rp.done i { background: var(--station); border-color: var(--station); }
.route-prog .rp.here i { background: var(--leather); border-color: var(--leather); box-shadow: 0 0 0 4px rgba(154, 85, 36, .2); }
.route-prog .rp.here { color: var(--text); font-weight: 700; }
.route-prog .rp.transit::before { background: linear-gradient(90deg, var(--station), var(--transit)); }

dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

/* Charts */
.chart { width: 100%; display: block; }
.chart .grid line { stroke: var(--line-2); }
.chart .axis text { font: 10px var(--sans); fill: var(--muted); }
.chart .ln { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .1; }
.hbar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 7px; }
.hbar .track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--leather-2); border-radius: 5px; width: 0; }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 20, 12, .45); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .12s ease; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 620px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.modal-b { padding: 18px 20px; overflow: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; font-size: 13px; animation: fade .15s; }
.toast.err { background: var(--accident); }
.secret-box { font-family: var(--mono); background: #faf5ec; border: 1px dashed var(--leather-2); padding: 12px; border-radius: 8px; font-size: 15px; letter-spacing: .08em; word-break: break-all; text-align: center; user-select: all; }
.steps { padding-left: 18px; margin: 0 0 16px; }
.steps li { margin-bottom: 6px; }
.notice { background: #fbf3e4; border: 1px solid #ecd8b4; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #efe5d6; color: #5a4632; font-weight: 600; }
.chip.me { background: var(--leather); color: #fff; }
.alert-row { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.alert-row:hover { background: #fbf7f0; }
.alert-row:last-child { border-bottom: 0; }
.alert-row .grow { flex: 1; min-width: 0; }
.mobile-top { display: none; }

@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; }
  .board .col.self { order: -1; }
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { min-height: 220px; padding: 28px; }
  .auth-art p.lead { font-size: 20px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .side .brand { padding: 4px 8px; }
  .side .who, .side .spacer, .side .foot { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .main { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .map { height: 380px; }
  dl.kv { grid-template-columns: 110px 1fr; }
  .hbar { grid-template-columns: 110px 1fr 36px; }
}

/* misc */
.modal h3 { margin: 16px 0 8px; }
.modal h3.mt { margin-top: 20px; }
select.btn { width: auto; padding: 8px 30px 8px 12px; }
.legend i.lg { width: 10px; height: 10px; }
.lg-t { background: var(--transit); } .lg-o { background: #e0691b; } .lg-d { background: var(--delayed); }
.lg-a { background: var(--accident); } .lg-r { background: var(--runout); } .lg-st { background: var(--station); }
.table-wrap input[type=number] { width: 120px; padding: 5px 8px; }
.plate { white-space: nowrap; }
.hbar { grid-template-columns: 150px 1fr 64px; }
.hbar .n { white-space: nowrap; }

/* ---------- sync status ---------- */
.netstat { display: block; margin: 0 6px 6px; padding: 6px 10px; border-radius: 7px; border: 0; font-size: 11px; font-weight: 600; text-align: left; cursor: pointer; background: var(--ink-2); color: var(--ink-text); }
.netstat::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: #3aa66a; vertical-align: 0; }
.netstat.off::before { background: #8a8a8a; } .netstat.wait::before { background: var(--tan); } .netstat.bad::before { background: #e5534b; }
.bad-t { color: var(--accident) !important; }
.nofeed { margin: -8px 0 14px; }

/* ---------- satellite map ---------- */
.map.sat { background: #2b2a24; }
.map .tiles img.img { filter: saturate(.9) brightness(.92); }
.map .tiles img.ref { filter: none; opacity: .9; }
.map.sat svg.ov .road { stroke: #ffcf7a; opacity: .95; stroke-width: 3.5; }
.map.sat svg.ov .road-casing { stroke: #1b120b; opacity: .75; stroke-width: 7; }
.map.sat svg.ov .st-l { fill: #fff; stroke: rgba(0,0,0,.85); stroke-width: 3.5px; font-weight: 700; }
.map.sat.schematic { background: #e8e2d6; }
.map.sat.schematic svg.ov .st-l { fill: var(--ink); stroke: rgba(255,255,255,.9); }
.map.sat.schematic svg.ov .road { stroke: #7a3e14; } .map.sat.schematic svg.ov .road-casing { stroke: #fff; }
svg.ov .prov { font: 800 22px var(--sans); letter-spacing: .5em; fill: rgba(255,255,255,.5); text-anchor: middle; pointer-events: none; }
.map.schematic svg.ov .prov { fill: rgba(90,58,34,.25); }
.map .attr { background: rgba(0,0,0,.55); color: #eee; }

/* ---------- segmented board (mobile) ---------- */
.seg { display: none; }
.mtop { display: none; }

@media (max-width: 820px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .shell { display: block; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 40; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; box-shadow: 0 -4px 18px rgba(0,0,0,.18); }
  .side .brand, .side .who, .side .spacer, .side .foot, .side > .netstat { display: none; }
  .nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; width: 100%; scrollbar-width: none; justify-content: space-around; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 1 0 auto; min-width: 64px; flex-direction: column; gap: 3px; padding: 6px 6px; font-size: 10.5px; text-align: center; border-radius: 9px; }
  .nav a svg { width: 20px; height: 20px; }
  .main { padding: 0 14px 24px; }
  .mtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30; margin: 0 -14px 14px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--ink); color: var(--ink-text); }
  .mtop .brand { font-size: 14px; letter-spacing: .16em; }
  .mtop .brand img { width: 24px; height: 24px; }
  .mtop-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .mtop .netstat { margin: 0; padding: 5px 9px; white-space: nowrap; }
  .mtop-who { font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  h1 { font-size: 19px; }
  .page-head { margin-bottom: 12px; }
  .page-head .btn-row { width: 100%; justify-content: space-between; }
  .reg-btn { flex: 1; padding: 12px; font-size: 15px; }
  .kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .kpi { padding: 9px 10px; }
  .kpi .v { font-size: 20px; }
  .kpi .l { font-size: 11px; }
  #strip-host { display: none; }
  .seg { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 4px; background: #e6dccd; padding: 4px; border-radius: 11px; margin-bottom: 10px; position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 20; }
  .seg button { border: 0; background: transparent; padding: 8px 4px; border-radius: 8px; font-weight: 700; font-size: 12.5px; color: #5a4632; cursor: pointer; line-height: 1.2; }
  .seg button small { display: block; font-weight: 500; font-size: 10.5px; opacity: .8; }
  .seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
  .seg button:disabled { opacity: .4; }
  .board { display: block; }
  .board .col { display: none; }
  .board.tab-prev .col.prev, .board.tab-self .col.self, .board.tab-next .col.next { display: block; }
  .veh-row { padding: 11px 12px; }
  .veh-row .acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .veh-row .acts .btn { padding: 10px 6px; font-size: 13px; }
  .veh-row .acts .btn.primary { grid-column: 1 / -1; font-size: 15px; padding: 12px; }
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal-f { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; padding: 12px; }
  input[type=text], input[type=password], input[type=number], input[type=search], select, textarea { font-size: 16px; padding: 11px 12px; }
  .table-wrap { max-height: none; }
  table.t { font-size: 12.5px; }
  table.t th, table.t td { padding: 8px 9px; }
  .toolbar input[type=search] { max-width: none; }
  .toolbar > * { flex: 1 1 140px; }
  #toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .map, .map.small { height: 62vh; }
  .route-prog .rp { min-width: 56px; }
  /* vehicles list becomes cards */
  #list table.t thead { display: none; }
  #list table.t tr { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
  #list table.t td { border: 0; padding: 0; }
  #list table.t td:nth-child(1) { grid-row: span 2; align-self: center; }
  #list table.t td:nth-child(3), #list table.t td:nth-child(4) { display: none; }
  #list table.t td:nth-child(8) { grid-column: 2; }
}
@media (display-mode: standalone) { .mtop { padding-top: calc(12px + env(safe-area-inset-top)); } }
.stack > *, .cols-2 > *, .cols-2e > *, .main { min-width: 0; }
.card { min-width: 0; overflow: hidden; }
