/* ── SCS design tokens · "Assurance Instrument" · dark-first ─────────────────
   Every color is declared on bare :root (dark). Light is a token-only override.
   Brand anchors come from tailwind.config.js: navy #01243A / #013D65 / #016EB0,
   green #018A42, slate #7A9E8A / #B8D4C4, off-white #E6F3EC, danger #FF4B6E. */
@property --attest-angle { syntax: '<angle>'; inherits: false; initial-value: 135deg; }
@property --meter { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --glow { syntax: '<number>'; inherits: true; initial-value: 0; }

:root {
  color-scheme: dark;
  /* grounds — navy biased, never neutral grey */
  --ink-0: oklch(15% 0.035 240);            /* page ground            */
  --ink-1: #01243A;                         /* brand navy · panels    */
  --ink-2: oklch(29% 0.06 238);             /* raised surface         */
  --ink-3: oklch(34% 0.065 236);            /* hover surface          */
  --line: color-mix(in oklch, #016EB0 32%, transparent);
  --line-strong: color-mix(in oklch, #016EB0 55%, transparent);
  /* text */
  --fg: #E8F2EE;
  --fg-2: #B8D4C4;
  --fg-3: #7A9E8A;
  --fg-on-accent: #01243A;
  /* accent — the logo's blue→green, used as one gradient, not two colors */
  --blue: #016EB0;
  --green: #018A42;
  /* hue rotated -10deg off --blue: the lift alone resolved to #4fa6ec, within dE 3.6 of a
     competitor's brand blue #41aaf5. Rotating at constant L separates them (dE 10.0) while
     holding button-text contrast (6.08:1 -> 6.11:1). See blue-lift-comparison.html. */
  --blue-lift: oklch(from var(--blue) calc(l + 0.18) c calc(h - 10));
  --green-lift: oklch(from var(--green) calc(l + 0.16) c h);
  --attest: linear-gradient(var(--attest-angle), var(--blue-lift), var(--green-lift));
  --attest-soft: linear-gradient(var(--attest-angle),
      color-mix(in oklch, var(--blue) 24%, transparent),
      color-mix(in oklch, var(--green) 24%, transparent));
  --focus: var(--green-lift);
  /* semantic severity — separate from the accent */
  --sev-critical: #FF4B6E;
  --sev-high: #FF8A3D;
  --sev-medium: #F2C14E;
  --sev-low: #4DA4D9;
  --sev-info: #7A9E8A;
  --ok: #2EC27E;
  --warn: #F2C14E;
  --bad: #FF4B6E;
  /* type */
  --font-display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-data: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* radii · squircle where supported */
  --r-1: 6px; --r-2: 10px; --r-3: 16px;
  --shadow-1: 0 1px 0 color-mix(in oklch, white 6%, transparent) inset,
              0 12px 32px -18px oklch(0% 0 0 / .8);
  --ease-out: linear(0, 0.4 12%, 0.72 27%, 0.9 44%, 0.98 66%, 1);
  --ease-spring: linear(0, 0.7 18%, 1.05 40%, 0.97 62%, 1.01 80%, 1);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ink-0: oklch(96.5% 0.012 160);
    --ink-1: #FFFFFF;
    --ink-2: oklch(98% 0.008 200);
    --ink-3: oklch(94% 0.02 210);
    --line: color-mix(in oklch, #01243A 14%, transparent);
    --line-strong: color-mix(in oklch, #01243A 28%, transparent);
    --fg: #0B1F2E;
    --fg-2: #345061;
    --fg-3: #5F7A72;
    --fg-on-accent: #FFFFFF;
    --blue-lift: var(--blue);
    --green-lift: var(--green);
    --focus: var(--blue);
    --sev-critical: #D8264C; --sev-high: #D9641A; --sev-medium: #B58A00;
    --sev-low: #1C6FA8; --sev-info: #5F7A72;
    --ok: #1C8A57; --warn: #B58A00; --bad: #D8264C;
    --shadow-1: 0 1px 2px oklch(20% 0.04 240 / .08), 0 12px 28px -20px oklch(20% 0.05 240 / .35);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink-0: oklch(96.5% 0.012 160);
  --ink-1: #FFFFFF;
  --ink-2: oklch(98% 0.008 200);
  --ink-3: oklch(94% 0.02 210);
  --line: color-mix(in oklch, #01243A 14%, transparent);
  --line-strong: color-mix(in oklch, #01243A 28%, transparent);
  --fg: #0B1F2E;
  --fg-2: #345061;
  --fg-3: #5F7A72;
  --fg-on-accent: #FFFFFF;
  --blue-lift: var(--blue);
  --green-lift: var(--green);
  --focus: var(--blue);
  --sev-critical: #D8264C; --sev-high: #D9641A; --sev-medium: #B58A00;
  --sev-low: #1C6FA8; --sev-info: #5F7A72;
  --ok: #1C8A57; --warn: #B58A00; --bad: #D8264C;
  --shadow-1: 0 1px 2px oklch(20% 0.04 240 / .08), 0 12px 28px -20px oklch(20% 0.05 240 / .35);
}

/* ── base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { interpolate-size: allow-keywords; scrollbar-color: var(--ink-3) transparent; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--ink-0); color: var(--fg);
  font: 14px/1.5 var(--font-ui);
  font-feature-settings: 'ss02', 'cv03'; /* Plex: open 'a' / straight quotes */
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { text-wrap: pretty; margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-ui); }
.eyebrow { font: 500 11px/1 var(--font-data); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.sq { corner-shape: squircle; } /* progressive: Chrome 139+, falls back to round */

/* attest gradient text */
.attest-text {
  background: var(--attest); -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-2); border: 1px solid var(--line); background: var(--ink-2);
  color: var(--fg); font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease-out), border-color .15s, translate .15s var(--ease-out);
}
.btn:hover { background: var(--ink-3); border-color: var(--line-strong); }
.btn:active { translate: 0 1px; }
.btn.primary { border: 0; background: var(--attest); color: var(--fg-on-accent); font-weight: 600; position: relative; isolation: isolate; }
.btn.primary::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: white; opacity: 0; transition: opacity .15s; z-index: -0; mix-blend-mode: soft-light; }
.btn.primary:hover::after { opacity: .35; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--ink-2); color: var(--fg); }
.btn svg { width: 16px; height: 16px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }

/* chips + severity */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font: 500 11.5px/1 var(--font-ui); border: 1px solid var(--line); color: var(--fg-2); background: color-mix(in oklch, var(--ink-2) 70%, transparent); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.complete { color: var(--ok); border-color: color-mix(in oklch, var(--ok) 40%, transparent); }
.chip.processing { color: var(--blue-lift); border-color: color-mix(in oklch, var(--blue) 50%, transparent); }
.chip.processing::before { animation: pulse 1.2s ease-in-out infinite; }
.chip.queued { color: var(--fg-3); }
.chip.failed { color: var(--bad); border-color: color-mix(in oklch, var(--bad) 45%, transparent); }
.chip.none::before { display: none; }
.sev { --c: var(--sev-info); display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1 var(--font-data); letter-spacing: .04em; text-transform: uppercase; color: var(--c); }
.sev::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c); box-shadow: 0 0 0 3px color-mix(in oklch, var(--c) 22%, transparent); }
.sev.critical { --c: var(--sev-critical); } .sev.high { --c: var(--sev-high); } .sev.medium { --c: var(--sev-medium); }
.sev.low { --c: var(--sev-low); } .sev.info { --c: var(--sev-info); }
.delta { font-family: var(--font-data); font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--bad); } .delta.down { color: var(--ok); }
@keyframes pulse { 50% { opacity: .25; } }

/* panels */
.panel { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel > header h2 { font-size: 15px; font-weight: 600; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; padding: 10px 14px; font: 500 11px/1 var(--font-data); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); border-bottom: 1px solid var(--line); }
table.data td { padding: 12px 14px; border-bottom: 1px solid color-mix(in oklch, var(--line) 55%, transparent); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: color-mix(in oklch, var(--ink-2) 65%, transparent); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.r, table.data th.r { text-align: right; }
.wrap-x { overflow-x: auto; overscroll-behavior-x: contain; }

/* anchored tooltip (CSS anchor positioning + popover) */
[popover].tip { margin: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-1);
  background: var(--ink-2); color: var(--fg); font-size: 12px; max-width: 28ch; box-shadow: var(--shadow-1);
  position-area: top; position-try-fallbacks: flip-block; margin-block-end: 6px;
  opacity: 0; translate: 0 4px; transition: opacity .15s, translate .15s var(--ease-out), display .15s allow-discrete, overlay .15s allow-discrete; }
[popover].tip:popover-open { opacity: 1; translate: 0 0; }
@starting-style { [popover].tip:popover-open { opacity: 0; translate: 0 4px; } }

/* motion — everything meaningful is visible at rest; motion only decorates */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
