/* =============================================================================
   SOCA design tokens — the single source of truth for colour, shape and type.
   =============================================================================

   Palette extracted from soca-template/dashboard/dashboard-css.css.

   Nothing else in the codebase may declare a colour. Templates use var(--x);
   if a value is missing here, add it here rather than hardcoding it in a
   page, which is how ~190 loose hex values accumulated across 18 templates.

   The short legacy names (--p, --bg, --tx, --tl, --bd, --ok, --da …) are kept
   deliberately: every existing page already references them, so re-valuing
   them repaints the whole app without touching a single call site. The longer
   --soca-* names below are the palette as the template defines it; the short
   names are aliases onto it.

   Two deviations from the template, both for contrast. Its status pairings
   are #60B477 on #EAF7EE (2.2:1) and #DD4E72 on #F9E6EE (3.0:1), which fail
   WCAG AA for 13px text. The fills are unchanged; only the text is darkened.
   ============================================================================= */

:root {
  /* ---------- Brand ramp ---------- */
  --soca-primary-600: #1E3A8A;   /* active menu, primary button, icons (navy, tone C) */
  --soca-primary-500: #2747A3;   /* chart line */
  --soca-primary-400: #5A74C2;   /* bar gradient bottom */
  --soca-primary-100: #E3E8F5;   /* active menu background */
  --soca-primary-50:  #EEF1F8;   /* chart area fill */
  --soca-primary-700: #172F6E;   /* hover / pressed */

  /* ---------- Surfaces ---------- */
  --soca-bg-outer:    #E8E9ED;
  --soca-bg-app:      #F6F7F9;
  --soca-surface:     #FFFFFF;
  --soca-border:      #EAEAEA;
  --soca-border-soft: #EEEFF3;

  /* ---------- Text ---------- */
  --soca-text:        #0C1011;
  --soca-text-2:      #686B6E;
  --soca-text-muted:  #747577;

  /* ---------- Status (text darkened, fills as given) ---------- */
  --soca-success:     #2F7D4A;
  --soca-success-bg:  #EAF7EE;
  --soca-danger:      #B32B52;
  --soca-danger-bg:   #F9E6EE;
  --soca-warning:     #8A4A17;
  --soca-warning-bg:  #F6E3D2;
  --soca-info:        #3364F6;
  --soca-info-bg:     #EEF2FE;

  /* Text that sits on a filled brand/status surface. */
  --soca-on-primary:  #FFFFFF;
  /* Letterbox behind snapshots and video — stays black in both themes. */
  --soca-media-bg:    #000000;

  /* ---------- Severity ramp ----------
     Each step drops in lightness as well as hue, so the four stay separable
     in greyscale and for red-green colour blindness. */
  --soca-sev-critical: #9E1F46;
  --soca-sev-high:     #DD4E72;
  --soca-sev-medium:   #EC9C59;
  --soca-sev-low:      #7DC292;

  /* ---------- Chart palette ---------- */
  --soca-chart-blue:     #3364F6;
  --soca-chart-green:    #7DC292;
  --soca-chart-orange:   #EC9C59;
  --soca-chart-purple:   #8B7BD8;
  --soca-chart-teal:     #4FB3A5;
  --soca-chart-gauge:    #6BCE87;
  --soca-chart-inactive: #EEEFF3;
  --soca-chart-gridline: #E5E7EB;
  --soca-chart-compare:  #C9CCD3;

  /* ---------- Shape ---------- */
  --soca-radius-shell: 28px;
  --soca-radius-card:  20px;
  --soca-radius-inner: 14px;
  --soca-radius-pill:  999px;
  --soca-radius-badge: 8px;
  --soca-shadow-card:  0 1px 2px rgba(16, 24, 40, 0.04);
  --soca-shadow-btn:   0 4px 12px rgba(30, 58, 138, 0.30);
  --soca-shadow-pop:   0 8px 24px rgba(16, 24, 40, 0.08);

  /* ---------- Type scale ---------- */
  --soca-font: 'Inter', 'DM Sans', 'SF Pro Display', -apple-system, 'Segoe UI', sans-serif;
  --soca-fs-page-title: 28px;
  --soca-fs-hero:       36px;
  --soca-fs-kpi:        30px;
  --soca-fs-card-title: 16px;
  --soca-fs-menu:       15px;
  --soca-fs-body:       14px;
  --soca-fs-small:      13px;
  --soca-fs-axis:       12px;

  /* ---------- Legacy aliases: what every existing page already uses ------- */
  --p:  var(--soca-primary-600);
  --pd: var(--soca-primary-700);
  --plt: var(--soca-primary-100);
  --ac: var(--soca-chart-orange);
  --ok: var(--soca-success);
  --wa: var(--soca-warning);
  --da: var(--soca-danger);
  --cr: var(--soca-sev-critical);
  --in: var(--soca-info);

  --bg: var(--soca-bg-app);
  --tx: var(--soca-text);
  --tl: var(--soca-text-2);
  --bd: var(--soca-border);

  --surface:        var(--soca-surface);
  --surface-2:      var(--soca-bg-app);
  --surface-hover:  #F0F2F5;
  --surface-active: var(--soca-primary-100);

  /* Report accent: overridden per page by the .rpt-* classes below. */
  --ac2:      var(--soca-primary-600);
  --ac2-on:   var(--soca-on-primary);
  --ac2-dim:  rgba(30, 58, 138, .13);
  --ac2-soft: rgba(30, 58, 138, .06);

  /* Shell geometry */
  --sw: 248px;
  --sc: 60px;
}

/* =============================================================================
   Dark theme.

   The source template is light-only — it ships no dark values at all. These
   are derived: the brand blue lifted until it holds 4.5:1 on the dark ground,
   and the surfaces rebuilt as a neutral ramp rather than inverted warm greys.
   ============================================================================= */
[data-theme="dark"] {
  --soca-primary-600: #93B4FF;
  --soca-primary-500: #93B4FF;
  --soca-primary-400: #B5CBFF;
  --soca-primary-100: #1A2440;
  --soca-primary-50:  #131A2E;
  --soca-primary-700: #B5CBFF;
  /* The dark-mode navy is a light blue: white on it fails contrast. */
  --soca-on-primary:  #06080E;

  --soca-bg-outer:    #0B0D12;
  --soca-bg-app:      #12151C;
  --soca-surface:     #191D26;
  --soca-border:      #262B36;
  --soca-border-soft: #21262F;

  --soca-text:        #E8EAEE;
  --soca-text-2:      #9BA1AC;
  --soca-text-muted:  #7D838E;

  --soca-success:     #5FC57F;
  --soca-success-bg:  #16301F;
  --soca-danger:      #F5809F;
  --soca-danger-bg:   #37131F;
  --soca-warning:     #F0A868;
  --soca-warning-bg:  #33220F;
  --soca-info:        #7E9EFB;
  --soca-info-bg:     #1E2740;

  --soca-sev-critical: #E0567C;
  --soca-sev-high:     #F5809F;
  --soca-sev-medium:   #F0A868;
  --soca-sev-low:      #7FC896;

  --soca-chart-blue:     #7E9EFB;
  --soca-chart-green:    #7FC896;
  --soca-chart-orange:   #F0A868;
  --soca-chart-purple:   #A594E8;
  --soca-chart-teal:     #5FC9BA;
  --soca-chart-gauge:    #7FC896;
  --soca-chart-inactive: #262B36;
  --soca-chart-gridline: #262B36;
  --soca-chart-compare:  #4A515F;

  --soca-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
  --soca-shadow-btn:  0 4px 12px rgba(0, 0, 0, 0.40);
  --soca-shadow-pop:  0 8px 24px rgba(0, 0, 0, 0.45);

  --surface-hover:  #222735;
  --surface-active: var(--soca-primary-100);

  --ac2-dim:  rgba(147, 180, 255, .14);
  --ac2-soft: rgba(147, 180, 255, .07);
}

/* =============================================================================
   Per-report accent.

   Each report page used to declare its own :root and [data-theme="dark"]
   block for --ac2 — seven pages, fourteen blocks, all saying the same thing
   with a different hue. The hue now lives here; a page opts in with one class
   on its wrapper, e.g. <div class="rp rpt-ppe">.

   Hues come from the template's chart palette so the reports stay in the same
   family as the rest of the app.
   ============================================================================= */
.rpt-ppe       { --ac2: var(--soca-chart-orange); --ac2-dim: rgba(236,156,89,.16);  --ac2-soft: rgba(236,156,89,.07);  --ac2-on: #2A1705;}
.rpt-intrusion { --ac2: var(--soca-sev-high);     --ac2-dim: rgba(221,78,114,.16);  --ac2-soft: rgba(221,78,114,.07);  --ac2-on: var(--soca-on-primary);}
.rpt-object    { --ac2: var(--soca-chart-blue);   --ac2-dim: rgba(51,100,246,.14);  --ac2-soft: rgba(51,100,246,.06);  --ac2-on: var(--soca-on-primary);}
.rpt-lpr       { --ac2: var(--soca-chart-purple); --ac2-dim: rgba(139,123,216,.16); --ac2-soft: rgba(139,123,216,.07);  --ac2-on: var(--soca-on-primary);}
.rpt-people    { --ac2: var(--soca-chart-teal);   --ac2-dim: rgba(79,179,165,.16);  --ac2-soft: rgba(79,179,165,.07);  --ac2-on: #04221E;}
.rpt-crowd     { --ac2: var(--soca-chart-green);  --ac2-dim: rgba(125,194,146,.18); --ac2-soft: rgba(125,194,146,.08);  --ac2-on: #10281A;}
.rpt-unified   { --ac2: var(--soca-primary-600);  --ac2-dim: rgba(30,58,138,.14);   --ac2-soft: rgba(30,58,138,.06);  --ac2-on: var(--soca-on-primary);}

/* KPI card accent selector — was repeated verbatim in all seven reports. */
.kp-c.c-ac { --kc: var(--ac2); }
.kp-c.c-ok { --kc: var(--ok); }
.kp-c.c-da { --kc: var(--da); }
.kp-c.c-wa { --kc: var(--wa); }
.kp-c.c-in { --kc: var(--in); }
.kp-c.c-cr { --kc: var(--cr); }

/* Severity helpers, so pages stop reaching for raw hex. */
.sev-critical { color: var(--soca-sev-critical); }
.sev-high     { color: var(--soca-sev-high); }
.sev-medium   { color: var(--soca-sev-medium); }
.sev-low      { color: var(--soca-sev-low); }
.sev-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.sev-dot.critical { background: var(--soca-sev-critical); }
.sev-dot.high     { background: var(--soca-sev-high); }
.sev-dot.medium   { background: var(--soca-sev-medium); }
.sev-dot.low      { background: var(--soca-sev-low); }
