/* Operations twin, Hall 2. Concept demo by Kosmorph with illustrative data. */

@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/geist-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Colour tokens. The studio palette (night, Majorelle blue, brass) lives in this one block so the
   final site direction can replace it in one place; status colours are the product's own. */
:root {
  --night: #0b0f28;
  --majorelle: #3a52e0;
  --majorelle-rim: #7a8cfa;
  --majorelle-hover: #2c43c9;
  --brass: #cebf8d;
  --brass-deep: #9d894d;
  --brass-hover: #efe6c6;

  --bg: var(--night);
  --s1: #0f1434;
  --s2: #13193d;
  --s3: #1a2149;
  --s4: #242c58;
  --panel: #0d1230;
  --line: rgba(214, 220, 255, 0.08);
  --line-2: rgba(214, 220, 255, 0.14);
  --line-3: rgba(214, 220, 255, 0.24);
  --ink-1: #eeebe4;
  --ink-2: #c3c2c4;
  --ink-3: #9a9caa;
  --accent: #a3b1ff;
  --accent-2: #4a62ec;
  --accent-3: var(--majorelle);
  --accent-soft: rgba(130, 148, 255, 0.14);
  --good: #4cc490;
  --warn: #e5b648;
  --crit: #f07563;
  --good-soft: rgba(76, 196, 144, 0.13);
  --warn-soft: rgba(229, 182, 72, 0.13);
  --crit-soft: rgba(240, 117, 99, 0.14);
  --in: var(--brass);
  --charge: #4fb3c8;
  --out: #aab6d6;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 3px;
  --r-lg: 5px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --rail: 368px;
  --top: 56px;
  --kpi-h: 100px;
  --tl-h: 184px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" 0;
}
button { font: inherit; color: inherit; }
p, h1, h2, h3, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 30; background: var(--s3); padding: 10px 14px; border-radius: var(--r); }
.skip + .skip { left: 220px; }
.skip:focus { top: 12px; }

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

/* Optically centred labels: trim the line box to cap height and baseline. */
.lbl, .count, .chip > span, .pin > span, .badge > span {
  display: block;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}
@supports not (text-box: trim-both cap alphabetic) {
  .lbl, .count, .chip > span, .pin > span, .badge > span { padding-top: 0.09em; }
}

/* ---------------- App grid ---------------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail);
  grid-template-rows: var(--top) var(--kpi-h) minmax(0, 1fr) var(--tl-h);
  grid-template-areas:
    "top top"
    "kpi kpi"
    "stage stage"
    "tl tl";
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
  background: var(--line);
  gap: 1px;
}
.topbar { grid-area: top; }
.kpis { grid-area: kpi; }
.stage { grid-area: stage; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); gap: 1px; min-height: 0; }
.timeline { grid-area: tl; }

/* ---------------- Top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--bg);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.mark { display: grid; place-items: center; color: var(--accent); }
.product { font-weight: 600; font-size: 15px; letter-spacing: -0.005em; }
.crumb-sep { color: var(--ink-3); }
.site { color: var(--ink-2); font-size: 15px; }
.concept {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
}
.short { display: none; }
.concept-dot { width: 6px; height: 6px; border-radius: 1px; background: var(--brass); flex: none; }
.top-clock { margin-left: auto; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.top-clock .k { color: var(--ink-3); font-size: 13px; }
.top-clock .v { font-size: 14px; font-weight: 500; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.top-links { display: flex; align-items: center; gap: 8px; }
.link {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--r);
  text-decoration: none; color: var(--ink-2); font-size: 14px;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.link:hover { color: var(--ink-1); background: var(--s2); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--s3), var(--s2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.3);
  color: var(--ink-1);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.btn:hover { background: linear-gradient(180deg, var(--s4), var(--s3)); border-color: var(--line-3); }
.btn-primary {
  border-color: var(--majorelle);
  background: var(--majorelle);
  box-shadow: none;
  color: #fff;
}
.btn-primary:hover { background: var(--majorelle-hover); border-color: var(--majorelle-hover); }
/* Kosmorph's own calls to action: square, Majorelle with a rim, a brass inlay with cut corners
   4 px inside the edge (the studio signature; the product's Play stays flat). */
@property --inlay-c { syntax: "<color>"; inherits: true; initial-value: transparent; }
.btn-kosmorph {
  --k: 5px; --in: 3px; --inlay-c: var(--brass);
  position: relative;
  height: 40px; padding: 0 20px;
  border-radius: 0;
  border-color: var(--majorelle-rim);
  background: var(--majorelle);
  transition: background-color 150ms var(--ease), --inlay-c 150ms var(--ease);
}
.btn-kosmorph::before {
  content: ""; position: absolute; inset: var(--in); pointer-events: none;
  --c: var(--inlay-c);
  --d: transparent calc(50% - 0.75px), var(--c) calc(50% - 0.35px), var(--c) calc(50% + 0.35px), transparent calc(50% + 0.75px);
  background:
    linear-gradient(var(--c), var(--c)) var(--k) 0 / calc(100% - 2 * var(--k)) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) var(--k) 100% / calc(100% - 2 * var(--k)) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 var(--k) / 1px calc(100% - 2 * var(--k)) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% var(--k) / 1px calc(100% - 2 * var(--k)) no-repeat,
    linear-gradient(to bottom right, var(--d)) 0 0 / var(--k) var(--k) no-repeat,
    linear-gradient(to bottom left, var(--d)) 100% 0 / var(--k) var(--k) no-repeat,
    linear-gradient(to top right, var(--d)) 0 100% / var(--k) var(--k) no-repeat,
    linear-gradient(to top left, var(--d)) 100% 100% / var(--k) var(--k) no-repeat;
}
.btn-kosmorph > .lbl, .btn-kosmorph > svg { position: relative; }
.btn-kosmorph:hover, .btn-kosmorph:focus-visible { background: var(--majorelle-hover); border-color: var(--majorelle-rim); --inlay-c: var(--brass-hover); }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn svg { flex: none; }

/* ---------------- KPI strip ---------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  min-width: 0;
}
.kpi {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "label label" "value viz" "sub sub";
  column-gap: 12px;
  padding: 14px 20px 13px;
  background: var(--bg);
  min-width: 0;
}
.kpi-label { grid-area: label; font-size: 13px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { grid-area: value; align-self: end; min-height: 1.1em; display: flex; align-items: baseline; gap: 6px; font-size: 28px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; margin-top: 6px; white-space: nowrap; }
.kpi-value .unit { font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.kpi-value .unit.pct { font-size: 18px; font-weight: 400; color: var(--ink-2); margin-left: -5px; letter-spacing: -0.01em; }
.kpi-sub { grid-area: sub; font-size: 13px; color: var(--ink-3); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub .up { color: var(--good); }
.kpi-sub .down { color: var(--crit); }
.kpi-sub .flat { color: var(--ink-2); }
.spark { grid-area: viz; align-self: end; width: 112px; height: 34px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: url(#none); fill: rgba(120, 140, 255, 0.10); stroke: none; }
.spark-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.dock-cells { grid-area: viz; align-self: end; display: grid; grid-template-columns: repeat(5, 14px); gap: 4px; margin-bottom: 2px; }
.dock-cells i { height: 26px; border-radius: 1px; background: var(--s3); box-shadow: inset 0 0 0 1px var(--line-2); }
.dock-cells i.on { background: var(--accent-2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.22); }
.dock-cells i.arr { background: repeating-linear-gradient(135deg, rgba(147,163,255,0.55) 0 2px, transparent 2px 5px), var(--s3); }
.fleet-bar { grid-area: viz; align-self: end; display: flex; width: 112px; height: 8px; gap: 2px; margin-bottom: 6px; }
.fleet-bar i { display: block; height: 100%; border-radius: 1px; min-width: 0; }
.fleet-bar .seg-active { background: var(--accent-2); }
.fleet-bar .seg-charging { background: var(--charge); }
.fleet-bar .seg-idle { background: var(--s4); }

/* ---------------- Viewport ---------------- */
.viewport {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  min-height: 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#scene.is-dragging { cursor: grabbing; }
#scene.is-over { cursor: pointer; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; pointer-events: none; }
.loading[hidden] { display: none; }

.vp-bar { position: absolute; display: flex; gap: 8px; z-index: 3; }
.vp-tl { left: 16px; top: 16px; }
.vp-tr { right: 16px; top: 16px; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: calc(var(--r) + 3px);
  background: var(--s1);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 6px 18px -8px rgba(0,0,0,0.6);
}
.seg-btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
  position: relative;
}
.seg-btn:hover { color: var(--ink-1); background: rgba(255,255,255,0.04); }
.seg-btn[aria-checked="true"] {
  color: var(--ink-1);
  background: linear-gradient(180deg, var(--s4), var(--s3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px var(--line-2);
}
.seg-btn::after { content: ""; position: absolute; inset: -4px -1px; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-radius: calc(var(--r) + 3px);
  border: 0;
  background: var(--s1);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 6px 18px -8px rgba(0,0,0,0.6);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.toggle:hover { color: var(--ink-1); background: var(--s2); }
.toggle[aria-pressed="true"] { color: var(--ink-1); box-shadow: inset 0 0 0 1px rgba(163, 177, 255, 0.55), 0 6px 18px -8px rgba(0,0,0,0.6); background: #1e2760; }
.toggle[aria-pressed="true"] svg { color: var(--accent); }

.legend {
  position: absolute; right: 16px; top: 64px; z-index: 3;
  width: 220px; padding: 12px 12px 10px;
  border-radius: var(--r-lg);
  background: var(--s1);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 24px -12px rgba(0,0,0,0.7);
}
.legend[hidden] { display: none; }
.legend-title { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.legend-ramp { height: 8px; border-radius: 1px; background: linear-gradient(90deg, #e6e1d7 0%, #cebf8d 25%, #3a52e0 60%, #151e66 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.legend-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--ink-3); }

.vp-foot {
  position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 14px; pointer-events: none; z-index: 2;
  height: 30px; padding: 0 10px; border-radius: calc(var(--r) + 3px);
  background: rgba(15, 20, 52, 0.8); box-shadow: inset 0 0 0 1px var(--line);
}
.scalebar { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12px; }
.scalebar .bar { display: block; width: 60px; height: 6px; border: 1.5px solid var(--ink-2); border-top: 0; }
.hint { color: var(--ink-3); font-size: 13px; padding-left: 14px; border-left: 1px solid var(--line-2); }

/* pins */
.pins { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.pins.is-off .pin:not(.pin-sel) { display: none; }
.pin {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 7px;
  border-radius: 2px;
  background: rgba(13, 18, 48, 0.86);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink-1);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
  will-change: transform;
}
.pin[hidden] { display: none; }
.is-compact .pin-aisle, .is-compact .pin-zone { display: none; }
.is-compact .pin-dock { height: 20px; padding: 0 5px; }
.pin-aisle { background: rgba(246, 244, 239, 0.92); color: #1e2436; box-shadow: inset 0 0 0 1px rgba(20, 26, 51, 0.16); }
.pin-zone { background: transparent; box-shadow: none; color: #4a5064; font-weight: 500; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.pin-sel { background: var(--majorelle); color: #fff; box-shadow: inset 0 0 0 1px var(--brass), 0 4px 12px -4px rgba(0,0,0,0.6); font-size: 13px; height: 24px; }
.pin-dock.is-late { box-shadow: inset 0 0 0 1px rgba(240, 117, 99, 0.8); }
.pin-dock.is-late::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--crit); margin-right: 6px; }

.hover-tip {
  position: absolute; left: 0; top: 0; z-index: 4;
  padding: 7px 9px; border-radius: var(--r);
  background: rgba(11, 15, 40, 0.95);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 8px 20px -8px rgba(0,0,0,0.7);
  font-size: 13px; color: var(--ink-1); white-space: nowrap; pointer-events: none;
}
.hover-tip .s { color: var(--ink-3); margin-left: 6px; }

/* inspector */
.inspector {
  position: absolute; left: 16px; bottom: 16px; z-index: 3;
  width: 340px; max-height: calc(100% - 88px); overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--s4) transparent;
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 18px 40px -16px rgba(0,0,0,0.75);
}
.inspector[hidden] { display: none; }
.inspector.is-scroll { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent); }
.ins-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--line); }
.ins-kind { font-size: 13px; color: var(--ink-3); }
.ins-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-top: 4px; }
.ins-actions { margin-left: auto; display: flex; gap: 6px; }
.ins-btn {
  height: 30px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--s2);
  color: var(--ink-2); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.ins-btn:hover { color: var(--ink-1); background: var(--s3); }
.ins-btn.icon { width: 30px; padding: 0; justify-content: center; }
.ins-body { padding: 12px 16px 16px; display: grid; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 8px;
  border-radius: 2px; font-size: 13px; font-weight: 500;
  background: var(--s3); color: var(--ink-1);
  box-shadow: inset 0 0 0 1px var(--line-2);
  white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 1px; background: var(--ink-3); flex: none; }
.chip.good i { background: var(--good); } .chip.warn i { background: var(--warn); } .chip.crit i { background: var(--crit); } .chip.accent i { background: var(--accent); } .chip.teal i { background: var(--charge); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; row-gap: 8px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink-1); text-align: right; font-variant-numeric: tabular-nums; }
.ins-task { padding: 10px 12px; border-radius: var(--r); background: var(--s2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; color: var(--ink-2); }
.ins-task b { color: var(--ink-1); font-weight: 500; }
.steps { display: flex; gap: 3px; margin-top: 10px; }
.steps i { flex: 1; height: 4px; border-radius: 1px; background: var(--s4); }
.steps i.done { background: var(--good); }
.steps i.now { background: var(--accent); }
.meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.meter .track { height: 6px; border-radius: 1px; background: var(--s4); overflow: hidden; }
.meter .fill { display: block; height: 100%; background: var(--accent-2); }
.meter .fill.warn { background: var(--warn); } .meter .fill.crit { background: var(--crit); } .meter .fill.good { background: var(--good); }
.ins-chart { width: 100%; height: 44px; display: block; }
.ins-chart .ln { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.ins-chart .ar { fill: rgba(120, 140, 255, 0.1); }
.ins-chart .now { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ins-chart .thr { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; vector-effect: non-scaling-stroke; }
.sec-title { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.bins { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.bins i { aspect-ratio: 1.6; border-radius: 1px; background: var(--s4); }
.bins i.l1 { background: #33427a; } .bins i.l2 { background: #4a60c8; } .bins i.l3 { background: #8597ff; }
.bins-axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: 6px; }

/* reduced motion gate */
.gate { position: absolute; left: 16px; bottom: 16px; z-index: 5; }
.gate[hidden] { display: none; }
.gate-card {
  width: 300px; padding: 18px; border-radius: var(--r-lg);
  background: rgba(13, 18, 48, 0.96);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 48px -16px rgba(0,0,0,0.8);
  display: grid; gap: 10px; justify-items: start;
}
.gate-title { font-size: 16px; font-weight: 600; }
.gate-text { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }

/* ---------------- Rail ---------------- */
.rail { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.tabs { display: flex; gap: 0; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  position: relative; height: 46px; padding: 0 10px; border: 0; background: transparent;
  color: var(--ink-3); font-size: 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 150ms var(--ease);
}
.tab:hover { color: var(--ink-1); }
.tab[aria-selected="true"] { color: var(--ink-1); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); }
.tab .count {
  min-width: 22px; padding: 5px 6px; border-radius: 2px; background: var(--s3); color: var(--ink-2); font-size: 13px; text-align: center;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.tab .count.has-crit { background: var(--crit-soft); color: #ffb3a8; box-shadow: inset 0 0 0 1px rgba(240,117,99,0.4); }
.panel { position: relative; flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--s4) transparent; }
.panel[hidden] { display: none; }
.panel-head { padding: 12px 20px 8px; }
.panel-note { font-size: 13px; color: var(--ink-3); }

.alert-list { padding: 0 12px 12px; display: grid; gap: 4px; }
.alert {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px;
  width: 100%; padding: 10px 8px 10px 8px; border: 0; border-radius: var(--r);
  background: transparent; text-align: left; cursor: pointer;
  transition: background-color 150ms var(--ease);
}
.alert:hover { background: var(--s2); }
.alert.is-active { background: var(--s1); box-shadow: inset 0 0 0 1px var(--line); }
.alert.is-active:hover { background: var(--s2); }
.alert.is-selected { box-shadow: inset 2px 0 0 var(--brass), inset 0 0 0 1px rgba(163, 177, 255, 0.4); }
.sev { width: 20px; height: 20px; display: grid; place-items: center; margin-top: -1px; }
.sev svg { display: block; }
.sev-critical { color: var(--crit); } .sev-warning { color: var(--warn); } .sev-info { color: var(--accent); }
.sev .cut { fill: none; stroke: var(--bg); } .sev .cut-dot { fill: var(--bg); }
.alert-empty { padding: 8px; }
.alert-title { display: block; font-size: 14px; font-weight: 500; color: var(--ink-1); }
.alert.is-resolved .alert-title { color: var(--ink-2); font-weight: 400; }
.alert-detail { display: block; font-size: 13px; color: var(--ink-3); margin-top: 3px; text-wrap: pretty; }
.alert-meta { display: grid; justify-items: end; align-content: start; gap: 6px; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.alert-meta .t { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 2px; font-size: 13px; font-weight: 500;
  background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2);
}
.badge.active-critical { background: var(--crit-soft); color: #ffb3a8; box-shadow: none; }
.badge.active-warning { background: var(--warn-soft); color: #f3d38a; box-shadow: none; }
.badge.active-info { background: var(--accent-soft); color: #c3ccff; box-shadow: none; }

.list-head {
  position: sticky; top: 0; z-index: 1;
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 92px; gap: 12px;
  padding: 12px 20px 8px; background: var(--bg);
  font-size: 13px; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.list-head .r { text-align: right; }
.rows { padding: 4px 12px 12px; }
.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 92px; gap: 12px; align-items: center;
  width: 100%; min-height: 44px; padding: 0 8px; border: 0; border-radius: var(--r);
  background: transparent; text-align: left; cursor: pointer; font-size: 13px;
  transition: background-color 150ms var(--ease);
}
.row:hover { background: var(--s2); }
.row[aria-pressed="true"] { background: var(--s2); box-shadow: inset 2px 0 0 var(--brass), inset 0 0 0 1px rgba(163, 177, 255, 0.4); }
.row-name { font-weight: 500; color: var(--ink-1); font-size: 14px; white-space: nowrap; }
.row-status { display: flex; align-items: center; gap: 8px; color: var(--ink-2); min-width: 0; }
.row-status > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 1px; flex: none; background: var(--ink-3); }
.dot.moving { background: var(--accent); } .dot.picking { background: var(--good); } .dot.queued { background: var(--warn); } .dot.charging { background: var(--charge); } .dot.low { background: var(--crit); } .dot.idle { background: #5d6580; }
.row-bat { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 8px; }
.row-bat .track { height: 5px; border-radius: 1px; background: var(--s4); overflow: hidden; }
.row-bat .fill { display: block; height: 100%; background: var(--ink-2); }
.row-bat .fill.low { background: var(--crit); } .row-bat .fill.mid { background: var(--warn); }
.row-bat .num { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rows .sep { height: 1px; background: var(--line); margin: 6px 8px; }

.rows.docks .row { grid-template-columns: 64px minmax(0, 1fr); padding: 10px 8px; align-items: start; }
.dock-main { display: grid; gap: 7px; min-width: 0; }
.dock-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink-2); min-width: 0; }
.dock-line .r { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dock-line > span { white-space: nowrap; }
.dock-line .truck { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dock-prog { height: 5px; border-radius: 1px; background: var(--s4); overflow: hidden; }
.dock-prog i { display: block; height: 100%; background: var(--accent-2); }
.dock-prog i.in { background: var(--in); } .dock-prog i.out { background: var(--out); }

/* ---------------- Timeline ---------------- */
.timeline {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: var(--bg);
  min-width: 0;
}
.timeline > * { min-height: 0; }
.tl-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 12px 14px; align-content: center; padding: 0 20px; border-right: 1px solid var(--line); }
.tl-controls .seg { grid-column: 1 / -1; justify-self: start; }
.tl-clock { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tl-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.seg-sm .seg-btn { height: 28px; min-width: 44px; }
#play .i-pause { display: none; }
#play.is-playing .i-play { display: none; }
#play.is-playing .i-pause { display: block; }
.tl-chart { position: relative; min-width: 0; padding: 12px 20px 8px 20px; }
.tl-chart:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
#tl-svg { position: absolute; left: 20px; right: 20px; top: 12px; bottom: 8px; display: block; width: calc(100% - 40px); height: calc(100% - 20px); overflow: visible; }
#scrub {
  position: absolute; left: 20px; right: 20px; top: 0; bottom: 0; width: calc(100% - 40px); height: 100%;
  margin: 0; opacity: 0; pointer-events: none;
}
.tl-chart { cursor: ew-resize; touch-action: pan-y; }
#tl-svg text { font-family: var(--sans); font-size: 12px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
#tl-svg .grid { stroke: var(--line); stroke-width: 1; }
#tl-svg .area-past { fill: rgba(120, 140, 255, 0.16); }
#tl-svg .line-past { fill: none; stroke: var(--accent); stroke-width: 1.5; }
#tl-svg .plan { fill: none; stroke: rgba(205, 214, 255, 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
#tl-svg .visit-in { fill: var(--in); }
#tl-svg .visit-out { fill: var(--out); }
#tl-svg .visit-late { stroke: var(--crit); stroke-width: 1.5; }
#tl-svg .slot { fill: url(#hatch); stroke: rgba(205, 214, 255, 0.22); stroke-width: 1; }
#tl-svg .hatch-line { fill: rgba(205, 214, 255, 0.2); }
#tl-svg .tick-critical { fill: var(--crit); } #tl-svg .tick-warning { fill: var(--warn); } #tl-svg .tick-info { fill: var(--accent); }
#tl-svg .playhead { stroke: var(--ink-1); stroke-width: 1.5; }
#tl-svg .playhead-cap { fill: var(--brass); }
#tl-svg .row-label { fill: var(--ink-3); }
#tl-svg .legend-label { fill: var(--ink-2); font-size: 13px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1280px) {
  :root { --rail: 332px; }
  .kpi { padding: 14px 16px; }
  .spark, .fleet-bar { width: 84px; }
  .hint { display: none; }
}
@media (max-width: 1100px) {
  .top-clock { display: none; }
  .kpi-value { font-size: 24px; }
  .spark, .fleet-bar, .dock-cells { display: none; }
}
@media (max-width: 900px) {
  :root { --rail: 100%; }
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    background: var(--bg);
  }
  .stage { display: contents; }
  .topbar { order: 1; } .viewport { order: 2; } .inspector { order: 3; } .timeline { order: 4; } .kpis { order: 5; } .rail { order: 6; }
  .topbar { height: auto; flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .brand { order: 1; }
  .top-links { display: contents; }
  .top-links .btn { order: 2; margin-left: auto; }
  .top-links .link { order: 4; height: 40px; padding: 0 8px; margin-left: auto; margin-block: -6px; }
  .concept { order: 3; }
  .long { display: none; }
  .short { display: inline; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .kpi { padding: 12px 16px; }
  .kpi[data-kpi="inv"] { grid-column: 1 / -1; }
  .kpi-value { font-size: 22px; align-self: start; }
  .kpi-sub { white-space: normal; }
  .kpi-label { white-space: normal; }
  .viewport { height: 52vh; min-height: 340px; max-height: 520px; border-bottom: 1px solid var(--line); }
  .vp-tl { left: 12px; top: 12px; }
  .vp-tr { right: 12px; top: 12px; }
  .vp-tr .toggle { width: 36px; padding: 0; justify-content: center; }
  .vp-tr .toggle .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .legend { top: auto; bottom: 12px; right: 12px; left: auto; width: 180px; }
  .vp-foot { display: none; }
  .gate { left: 12px; right: 12px; bottom: 12px; }
  .gate-card { width: auto; }
  .inspector { position: static; width: auto; max-height: none; overflow: visible; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); background: var(--s1); scroll-margin-top: 12px; }
  .inspector.is-scroll { -webkit-mask-image: none; mask-image: none; }
  .timeline { display: block; border-bottom: 1px solid var(--line); }
  .tl-controls { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tl-controls .seg { grid-column: auto; justify-self: end; }
  .tl-clock { font-size: 18px; }
  .tl-chart { height: 172px; padding: 10px 16px 6px; }
  #scrub { left: 16px; right: 16px; width: calc(100% - 32px); }
  #tl-svg { left: 16px; right: 16px; top: 10px; bottom: 6px; width: calc(100% - 32px); height: calc(100% - 16px); }
  .rail { min-height: 0; }
  .tabs { padding: 0 6px; overflow-x: auto; }
  .tab { padding: 0 10px; }
  .panel { max-height: 560px; }
  .list-head, .row { grid-template-columns: 84px minmax(0, 1fr) 84px; }
}
@media (max-width: 900px) {
  .seg-btn, .seg-sm .seg-btn { height: 40px; }
  .toggle { height: 40px; }
  .vp-tr .toggle { width: 40px; }
  .ins-btn { height: 40px; }
  .ins-btn.icon { width: 40px; }
}
@media (max-width: 420px) {
  .seg-btn { padding: 0 10px; }
  .toggle { padding: 0 10px; }
}

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