/* ===========================================================================
   WuWa Bot Console — "Solaris-3" design system (light)
   ---------------------------------------------------------------------------
   A daylight observatory: pale cool surfaces, ink type, thin gold orbit lines,
   and data in the colours of the six Resonance elements. The look borrows the
   game's own vocabulary — Solaris-3, Resonance, Beacons, the Data Bank — but no
   official artwork, logo or asset. Everything here is drawn from scratch.

   Data colours are the validated reference steps, NAMED after the elements so
   the story and the accessibility maths agree:
     Glacio #2a78d6 · Fusion #eb6834 · Aero #1baf7a · Spectro #eda100
   Adjacent pairs pass CVD separation (worst ΔE 9.1); Fusion↔Spectro fails the
   all-pairs normal-vision floor (13.7), so every multi-series chart carries
   direct labels and a table view, and the 3D ridge never seats them side by
   side. Two scales ride alongside:
     loyalty (ordinal, one hue):  #86b6ef → #3987e5 → #1c5cab → #0d366b
     survey stars (diverging):    #a82a28 #e8766b | #cfcdc6 | #5598e7 #1c5cab
   All validated with the data-viz skill's validate_palette.js.
   =========================================================================== */

:root {
  color-scheme: light;

  /* surfaces */
  --bg:          #edf0f5;
  --bg-deep:     #e3e8f0;
  --card:        rgba(255, 255, 255, 0.84);
  --card-solid:  #ffffff;
  --card-sunken: #f4f6fa;
  --card-well:   #eef1f6;

  /* ink */
  --ink:    #10131c;
  --ink-2:  #454d5e;
  --muted:  #7f889a;
  --faint:  #b6bdca;

  /* hairlines */
  --line:   rgba(16, 19, 28, 0.08);
  --line-2: rgba(16, 19, 28, 0.15);
  --grid:   #e6e9ef;
  --axis:   #c9cfd9;

  /* the elements — categorical, fixed order, never cycled */
  --glacio:  #2a78d6;
  --fusion:  #eb6834;
  --aero:    #1baf7a;
  --spectro: #eda100;
  --havoc:   #e87ba4;
  --other:   #b6bdca;

  /* sequential — Glacio's own ramp */
  --b100: #cde2fb; --b150: #b7d3f6; --b200: #9ec5f4; --b250: #86b6ef;
  --b300: #6da7ec; --b350: #5598e7; --b400: #3987e5; --b450: #2a78d6;
  --b500: #256abf; --b550: #1c5cab; --b600: #184f95; --b650: #104281; --b700: #0d366b;

  /* survey stars — diverging, neutral midpoint */
  --s1: #a82a28; --s2: #e8766b; --s3: #cfcdc6; --s4: #5598e7; --s5: #1c5cab;

  /* status — reserved; always with a glyph and a word */
  --good: #0ca30c;     --good-ink: #006300;
  --warning: #fab219;  --warning-ink: #7a5200;
  --critical: #d03b3b; --critical-ink: #a12a2a;

  /* brand chrome — decoration only, never data */
  --gold:      #c9a24a;
  --gold-soft: rgba(201, 162, 74, 0.38);
  --gold-wash: rgba(201, 162, 74, 0.10);

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow:    0 1px 2px rgba(16, 19, 28, 0.04), 0 12px 32px -14px rgba(16, 19, 28, 0.16);
  --shadow-lg: 0 30px 80px -24px rgba(16, 19, 28, 0.32);

  --font:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Rajdhani", "Inter", system-ui, sans-serif;
  --mono:    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --rail: 84px;
  --gap: 18px;
}

/* ---- base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--glacio); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.spacer { flex: 1 1 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the sky behind everything ------------------------------------------- */
/* Two soft glows, a scatter of faint stars and one slow orbit. Fixed, so the
   page scrolls over a still sky. Purely decorative; aria-hidden in the HTML. */
.cosmos {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(237, 161, 0, 0.13), transparent 60%),
    radial-gradient(1000px 700px at 100% 18%, rgba(27, 175, 122, 0.10), transparent 62%),
    radial-gradient(900px 700px at 55% 120%, rgba(42, 120, 214, 0.12), transparent 60%),
    var(--bg);
}
.cosmos::before {
  content: ""; position: absolute; inset: -50%;
  background-image:
    radial-gradient(1.2px 1.2px at 20% 30%, rgba(16, 19, 28, .22), transparent 60%),
    radial-gradient(1px 1px at 70% 80%, rgba(16, 19, 28, .18), transparent 60%),
    radial-gradient(1.4px 1.4px at 40% 60%, rgba(42, 120, 214, .28), transparent 60%),
    radial-gradient(1px 1px at 85% 25%, rgba(16, 19, 28, .16), transparent 60%),
    radial-gradient(1.2px 1.2px at 55% 12%, rgba(201, 162, 74, .35), transparent 60%);
  background-size: 340px 340px, 420px 420px, 520px 520px, 610px 610px, 700px 700px;
}
.cosmos svg { position: absolute; width: 1600px; height: 1600px; right: -520px; top: -700px; opacity: .55; }
.cosmos .orbit-spin { transform-origin: 800px 800px; animation: orbit 240s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cosmos .orbit-spin { animation: none; } }

/* ---- left rail ----------------------------------------------------------- */
.rail {
  position: fixed; left: 14px; top: 14px; bottom: 14px; z-index: 50;
  width: calc(var(--rail) - 22px);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.rail-logo {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--ink); color: #fff; text-decoration: none; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 6px 16px -6px rgba(16,19,28,.6);
}
.rail-logo svg { width: 24px; height: 24px; }
.rail-sep { width: 26px; height: 1px; background: var(--line-2); margin: 4px 0; flex: none; }
.rail-nav { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rail-btn {
  position: relative; width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; flex: none;
  color: var(--ink-2); text-decoration: none; background: transparent; border: 0; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: var(--card-well); color: var(--ink); }
.rail-btn[aria-current="page"] { background: var(--ink); color: #fff; }
.rail-btn[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--gold);
}
.rail-btn img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.rail-btn.is-signed { box-shadow: 0 0 0 2px var(--good); }
.rail-tip {
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-4px);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .01em;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.rail-btn:hover .rail-tip, .rail-btn:focus-visible .rail-tip { opacity: 1; transform: translateY(-50%); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-coord {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--muted);
}

/* ---- page frame ------------------------------------------------------------ */
.main { margin-left: var(--rail); padding: 26px 30px 90px 22px; }
.frame { max-width: 1360px; margin: 0 auto; }

.head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin: 6px 0 22px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.eyebrow .diamond { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); display: inline-block; }
.title {
  font-family: var(--display); font-weight: 700; font-size: 46px; line-height: .95;
  letter-spacing: .01em; text-transform: uppercase;
}
.title .soft { color: var(--faint); }
.lede { color: var(--ink-2); font-size: 14px; max-width: 64ch; margin-top: 10px; }
.head-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- pills & chips ---------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}
.pill .k { color: var(--muted); font-weight: 500; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--good-ink); }
.pill.live .dot { background: var(--good); box-shadow: 0 0 0 4px rgba(12, 163, 12, .14); animation: beat 1.8s ease-in-out infinite; }
.pill.warn { color: var(--warning-ink); }
.pill.warn .dot { background: var(--warning); }
.pill.bad { color: var(--critical-ink); }
.pill.bad .dot { background: var(--critical); }
@keyframes beat { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .pill.live .dot { animation: none; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--card-well); color: var(--ink-2); border: 1px solid var(--line);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-good     { color: var(--good-ink);     background: rgba(12, 163, 12, .10);  border-color: rgba(12, 163, 12, .26); }
.chip-warning  { color: var(--warning-ink);  background: rgba(250, 178, 25, .16); border-color: rgba(250, 178, 25, .40); }
.chip-critical { color: var(--critical-ink); background: rgba(208, 59, 59, .10);  border-color: rgba(208, 59, 59, .28); }
.chip-accent   { color: var(--b600);         background: rgba(42, 120, 214, .10); border-color: rgba(42, 120, 214, .26); }
.chip-live .dot { animation: beat 1.8s ease-in-out infinite; }

/* filter row — one row, above everything it scopes */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
.seg {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  overflow-x: auto; max-width: 100%;
}
.seg button {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  height: 30px; padding: 0 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 7px;
}
.seg button:hover { background: var(--card-well); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg .key { width: 10px; height: 3px; border-radius: 2px; background: currentColor; }

/* ---- buttons -------------------------------------------------------------- */
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-solid); color: var(--ink);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--line-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink { background: var(--ink); color: #fff; border-color: transparent; }
.btn-ink:hover { background: #1f2433; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--card-well); color: var(--ink); }
.btn-danger { color: var(--critical-ink); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.icon-btn {
  appearance: none; cursor: pointer; flex: none;
  width: 30px; height: 30px; border-radius: 10px; border: 0;
  display: grid; place-items: center; background: transparent; color: var(--muted);
  font-size: 16px; letter-spacing: .08em; line-height: 1;
}
.icon-btn:hover { background: var(--card-well); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---- grid ------------------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.s-3 { grid-column: span 3; } .s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; }
.s-6 { grid-column: span 6; } .s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; }
.s-9 { grid-column: span 9; } .s-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.mt { margin-top: var(--gap); }

/* ---- cards ------------------------------------------------------------------ */
.card {
  position: relative; min-width: 0;
  background: var(--card);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  display: flex; flex-direction: column;
}
/* HUD brackets: two gold corners, the only ornament a card wears */
.card::before, .card::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--gold-soft); border-style: solid;
}
.card::before { top: 10px; left: 10px; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 6px; }
.card::after  { bottom: 10px; right: 10px; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 6px; }
.card.flush { padding: 0; overflow: hidden; }
.card.dark { background: var(--ink); color: #fff; border-color: transparent; }

.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card-head > div { min-width: 0; }
.card-title {
  font-family: var(--display); font-weight: 700; font-size: 15.5px;
  letter-spacing: .09em; text-transform: uppercase; line-height: 1.1;
}
.card-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap;
}
.card-tag.live { color: var(--good-ink); border-color: rgba(12, 163, 12, .3); }
.card-tag.archive { color: var(--b600); border-color: rgba(42, 120, 214, .28); }
.card-body { flex: 1 1 auto; min-width: 0; position: relative; }
.card-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.card-foot .total { margin-left: auto; font-weight: 600; color: var(--ink); }
.card-foot .total span { color: var(--muted); font-weight: 500; }
.card-empty {
  display: grid; place-items: center; text-align: center; padding: 26px 14px;
  color: var(--muted); font-size: 12.5px; border: 1px dashed var(--faint);
  border-radius: var(--r-md); background: var(--card-sunken);
}

/* legend: identity for >= 2 series; the swatch mirrors the mark */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item .sw.line { height: 3px; width: 14px; border-radius: 2px; }
.legend-item .sw.dot { border-radius: 50%; }

/* ---- stat tiles --------------------------------------------------------------- */
.kpi { display: flex; flex-direction: column; gap: 10px; min-height: 176px; }
.kpi-top { display: flex; align-items: flex-start; gap: 8px; }
.kpi-label {
  font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: .09em; text-transform: uppercase;
}
.kpi-value { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi-sub { font-size: 12px; color: var(--ink-2); }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.kpi-delta.up { color: var(--good-ink); }
.kpi-viz { margin-top: auto; min-height: 54px; }

/* the one hero figure per view — same sans as everything else */
.hero-figure { font-size: 64px; font-weight: 700; letter-spacing: -0.045em; line-height: .95; }
.hero-caption { font-size: 13px; color: var(--ink-2); margin-top: 6px; max-width: 34ch; }

/* ---- 3D stages -------------------------------------------------------------- */
.stage { position: relative; width: 100%; height: 100%; min-height: 360px; border-radius: var(--r-lg); overflow: hidden; }
.stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: pan-y; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage-overlay { position: absolute; inset: 0; pointer-events: none; }
.stage-overlay > * { pointer-events: auto; }
.stage-label {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: rgba(255, 255, 255, .86); border: 1px solid var(--line); color: var(--ink);
  box-shadow: 0 4px 12px -6px rgba(16, 19, 28, .3);
}
.stage-label .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.stage-axis { position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 10px; color: var(--muted); pointer-events: none; white-space: nowrap; }
.stage-hint {
  position: absolute; right: 14px; bottom: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.stage-print { display: none; width: 100%; border-radius: var(--r-lg); }
.stage-fallback { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12.5px; text-align: center; padding: 20px; }

/* ---- charts (SVG) --------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .label { font-size: 11.5px; fill: var(--ink-2); }
.chart .label-strong { font-size: 12px; font-weight: 700; fill: var(--ink); }
.chart .value { font-size: 11px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .value-in { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .marker-line { stroke: var(--ink); stroke-width: 1; opacity: .55; }
.chart .crosshair { stroke: var(--ink); stroke-width: 1; opacity: .35; pointer-events: none; }
.chart .hit { fill: transparent; cursor: default; }
.chart .mark { transition: opacity .12s ease, filter .12s ease; }
.chart .mark.dim { opacity: .28; }
.chart .mark.lift { filter: brightness(1.08) drop-shadow(0 2px 4px rgba(16, 19, 28, .18)); }
.chart .gold-line { stroke: var(--gold); stroke-width: 1.5; }

/* tooltip — value leads, label follows */
.tip {
  position: fixed; z-index: 300; pointer-events: none;
  min-width: 140px; max-width: 280px;
  background: rgba(16, 19, 28, .94); color: #fff;
  border-radius: 12px; padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px; line-height: 1.35;
  opacity: 0; transform: translateY(4px); transition: opacity .1s ease, transform .1s ease;
}
.tip.show { opacity: 1; transform: none; }
.tip-title { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.62); margin-bottom: 6px; font-family: var(--mono); }
.tip-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip-row .key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.tip-row .l { color: rgba(255,255,255,.72); }
.tip-note { margin-top: 6px; color: rgba(255,255,255,.62); font-size: 11px; }

/* table view — every chart's accessible twin */
.table-view { display: none; max-height: 340px; overflow: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card-solid); }
.card.show-table .table-view { display: block; grid-column: 1 / -1; }
.card.show-table .chart, .card.show-table .stage, .card.show-table .viz-hide-in-table { display: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; position: sticky; top: 0; background: var(--card-sunken);
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr:hover td { background: var(--card-sunken); }

/* ---- fleet / beacons ----------------------------------------------------------- */
.beacon { display: flex; flex-direction: column; gap: 12px; }
.beacon-row { display: flex; align-items: center; gap: 12px; }
.beacon-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--card-well); border: 1px solid var(--line); font-size: 21px;
}
.beacon-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.beacon-tag { font-size: 12px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fact { background: var(--card-sunken); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.fact .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.fact .v { font-size: 14px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fleet-list { display: flex; flex-direction: column; gap: 10px; }
.fleet-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px;
  background: var(--card-sunken); border: 1px solid var(--line); text-decoration: none;
}
.fleet-item:hover { border-color: var(--line-2); }
.fleet-item.ghost { border-style: dashed; background: transparent; color: var(--ink-2); cursor: pointer; justify-content: center; }
.fleet-item.ghost:hover { border-color: var(--glacio); color: var(--ink); }

/* live heartbeat trace */
.pulse-trace { height: 58px; width: 100%; display: block; }

/* ---- feed ------------------------------------------------------------------- */
.feed { display: flex; flex-direction: column; }
.feed-day {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 12px 0 6px;
}
.feed-day:first-child { margin-top: 0; }
.feed-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: 0; }
.feed-mark { width: 22px; height: 22px; display: grid; place-items: center; }
.feed-mark i { width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px; display: block; }
.feed-title { font-size: 13px; font-weight: 600; }
.feed-detail { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.feed-meta { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.feed-scroll { max-height: 420px; overflow: auto; padding-right: 4px; }

/* ---- calendar ------------------------------------------------------------------ */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-month { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid transparent;
  display: flex; flex-direction: column; justify-content: space-between; padding: 5px 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--card-sunken);
  cursor: default; min-width: 0; outline: none;
}
.cal-day.out { background: transparent; color: var(--faint); }
.cal-day.today { border-color: var(--ink); }
.cal-day .n { font-variant-numeric: tabular-nums; }
.cal-day .bar { height: 4px; border-radius: 2px; background: var(--glacio); align-self: stretch; }
.cal-day.event { box-shadow: inset 0 0 0 2px var(--spectro); }
.cal-day.event::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  background: var(--spectro); transform: rotate(45deg); border-radius: 1.5px;
}
.cal-day:hover, .cal-day:focus-visible { border-color: var(--line-2); }
.cal-day.sel { border-color: var(--ink); }
.cal-detail {
  margin-top: 12px; padding: 11px 13px; border-radius: 14px; background: var(--card-sunken);
  border: 1px solid var(--line); font-size: 12.5px; min-height: 64px;
}
.cal-detail h4 { font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.cal-detail ul { margin: 0; padding-left: 16px; color: var(--ink-2); }
.cal-detail li { margin: 2px 0; }
.cal-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.cal-scale i { width: 14px; height: 6px; border-radius: 2px; display: inline-block; }

/* ---- work record ---------------------------------------------------------------- */
.work-item { padding: 0; overflow: hidden; }
.work-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 18px 20px 10px; }
.work-title { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.work-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.work-prose { padding: 0 20px 6px; }
.work-prose p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); max-width: 82ch; }
.work-prose strong { color: var(--ink); }
.metric-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 6px 20px 14px; }
.metric { background: var(--card-sunken); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.metric .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.metric .v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; }
.metric .n { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 20px 16px; border-top: 1px solid var(--line); }

.shots { display: grid; gap: 10px; padding: 4px 20px 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.shot { margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card-sunken); position: relative; cursor: zoom-in; }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.shot figcaption { font-size: 11.5px; color: var(--ink-2); padding: 8px 10px; background: var(--card-solid); border-top: 1px solid var(--line); }
.shot-del {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 9px; border: 0;
  background: rgba(16, 19, 28, .7); color: #fff; cursor: pointer; display: none; place-items: center;
}
body.is-admin .shot:hover .shot-del { display: grid; }

/* ---- forms / modal / lightbox / toast ------------------------------------------------ */
.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="date"], textarea, select {
  width: 100%; font: inherit; font-size: 13.5px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-solid); color: var(--ink);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--glacio); box-shadow: 0 0 0 3px rgba(42, 120, 214, .14); }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(16, 19, 28, .36); backdrop-filter: blur(4px); }
.modal { width: min(640px, 100%); max-height: calc(100vh - 50px); display: flex; flex-direction: column; background: var(--card-solid); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--display); font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--card-sunken); }

.dropzone { border: 1.5px dashed var(--faint); border-radius: 16px; padding: 22px; text-align: center; color: var(--ink-2); font-size: 13px; cursor: pointer; background: var(--card-sunken); margin-bottom: 14px; }
.dropzone:hover, .dropzone.over { border-color: var(--glacio); color: var(--ink); }

.lightbox { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 28px; background: rgba(16, 19, 28, .88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 14px; box-shadow: var(--shadow-lg); }
.lightbox figcaption { color: #e9ebf0; font-size: 13px; text-align: center; margin-top: 14px; max-width: 70ch; }
.lightbox .close { position: absolute; top: 16px; right: 18px; width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 17px; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); z-index: 320;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 11px 16px;
  border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot-note { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.foot-note a { color: var(--ink-2); }

/* ---- responsive ------------------------------------------------------------------ */
@media (max-width: 1180px) {
  .s-3 { grid-column: span 6; } .s-4, .s-5, .s-7, .s-8, .s-9 { grid-column: span 12; }
  .s-6 { grid-column: span 12; }
}
@media (max-width: 760px) {
  :root { --gap: 14px; }
  .rail {
    left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; height: 64px;
    flex-direction: row; justify-content: space-around; padding: 0 10px; border-radius: 20px;
  }
  .rail-logo, .rail-sep, .rail-coord { display: none; }
  .rail-nav { flex-direction: row; gap: 4px; }
  .rail-foot { margin: 0; flex-direction: row; }
  .rail-tip { display: none; }
  .rail-btn[aria-current="page"]::before { left: 12px; right: 12px; top: auto; bottom: -8px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .main { margin-left: 0; padding: 18px 16px 100px; }
  .title { font-size: 34px; }
  .hero-figure { font-size: 50px; }
  .s-3 { grid-column: span 12; }
  .head-right { margin-left: 0; }
  .facts { grid-template-columns: 1fr 1fr; }
}

/* ---- print: the delivery packet ---------------------------------------------------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .cosmos, .rail, .no-print, .btn, .icon-btn, .shot-del, .dropzone, .stage-hint { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; backdrop-filter: none; background: #fff; break-inside: avoid; }
  .card::before, .card::after { display: none; }
  .stage canvas { display: none !important; }
  .stage-print { display: block; }
  .grid { gap: 10px; }
  .s-3, .s-4, .s-5, .s-6, .s-7, .s-8 { grid-column: span 6; }
  .feed-scroll { max-height: none; overflow: visible; }
}
