/* CyberPaw design tokens (UI restyle 2026-10-14, spec §1).
   The ONLY file in the app that defines a colour. Everything in ui/base.css, ui/components.css
   and the per-area sheets refers to these custom properties. Dark only.

   Load order: tokens → base → components → legacy sheets. The legacy app.css :root still
   defines --sev-critical/high/low/unknown with its old values and loads after this file, so
   until the legacy tokens are deleted (Task 9) the --sev-* names below are shadowed. The ui
   components therefore reference the --c-* names (which nothing legacy defines); page CSS
   written during the restyle should do the same. */
:root {
  color-scheme: dark;

  /* Surfaces */
  --c-bg:       #0b0c0e;   /* page */
  --c-sidebar:  #111316;   /* sidebar, topbar */
  --c-surface:  #16181b;   /* cards */
  --c-raised:   #1c1f23;   /* hover, active nav, inputs, segmented track */
  --c-border:   #2a2e33;   /* 1px borders, table rules */
  --c-border-strong: #6a717a; /* control boundary: 3:1 on --c-surface, --c-raised (input fill) and --c-row-hover (WCAG 1.4.11) */

  /* Table rows: zebra stripe and hover. Hover is clearly lighter than the stripe, so the row
     under the pointer still stands out on a striped row. */
  --c-zebra:     #1a1c20;
  --c-row-hover: #22252a;

  /* Text. Every text colour reaches WCAG AA (4.5:1) on every surface above, the row hover
     included (test/ui-contrast.test.js checks it). */
  --c-text:   #e6e8eb;     /* primary */
  --c-text-2: #a3a9b1;     /* secondary */
  --c-text-3: #858c95;     /* muted: meta, empty-cell marks, placeholders */

  /* Accent: teal-green. Links, active, primary, "remediated". */
  --c-accent:       #1fb59a;
  --c-accent-hover: #26c9ab;
  --c-accent-muted: #12443b;
  --c-on-accent:    #04211b; /* text on a filled accent control (7.9:1) */

  /* Status. Red is reserved for risk. */
  --c-risk:      #ec5a5f;
  --c-risk-fill: #2a1215;  /* risk banner fill */
  --c-risk-edge: #5a1d22;  /* risk banner edge */
  --c-risk-text: color-mix(in srgb, var(--c-risk) 78%, var(--c-text)); /* red TEXT on risk fills, keeps 4.5:1 */
  --c-warn: #f5a524;
  --c-ok:   #2fbf71;
  --c-info: #4c9ef8;
  --c-sev-high: #f97316;

  /* Banner fills and edges for the other levels, derived from the status colours so a change
     to a status colour carries through. */
  --c-warn-fill: color-mix(in srgb, var(--c-warn) 9%, var(--c-bg));
  --c-warn-edge: color-mix(in srgb, var(--c-warn) 32%, var(--c-bg));
  --c-info-fill: color-mix(in srgb, var(--c-info) 9%, var(--c-bg));
  --c-info-edge: color-mix(in srgb, var(--c-info) 32%, var(--c-bg));
  --c-ok-fill:   color-mix(in srgb, var(--c-accent) 9%, var(--c-bg));
  --c-ok-edge:   color-mix(in srgb, var(--c-accent) 32%, var(--c-bg));

  /* Attack map (/admin/attack-map, 1.44.0): the world and the two attack categories no status
     colour covers. The other categories reuse --c-risk, --c-sev-high, --c-warn and --c-text. */
  --c-map-ocean: #0d1117;
  --c-map-land:  #222831;
  --c-map-edge:  #343c47;
  --c-map-grid:  #19202a;
  --c-cat-credential: #e05fd0; /* magenta: sign-in and SSH guessing */
  --c-cat-repeat:     #b8243c; /* deep red: repeat offenders */

  --c-scrim: rgba(5, 6, 8, .72); /* modal backdrop */
  --c-focus: var(--c-accent-hover);

  /* Severity scale (spec names). See the load-order note above. */
  --sev-critical: var(--c-risk);
  --sev-high:     var(--c-sev-high);
  --sev-medium:   var(--c-warn);
  --sev-low:      var(--c-info);
  --sev-unknown:  var(--c-text-3);

  /* Spacing: 4px scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;

  /* Radius. No shadows anywhere. */
  --r-sm: 6px;
  --r: 10px;
  --r-pill: 999px;

  /* Type */
  --f-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --t-xs: 12px;     /* small: meta, chips, table headers */
  --t-sm: 13px;     /* body dense: tables, forms */
  --t-md: 14px;     /* body */
  --t-lg: 16px;     /* card title */
  --t-xl: 20px;     /* page title */
  --t-stat: 28px;   /* stat tile value */

  /* Sizes */
  --row-h: 36px;        /* table row */
  /* A long table (data-tall) is capped at this height and scrolls inside its own box, so its
     sticky header stays in view.
     --header-height is the topbar (ui/shell.css). */
  --tbl-max-h: calc(100vh - var(--header-height, 52px) - var(--s-7));
  --ctl-h: 32px;        /* buttons, inputs */
  --ctl-h-sm: 26px;
  --gutter: 24px;       /* page gutter */
  --ease: 150ms cubic-bezier(.4, 0, .2, 1);
}

/* Print / PDF: a light paper palette (UX-5.6). The dark theme printed as pale grey on white and
   the status hues fell to 1.3-1.8:1 on paper (U-7), so print swaps in darker members of the same
   hues. Every sheet reads these tokens, so the whole page flips here, in one place. */
@media print {
  :root {
    color-scheme: light;
    --c-bg: #fff; --c-sidebar: #fff; --c-surface: #fff; --c-raised: #f3f4f6;
    --c-border: #ccc; --c-border-strong: #999; --c-zebra: #f6f7f8; --c-row-hover: #eef0f2;
    --c-text: #000; --c-text-2: #333; --c-text-3: #555;
    --c-accent: #0f766e; --c-accent-hover: #0f766e; --c-accent-muted: #ccfbf1; --c-on-accent: #fff;
    --c-risk: #b91c1c; --c-risk-fill: #fef2f2; --c-risk-edge: #fca5a5; --c-risk-text: #b91c1c;
    --c-sev-high: #c2410c; --c-warn: #a16207; --c-ok: #15803d; --c-info: #0e7490;
  }
}
