/* =============================================================================
   Blast Radius — design system
   -----------------------------------------------------------------------------
   One source of truth for every screen (team app AND facilitator dashboard).
   Screens may only compose these tokens and classes; they never invent colours,
   sizes or shadows of their own.

   Direction: a technical simulation console. Machined, calm, engineered.
   Graphite surfaces, hairline borders, a faint top-edge highlight on anything
   raised, soft shadows below. No glow, no neon, no bevels.

   Sections
     1. Tokens — surfaces, text, semantic colour, type, space, radii, shadow, motion
     2. Base   — element defaults
     3. Components — .btn, .chip, .input, .card, .metric, .eyebrow, .callout, .tabs
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Surfaces — three levels. Each step is one notch lighter. Never pure black. */
  --surface-0: #111418;          /* app background (graphite) */
  --surface-1: #171b21;          /* raised: panels, cards, bars */
  --surface-2: #1f242c;          /* elevated: controls, dialogs, popovers */
  --surface-3: #272d36;          /* hover on an elevated surface */
  --surface-inset: #0c0f12;      /* wells: inputs, meters, code */
  --canvas: #15191e;             /* the graph sits on charcoal */

  /* Lines */
  --border-subtle: #22282f;
  --border: #2c333c;
  --border-strong: #3b434e;
  --highlight: rgba(255, 255, 255, .055);   /* 1px top-edge catch-light on raised surfaces */
  --highlight-strong: rgba(255, 255, 255, .14);

  /* Text */
  --text-1: #e6e9ed;             /* primary */
  --text-2: #a2aab5;             /* secondary / descriptions */
  --text-3: #6f7883;             /* tertiary / labels / inert */
  --text-on-color: #ffffff;

  /* Semantic colour. These carry MEANING — use them only for that meaning.
     amber  = authority (what can control what)
     red    = compromise / danger / destructive command
     purple = final / locked phase
     blue   = primary interaction / selection
     green  = improvement / owned (supporting; changed for the better)
     neutral= decoys, inert edges, readable-but-not-controlled */
  --authority: #dba341;
  --authority-hover: #e8b65c;
  --authority-active: #c08a2b;
  --authority-soft: rgba(219, 163, 65, .12);
  --authority-line: rgba(219, 163, 65, .45);

  --danger: #e5484d;
  --danger-hover: #f0646a;
  --danger-active: #c7353a;
  --danger-deep: #a8262b;          /* fill of the RUN command */
  --danger-soft: rgba(229, 72, 77, .12);
  --danger-line: rgba(229, 72, 77, .5);

  --final: #9a72e8;
  --final-hover: #ad89f0;
  --final-active: #8259d4;
  --final-deep: #4b2f84;
  --final-soft: rgba(154, 114, 232, .12);
  --final-line: rgba(154, 114, 232, .5);

  --select: #4c9dff;
  --select-hover: #6cb0ff;
  --select-active: #3787ea;
  --select-deep: #2563b8;
  --select-soft: rgba(76, 157, 255, .12);
  --select-line: rgba(76, 157, 255, .55);

  --ok: #3fb950;
  --ok-hover: #56c866;
  --ok-active: #2fa040;
  --ok-soft: rgba(63, 185, 80, .12);
  --ok-line: rgba(63, 185, 80, .5);

  --neutral: #6b7380;
  --neutral-soft: rgba(139, 148, 163, .1);
  --neutral-line: rgba(139, 148, 163, .35);

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --fs-display: 40px;  --lh-display: 1.05; --fw-display: 700;  /* product name */
  --fs-h1: 20px;       --lh-h1: 1.25;      --fw-h1: 650;       /* screen / dialog title */
  --fs-h2: 16px;       --lh-h2: 1.3;       --fw-h2: 600;       /* panel title */
  --fs-h3: 14px;       --lh-h3: 1.35;      --fw-h3: 600;       /* card title */
  --fs-body: 14px;     --lh-body: 1.5;     --fw-body: 400;
  --fs-small: 12.5px;  --lh-small: 1.45;
  --fs-label: 11px;    --lh-label: 1.2;    --fw-label: 600;    --ls-label: .09em;  /* UPPERCASE */
  --fs-metric: 30px;   --lh-metric: 1;     --fw-metric: 600;   /* mono numbers */
  --fs-mono: 12.5px;

  /* Spacing (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Radii */
  --r-xs: 3px; --r-sm: 5px; --r-md: 7px; --r-lg: 10px; --r-xl: 14px; --r-pill: 999px;

  /* Shadows — soft, below the surface. Pair raised surfaces with the top highlight. */
  --shadow-1: 0 1px 0 rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
  --shadow-2: 0 1px 0 rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .28);
  --shadow-3: 0 2px 0 rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .5);
  --shadow-pressed: inset 0 1px 2px rgba(0, 0, 0, .45);
  --ring: 0 0 0 2px var(--surface-0), 0 0 0 4px var(--select-line);   /* keyboard focus */

  /* Motion — state feedback only (hover / press). No decorative animation. */
  --dur-fast: 80ms;
  --dur: 140ms;
  --ease: cubic-bezier(.2, .6, .2, 1);

  /* Graph */
  --graph-lane: rgba(255, 255, 255, .018);
  --graph-lane-line: rgba(255, 255, 255, .06);
  --graph-edge: #3e4651;
  --graph-edge-inert: #2c323b;
  --graph-node-fill: #1e242c;
  --graph-node-stroke: #5f6874;
}

/* -----------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-1);
  font: var(--fw-body) var(--fs-body)/var(--lh-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-h1); margin: 0 0 var(--sp-2); letter-spacing: -.01em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-h2); margin: 0 0 var(--sp-2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-h3); margin: 0 0 var(--sp-2); }
h4 { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--text-3); margin: var(--sp-5) 0 var(--sp-2); }
p { margin: 0 0 var(--sp-3); }
a, .link { color: var(--select); }
code, kbd { font-family: var(--font-mono); font-size: var(--fs-mono); background: var(--surface-inset); border: 1px solid var(--border-subtle);
  padding: 1px 5px; border-radius: var(--r-xs); }
:focus-visible { outline: none; box-shadow: var(--ring); }
::selection { background: var(--select-soft); }
[hidden] { display: none !important; }

/* Text utilities */
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-small); line-height: var(--lh-small); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.good-text, .ok-text { color: var(--ok); }
.bad-text, .danger-text { color: var(--danger); }
.warn-text, .authority-text { color: var(--authority); }
.eyebrow { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--text-3); }

/* -----------------------------------------------------------------------------
   3. COMPONENTS
   -------------------------------------------------------------------------- */

/* Buttons ---------------------------------------------------------------------
   Tactile: vertical gradient, 1px bright top edge, soft drop shadow; hover lifts
   the gradient; pressed sinks 1px and loses its shadow.
   Variants: default (neutral) · .primary (blue) · .secondary (quiet) ·
             .danger (red) · .run (red, the main command) · .final (purple)
   Sizes:    .small · default · .lg                                            */
.btn {
  --b-top: #2a3039; --b-bot: #21262e; --b-border: var(--border-strong); --b-text: var(--text-1); --b-hl: var(--highlight-strong);
  --b-top-h: #313844; --b-bot-h: #262c35;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 32px; padding: 0 var(--sp-3);
  border: 1px solid var(--b-border); border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--b-top), var(--b-bot));
  color: var(--b-text); font-size: var(--fs-body); font-weight: 550; line-height: 1; white-space: nowrap;
  box-shadow: inset 0 1px 0 var(--b-hl), var(--shadow-1);
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover:not(:disabled) { background: linear-gradient(180deg, var(--b-top-h), var(--b-bot-h)); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--shadow-pressed); background: linear-gradient(180deg, var(--b-bot), var(--b-bot)); }
.btn:focus-visible { box-shadow: inset 0 1px 0 var(--b-hl), var(--ring); }
.btn:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; background: var(--b-bot); }

.btn.primary {
  --b-top: #4f9cf8; --b-bot: #2f78db; --b-border: #2465bd; --b-text: #fff; --b-hl: rgba(255, 255, 255, .28);
  --b-top-h: #63aaff; --b-bot-h: #3a86e6;
}
.btn.secondary {
  --b-top: #1d2229; --b-bot: #1a1e24; --b-border: var(--border); --b-text: var(--text-2); --b-hl: var(--highlight);
  --b-top-h: #242a32; --b-bot-h: #1f242b;
}
.btn.secondary:hover:not(:disabled) { color: var(--text-1); }
.btn.danger, .btn.run {
  --b-top: #c8383d; --b-bot: var(--danger-deep); --b-border: #85191d; --b-text: #fff; --b-hl: rgba(255, 255, 255, .26);
  --b-top-h: #d84248; --b-bot-h: #b52b30;
}
.btn.final {
  --b-top: #5d3ba0; --b-bot: var(--final-deep); --b-border: #352063; --b-text: #f3edff; --b-hl: rgba(255, 255, 255, .2);
  --b-top-h: #6a46b1; --b-bot-h: #553593;
}
.btn.small { min-height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-small); border-radius: var(--r-sm); }
.btn.lg { min-height: 42px; padding: 0 var(--sp-5); font-size: 15px; font-weight: 650; }
.btn.block { width: 100%; }

/* The RUN command: the most important control on its screen. Heavier, taller,
   a stronger catch-light and a deeper shadow so it reads as a physical key. */
.btn.run {
  min-height: 44px; padding: 0 var(--sp-6);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -2px 0 rgba(0, 0, 0, .22), 0 1px 0 rgba(0, 0, 0, .5), 0 4px 12px rgba(168, 38, 43, .28), 0 2px 4px rgba(0, 0, 0, .4);
}
.btn.run:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), inset 0 -2px 0 rgba(0, 0, 0, .22), 0 1px 0 rgba(0, 0, 0, .5), 0 6px 18px rgba(229, 72, 77, .32), 0 2px 4px rgba(0, 0, 0, .4);
}
.btn.run:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .45); }
.btn.final { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; min-height: 44px; padding: 0 var(--sp-4); }

/* Text-only action */
.link { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font: inherit; color: var(--select); border-radius: var(--r-xs); }
.link:hover { color: var(--select-hover); text-decoration: underline; text-underline-offset: 2px; }

/* Chips / badges ---------------------------------------------------------------
   One treatment: small pill on an inset surface with a hairline border.
   Colour variants carry the semantic meaning; .dot adds a status lamp.        */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 var(--sp-2) 0 var(--sp-2);
  border-radius: var(--r-pill); border: 1px solid var(--border);
  background: var(--surface-inset); color: var(--text-2);
  font-size: var(--fs-small); font-weight: 500; line-height: 1; white-space: nowrap;
}
.chip.sm { height: 20px; padding: 0 6px; font-size: 11px; border-radius: var(--r-xs); }
.chip.label { font-size: 10px; font-weight: var(--fw-label); letter-spacing: var(--ls-label); text-transform: uppercase; }
.chip.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.chip.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.chip.danger { color: var(--danger-hover); border-color: var(--danger-line); background: var(--danger-soft); }
.chip.authority { color: var(--authority); border-color: var(--authority-line); background: var(--authority-soft); }
.chip.final { color: var(--final-hover); border-color: var(--final-line); background: var(--final-soft); }
.chip.select { color: var(--select-hover); border-color: var(--select-line); background: var(--select-soft); }
.chip.neutral { color: var(--text-3); border-color: var(--border-subtle); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip .swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* Inputs ------------------------------------------------------------------------ */
:where(.input, input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) {
  min-height: 34px; padding: 0 var(--sp-3);
  background: var(--surface-inset); color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
:where(textarea) { padding: var(--sp-2) var(--sp-3); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
:where(.input, input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea):hover { border-color: var(--border-strong); }
:where(.input, input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea):focus { outline: none; border-color: var(--select); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35), 0 0 0 3px var(--select-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
input[type=checkbox] { accent-color: var(--select); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-2); }
.field-label .hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-3); margin-left: 4px; }

/* Cards --------------------------------------------------------------------------
   .card       raised surface (level 1)
   .card.elevated  level 2 — for things that sit above a panel (dialogs, hero cards)
   .card.interactive  hover lifts the border; .selected marks the blue selection */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-1);
}
.card.elevated { background: var(--surface-2); border-color: var(--border-strong); box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-2); }
.card.interactive { transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.card.interactive:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card.selected { border-color: var(--select); box-shadow: inset 0 1px 0 var(--highlight), 0 0 0 1px var(--select), var(--shadow-1); }

/* Metric card: a big mono number over an uppercase label. */
.metric { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.metric-value { font-family: var(--font-mono); font-size: var(--fs-metric); line-height: var(--lh-metric); font-weight: var(--fw-metric);
  font-variant-numeric: tabular-nums; color: var(--text-1); }
.metric-label { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--text-3); }

/* Callouts: a left rule in the semantic colour on a tinted surface. */
.callout { border: 1px solid var(--border); border-left: 3px solid var(--neutral); background: var(--surface-2);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-body); }
.callout.danger { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-soft), transparent 70%), var(--surface-1); }
.callout.authority { border-left-color: var(--authority); background: linear-gradient(90deg, var(--authority-soft), transparent 70%), var(--surface-1); }
.callout.ok { border-left-color: var(--ok); background: linear-gradient(90deg, var(--ok-soft), transparent 70%), var(--surface-1); }
.callout.select { border-left-color: var(--select); background: linear-gradient(90deg, var(--select-soft), transparent 70%), var(--surface-1); }
.callout.final { border-left-color: var(--final); background: linear-gradient(90deg, var(--final-soft), transparent 70%), var(--surface-1); }

/* Tabs: segmented header with a blue selection rule. */
.tabs { display: flex; gap: 2px; padding: 0 var(--sp-2); border-bottom: 1px solid var(--border); background: var(--surface-1); }
.tab { flex: 1; position: relative; padding: var(--sp-3) var(--sp-1); background: none; border: 0; cursor: pointer;
  color: var(--text-3); font-size: var(--fs-small); font-weight: 600; letter-spacing: .02em; transition: color var(--dur) var(--ease); }
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--text-1); }
.tab.active::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--select); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--text-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); }
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
