/* ------------------------------------------------------------------
   GenTech - FlowSight — frosted-glass big-screen theme
   ------------------------------------------------------------------ */
:root {
  --ink-1: #0f1b2d;
  --ink-2: #4a5568;
  --ink-3: #8590a3;
  --hair: rgba(15, 27, 45, 0.08);
  --grid: #e3e8f0;

  --accent: #2a78d6;
  --accent-ink: #1f63b8;
  --accent-soft: rgba(42, 120, 214, 0.1);
  --series-1: #2a78d6;
  --series-2: #1baf7a;

  --good: #0ca30c;
  --good-ink: #0a7a30;
  --good-soft: rgba(12, 163, 12, 0.1);
  --warn: #fab219;
  --warn-ink: #a86a00;
  --warn-soft: rgba(250, 178, 25, 0.14);
  --critical: #d03b3b;

  --glass: rgba(255, 255, 255, 0.56);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --surface: #f6f8fc;
  --shadow: 0 18px 40px -22px rgba(28, 58, 108, 0.28), 0 2px 8px -3px rgba(28, 58, 108, 0.1);
  --radius: 18px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --top: 64px;
  --foot: 28px;
  --gutter: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink-1);
  font-size: 14px;
  background:
    radial-gradient(1100px 700px at 68% 32%, #f8fbff 0%, rgba(248, 251, 255, 0) 62%),
    radial-gradient(900px 620px at 8% 92%, #dfe8f6 0%, rgba(223, 232, 246, 0) 60%),
    linear-gradient(180deg, #edf2f9 0%, #e5ecf5 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- canvas + overlay layers ---------- */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; outline: none; touch-action: none; }
#gl.enter { animation: gl-in 0.9s ease both; }
@keyframes gl-in { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: none; } }
#labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.view { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top); z-index: 6;
  display: flex; align-items: center; gap: 48px; padding: 0 var(--gutter);
  background: linear-gradient(180deg, rgba(238, 243, 250, 0.92), rgba(238, 243, 250, 0));
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg, #3a8bf0, #1f5fc4); display: grid; place-items: center; box-shadow: 0 6px 14px -6px rgba(31, 95, 196, 0.6); }
.brand-mark svg { width: 20px; height: 20px; fill: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 15.5px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.brand-text b i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.brand-text b em { font-style: normal; color: var(--accent-ink); }
.brand-text small { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.tabs { display: flex; gap: 34px; height: 100%; }
.tabs a { position: relative; display: flex; align-items: center; font-size: 13.5px; font-weight: 500; color: var(--ink-3); transition: color 0.2s; }
.tabs a:hover { color: var(--ink-1); }
.tabs a.on { color: var(--accent-ink); font-weight: 600; }
.tabs a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 12px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform 0.3s; }
.tabs a.on::after { transform: scaleX(1); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 12px; color: var(--ink-3); }
.clock b { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--glass-strong); border: 1px solid var(--glass-edge); display: grid; place-items: center; }
.avatar svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--accent-soft); color: var(--accent-ink); }
.pill.live i { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.18); animation: blink 2s infinite; }
.pill.good { background: var(--good-soft); color: var(--good-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.mute { background: rgba(15, 27, 45, 0.05); color: var(--ink-2); }
.pill svg { width: 12px; height: 12px; }
@keyframes blink { 50% { opacity: 0.45; } }

.foot {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--foot); z-index: 3; pointer-events: none;
  display: flex; justify-content: space-between; align-items: center; padding: 0 var(--gutter);
  font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.02em;
}

/* ---------- glass panel ---------- */
.panel {
  position: relative; pointer-events: auto;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  backdrop-filter: blur(22px) saturate(165%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--d, 0s);
  min-width: 0;
}
.panel::before { /* top sheen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%);
}
.panel > * { position: relative; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: none; } }
.rise { animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: var(--d, 0s); }

.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-h > span:first-child { font-size: 13px; font-weight: 600; }
.panel-h .aux { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.muted { color: var(--ink-3); font-size: 11.5px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { font: 600 10px/1 var(--mono); letter-spacing: 0.16em; color: var(--accent-ink); text-transform: uppercase; }
.hero { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 4px; }
.hero b { font-size: 48px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.hero .unit, .big .unit { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.big { display: flex; align-items: baseline; gap: 4px; }
.big b { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.delta { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical); }
.link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent-ink); cursor: pointer; background: none; border: 0; padding: 0; }
.link svg { width: 13px; height: 13px; }
.link:hover { text-decoration: underline; }

/* ---------- icons ---------- */
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none;
  min-width: 140px; max-width: 260px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-edge); box-shadow: 0 14px 30px -14px rgba(20, 45, 90, 0.4);
  font-size: 12px; color: var(--ink-2); opacity: 0; transition: opacity 0.15s;
}
.tooltip.on { opacity: 1; }
.tt-eyebrow { font: 600 9.5px/1 var(--mono); letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 5px; text-transform: uppercase; }
.tt-h { font-weight: 600; color: var(--ink-1); font-size: 13px; margin-bottom: 6px; }
.tt-r { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tt-r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tt-r b { margin-left: auto; color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-foot { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--hair); font-size: 11px; color: var(--accent-ink); font-weight: 600; }

/* ---------- loader ---------- */
.loader { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px; background: #edf2f9; color: var(--ink-3); font-size: 12px; transition: opacity 0.6s, visibility 0.6s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader-ring { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================================================================
   Overview
   ================================================================== */
.ov { position: absolute; inset: var(--top) 0 var(--foot) 0; }
.ov-stage { position: absolute; left: 360px; right: var(--gutter); top: 0; bottom: 250px; pointer-events: none; }
.ov-title { position: absolute; left: var(--gutter); top: 10px; pointer-events: none; }
.ov-title h1 { margin: 10px 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.ov-title p { margin: 0; font-size: 12px; color: var(--ink-3); }
.ov-left { position: absolute; left: var(--gutter); top: 116px; width: 320px; bottom: 250px; display: flex; flex-direction: column; gap: 14px; }
.ov-left .panel { flex: none; }
.ov-bottom { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 12px; height: 222px; display: grid; grid-template-columns: 320px minmax(0, 1.3fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 14px; }
.ov-bottom .panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.spark { height: 74px; margin-top: 8px; }
.metrics { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.metrics li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.metrics li:last-child { border-bottom: 0; }
.metrics .ml { font-size: 12.5px; color: var(--ink-2); }
.metrics b { margin-left: auto; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.metrics b small { font-size: 11px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.mi { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.mi .ic { width: 14px; height: 14px; }
.mi.good { background: var(--good-soft); color: var(--good-ink); }
.mi.warn { background: var(--warn-soft); color: var(--warn-ink); }

.meter { position: relative; height: 6px; border-radius: 6px; background: #d7e5f8; overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, #4b95ec, var(--accent)); transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
.meter.lg { height: 8px; }

.bars-wrap { flex: 1; min-height: 0; position: relative; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }

.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.feed li { display: grid; grid-template-columns: 58px 26px 1fr; align-items: start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.feed li:last-child { border-bottom: 0; }
.feed li.new { animation: feed-in 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes feed-in { from { opacity: 0; transform: translateY(-10px); background: var(--accent-soft); } }
.feed time { font: 500 11px/26px var(--mono); color: var(--ink-3); }
.feed .ft { font-size: 12.5px; font-weight: 600; color: var(--ink-1); }
.feed .fs { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.ov-tools, .ov-legend { position: absolute; display: flex; gap: 6px; pointer-events: auto; padding: 4px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.ov-tools { right: var(--gutter); top: 12px; }
.ov-legend { right: var(--gutter); bottom: 250px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; font-size: 11.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background 0.2s, color 0.2s; }
.chip:hover { background: rgba(15, 27, 45, 0.06); color: var(--ink-1); }
.chip.on { background: var(--accent); color: #fff; box-shadow: 0 4px 10px -4px rgba(31, 99, 184, 0.6); }
.chip.on:hover { background: var(--accent-ink); color: #fff; }
.chip .ic { width: 14px; height: 14px; }
.chip i.dot { width: 7px; height: 7px; border-radius: 50%; }

/* hotspot labels */
.hs { position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; gap: 10px; pointer-events: auto; cursor: pointer; transition: opacity 0.35s; will-change: transform; }
.hs-dot { position: relative; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 4px rgba(42, 120, 214, 0.16), 0 3px 8px rgba(20, 50, 100, 0.25); display: grid; place-items: center; flex: none; }
.hs-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hs-dot::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; animation: ping 2.6s ease-out infinite; }
.hs[data-tone="amber"] .hs-dot i { background: #f59e0b; }
.hs[data-tone="amber"] .hs-dot::after { border-color: #f59e0b; }
.hs[data-tone="violet"] .hs-dot i { background: #6250d6; }
.hs[data-tone="violet"] .hs-dot::after { border-color: #6250d6; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.6); opacity: 0; } }
.hs-card { margin-top: -22px; min-width: 156px; padding: 8px 12px 9px; border-radius: 12px; background: rgba(255, 255, 255, 0.72); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); border: 1px solid var(--glass-edge); box-shadow: 0 10px 24px -14px rgba(20, 45, 90, 0.45); transition: transform 0.25s, box-shadow 0.25s; }
.hs:hover .hs-card, .hs.pulse .hs-card { transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(20, 45, 90, 0.55); }
.hs-eyebrow { font: 600 9px/1 var(--mono); letter-spacing: 0.13em; color: var(--ink-3); }
.hs-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 5px; font-size: 13px; font-weight: 600; }
.hs-title .ic { width: 13px; height: 13px; color: var(--ink-3); transition: color 0.2s, transform 0.2s; }
.hs:hover .hs-title .ic { color: var(--accent); transform: translate(1px, -1px); }
.hs-more { max-height: 0; opacity: 0; overflow: hidden; font-size: 11.5px; color: var(--ink-2); transition: max-height 0.3s, opacity 0.3s, margin 0.3s; }
.hs:hover .hs-more, .hs.pulse .hs-more { max-height: 44px; opacity: 1; margin-top: 6px; }

/* ==================================================================
   Detail views (fleet / storage / parcel)
   ================================================================== */
.detail {
  position: absolute; inset: var(--top) 0 var(--foot) 0; padding: 8px var(--gutter) 12px;
  display: grid; gap: 14px 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: auto minmax(0, 1fr) auto 214px;
  grid-template-areas: "head head" "stage side" "switch switch" "bottom bottom";
}
.d-head { grid-area: head; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; pointer-events: none; }
.back { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.back:hover { color: var(--accent-ink); }
.back .ic { width: 13px; height: 13px; }
.d-head h1 { margin: 8px 0 4px; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.d-head h1 em { font-style: normal; color: var(--accent); font-weight: 500; margin-left: 6px; }
.d-head p { margin: 0; font-size: 12px; color: var(--ink-3); }
.d-meta { display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--ink-3); padding-bottom: 4px; }
.stage { grid-area: stage; position: relative; pointer-events: none; min-height: 0; }
.stage-cap { position: absolute; left: 0; top: 0; font: 600 9.5px/1 var(--mono); letter-spacing: 0.14em; color: var(--ink-3); }
.stage-hint { position: absolute; right: 0; top: -4px; display: flex; gap: 6px; pointer-events: auto; }
.stage-dock { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); display: flex; gap: 18px; font-size: 11px; color: var(--ink-2); }
.stage-dock span { display: inline-flex; align-items: center; gap: 6px; }
.stage-dock i { width: 9px; height: 9px; border-radius: 3px; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.switcher { grid-area: switch; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sw {
  pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow); transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: var(--d, 0s);
}
.sw:hover { transform: translateY(-2px); background: var(--glass-strong); }
.sw.on { background: #fff; box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.sw b { display: block; font-size: 13px; font-weight: 600; }
.sw small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.sw svg.thumb { width: 64px; height: 30px; flex: none; }
.d-bottom { grid-area: bottom; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; min-height: 0; }
.d-bottom .panel { display: flex; flex-direction: column; min-height: 0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(255, 255, 255, 0.8); }
.stat small { display: block; font-size: 11px; color: var(--ink-3); }
.stat b { display: block; font-size: 20px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.stat b span { font-size: 11px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }

.plate { font-size: 24px; font-weight: 700; letter-spacing: 0.02em; margin-top: 2px; }
.segbar { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin: 8px 0 14px; }
.segbar i { height: 6px; border-radius: 3px; background: #d7e5f8; transition: background 0.4s; transition-delay: calc(var(--i) * 40ms); }
.segbar i.on { background: var(--accent); }
.route { margin-top: 14px; }
.route-line { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin: 8px 0 6px; }
.route-line i { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); border-radius: 2px; position: relative; }
.route-line i::after { content: ""; position: absolute; top: -3px; left: var(--p, 40%); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.2); }
.route-line .node { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--accent); background: #fff; flex: none; }

.hover-card { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, rgba(98, 80, 214, 0.08), rgba(42, 120, 214, 0.06)); border: 1px solid rgba(255, 255, 255, 0.85); font-size: 11.5px; color: var(--ink-2); min-height: 92px; }
.hover-card b { display: block; color: var(--ink-1); font-size: 12.5px; margin-bottom: 4px; }
.hover-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 6px 0 0; }
.hover-card dt { color: var(--ink-3); }
.hover-card dd { margin: 0; color: var(--ink-1); font-weight: 500; text-align: right; }

/* tables */
.tbl-wrap { flex: 1; min-height: 0; overflow: auto; margin: 0 -6px; padding: 0 6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 500; font-size: 11px; color: var(--ink-3); padding: 7px 8px; background: rgba(240, 245, 252, 0.95); }
.tbl th:first-child { border-radius: 8px 0 0 8px; }
.tbl th:last-child { border-radius: 0 8px 8px 0; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.id { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.tbl tr { transition: background 0.15s; }
.tbl tbody tr:hover, .tbl tbody tr.hot { background: var(--accent-soft); }
.tbl .num { text-align: right; }
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: rgba(15, 27, 45, 0.05); }
.seg button { border: 0; background: none; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 11px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 4px rgba(28, 58, 108, 0.15); }

/* horizontal distribution bars */
.hbars { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.hbar-top b { color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar { height: 6px; border-radius: 6px; background: #dfe9f7; position: relative; overflow: hidden; }
.hbar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1); }

/* stepper */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 18px; position: relative; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; position: relative; }
.step::before { content: ""; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: #d7e5f8; z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.active::before { background: var(--accent); }
.step .sd { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid #d7e5f8; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.step.done .sd { background: var(--good-soft); border-color: transparent; color: var(--good-ink); }
.step.active .sd { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 5px rgba(42, 120, 214, 0.18); }
.step .sd .ic { width: 14px; height: 14px; }
.step b { font-size: 12px; font-weight: 600; }
.step small { font-size: 10.5px; color: var(--ink-3); margin-top: -4px; }

/* timeline */
.timeline { list-style: none; margin: 4px 0 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.timeline li { display: grid; grid-template-columns: 44px 18px 1fr; gap: 8px; padding-bottom: 12px; position: relative; }
.timeline time { font: 500 11px/18px var(--mono); color: var(--ink-3); }
.timeline .tl-dot { width: 10px; height: 10px; border-radius: 50%; margin: 4px auto 0; border: 2px solid #c6d6ee; background: #fff; position: relative; z-index: 1; }
.timeline li::before { content: ""; position: absolute; left: 60px; top: 14px; bottom: -2px; width: 2px; background: #dfe8f5; }
.timeline li:last-child::before { display: none; }
.timeline li.done .tl-dot { background: var(--accent); border-color: var(--accent); }
.timeline li.done::before { background: var(--accent); }
.timeline li.now .tl-dot { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(42, 120, 214, 0.18); }
.timeline b { font-size: 12.5px; font-weight: 600; display: block; }
.timeline li.todo b { color: var(--ink-3); font-weight: 500; }
.timeline small { font-size: 11px; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 12px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(15, 27, 45, 0.05); color: var(--ink-2); }

.related { display: flex; flex-direction: column; gap: 8px; }
.rel { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.85); pointer-events: auto; transition: background 0.2s; }
.rel:hover { background: #fff; }
.rel .mi { width: 30px; height: 30px; }
.rel b { font-size: 12.5px; display: block; }
.rel small { font-size: 11px; color: var(--ink-3); }
.rel > .ic { margin-left: auto; color: var(--ink-3); }

.swap { animation: swap 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes swap { from { opacity: 0.2; transform: translateY(6px); } }

/* parcel layout */
.detail.parcel {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head head" "stage stats" "stage archive" "stage lower" "switch lower";
}
.p-stats { grid-area: stats; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.p-stats .panel { padding: 14px 16px; }
.p-archive { grid-area: archive; }
.p-lower { grid-area: lower; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-height: 0; }
.p-lower .panel { display: flex; flex-direction: column; min-height: 0; }
.detail.parcel .switcher { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; }
.detail.parcel .sw { padding: 8px 14px; }
.stage-btn { pointer-events: auto; background: var(--glass-strong); border: 1px solid var(--glass-edge); }

/* scrollbars */
.tbl-wrap::-webkit-scrollbar, .timeline::-webkit-scrollbar, .side::-webkit-scrollbar { width: 6px; height: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb, .timeline::-webkit-scrollbar-thumb, .side::-webkit-scrollbar-thumb { background: rgba(15, 27, 45, 0.12); border-radius: 6px; }

/* ---------- shorter screens ---------- */
@media (max-height: 860px) {
  :root { --top: 56px; }
  .hero b { font-size: 40px; }
  .ov-title h1 { font-size: 22px; margin: 8px 0 4px; }
  .ov-left { top: 98px; bottom: 222px; gap: 10px; }
  .ov-bottom { height: 198px; }
  .ov-stage, .ov-legend { bottom: 222px; }
  .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .metrics li { flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 10px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.5); }
  .metrics .mi { display: none; }
  .metrics .ml { font-size: 11px; }
  .metrics b { margin-left: 0; font-size: 17px; }
  .ov-left .panel-h { margin-bottom: 6px; }
  .spark { height: 48px; margin-top: 4px; }
  .panel { padding: 13px 15px; }
  .detail { grid-template-rows: auto minmax(0, 1fr) auto 184px; gap: 10px 14px; }
  .d-head h1 { font-size: 23px; margin: 6px 0 2px; }
  .sw { padding: 9px 14px; }
}
@media (max-height: 760px) {
  .ov-left .panel:last-child { display: none; }
}

/* ---------- narrow screens: stack and scroll ---------- */
@media (max-width: 1100px) {
  .tabs { gap: 18px; }
  .top-right .clock, .foot { display: none; }
  .view { overflow-y: auto; pointer-events: auto; }
  .ov, .detail { position: relative; inset: auto; padding: calc(var(--top) + 8px) 16px 48px; }
  .ov { display: flex; flex-direction: column; gap: 14px; }
  .ov-title, .ov-left, .ov-bottom, .ov-tools, .ov-legend, .ov-stage { position: relative; inset: auto; width: auto; height: auto; }
  .ov-stage { height: 52vh; order: 1; }
  .ov-title { order: 0; }
  .ov-tools, .ov-legend { order: 2; align-self: flex-start; flex-wrap: wrap; border-radius: 16px; }
  .ov-left { order: 3; }
  .ov-left .panel:last-child { display: block; }
  .ov-bottom { order: 4; grid-template-columns: 1fr; }
  .ov-bottom .panel { min-height: 200px; }
  .detail, .detail.parcel { display: flex; flex-direction: column; }
  .stage { height: 50vh; flex: none; }
  .switcher, .detail.parcel .switcher { grid-template-columns: 1fr 1fr; }
  .d-bottom, .p-lower, .p-stats { grid-template-columns: 1fr; }
  .d-bottom .panel, .p-lower .panel { min-height: 240px; }
  .d-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .tabs { display: none; }
  .switcher, .detail.parcel .switcher { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .foot span:last-child { display: none; }
}
