:root {
  --bg: #0f1720;
  --card: #141e29;
  --line: rgba(255, 255, 255, 0.09);
  --grid: #2c2c2a;
  --text: #e8eef3;
  --text-2: #c3cdd6;
  --muted: #94a3b2;
  --accent: #57c7a5;
  --live: #4cc38a;
  --sim: #7aa7ff;
  /* Status (fixed, always paired with a label) */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  /* Categorical, dark steps, fixed order */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
  /* Sequential blue for utilisation */
  --q1: #184f95; --q2: #1c5cab; --q3: #256abf; --q4: #2a78d6; --q5: #3987e5; --q6: #5598e7; --q7: #86b6ef;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 5px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: rgba(15,23,32,.92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.brand > span:last-child { display: grid; }
.logo { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M4 26V12l12-7 12 7v14h-6v-8H10v8z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M4 26V12l12-7 12 7v14h-6v-8H10v8z'/%3E%3C/svg%3E") center/contain no-repeat; }
.title { font-size: 16.5px; font-weight: 600; }
.sub { color: var(--muted); font-size: 12.5px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px;
  background: var(--card); border: 1px solid var(--line); white-space: nowrap; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.pill.link:hover { border-color: var(--accent); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.live .dot { background: var(--live); }
.pill.sim .dot { background: var(--sim); }

main { max-width: 1240px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 16px; }
.lede { margin: 4px 0 0; color: var(--text-2); max-width: 78ch; font-size: 15px; }
.grid.two { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 960px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.card h2 { font-size: 15px; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 60ch; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
svg { display: block; }
svg text { fill: var(--text-2); font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
svg text.strong { fill: var(--text); font-weight: 600; }
svg text.muted { fill: var(--muted); font-size: 11px; }

.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 2px; }
.kpi .meta { color: var(--muted); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .bar, .dos .bar { height: 4px; border-radius: 2px; background: var(--grid); margin-top: 8px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; border-radius: 2px; background: var(--s1); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; color: var(--text-2); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.ramp { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.ramp .steps { display: flex; gap: 2px; }
.ramp .steps i { width: 22px; height: 8px; border-radius: 2px; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 520px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .n { text-align: right; }
.table .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; }
.dos { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.dos .bar { position: relative; flex: 1; margin: 0; height: 6px; overflow: visible; }
.dos .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--s1); }
.dos .bar b { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); border-radius: 1px; }
.dos span { width: 44px; text-align: right; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok, .status.received, .status.dispatched { color: var(--good); }
.status.low, .status.high, .status.warn, .status.loading, .status.at-dock { color: var(--warning); }
.status.alarm { color: var(--critical); }
.status.scheduled, .status.queued { color: var(--muted); }
.status span { color: var(--text-2); }

.mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.mini div { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mini b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.mini span { color: var(--muted); font-size: 11.5px; }
@media (max-width: 520px) { .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip.busy { border-color: var(--s1); color: var(--text); }

.prose ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); max-width: 90ch; }
.fine { color: var(--muted); font-size: 12.5px; max-width: 90ch; }
.refs { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; display: grid; gap: 3px; }

.tip { position: fixed; z-index: 10; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: 8px;
  background: #1b2633; border: 1px solid rgba(255,255,255,.14); color: var(--text); font-size: 12.5px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.tip b { font-variant-numeric: tabular-nums; }
.hot { cursor: pointer; }
.area { cursor: pointer; }
.area:hover rect.fill, .area:focus rect.fill { stroke: var(--text); stroke-width: 1.5; }
.link-band { transition: opacity .15s; }
.link-band:hover { opacity: .85 !important; }
