/*
 * The night shift. One dark theme, one accent (sodium lamp amber) and one signal (attack red).
 *
 * Amber and red sit close for some colour-blind readers, so red never works alone: every attack
 * also carries the word "attack" or a filled mark, and amber is always the lighter of the two.
 */

@import url('fonts.css');

:root {
  color-scheme: dark;

  --bg: #0b0d10;
  --bg-2: #101318;
  --bg-3: #161a21;
  --line: rgba(206, 214, 226, 0.09);
  --line-2: rgba(206, 214, 226, 0.17);
  --ink: #e8e6e1;
  --ink-2: #a9adb3;
  --ink-3: #80858d;
  --accent: #f0b340;
  --accent-ink: #1a1305;
  --accent-soft: rgba(240, 179, 64, 0.13);
  --signal: #ff5a4f;
  --signal-soft: rgba(255, 90, 79, 0.13);

  /* Chart slots map onto the same four colours, so a chart never introduces a fifth. */
  --series-1: #aeb3ba;
  --series-2: var(--accent);
  --series-3: #6d737b;
  --series-4: var(--signal);
  --critical: var(--signal);
  --grid: rgba(206, 214, 226, 0.07);
  --axis: rgba(206, 214, 226, 0.22);
  --track: transparent;
  --surface: var(--bg-2);
  --surface-2: var(--bg-3);
  --fg: var(--ink);
  --fg-muted: var(--ink-2);
  --fg-dim: var(--ink-3);
  --border: var(--line);

  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --sans: 'IBM Plex Sans', ui-sans-serif, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-move: cubic-bezier(0.77, 0, 0.175, 1);

  /* Shape rule: controls get 3px, panels get none and are held by hairlines. */
  --r: 3px;

  --gutter: clamp(16px, 4vw, 40px);
  --bar-h: 56px;

  --z-bar: 20;
  --z-tip: 40;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 8px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }
html { scrollbar-color: #2a2f38 var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2f38; border-radius: 5px; border: 2px solid var(--bg); }

h1, h2, h3 { margin: 0; font-weight: 700; text-wrap: balance; }
h2 {
  font-family: var(--display); font-weight: 750; font-size: clamp(2rem, 3.4vw, 2.75rem);
  line-height: 1.02; letter-spacing: -0.005em;
}
h3 { font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1.05; }
p { margin: 0 0 1rem; text-wrap: pretty; }
strong { font-weight: 600; color: var(--ink); }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, pre, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* JetBrains Mono draws "--" and "->" as ligatures, which turns SQL comments into long dashes. */
body, textarea, select, button { font-variant-ligatures: no-contextual; font-feature-settings: 'calt' 0; }
[hidden] { display: none !important; }
button, a, [role='slider'], select, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
code { font-size: 0.88em; color: var(--ink); }
.signal { color: var(--signal); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); }
textarea, input, select { caret-color: var(--accent); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--r);
}
.skip-link:focus { left: 8px; }
.skip-link:hover { color: var(--accent-ink); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------------------------------------------------------------- top bar */
.bar {
  position: sticky; top: 0; z-index: var(--z-bar);
  height: var(--bar-h);
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (prefers-reduced-transparency: reduce) { .bar { background: var(--bg); backdrop-filter: none; } }
.bar-inner {
  height: 100%;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: 0.01em;
}
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.bar-nav { display: flex; gap: 2px; margin-left: 8px; }
.bar-nav a {
  color: var(--ink-2); text-decoration: none; font-size: 0.875rem;
  padding: 6px 10px; border-radius: var(--r);
  transition: color 160ms ease, background-color 160ms ease;
}
.bar-nav a:hover { color: var(--ink); background: var(--bg-3); }
.bar-nav a[aria-current='true'] { color: var(--ink); }
.bar-clock {
  margin-left: auto; display: flex; gap: 12px; align-items: baseline;
  font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap;
}
.clock-t { color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 980px) { .bar-nav { display: none; } }

/* ---------------------------------------------------------------- the day */
.night {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "stage feed"
    "transport feed"
    "work work";
  border-bottom: 1px solid var(--line);
}

.stage {
  grid-area: stage; position: relative; overflow: hidden;
  height: clamp(460px, calc(100dvh - var(--bar-h) - 100px), 820px);
  background: var(--bg);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.stage canvas.night-base { pointer-events: none; }

.night-copy {
  position: absolute; left: var(--gutter); top: clamp(20px, 5vh, 56px);
  max-width: min(27rem, 38%); pointer-events: none;
}
.night-copy h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.75rem, 4.6vw, 4.5rem); line-height: 0.95; letter-spacing: -0.01em;
  text-wrap: balance; margin-bottom: 20px;
}
.lede { color: var(--ink-2); font-size: 1.0625rem; max-width: 36ch; margin-bottom: 16px; }
.facts { font-size: 0.8125rem; color: var(--ink-3); max-width: 36ch; line-height: 1.7; }
.facts span { color: var(--ink); }

.stage-legend {
  position: absolute; left: var(--gutter); bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: 44%;
  font-size: 0.75rem; color: var(--ink-3);
}
.stage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.k { display: inline-block; flex: none; width: 8px; height: 8px; }
.k-user { border-radius: 50%; background: var(--ink-2); }
.k-comp { background: var(--ink-3); width: 7px; height: 7px; }
.k-login { width: 14px; height: 2px; background: var(--accent); opacity: 0.55; }
.k-alert { border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; width: 10px; height: 10px; }
.k-attack { width: 14px; height: 2px; background: var(--signal); }
.k-pivot { width: 8px; height: 8px; background: var(--accent); }
.k-route { width: 14px; height: 2px; background: var(--accent); }
.legend .k-attack { width: 8px; height: 8px; border-radius: 50%; }

.stage-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 6px 9px; font: 500 0.75rem/1.45 var(--mono); color: var(--ink); white-space: nowrap;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.7);
}
.stage-tip span { color: var(--ink-3); }

/* transport: play, scrub, note */
.transport {
  grid-area: transport;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; align-items: center;
  padding: 12px var(--gutter) 14px;
  border-top: 1px solid var(--line);
}
.transport-note { grid-column: 1 / -1; margin: 0; font-size: 0.75rem; color: var(--ink-3); max-width: 90ch; }

.scrub {
  position: relative; height: 36px; cursor: pointer; touch-action: none; user-select: none;
  border-radius: var(--r);
}
.scrub-rail { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.scrub-fill {
  position: absolute; left: 0; top: calc(50% - 1px); height: 2px; width: 100%;
  background: var(--ink-2); transform-origin: left center; transform: scaleX(0);
}
.scrub-head {
  position: absolute; top: 50%; left: 0; width: 2px; height: 22px; margin: -11px 0 0 -1px;
  background: var(--accent); border-radius: 1px;
  box-shadow: 0 0 0 3px rgba(11, 13, 16, 0.9);
}
.scrub:active .scrub-head, .scrub.dragging .scrub-head { height: 28px; margin-top: -14px; }
.scrub-ticks { position: absolute; inset: 0; pointer-events: none; }
.scrub-ticks i {
  position: absolute; top: 50%; width: 1px; height: 10px; margin-top: -5px; background: var(--accent);
}
.scrub-ticks i.attack { background: var(--signal); height: 16px; margin-top: -8px; width: 2px; }
.scrub-ticks b {
  position: absolute; bottom: -2px; font: 400 0.625rem/1 var(--mono); color: var(--ink-3);
  transform: translateX(-50%);
}

/* feed */
.feed {
  grid-area: feed;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-2);
}
.feed-head {
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.feed-head h2 { font-size: 1.5rem; }
.feed-count { grid-column: 1; margin: 0; font-size: 0.8125rem; color: var(--ink-3); }
.feed-count .mono { color: var(--ink); font-size: 1rem; font-weight: 500; }
.feed-head .switch { grid-column: 2; grid-row: 1 / span 2; }

.alerts {
  list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto;
  max-height: clamp(460px, calc(100dvh - var(--bar-h) - 76px - 90px), 730px);
  overscroll-behavior: contain;
}
.alert {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 320ms var(--ease-out), opacity 220ms ease;
}
.alert[hidden] { display: none; }
.alert > .alert-in {
  overflow: hidden; min-height: 0; display: block; width: 100%; padding: 0; margin: 0;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.alert-body {
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px;
}
.alert.arriving .alert-body { animation: land 520ms var(--ease-out); }
@keyframes land {
  from { background: var(--accent-soft); }
  to { background: transparent; }
}
.a-time { font: 400 0.6875rem/1.9 var(--mono); color: var(--ink-3); }
.a-who { font: 500 0.8125rem/1.6 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.a-who .a-path { color: var(--ink-3); font-weight: 400; }
.a-score { font: 500 0.8125rem/1.6 var(--mono); color: var(--accent); text-align: right; }
.a-reason, .a-call, .a-why, .a-truth { grid-column: 2 / -1; }
.a-reason { font-size: 0.8125rem; color: var(--ink-3); }
.a-call {
  font: 500 0.8125rem/1.5 var(--mono); color: var(--ink); margin-top: 4px; min-height: 1.5em;
}
.a-call .caret {
  display: inline-block; width: 0.55em; height: 1.05em; vertical-align: -0.18em; margin-left: 1px;
  background: var(--accent); animation: blink 1s steps(1) infinite;
}
.a-call .caret[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.a-call.said-attack { color: var(--signal); }
.a-why {
  font-size: 0.8125rem; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  opacity: 0; transition: opacity 260ms ease;
}
.alert.said .a-why { opacity: 1; }
.alert.open .a-why { -webkit-line-clamp: unset; }
.a-truth {
  font: 600 0.75rem/1.6 var(--mono); color: var(--signal); text-transform: none;
  display: none; margin-top: 4px;
}
.alert.said.truth-attack .a-truth { display: block; }
.alert.truth-attack.said .alert-body { box-shadow: inset 2px 0 0 var(--signal); }
.a-time, .a-who, .a-score, .a-reason, .a-call { display: block; }
.a-call .typed { display: inline; }
@media (hover: hover) and (pointer: fine) { .alert-in:hover .alert-body { background: rgba(206, 214, 226, 0.03); } }
.alert-in:focus-visible { outline-offset: -2px; }

/* The agent reads first: closed alerts fold away, but a missed attack leaves a scar. */
.feed.agent .alert.closed { grid-template-rows: 0fr; opacity: 0; }
.feed.agent .alert.closed.truth-attack { grid-template-rows: 1fr; opacity: 1; }
.feed.agent .alert.closed.truth-attack .alert-body { background: var(--signal-soft); }
.feed.agent .alert.closed.truth-attack .a-reason,
.feed.agent .alert.closed.truth-attack .a-why { display: none; }
.feed.agent .alert.closed.truth-attack .a-truth::before { content: 'Closed by the agent. '; color: var(--ink-2); font-weight: 500; }

.feed-empty { padding: 20px; margin: 0; font-size: 0.875rem; color: var(--ink-3); }
.feed-note { padding: 14px 20px 18px; margin: 0; font-size: 0.75rem; color: var(--ink-3); border-top: 1px solid var(--line); }

/* the workload strip */
.work {
  grid-area: work; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.4fr);
}
.work > div { padding: 18px var(--gutter) 20px; border-right: 1px solid var(--line); min-width: 0; }
.work > div:last-child { border-right: 0; }
.work .num-big {
  display: block; font: 500 clamp(1.5rem, 2.6vw, 2.125rem)/1.1 var(--mono);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
.work .num-big.good { color: var(--accent); }
.work .num-big.bad { color: var(--signal); }
.work .lbl { display: block; margin-top: 4px; font-size: 0.8125rem; color: var(--ink-3); }
.work p { margin: 0; font-size: 0.8125rem; color: var(--ink-2); }

@media (max-width: 1100px) {
  .work { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .night {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "transport" "feed" "work";
  }
  .stage { height: auto; }
  .stage { display: grid; grid-template-areas: "copy" "canvas" "legend"; }
  .stage canvas { position: relative; height: min(96vw, 520px); grid-area: canvas; }
  .night-copy { position: static; max-width: none; padding: 28px var(--gutter) 8px; grid-area: copy; }
  .stage-legend { position: static; max-width: none; padding: 8px var(--gutter) 12px; grid-area: legend; }
  .feed { border-left: 0; border-top: 1px solid var(--line); }
  .alerts { max-height: none; overflow: visible; }
  .work { grid-template-columns: minmax(0, 1fr); }
  .work > div { border-right: 0; border-top: 1px solid var(--line); }
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  font: 500 0.875rem/1 var(--sans); color: var(--ink);
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r);
  cursor: pointer; user-select: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}
.btn svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: #1d222b; border-color: rgba(206, 214, 226, 0.26); }
  .btn.primary:hover:not(:disabled) { background: #ffc453; border-color: #ffc453; }
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.loading { color: transparent; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--ink-3); border-top-color: var(--ink); animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.icon { width: 40px; padding: 0; }
.btn.icon svg { width: 15px; height: 15px; }
#play .i-play, #play .i-replay { display: none; }
#play[data-state='paused'] .i-pause, #play[data-state='ended'] .i-pause { display: none; }
#play[data-state='paused'] .i-play { display: block; }
#play[data-state='ended'] .i-replay { display: block; }

.switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 2px;
  background: none; border: 0; color: var(--ink-2); font: 500 0.8125rem/1.2 var(--sans);
  cursor: pointer; text-align: left;
}
.switch-track {
  position: relative; width: 34px; height: 20px; flex: none; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  transition: background-color 200ms ease, border-color 200ms ease;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-2); transition: transform 240ms var(--ease-out), background-color 200ms ease;
}
.switch[aria-checked='true'] { color: var(--ink); }
.switch[aria-checked='true'] .switch-track { background: var(--accent-soft); border-color: var(--accent); }
.switch[aria-checked='true'] .switch-knob { transform: translateX(14px); background: var(--accent); }
.switch:active .switch-knob { transform: scale(0.9); }
.switch[aria-checked='true']:active .switch-knob { transform: translateX(14px) scale(0.9); }
@media (hover: hover) and (pointer: fine) { .switch:hover { color: var(--ink); } }

.tag {
  display: inline-block; vertical-align: 0.5em; margin-left: 8px;
  font: 500 0.6875rem/1 var(--mono); letter-spacing: 0.02em; color: var(--accent);
  padding: 4px 6px; border: 1px solid rgba(240, 179, 64, 0.4); border-radius: var(--r);
  white-space: nowrap;
}

.field label { display: block; font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 6px; }
select {
  width: 100%; min-height: 40px; padding: 0 12px;
  font: 400 0.875rem var(--mono); color: var(--ink);
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r);
}
select:focus { border-color: var(--accent); outline: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 0.875rem; color: var(--ink-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------------------------------------------------------------- bands */
.band { padding: clamp(64px, 9vw, 112px) 0; border-bottom: 1px solid var(--line); }
.head { max-width: 68ch; margin-bottom: 40px; }
.head h2 { margin-bottom: 18px; }
.head p { color: var(--ink-2); }

.ledger { display: grid; gap: 2px; max-width: 880px; }
.ledger-row {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 5.5rem; gap: 16px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.ledger-row .name { font-size: 0.9375rem; color: var(--ink-2); }
.ledger-row .lbar { position: relative; height: 10px; }
.ledger-row .lbar span {
  position: absolute; inset: 0 auto 0 0; background: var(--ink-3);
  transform-origin: left center; border-radius: 1px;
}
.ledger-row.best .bar span { background: var(--accent); }
.ledger-row .v { font: 500 1rem var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.ledger-row .v small { color: var(--ink-3); font-weight: 400; font-size: 0.75rem; }
.ledger-note { font-size: 0.8125rem; color: var(--ink-3); margin: 12px 0 48px; max-width: 70ch; }
@media (max-width: 640px) {
  .ledger-row { grid-template-columns: minmax(0, 1fr) 5rem; }
  .ledger-row .lbar { grid-column: 1 / -1; grid-row: 2; }
}

.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  position: relative; min-height: 44px; padding: 0 16px;
  background: none; border: 0; color: var(--ink-3); font: 500 0.9375rem var(--sans); cursor: pointer;
  transition: color 160ms ease;
}
.tab::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform 240ms var(--ease-out);
}
.tab[aria-pressed='true'] { color: var(--ink); }
.tab[aria-pressed='true']::after { transform: scaleX(1); }
.tab-signal[aria-pressed='true']::after { background: var(--signal); }
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--ink); } }
.tab:active { transform: translateY(1px); }

#tri-view { min-height: 320px; }
.tri-line { color: var(--ink-2); max-width: 72ch; margin: 0 0 16px; }
.tri-line strong { font-family: var(--mono); font-weight: 500; font-size: 0.9em; }

.tri-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px 48px; align-items: start; }
@media (max-width: 900px) { .tri-grid { grid-template-columns: minmax(0, 1fr); } }
.tri-bars { display: grid; gap: 8px; margin: 0; }
.tri-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) 4ch; gap: 12px; align-items: center; font-size: 0.875rem; color: var(--ink-2); }
.tri-bar-track { height: 8px; position: relative; }
.tri-bar-track span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 1px; }
.tri-bar .num { font: 500 0.8125rem var(--mono); text-align: right; color: var(--ink); }
.subgraph svg { width: 100%; height: auto; display: block; }
.subgraph text { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.subgraph .sg-alert { stroke: var(--signal); stroke-width: 2; }
.subgraph .sg-own { stroke: var(--ink-2); stroke-width: 1; opacity: 0.7; }
.subgraph .sg-other { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.8; }
.sg-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.75rem; color: var(--ink-3); margin-top: 8px; }
.sg-key i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--signal); vertical-align: middle; margin-right: 6px; }
.sg-key i.own { border-top: 1px solid var(--ink-2); }
.sg-key i.other { border-top: 1px dashed var(--ink-3); }
.tri-sub { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-top: 28px; }
.tri-sub h4 { margin: 0 0 8px; font: 600 0.875rem var(--sans); }
.tri-sub ul { margin: 0; padding: 0; list-style: none; font: 400 0.8125rem/1.8 var(--mono); color: var(--ink-2); }
.tri-verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.tri-verdict { padding: 20px 24px 20px 0; border-bottom: 1px solid var(--line); }
.tri-verdict + .tri-verdict { padding-left: 24px; border-left: 1px solid var(--line); }
@media (max-width: 640px) { .tri-verdict + .tri-verdict { padding-left: 0; border-left: 0; } }
.tri-verdict h4 { margin: 0 0 10px; font: 600 0.9375rem var(--sans); }
.tri-verdict p { font-size: 0.9375rem; color: var(--ink-2); }
.tri-call { font: 600 1rem var(--mono) !important; color: var(--ink) !important; }
.tri-call.true_positive { color: var(--signal) !important; }
.tri-meta { font: 400 0.75rem/1.6 var(--mono) !important; color: var(--ink-3) !important; }
.tag-attack { font: 600 0.75rem var(--mono); color: var(--signal); }
.tag-fa { font: 400 0.75rem var(--mono); color: var(--ink-3); }

/* ---------------------------------------------------------------- console (SQL) */
.console { border: 1px solid var(--line-2); background: var(--bg-2); padding: 20px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset {
  min-height: 36px; padding: 0 12px; font: 400 0.8125rem var(--sans); color: var(--ink-2);
  background: transparent; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; text-align: left;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .preset:hover { color: var(--ink); border-color: rgba(206, 214, 226, 0.3); } }
.preset:active { transform: scale(0.97); }
.preset[aria-pressed='true'] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.editor {
  width: 100%; min-height: 220px; resize: vertical; tab-size: 2;
  font: 400 0.8125rem/1.65 var(--mono); color: var(--ink);
  padding: 14px 16px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
}
.editor:focus { border-color: var(--accent); outline: none; }
.console-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.status { font: 400 0.8125rem var(--mono); color: var(--ink-3); }
.status.ok { color: var(--accent); }
.status.error { color: var(--signal); }
.load { height: 2px; background: var(--line); margin-top: 12px; overflow: hidden; }
.load span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); transition: transform 200ms linear; }
.finding { margin-top: 16px; padding: 12px 16px; background: var(--bg-3); font-size: 0.9375rem; color: var(--ink-2); max-width: 90ch; }
.finding strong { color: var(--ink); }
.lookalike-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.lookalike-controls .field { flex: 1 1 300px; }

/* tables */
.table-scroll { overflow-x: auto; margin-top: 16px; border-top: 1px solid var(--line-2); }
table { border-collapse: collapse; width: 100%; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
thead th {
  text-align: left; padding: 10px 12px; white-space: nowrap;
  font: 500 0.75rem var(--sans); color: var(--ink-3); border-bottom: 1px solid var(--line-2);
}
tbody td { padding: 9px 12px; white-space: nowrap; color: var(--ink-2); border-bottom: 1px solid var(--line); }
tbody td:first-child { color: var(--ink); }
tbody tr:hover td { background: var(--bg-3); }
td.n, td.num { text-align: right; font-family: var(--mono); color: var(--ink); }
th.num { text-align: right; }
tr.is-redteam td, tr.is-hit td, tr.is-attack td { background: var(--signal-soft); }
tr.is-redteam td:first-child, tr.is-hit td:first-child, tr.is-attack td:first-child { box-shadow: inset 2px 0 0 var(--signal); }

/* ---------------------------------------------------------------- charts and panels */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 56px; margin-top: 40px; align-items: start; }
.split.tight { gap: 16px; margin-top: 24px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
figure { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-title { display: block; font: 600 1rem var(--sans); color: var(--ink); margin: 0 0 4px; }
.chart-title.spaced { margin-top: 48px; }
.chart-sub { font-size: 0.8125rem; color: var(--ink-3); margin: 0 0 20px; max-width: 70ch; }
.caption, .small { font-size: 0.8125rem; color: var(--ink-3); margin-top: 12px; max-width: 70ch; }
.plain { color: var(--ink-2); }
.sm-title { font-size: 0.8125rem; color: var(--ink-2); margin: 16px 0 4px; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.legend li, .legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 1px; flex: none; display: inline-block; }
#diurnal-sub .legend { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.mark { cursor: pointer; transition: opacity 150ms ease; }
.mark:hover, .mark:focus-visible { opacity: 0.8; }
.tip {
  position: fixed; z-index: var(--z-tip); pointer-events: none; max-width: 280px;
  background: var(--bg-3); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 8px 10px; font-size: 0.8125rem; line-height: 1.5;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
  opacity: 0; transition: opacity 120ms ease;
}
.tip.show { opacity: 1; }
.tip .tip-k { color: var(--ink-3); }
.tip .tip-note { margin-top: 4px; color: var(--ink-2); }

details.panel { margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.split details.panel { margin-top: 0; }
details.panel > summary {
  list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; color: var(--ink-2);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(-45deg); transition: transform 200ms var(--ease-out);
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > summary:hover { color: var(--ink); }
details.panel pre {
  margin: 0 0 16px; padding: 14px; overflow: auto; max-height: 440px;
  font-size: 0.75rem; line-height: 1.55; color: var(--ink-2); background: var(--bg-2);
}
.provenance { margin-top: 24px; font: 400 0.75rem/1.75 var(--mono); color: var(--ink-3); max-width: 110ch; }
.provenance b { color: var(--ink-2); font-weight: 500; }

.sub { padding-top: 56px; margin-top: 56px; border-top: 1px solid var(--line); }
.sub:first-of-type { margin-top: 0; }
.sub > h3 { margin-bottom: 16px; }
.sub > p { color: var(--ink-2); max-width: 70ch; }

/* graph explorer */
.graph-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; margin-top: 28px; }
@media (max-width: 900px) { .graph-layout { grid-template-columns: minmax(0, 1fr); } }
.graph-controls { display: flex; flex-direction: column; gap: 14px; }
.graph-canvas { border: 1px solid var(--line); background: var(--bg-2); min-height: 200px; }
.graph-canvas svg { width: 100%; height: 520px; display: block; }
.node-user { fill: var(--ink-2); }
.node-comp { fill: var(--ink-3); }
.node-pivot { fill: var(--accent); }
.node-target { fill: var(--signal); }
.edge { stroke: rgba(206, 214, 226, 0.14); stroke-width: 1; }
.edge.redteam { stroke: var(--signal); stroke-width: 1.4; }
.edge.onpath { stroke: var(--accent); stroke-width: 2.5; }
.node.onpath { stroke: var(--accent); stroke-width: 2.5; }
.node-label { font-family: var(--mono); font-size: 9px; fill: var(--ink-2); pointer-events: none; }
.path-readout { margin-top: 12px; font-size: 0.875rem; color: var(--ink-2); min-height: 3em; }
.path-hops { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.hop { font: 500 0.8125rem var(--mono); padding: 3px 7px; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--ink); }
.hop.comp { color: var(--ink-2); }
.hop-arrow { color: var(--ink-3); }

/* ---------------------------------------------------------------- footer */
footer { padding: 72px 0 56px; }
.foot-title { font-size: 1.75rem; margin-bottom: 28px; }
.prov-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 980px) { .prov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .prov-grid { grid-template-columns: minmax(0, 1fr); } }
.prov-grid h3 { font: 600 0.875rem var(--sans); margin-bottom: 8px; }
.prov-grid p { font-size: 0.8125rem; color: var(--ink-2); }
.foot-note { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--ink-3); }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .alert, .switch-knob, .tab::after, .scrub-fill, .load span { transition-duration: 0.01ms !important; }
  .a-why { transition: opacity 120ms ease; }
}
