/* Fleet Control Tower, concept demo by Kosmorph. */

@font-face {
  font-family: "Plex Sans";
  src: url("../fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-stretch: 85% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --sans: "Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Surfaces: warm sand neutrals (tadelakt), ink with an indigo cast. */
  --desk: #e7e2d7;
  --win: #f8f6f1;
  --panel: #fefdfa;
  --panel-2: #f6f3ec;
  --sunk: #efebe2;
  --ink: #18192b;
  --ink-2: #48485c;
  --ink-3: #636275;
  --line: rgba(46, 38, 22, 0.1);
  --line-2: rgba(46, 38, 22, 0.17);
  --line-3: rgba(46, 38, 22, 0.28);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%23302816' stroke-opacity='.075'%3E%3Crect x='9' y='9' width='10' height='10'/%3E%3Crect x='9' y='9' width='10' height='10' transform='rotate(45 14 14)'/%3E%3Cpath d='M0 0l4 4M28 0l-4 4M0 28l4-4M28 28l-4-4'/%3E%3C/g%3E%3C/svg%3E");

  /* Brand: Majorelle blue for action and selection, brass for the inlaid hairline.
     Brand colours are never used for status. */
  --accent: #4136c6;
  --accent-ink: #4136c6;
  --accent-hover: #382eb0;
  --accent-press: #30279a;
  --accent-soft: rgba(65, 54, 198, 0.08);
  --accent-soft-2: rgba(65, 54, 198, 0.14);
  --on-accent: #ffffff;
  --brass: #a27c34;
  --inlay: rgba(162, 124, 52, 0.34);
  --inlay-accent: rgba(240, 214, 150, 0.62);

  /* Status: data only. */
  --ok: #11734f;
  --risk: #745b06;
  --late: #b62f28;
  --late-fill: #c4352d;
  --dock: #0d7684;
  --rest: #6d7486;
  --ok-soft: rgba(22, 130, 90, 0.1);
  --risk-soft: rgba(168, 133, 15, 0.12);
  --late-soft: rgba(196, 53, 45, 0.09);
  --dock-soft: rgba(13, 118, 132, 0.1);
  --rest-soft: rgba(109, 116, 134, 0.12);

  --btn-top: #fffefb;
  --btn-bot: #f5f2eb;
  --btn-hover: #efebe2;
  --btn-press: #e7e2d7;
  --btn-ring: rgba(46, 38, 22, 0.18);
  --btn-hi: rgba(255, 255, 255, 0.9);

  --shadow-win: 0 0 0 1px rgba(40, 32, 18, 0.13), 0 2px 4px rgba(40, 32, 18, 0.05), 0 24px 60px -24px rgba(40, 32, 18, 0.3);
  --shadow-pop: 0 0 0 1px rgba(40, 32, 18, 0.1), 0 8px 24px -8px rgba(40, 32, 18, 0.24);
  --focus: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);

  --map-sea: #dce1e7;
  --map-sea-line: #d0d6df;
  --map-sea-ink: #4c5869;
  --map-land: #f7f3eb;
  --map-land-side: #cdc6b6;
  --map-dot: #e2dbcc;
  --map-road: #262838;
  --map-road-side: #13141f;
  --map-road-2: #8f8d9c;
  --map-road-2-side: #6c6a7a;
  --map-city: #1c1d2e;
  --map-city-fill: #ffffff;
  --map-hub: #4136c6;
  --map-halo: #ffffff;
  --map-cap: #f4f6fa;
  --map-rest: #9a98a8;

  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Indigo night */
  --desk: #05060e;
  --win: #0a0b18;
  --panel: #0f1020;
  --panel-2: #141529;
  --sunk: #0c0d1b;
  --ink: #e8e8f2;
  --ink-2: #aeafc4;
  --ink-3: #8d8fa8;
  --line: rgba(222, 224, 255, 0.08);
  --line-2: rgba(222, 224, 255, 0.14);
  --line-3: rgba(222, 224, 255, 0.24);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%23dcdcff' stroke-opacity='.06'%3E%3Crect x='9' y='9' width='10' height='10'/%3E%3Crect x='9' y='9' width='10' height='10' transform='rotate(45 14 14)'/%3E%3Cpath d='M0 0l4 4M28 0l-4 4M0 28l4-4M28 28l-4-4'/%3E%3C/g%3E%3C/svg%3E");
  --accent: #5a50de;
  --accent-ink: #aba5ff;
  --accent-hover: #4f45cb;
  --accent-press: #463dba;
  --accent-soft: rgba(150, 140, 255, 0.1);
  --accent-soft-2: rgba(150, 140, 255, 0.18);
  --on-accent: #ffffff;
  --brass: #c9a560;
  --inlay: rgba(214, 180, 112, 0.22);
  --inlay-accent: rgba(240, 214, 150, 0.45);
  --ok: #3cc28a;
  --risk: #e2c050;
  --late: #f06a60;
  --late-fill: #c4352d;
  --dock: #3bb8c6;
  --rest: #959cad;
  --ok-soft: rgba(60, 194, 138, 0.12);
  --risk-soft: rgba(226, 192, 80, 0.13);
  --late-soft: rgba(240, 106, 96, 0.13);
  --dock-soft: rgba(59, 184, 198, 0.12);
  --rest-soft: rgba(149, 156, 173, 0.13);
  --btn-top: #1a1b30;
  --btn-bot: #15162a;
  --btn-hover: #1e1f36;
  --btn-press: #23243d;
  --btn-ring: rgba(222, 224, 255, 0.13);
  --btn-hi: rgba(255, 255, 255, 0.05);
  --shadow-win: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 64px -20px rgba(0, 0, 0, 0.8);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  --map-sea: #05060e;
  --map-sea-line: #0b0c1a;
  --map-sea-ink: #7d8098;
  --map-land: #13142a;
  --map-land-side: #2a2c48;
  --map-dot: #212340;
  --map-road: #c7c8dc;
  --map-road-side: #8b8ca6;
  --map-road-2: #5b5c7a;
  --map-road-2-side: #40415a;
  --map-city: #e1e1ef;
  --map-city-fill: #13142a;
  --map-hub: #a39cff;
  --map-halo: #0a0b18;
  --map-cap: #e6e7f2;
  --map-rest: #8e90a9;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Indigo night */
    --desk: #05060e;
    --win: #0a0b18;
    --panel: #0f1020;
    --panel-2: #141529;
    --sunk: #0c0d1b;
    --ink: #e8e8f2;
    --ink-2: #aeafc4;
    --ink-3: #8d8fa8;
    --line: rgba(222, 224, 255, 0.08);
    --line-2: rgba(222, 224, 255, 0.14);
    --line-3: rgba(222, 224, 255, 0.24);
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%23dcdcff' stroke-opacity='.06'%3E%3Crect x='9' y='9' width='10' height='10'/%3E%3Crect x='9' y='9' width='10' height='10' transform='rotate(45 14 14)'/%3E%3Cpath d='M0 0l4 4M28 0l-4 4M0 28l4-4M28 28l-4-4'/%3E%3C/g%3E%3C/svg%3E");
    --accent: #5a50de;
    --accent-ink: #aba5ff;
    --accent-hover: #4f45cb;
    --accent-press: #463dba;
    --accent-soft: rgba(150, 140, 255, 0.1);
    --accent-soft-2: rgba(150, 140, 255, 0.18);
    --on-accent: #ffffff;
    --brass: #c9a560;
    --inlay: rgba(214, 180, 112, 0.22);
    --inlay-accent: rgba(240, 214, 150, 0.45);
    --ok: #3cc28a;
    --risk: #e2c050;
    --late: #f06a60;
    --late-fill: #c4352d;
    --dock: #3bb8c6;
    --rest: #959cad;
    --ok-soft: rgba(60, 194, 138, 0.12);
    --risk-soft: rgba(226, 192, 80, 0.13);
    --late-soft: rgba(240, 106, 96, 0.13);
    --dock-soft: rgba(59, 184, 198, 0.12);
    --rest-soft: rgba(149, 156, 173, 0.13);
    --btn-top: #1a1b30;
    --btn-bot: #15162a;
    --btn-hover: #1e1f36;
    --btn-press: #23243d;
    --btn-ring: rgba(222, 224, 255, 0.13);
    --btn-hi: rgba(255, 255, 255, 0.05);
    --shadow-win: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 64px -20px rgba(0, 0, 0, 0.8);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
    --map-sea: #05060e;
    --map-sea-line: #0b0c1a;
    --map-sea-ink: #7d8098;
    --map-land: #13142a;
    --map-land-side: #2a2c48;
    --map-dot: #212340;
    --map-road: #c7c8dc;
    --map-road-side: #8b8ca6;
    --map-road-2: #5b5c7a;
    --map-road-2-side: #40415a;
    --map-city: #e1e1ef;
    --map-city-fill: #13142a;
    --map-hub: #a39cff;
    --map-halo: #0a0b18;
    --map-cap: #e6e7f2;
    --map-rest: #8e90a9;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--desk);
  color: var(--ink);
  font: 400 13px/1.4 var(--sans);
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.ico circle[r=".4"], .ico circle[r=".2"] { fill: currentColor; }

/* Labels inside shapes: trim the line box to cap height and alphabetic baseline, then centre. */
.lbl, .kbd > span, .chip > span, .pill > span, .rail-badge > span, .count > span {
  display: block;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- Desk and window ---------- */
.desk { min-height: 100dvh; padding: 16px; display: flex; background: var(--desk) var(--pattern); }
.window {
  flex: 1;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr) 28px;
  height: calc(100dvh - 32px);
  min-height: 720px;
  background: var(--win);
  border-radius: 10px;
  box-shadow: var(--shadow-win);
  overflow: hidden;
  isolation: isolate;
}

.titlebar {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 420px) 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 0 0 14px;
  background: var(--win);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 20px; height: 20px; fill: none; stroke: var(--accent-ink); stroke-width: 1.4; stroke-linejoin: round; flex: none; }
.mark circle { fill: var(--brass); stroke: none; }
.app-name { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; white-space: nowrap; }
.tb-sep { width: 1px; height: 14px; background: var(--line-2); }
.doc-name { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; height: 100%; }

.concept {
  display: inline-flex; align-items: center; gap: 8px;
  height: 24px; padding: 0 10px;
  border-radius: 3px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
  color: var(--accent-ink);
  font-size: 13px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background-color 120ms ease-out;
}
.concept:hover { background: var(--accent-soft-2); }
.concept-dot { width: 6px; height: 6px; background: currentColor; transform: rotate(45deg); flex: none; }

.winctl { display: flex; height: 100%; }
.winctl span { width: 44px; height: 100%; display: grid; place-items: center; color: var(--ink-3); }
.winctl svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.1; }

.search { position: relative; display: flex; align-items: center; height: 28px; padding: 0 6px 0 8px; gap: 8px; border-radius: 4px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
.search:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft-2); }
.search .ico { width: 16px; height: 16px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; background: none; height: 100%; font-size: 13px; outline: none; }
.search input::placeholder { color: var(--ink-3); }
.search-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--panel); border-radius: 6px; box-shadow: var(--shadow-pop); padding: 4px; max-height: 320px; overflow: auto;
}
.search-list li { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.search-list li[aria-selected="true"] { background: var(--accent-soft-2); }
.search-list .meta { margin-left: auto; color: var(--ink-3); }
.search-list .empty { color: var(--ink-3); cursor: default; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 3px;
  font: 500 12px/1 var(--mono);
  color: var(--ink-2);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 -1px 0 var(--line-2);
  white-space: nowrap;
  position: relative;
}

/* ---------- Frame ---------- */
.frame { display: grid; grid-template-columns: 56px minmax(0, 1fr); min-height: 0; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border-right: 1px solid var(--line); background: var(--win) var(--pattern); }
.rail-gap { flex: 1; }
.rail-btn {
  position: relative; width: 40px; height: 40px; border: 0; border-radius: 4px;
  display: grid; place-items: center; background: none; color: var(--ink-2);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.rail-btn:hover { background: var(--sunk); color: var(--ink); }
.rail-btn .ico { width: 20px; height: 20px; }
.rail-badge {
  position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  background: var(--late-fill); color: #fff; border-radius: 2px;
  font: 500 12px/1 var(--sans);
  box-shadow: 0 0 0 2px var(--win);
}
.rail-btn[data-go="inbox"] .ico { transform: translate(-2px, 2px); }
.rail-badge[data-n="0"] { display: none; }
.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
}

.workspace { display: grid; grid-template-rows: 52px auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.tl-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.tl-title h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.tl-date { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.clock { display: flex; align-items: center; padding-left: 20px; border-left: 1px solid var(--line); height: 28px; }
.clock-time { font-size: 22px; font-weight: 560; letter-spacing: -0.02em; }
.clock-sec { font-size: 14px; color: var(--ink-3); margin-left: 1px; align-self: flex-end; padding-bottom: 4px; }
.tl-group { display: flex; align-items: center; gap: 10px; }
.tl-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- Buttons: square, with an inlaid hairline ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px 0 10px;
  border: 0; border-radius: 3px;
  font-size: 14px; font-weight: 400;
  color: var(--ink);
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  box-shadow: inset 0 0 0 1px var(--btn-ring), inset 0 1px 0 var(--btn-hi), 0 1px 1px rgba(19, 24, 38, 0.04);
  transition: background-color 120ms ease-out, color 120ms ease-out;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { background: var(--btn-press); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(19, 24, 38, 0.12);
}
/* The crafted touch: a hairline inlaid 3px inside every square control (brass on sand,
   a pale brass on the Majorelle primary). */
.btn::after, .icon-btn::after, .chip::after, .seg button[aria-checked="true"]::before, .kbd::after {
  content: ""; position: absolute; inset: 3px; border-radius: 1px;
  box-shadow: inset 0 0 0 1px var(--inlay);
  pointer-events: none;
}
.kbd::after { inset: 2px; }
.btn-primary::after, .icon-btn[aria-pressed="true"]::after { box-shadow: inset 0 0 0 1px var(--inlay-accent); }
.chip::after { opacity: 0; }
.chip[aria-pressed="true"]::after { opacity: 1; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }
.btn-primary .kbd-on { background: rgba(0, 0, 0, 0.28); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.btn-primary .kbd-on::after { box-shadow: inset 0 0 0 1px rgba(240, 214, 150, 0.35); }
.btn-primary .ico { stroke-width: 1.8; }
#play .ico-pause { display: none; }
#play[aria-pressed="true"] .ico-pause { display: block; }
#play[aria-pressed="true"] .ico-play { display: none; }
#play[aria-pressed="true"] { color: var(--ink); background: linear-gradient(var(--btn-top), var(--btn-bot)); box-shadow: inset 0 0 0 1px var(--btn-ring), inset 0 1px 0 var(--btn-hi), 0 1px 1px rgba(19, 24, 38, 0.04); }
#play[aria-pressed="true"]::after { box-shadow: inset 0 0 0 1px var(--inlay); }
#play[aria-pressed="true"]:hover { background: var(--btn-hover); }
#play[aria-pressed="true"] .kbd-on { background: var(--panel); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2), inset 0 -1px 0 var(--line-2); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-ghost { background: none; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); }

/* Segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 4px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
.seg button {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border: 0; border-radius: 2px;
  background: none; color: var(--ink-2); font-size: 14px;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.seg button .ico { width: 16px; height: 16px; }
.seg button:hover { color: var(--ink); background: var(--btn-hover); }
.seg button[aria-checked="true"] {
  color: var(--ink);
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  box-shadow: inset 0 0 0 1px var(--btn-ring), inset 0 1px 0 var(--btn-hi), 0 1px 2px rgba(19, 24, 38, 0.08);
}
.seg button[aria-checked="true"]::after {
  content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 1px; background: var(--accent); opacity: 0.85;
}
#speed button { font-size: 14px; min-width: 46px; justify-content: center; }
.seg-sm button { height: 24px; padding: 0 8px; font-size: 13px; }
.seg-sm button[aria-checked="true"]::after { bottom: 2px; }

.icon-btn {
  position: relative; width: 32px; height: 32px; border: 0; border-radius: 3px;
  display: grid; place-items: center; color: var(--ink-2);
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  box-shadow: inset 0 0 0 1px var(--btn-ring), inset 0 1px 0 var(--btn-hi), 0 1px 1px rgba(19, 24, 38, 0.05);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.icon-btn:hover { background: var(--btn-hover); color: var(--ink); }
.icon-btn:active { background: var(--btn-press); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--panel); }
.kpi { position: relative; display: grid; gap: 9px; padding: 12px 16px 12px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; white-space: nowrap; line-height: 1; }
.kpi-label .tgt { margin-left: auto; color: var(--ink-3); }
.kpi-row { display: flex; align-items: flex-end; gap: 10px; min-width: 0; height: 26px; }
.kpi-val { display: flex; align-items: baseline; gap: 4px; font-size: 28px; font-weight: 560; letter-spacing: -0.02em; line-height: 0.74; white-space: nowrap; }
.kpi-val small { font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.kpi-sub { font-size: 13px; line-height: 1; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi-spark { margin-left: auto; flex: none; width: 76px; height: 26px; overflow: visible; }
.kpi-spark .area { fill: var(--accent-soft-2); }
.kpi-spark .ln { fill: none; stroke: var(--accent-ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kpi-spark .tg { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.kpi-spark .end { fill: var(--accent-ink); }
.kpi[data-tone="late"] .kpi-val { color: var(--late); }
.kpi[data-tone="late"] .kpi-spark .ln { stroke: var(--late); }
.kpi[data-tone="late"] .kpi-spark .area { fill: var(--late-soft); }
.kpi[data-tone="late"] .kpi-spark .end { fill: var(--late); }

/* ---------- Panes ---------- */
.panes { display: grid; grid-template-columns: 324px minmax(0, 1fr) 344px; min-height: 0; }
.col { min-height: 0; min-width: 0; }
.col-left { display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid var(--line); background: var(--panel); }
.panel { background: var(--panel); }
.ph { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.ph h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.ph-note { color: var(--ink-3); font-size: 13px; }
.ph .seg { margin-left: auto; }
.count { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 2px; background: var(--sunk); color: var(--ink-2); font: 500 13px/1 var(--sans); box-shadow: inset 0 0 0 1px var(--line); }
.count.is-hot { background: var(--late-soft); color: var(--late); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--late) 30%, transparent); }
#board-count { margin-left: auto; }

/* Inbox */
.inbox { position: relative; display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--line); }
.inbox-list { overflow: auto; max-height: 244px; scrollbar-width: thin; }
.ex { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; border-bottom: 1px solid var(--line); }
.ex:last-child { border-bottom: 0; }
.ex-main { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; padding: 10px 6px 10px 16px; border: 0; background: none; text-align: left; min-width: 0; transition: background-color 100ms ease-out; }
.ex-main:hover { background: var(--panel-2); }
.ex-main:focus-visible { outline-offset: -2px; border-radius: 0; }
.ex-ack { margin: 10px 12px 0 0; width: 30px; height: 30px; }
.ex-ack .ico { width: 16px; height: 16px; }
.ex-ack:hover { color: var(--ok); }
.ex-ico { width: 28px; height: 28px; border-radius: 3px; display: grid; place-items: center; }
.ex-ico .ico { width: 16px; height: 16px; }
.ex[data-type="delay"] .ex-ico { background: var(--late-soft); color: var(--late); }
.ex[data-type="temp"] .ex-ico { background: var(--risk-soft); color: var(--risk); }
.ex[data-type="route"] .ex-ico { background: var(--accent-soft); color: var(--accent-ink); }
.ex-text { display: block; min-width: 0; }
.ex-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ex-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ex-time { margin-left: auto; color: var(--ink-3); font-size: 13px; line-height: 1; flex: none; }
.ex-body { display: block; color: var(--ink-2); font-size: 13px; line-height: 1.35; margin-top: 3px; font-stretch: 94%; }
.ex-body b { font-weight: 500; color: var(--ink); }
.ex-state { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.ex-state .ico { width: 14px; height: 14px; color: var(--ok); }
.ex.is-closed .ex-title { color: var(--ink-2); font-weight: 400; }
.ex.is-closed .ex-ico { background: var(--sunk); color: var(--ink-3); }
.ex.is-closed .ex-main { grid-column: 1 / -1; }
.ex.is-new::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: var(--late); z-index: 1; }
.ex.is-sel { background: var(--accent-soft); }
.ex.is-sel .ex-main:hover { background: transparent; }
.inbox-empty { padding: 20px 16px; color: var(--ink-3); font-size: 13px; }

/* ETA board */
.board { position: relative; display: flex; flex-direction: column; min-height: 0; }
.board-head, .row { display: grid; grid-template-columns: minmax(0, 1fr) 48px 64px; column-gap: 10px; align-items: center; }
.board-head { height: 30px; padding: 0 12px 0 16px; color: var(--ink-3); font-size: 13px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.board-head .r, .row .r { text-align: right; justify-self: end; }
.board-list { overflow: auto; min-height: 0; scrollbar-width: thin; }
.row {
  position: relative; height: 46px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background-color 100ms ease-out; font-stretch: 94%;
}
.row:hover { background: var(--panel-2); }
.row[aria-selected="true"] { background: var(--accent-soft); }
.row[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.row:focus-visible { outline-offset: -2px; border-radius: 0; }
.row-id { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: center; min-width: 0; }
.row-g { display: grid; place-items: center; }
.row-why { display: inline-flex; align-self: center; gap: 2px; margin-left: auto; flex: none; }
.why .ico { width: 15px; height: 15px; display: block; }
.why[data-r="temp"] { color: var(--late); }
.why[data-r="route"] { color: var(--accent-ink); }
.why[data-r="hours"] { color: var(--risk); }
.row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-name { font-weight: 500; font-size: 13px; white-space: nowrap; }
.row-st { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-st[data-s="delayed"] { color: var(--late); }
.row-st[data-s="risk"] { color: var(--risk); }
.row-st[data-s="loading"] { color: var(--dock); }
.row-lane { grid-column: 2; color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-stop { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-eta { font-size: 14px; line-height: 1; }
.row-slack { font-size: 14px; font-weight: 500; line-height: 1; }
.row-slack[data-tone="late"] { color: var(--late); }
.row-slack[data-tone="risk"] { color: var(--risk); }
.row-slack[data-tone="ok"] { color: var(--ink-2); }
.sg { width: 12px; height: 12px; flex: none; display: block; color: var(--rest); }
.sg[data-s="ontime"] { color: var(--ok); }
.sg[data-s="risk"] { color: var(--risk); }
.sg[data-s="delayed"] { color: var(--late); }
.sg[data-s="loading"] { color: var(--dock); }
.sg[data-s="resting"], .sg[data-s="parked"] { color: var(--rest); }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--rest); flex: none; }
.sdot[data-s="ontime"] { background: var(--ok); }
.sdot[data-s="delayed"] { background: var(--late); }
.sdot[data-s="loading"] { background: var(--dock); }
.sdot[data-s="resting"] { background: var(--rest); }
.sdot[data-s="risk"] { background: var(--risk); }

/* ---------- Map ---------- */
.mapwrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--sunk); touch-action: none; cursor: grab; }
.mapwrap.is-dragging { cursor: grabbing; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.labels .is-off { visibility: hidden; }
.terrain { position: absolute; left: 0; top: 0; font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; transform-origin: 0 0; }
.clabel { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 13px; line-height: 1; color: var(--ink-2); will-change: transform; }
.clabel[data-tier="0"], .clabel[data-tier="1"] { font-size: 14px; font-weight: 500; color: var(--ink); }
.clabel .site { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--ink-3); }
.clabel[data-tier="0"] .site { color: var(--accent-ink); }
.halo { text-shadow: 0 0 2px var(--map-land, #f3f1ec), 0 0 2px var(--map-land, #f3f1ec), 0 0 3px var(--map-land, #f3f1ec); }
.sea { position: absolute; left: 0; top: 0; font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--map-sea-ink); white-space: nowrap; transform-origin: 0 0; font-stretch: 100%; }
.ttag {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px;
  border-radius: 2px; font: 500 12px/1 var(--sans); white-space: nowrap;
  background: var(--panel); color: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgba(0, 0, 0, 0.06);
  will-change: transform;
}
.ttag .ico { width: 12px; height: 12px; stroke-width: 1.6; }
.ttag.is-bad { color: #fff; background: var(--late-fill); box-shadow: none; }
.ttag.is-sel { height: 24px; padding: 0; gap: 0; font: 500 13px/1 var(--sans); color: var(--on-accent); background: var(--accent); box-shadow: 0 2px 8px -2px rgba(19, 24, 38, 0.35); }
.ttag.is-sel > span { padding: 0 8px; }
.ttag.is-sel > .tv { display: flex; align-items: center; align-self: stretch; padding: 0 7px; border-left: 1px solid rgba(255, 255, 255, 0.28); text-box: none; }
.ttag.is-sel .tv > span { display: block; line-height: 1; text-box: trim-both cap alphabetic; }
.ttag.is-sel .tv.is-bad { background: var(--late-fill); border-left-color: transparent; border-radius: 0 2px 2px 0; }
.ttag.is-sel .tv .ico { width: 12px; height: 12px; margin-right: 4px; stroke-width: 1.6; }
.ttag.is-sel::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: inherit; transform: translateX(-50%) rotate(45deg); z-index: -1; }
.ttag.is-sel[data-dir="down"]::after { bottom: auto; top: -4px; }
.ttag.is-sel[data-dir="right"]::after { left: -4px; top: 50%; bottom: auto; transform: translateY(-50%) rotate(45deg); }
.ttag.is-sel[data-dir="left"]::after { left: auto; right: -4px; top: 50%; bottom: auto; transform: translateY(-50%) rotate(45deg); }
.ttag > span { display: block; line-height: 1; text-box: trim-both cap alphabetic; }
.ctag { position: absolute; left: 0; top: 0; min-width: 20px; height: 18px; padding: 0 5px; display: flex; align-items: center; justify-content: center; border-radius: 2px; background: var(--panel); color: var(--ink); font: 500 12px/1 var(--sans); box-shadow: 0 0 0 1px var(--accent), 0 1px 3px rgba(0, 0, 0, 0.12); will-change: transform; }
.ctag > span { display: block; line-height: 1; text-box: trim-both cap alphabetic; }
.map-tag { position: absolute; top: 12px; left: 14px; color: var(--ink-3); font-size: 13px; pointer-events: none; }
.compass { position: absolute; top: 10px; right: 12px; width: 32px; height: 46px; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.compass svg { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--panel) 90%, transparent); box-shadow: 0 0 0 1px var(--line-2); }
.compass .n1 { fill: var(--accent-ink); }
.compass .n2 { fill: none; stroke: var(--ink-3); stroke-width: 1.2; stroke-linejoin: round; }
.compass .lbl { font: 500 12px/1 var(--sans); color: var(--ink-2); }
.legend { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 68px); display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 4px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: 0 0 0 1px var(--line-2), 0 4px 12px -6px rgba(19, 24, 38, 0.2); }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 0; border-radius: 2px;
  background: none; font-size: 13px; color: var(--ink-2);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.chip:hover { background: var(--sunk); color: var(--ink); }
.chip .n { font-size: 13px; font-weight: 500; color: var(--ink); }
.chip .sg { width: 12px; height: 12px; }
.chip[aria-pressed="false"] { color: var(--ink-3); }
.chip[aria-pressed="false"] .sg { color: var(--ink-3); opacity: 0.6; }
.chip[aria-pressed="false"] .n { color: var(--ink-3); }
.chip > span.lbl { display: block; }
.mapctl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.map-tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; min-width: 180px; padding: 10px 12px; border-radius: 4px; background: var(--panel); box-shadow: var(--shadow-pop); font-size: 13px; }
.map-tip b { font-weight: 600; font-size: 14px; }
.map-tip .tip-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); margin-top: 4px; }
.map-tip .tip-row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.map-tip b { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ---------- Inspector ---------- */
.inspector { border-left: 1px solid var(--line); overflow: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
.insp-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; row-gap: 10px; column-gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.insp-pills { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.insp-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.insp-title h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.insp-title .sub { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-head .icon-btn { margin-left: auto; width: 28px; height: 28px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 2px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill .sg { width: 10px; height: 10px; }
.pill .pi { width: 14px; height: 14px; margin: 0 -1px; }
.pill[data-s="alarm"] { background: var(--late-fill); color: #fff; }
.pill[data-s="route"] { background: var(--accent-soft); color: var(--accent-ink); }
.pill[data-s="ontime"] { background: var(--ok-soft); color: var(--ok); }
.pill[data-s="delayed"] { background: var(--late-soft); color: var(--late); }
.pill[data-s="loading"] { background: var(--dock-soft); color: var(--dock); }
.pill[data-s="resting"], .pill[data-s="parked"] { background: var(--rest-soft); color: var(--ink-2); }
.pill[data-s="risk"] { background: var(--risk-soft); color: var(--risk); }
.insp-sec { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.insp-sec:last-child { border-bottom: 0; }
.sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--ink-2); font-size: 13px; line-height: 1; }
.sec-h .r { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* contextual exception */
.insp-alert { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 12px 12px 0 16px; padding: 10px; border-radius: 4px; background: var(--late-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--late) 22%, transparent); }
.insp-alert[data-type="temp"] { background: var(--risk-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--risk) 26%, transparent); }
.insp-alert[data-type="route"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-soft-2); }
.insp-alert .ex-ico { background: var(--panel); }
.insp-alert[data-type="delay"] .ex-ico { color: var(--late); }
.insp-alert[data-type="temp"] .ex-ico { color: var(--risk); }
.insp-alert[data-type="route"] .ex-ico { color: var(--accent-ink); }
.insp-alert b { display: block; font-size: 13px; font-weight: 500; font-stretch: 94%; }
.insp-alert { border-left: 3px solid var(--late); padding-left: 12px; }
.insp-alert[data-type="temp"] { border-left-color: var(--risk); }
.insp-alert[data-type="route"] { border-left-color: var(--accent); }
.insp-alert span.d { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.insp-alert .btn { flex: none; }

/* route strip */
.route { position: relative; display: grid; grid-template-columns: auto 1fr auto; column-gap: 0; align-items: center; }
.route-end { display: flex; flex-direction: column; gap: 4px; }
.route-end:last-child { text-align: right; align-items: flex-end; }
.route-end b { font-size: 14px; font-weight: 600; }
.route-end span { color: var(--ink-3); font-size: 13px; line-height: 1; }
.route-end span .num { color: var(--ink-2); }
.route-track { position: relative; height: 20px; margin: 0 12px; }
.route-km { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font-size: 13px; line-height: 1; color: var(--ink-3); white-space: nowrap; }
.route-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line-2); }
.route-fill { position: absolute; left: 0; top: 9px; height: 2px; background: var(--accent); }
.route-node { position: absolute; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 2px var(--ink-2); transform: translateX(-50%); }
.route-node.is-done { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent); }
.route-truck { position: absolute; top: 4px; width: 16px; height: 12px; border-radius: 2px; background: var(--accent); transform: translateX(-50%); box-shadow: 0 0 0 2px var(--panel); }
.route-rest { position: absolute; top: 3px; width: 2px; height: 14px; background: var(--rest); transform: translateX(-50%); }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 12px; }
.insp-tools { margin-left: auto; display: flex; gap: 6px; }
.insp-head .insp-tools .icon-btn { margin-left: 0; }
.icon-btn[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.icon-btn[aria-pressed="true"]:hover { background: var(--accent-hover); color: var(--on-accent); }
.fact { min-width: 0; }
.fact dt { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.fact dd { display: flex; align-items: baseline; gap: 3px; margin-top: 4px; font-size: 16px; font-weight: 560; line-height: 1.15; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact dd small { font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.fact dd.txt { font-family: var(--sans); font-size: 14px; font-weight: 500; }
.fact dd[data-tone="late"] { color: var(--late); }
.fact dd[data-tone="risk"] { color: var(--risk); }
.fact dd[data-tone="ok"] { color: var(--ok); }

.hours { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.hours .sec-h { margin-bottom: 0; }
.hbar { position: relative; height: 10px; border-radius: 1px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.hbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); }
.hbar i.used { background: repeating-linear-gradient(135deg, var(--line-3) 0 2px, transparent 2px 5px); }
.hbar i.left { background: var(--accent); }
.hbar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--risk); }
.hours-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-3); }
.hours-meta span b { font-weight: 500; color: var(--ink); }

.tchart { width: 100%; height: 88px; display: block; overflow: visible; }
.tchart .band { fill: var(--ok-soft); }
.tchart .bandln { stroke: var(--ok); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.tchart .ln { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.tchart .ln-bad { fill: none; stroke: var(--late); stroke-width: 2; stroke-linejoin: round; }
.tchart .grid { stroke: var(--line); stroke-width: 1; }
.tchart text { fill: var(--ink-3); font: 400 12px var(--sans); }
.tchart .now { fill: var(--ink); }
.tchart .now-bad { fill: var(--late); }
.temp-now { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.temp-now .v { font-size: 22px; font-weight: 560; line-height: 1; letter-spacing: -0.02em; }
.temp-now .v[data-tone="late"] { color: var(--late); }
.temp-now .u { color: var(--ink-3); font-size: 13px; }
.insp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.insp-empty { padding: 24px 16px; color: var(--ink-3); }
.park { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 14px; }
.park-ico { width: 28px; height: 28px; padding: 6px; border-radius: 3px; background: var(--rest-soft); color: var(--ink-2); stroke-width: 1.8; }
.park b { display: block; font-size: 14px; font-weight: 600; }
.park span { display: block; color: var(--ink-2); margin-top: 2px; }
.cargo-line { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 13px; margin-top: 12px; }
.cargo-line .ico { width: 15px; height: 15px; }
.loadbar { flex: 1; height: 6px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); position: relative; border-radius: 1px; }
.loadbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-3); border-radius: 1px; }

/* day list (dry vans) */
.daylist { display: grid; gap: 2px; }
.daylist li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 4px 0; font-size: 13px; color: var(--ink-2); }
.daylist li .num { font-size: 13px; color: var(--ink-3); }
.daylist li .w { color: var(--ink-3); }
.daylist li.is-done { color: var(--ink-3); }
.daylist li.is-now { color: var(--ink); font-weight: 500; }
.daylist li.is-now .tm { color: var(--accent-ink); }

/* ---------- Timeline ---------- */
.timeline { border-top: 1px solid var(--line); position: relative; }
.tl-head { position: absolute; left: 0; right: 0; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; height: 28px; padding: 4px 16px 0; pointer-events: none; }
.tl-head h2 { font-size: 14px; font-weight: 600; }
.tl-hint { color: var(--ink-3); font-size: 13px; }
.tl-lgd { margin-left: auto; display: flex; align-items: center; gap: 0; color: var(--ink-2); font-size: 13px; }
.tl-lgd .g { display: inline-flex; gap: 12px; padding: 0 14px; }
.tl-lgd .g + .g { border-left: 1px solid var(--line-2); }
.tl-lgd .g:last-child { padding-right: 0; }
.tl-lgd span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tl-lgd i { display: inline-block; width: 10px; height: 10px; border-radius: 1px; }
.tl-lgd i.l-road { background: var(--accent-soft-2); box-shadow: inset 0 2px 0 var(--accent-ink); }
.tl-lgd i.l-plan { height: 0; border-top: 1.5px dashed var(--ink-3); width: 14px; border-radius: 0; }
.tl-lgd i.l-drive { background: var(--accent); }
.tl-lgd i.l-dock { background: var(--dock); }
.tl-lgd i.l-rest { background: var(--rest); opacity: 0.6; }
.tl-lgd i.l-ex { width: 8px; height: 8px; transform: rotate(45deg); background: var(--ink-3); }
.tl-lgd i.ex-delay { background: var(--late); }
.tl-lgd i.ex-temp { background: var(--risk); }
.tl-lgd i.ex-route { background: var(--accent-ink); }
.tl-lgd i.l-hatch { background: repeating-linear-gradient(135deg, var(--ink-3) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1px var(--ink-3); }
.tl-svg { display: block; width: 100%; height: 124px; user-select: none; touch-action: none; }
.tl-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-svg text { font: 400 12px var(--sans); fill: var(--ink-3); }
.tl-svg .rowlbl { font: 400 13px var(--sans); fill: var(--ink-2); }
.tl-svg .rowlbl-b { font: 500 13px var(--sans); fill: var(--ink); }
.tl-svg .tick { stroke: var(--line-2); }
.tl-svg .tick-maj { stroke: var(--line-3); }
.tl-svg .lane { fill: var(--panel-2); }
.tl-svg .area-past { fill: var(--accent-soft-2); }
.tl-svg .ln-past { fill: none; stroke: var(--accent-ink); stroke-width: 1.5; stroke-linejoin: round; }
.tl-svg .ln-plan { fill: none; stroke: var(--ink-3); stroke-width: 1.25; stroke-dasharray: 3 3; }
.tl-svg .seg-drive { fill: var(--accent); }
.tl-svg .seg-dock { fill: var(--dock); }
.tl-svg .seg-rest { fill: var(--rest); opacity: 0.6; }
.tl-svg .hp-bg { fill: var(--panel); }
.tl-svg .hp-drive { fill: var(--accent); }
.tl-svg .hp-dock { fill: var(--dock); }
.tl-svg .hp-rest { fill: var(--rest); }
.tl-svg .seg-plan { stroke-width: 1; }
.tl-svg .seg-plan-drive { stroke: var(--accent); }
.tl-svg .seg-plan-dock { stroke: var(--dock); }
.tl-svg .seg-plan-rest { stroke: var(--rest); }
.tl-now { position: absolute; left: 0; top: 0; width: 0; height: 124px; pointer-events: none; will-change: transform; }
.tl-now-ln { position: absolute; left: -0.75px; top: 30px; width: 1.5px; height: 80px; background: var(--ink); }
.tl-now-cap { position: absolute; left: -24px; top: 107px; width: 48px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 2px; background: var(--ink); color: var(--panel); font: 500 12px/1 var(--sans); contain: strict; }
.tl-now-cap > span { display: block; line-height: 1; text-box: trim-both cap alphabetic; }
.tl-svg .now { stroke: var(--ink); stroke-width: 1.5; }
.tl-svg .now-cap { fill: var(--ink); }
.tl-svg .now-txt { fill: var(--panel); font: 600 12px var(--sans); }
.tl-svg .ex-m { stroke: var(--panel); stroke-width: 1.5; }
.tl-svg .ex-delay { fill: var(--late); }
.tl-svg .ex-temp { fill: var(--risk); }
.tl-svg .ex-route { fill: var(--accent-ink); }
.tl-svg .ex-closed { opacity: 0.4; }
.tl-svg .lgd { font: 400 13px var(--sans); fill: var(--ink-3); }

/* Rail jump: the target panel is outlined briefly. */
.is-target::after { content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; box-shadow: inset 0 0 0 2px var(--accent); animation: target 1.4s ease-out forwards; }
@keyframes target { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 24px; padding: 0 14px; border-top: 1px solid var(--line); background: var(--win); color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.sb-item { display: inline-flex; align-items: center; gap: 8px; }
.sb-mid { color: var(--ink-2); }
.sb-right { margin-left: auto; gap: 18px; }
.sb-right a { color: var(--ink-2); text-decoration: none; }
.sb-right a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sb-cta { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-ink) !important; font-weight: 500; }
.sb-cta .ico { width: 14px; height: 14px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.dot-live { box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------- Tooltip and dialog ---------- */
.tip {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px 0 10px;
  border-radius: 3px; background: var(--ink); color: var(--panel); font-size: 13px; white-space: nowrap;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.3);
}
.tip .kbd { background: rgba(255, 255, 255, 0.14); color: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
:root[data-theme="dark"] .tip .kbd { background: rgba(0, 0, 0, 0.08); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.tip:not(:has(.kbd)) { padding-right: 10px; }

.keys { width: min(720px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop); }
.keys::backdrop { background: rgba(6, 8, 14, 0.42); }
.keys header { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.keys h2 { font-size: 16px; font-weight: 600; }
.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.keys-grid section { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.keys-grid section:nth-child(odd) { border-right: 1px solid var(--line); }
.keys h3 { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-bottom: 8px; }
.keys dl > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.keys dt { font-size: 13px; color: var(--ink-2); }
.keys dd { display: flex; gap: 4px; }

/* Panels refresh while the replay plays: keep their layout work local. */
.kpi, .inbox-list, .board-list, .inspector, .timeline, .statusbar, .legend { contain: content; }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .panes { grid-template-columns: 300px minmax(0, 1fr) 318px; }
  .board-head, .row { grid-template-columns: minmax(0, 1fr) 42px 64px; column-gap: 8px; }
  .board-head span { white-space: nowrap; }
  .tl-date { display: none; }
}
@media (max-width: 1180px) {
  .kpi-spark { display: none; }
  .titlebar { grid-template-columns: 1fr minmax(200px, 300px) auto; }
  .doc-name, .tb-sep { display: none; }
}
/* Narrow map beside both side columns (1061 to 1279 px, the work page frame is 1226 px): the legend stays on one
   row left of the map controls. Tighter chips first; below 1220 px the chips show glyph and count, and the status
   name stays in the accessibility tree. */
@media (min-width: 1061px) and (max-width: 1279px) {
  .legend .chip { padding: 0 5px; gap: 4px; }
}
@media (min-width: 1061px) and (max-width: 1219px) {
  .legend .chip .lbl:not(.n) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* Laptop heights (1366x768, 1280x800): one-line KPI strip, more rows for the board. */
@media (min-width: 1061px) and (max-height: 820px) {
  .desk { padding: 8px; }
  .window { height: calc(100dvh - 16px); }
  .workspace { grid-template-rows: 48px auto minmax(0, 1fr) auto; }
  .kpi { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; }
  .kpi-row { order: -1; height: auto; flex: none; }
  .kpi-val { font-size: 22px; line-height: 0.74; }
  .kpi-spark, .kpi-sub, .kpi-label .tgt { display: none; }
  .kpi-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .col-left { grid-template-rows: minmax(150px, 38%) minmax(220px, 1fr); }
  .inbox-list { max-height: none; flex: 1 1 auto; min-height: 0; }
  .row { height: 42px; }
}
@media (max-width: 1060px) {
  .window { height: auto; min-height: 0; }
  .frame { grid-template-columns: 56px minmax(0, 1fr); }
  .panes { grid-template-columns: 1fr 1fr; grid-template-rows: 560px auto; }
  .mapwrap { grid-column: 1 / -1; grid-row: 1; border-bottom: 1px solid var(--line); }
  .col-left { border-right: 1px solid var(--line); grid-row: 2; grid-column: 1; }
  .inspector { grid-row: 2; grid-column: 2; }
  .board-list { max-height: 420px; }
  .inspector { border-left: 0; }
}
@media (max-width: 760px) {
  .desk { padding: 0; }
  .window { border-radius: 0; box-shadow: none; grid-template-rows: auto auto auto; }
  .titlebar { display: flex; flex-wrap: wrap; padding: 10px 12px; gap: 8px; height: auto; }
  .tb-left { flex: 1 1 100%; }
  .tb-right { flex: 1 1 100%; justify-content: flex-start; }
  .tb-center { display: none; }
  .winctl { display: none; }
  .tb-right { height: auto; }
  .concept { height: 28px; }
  .concept .lbl { font-size: 13px; }
  .frame { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .workspace { grid-template-rows: auto auto auto auto; }
  .toolbar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 12px; }
  .tl-title { flex: 1 1 auto; }
  .clock { padding-left: 0; border-left: 0; }
  .tl-group { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .tl-right { order: 4; margin-left: 0; flex: 1 1 100%; }
  .tl-right .seg { flex: 1; }
  .tl-right .seg button { flex: 1; justify-content: center; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px; }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .kpi:last-child { grid-column: 1 / -1; border-left: 0; }
  .kpi-val { font-size: 22px; }
  .panes { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .mapwrap, .col-left, .inspector { grid-column: 1; grid-row: auto; }
  .mapwrap { height: 420px; touch-action: pan-y; order: -1; border-bottom: 1px solid var(--line); }
  .tl-head { position: static; flex-wrap: wrap; height: auto; padding: 10px 12px 0; gap: 4px 12px; }
  .tl-hint { display: none; }
  .tl-lgd { margin-left: 0; flex-wrap: wrap; gap: 4px 12px; }
  .col-left { border-right: 0; }
  .inbox-list { max-height: none; }
  .board-list { max-height: 460px; }
  .inspector { border-top: 1px solid var(--line); }
  .legend { right: auto; }
  .legend .chip .lbl:not(.n) { display: none; }
  .legend .chip { padding: 0 7px; }
  .statusbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 6px 16px; white-space: normal; }
  .sb-mid { display: none; }
  .sb-right { margin-left: 0; }
  .keys-grid { grid-template-columns: 1fr; }
  .btn .kbd, .tip .kbd { display: none; }
  .keys-grid section:nth-child(odd) { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
