/**
 * Account Suite 360 — Platform Color System
 * Single source of truth for colours across all modules.
 * Load first; module CSS should reference these tokens.
 */

:root {
  /* ══════════════════════════════════════════════════════════════
     TYPE SCALE
     Seven steps. Every font-size in the product should resolve to
     one of these. The audit found 192 distinct sizes in use, with
     0.72/0.74/0.75/0.76/0.78/0.80/0.8125/0.82rem all live at once —
     visually indistinguishable, but they destroy vertical rhythm.
     ══════════════════════════════════════════════════════════════ */
  --fs-2xs: 0.6875rem;  /* 11px — micro labels, table eyebrows      */
  --fs-xs:  0.75rem;    /* 12px — captions, pill text, hints        */
  --fs-sm:  0.8125rem;  /* 13px — dense table/meta text             */
  --fs-md:  0.875rem;   /* 14px — body default, buttons, inputs     */
  --fs-lg:  1rem;       /* 16px — card titles, emphasised body      */
  --fs-xl:  1.25rem;    /* 20px — section headings (h2)             */
  --fs-2xl: 1.625rem;   /* 26px — page titles (h1)                  */
  --fs-3xl: 2rem;       /* 32px — KPI figures                       */

  /* Line heights — tight for headings, open for reading */
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-base: 1.5;

  /* Weights — 800 is reserved for nothing; it reads as shouting */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Letter-spacing — only headings and uppercase eyebrows need it */
  --ls-tight: -0.011em;
  --ls-eyebrow: 0.04em;

  /* ══════════════════════════════════════════════════════════════
     SPACING SCALE — 4px base
     ══════════════════════════════════════════════════════════════ */
  --sp-1: 0.25rem;   /*  4px */
  --sp-2: 0.5rem;    /*  8px */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.25rem;   /* 20px */
  --sp-6: 1.5rem;    /* 24px */
  --sp-8: 2rem;      /* 32px */
  --sp-10: 2.5rem;   /* 40px */

  /* ══════════════════════════════════════════════════════════════
     MOTION — one duration, one easing. Consistency reads as quality.
     ══════════════════════════════════════════════════════════════ */
  --motion-fast: 120ms;
  --motion-base: 160ms;
  --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Focus ring — a single accessible treatment used everywhere */
  --focus-ring: 0 0 0 3px rgba(31, 95, 191, 0.35);
  --focus-ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.3);

  /* ── Primary brand ──
     The product was shipping TWO brand blues at once: this token
     resolved to #1e5eff (used by AML, ledger and .accent) while
     design-system.css hardcoded --ui-primary: #1f5fbf for the shell,
     so buttons and navigation were a different blue from module
     accents on the same screen. Unified on the shell's restrained
     #1f5fbf, which is what users see on every page. */
  --color-primary: #1f7a4c;
  --color-primary-hover: #19663f;
  --color-primary-pressed: #145234;
  --color-primary-soft: #e7f4ec;
  --color-primary-tint: #dce8e1;

  /* ── Secondary ── */
  --color-navy: #1f2937;

  /* ── Semantic ──
     Each semantic colour has two roles, and they are NOT interchangeable:
       --color-x      fill/accent — dots, bars, icons, solid buttons. Chosen to read
                      as the colour at a glance; too light for text.
       --color-x-text text on the matching -bg tint. Darkened to clear WCAG AA (4.5:1).
                      Using the fill value for text fails: #f59e0b on #fef3c7 is 2.01:1.
     Reach for -text whenever the colour lands on type. */
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-success-text: #067647;
  --color-warning: #f59e0b;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #ad5600;
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #b42318;
  --color-info: #0ea5e9;
  --color-info-bg: #e0f2fe;
  --color-ai: #7c3aed;
  --color-ai-bg: #ede9fe;

  /* ── Neutrals & surfaces (premium enterprise tint) ── */
  --color-bg: #e2eaf4;
  --color-bg-subtle: #edf2fa;
  --color-bg-warm: #eef3fb;
  --color-surface: #ffffff;
  --color-surface-raised: #f8fbff;
  --color-border: #c5d4e8;
  --color-border-soft: #d5dff0;
  --color-divider: #b8c9e0;
  --color-text: #111827;
  --color-text-secondary: #4b5563;
  --color-text-disabled: #9ca3af;

  /* ── Sidebar (enterprise navy rail — tenant & operator) ── */
  --color-sidebar-bg: #1c211f;
  --color-sidebar-bg-end: #1c211f;
  --color-sidebar-brand-bg: #161a18;
  --color-sidebar-foot-bg: #161a18;
  --color-sidebar-selected: #1f7a4c;
  --color-sidebar-hover: rgba(255, 255, 255, 0.08);
  --color-sidebar-border: rgba(255, 255, 255, 0.08);
  --color-sidebar-text: #f2f4f3;
  --color-sidebar-text-muted: #9aa39c;
  --color-sidebar-text-active: #ffffff;
  --color-sidebar-icon: #d0d6d2;
  --color-sidebar-icon-active: #ffffff;

  /* ── Tables ── */
  --color-table-header: #1f7a4c;
  --color-table-header-text: #ffffff;
  --color-table-header-border: #19663f;
  --color-table-alt: #f0f5fc;
  --color-table-hover: #d4e4ff;
  --color-table-selected: #c7dbff;

  /* ── Status pills (table badges) ── */
  --color-pill-info-bg: #bfdbfe;
  --color-pill-info-text: #1e3a8a;
  --color-pill-info-border: #93c5fd;
  --color-pill-ok-bg: #bbf7d0;
  --color-pill-ok-text: #166534;
  --color-pill-ok-border: #86efac;
  --color-pill-warn-bg: #fde68a;
  --color-pill-warn-text: #92400e;
  --color-pill-warn-border: #fbbf24;
  --color-pill-neutral-bg: #e2e8f0;
  --color-pill-neutral-text: #334155;
  --color-pill-neutral-border: #cbd5e1;
  --color-pill-risk-bg: #fecaca;
  --color-pill-risk-text: #991b1b;
  --color-pill-risk-border: #f87171;
  --color-muted-subnote: #64748b;

  /* ── Risk levels ── */
  --color-risk-low: #16a34a;
  --color-risk-medium: #f59e0b;
  --color-risk-high: #dc2626;
  --color-risk-extreme: #991b1b;

  /* ── Status badges ── */
  --color-status-draft: #6b7280;
  --color-status-pending: #1e5eff;
  --color-status-awaiting-signature: #7c3aed;
  --color-status-cdd: #0ea5e9;
  --color-status-verified: #16a34a;
  --color-status-approved: #16a34a;
  --color-status-manual-review: #f59e0b;
  --color-status-rejected: #dc2626;
  --color-status-archived: #6b7280;

  /* ── Escalations ── */
  --color-esc-open: #f59e0b;
  --color-esc-assigned: #1e5eff;
  --color-esc-investigating: #7c3aed;
  --color-esc-awaiting: #f59e0b;
  --color-esc-resolved: #16a34a;
  --color-esc-closed: #6b7280;
  --color-esc-smr: #991b1b;

  /* ── Dashboard charts ── */
  --color-chart-cdd: #1e5eff;
  --color-chart-completed: #16a34a;
  --color-chart-pending: #f59e0b;
  --color-chart-high-risk: #dc2626;
  --color-chart-training: #7c3aed;
  --color-chart-activity: #6b7280;

  /* ── Legacy aliases (app.css / shared components) ── */
  --bg: var(--color-bg);
  --bg-subtle: var(--color-bg-subtle);
  --panel: var(--color-surface);
  --panel-muted: var(--color-surface-raised);
  --border: var(--color-border);
  --border-strong: var(--color-divider);
  --text: var(--color-text);
  --text-secondary: var(--color-text-secondary);
  --muted: var(--color-text-secondary);
  --accent: var(--color-primary);
  --accent-soft: var(--color-primary-soft);
  --accent-hover: var(--color-primary-hover);
  --sidebar: var(--color-sidebar-bg);
  --sidebar-2: var(--color-sidebar-brand-bg);
  --sidebar-text: var(--color-sidebar-text);
  --sidebar-link: var(--color-sidebar-text);
  --sidebar-muted: var(--color-sidebar-text-muted);
  --danger: var(--color-danger);
  --danger-hover: #b91c1c;
  --danger-soft: var(--color-danger-bg);
  --success: var(--color-success);
  --success-soft: var(--color-success-bg);
  --warning: var(--color-warning);
  --warning-soft: var(--color-warning-bg);
  --rose: var(--color-danger);
  --rose-soft: var(--color-danger-bg);

  /* ── Design-system aliases ── */
  --ui-primary: var(--color-primary);
  --ui-primary-hover: var(--color-primary-hover);
  --ui-primary-pressed: var(--color-primary-pressed);
  --ui-success: var(--color-success);
  --ui-warning: var(--color-warning);
  --ui-danger: var(--color-danger);
  --ui-info: var(--color-info);
  --ui-text: var(--color-text);
  --ui-muted: var(--color-text-secondary);
  --ui-border: var(--color-divider);
  --ui-border-soft: var(--color-border);
  --ui-surface: var(--color-surface);
  --ui-surface-subtle: var(--color-bg-subtle);
  --ui-surface-raised: var(--color-surface);
  --ui-surface-muted: var(--color-surface-raised);

  /* ── SaaS shell aliases ── */
  --saas-bg: var(--color-bg);
  --saas-card: var(--color-surface);
  --saas-card-muted: var(--color-surface-raised);
  --saas-text: var(--color-text);
  --saas-text-muted: var(--color-text-secondary);
  --saas-border: var(--color-border);
  --saas-border-soft: var(--color-border);
  --saas-primary: var(--color-primary);
  --saas-primary-hover: var(--color-primary-hover);
  --saas-primary-soft: var(--color-primary-soft);
  --saas-sidebar: var(--color-sidebar-bg);
  --saas-sidebar-strong: var(--color-sidebar-brand-bg);
  --saas-sidebar-hover: var(--color-sidebar-hover);
  --saas-sidebar-active: var(--color-sidebar-selected);
  --saas-sidebar-link: var(--color-sidebar-text);
  --saas-warning: var(--color-warning);
  --saas-danger: var(--color-danger);

  /* ── AML module aliases ── */
  --aml-primary: var(--color-primary);
  --aml-primary-dark: var(--color-primary-hover);
  --aml-surface: var(--color-surface);
  --aml-surface-muted: var(--color-bg);
  --aml-border: var(--color-border);
  --aml-line: var(--color-border);
  --aml-text: var(--color-text);
  --aml-ink: var(--color-navy);
  --aml-muted: var(--color-text-secondary);
  --aml-text-muted: var(--color-text-secondary);
  --aml-success: var(--color-success);
  --aml-warning: var(--color-warning);
  --aml-danger: var(--color-danger);
  --aml-info: var(--color-info);

  /* ── Ledger module aliases ── */
  --lp-bg: var(--color-bg);
  --lp-surface: var(--color-surface);
  --lp-elevated: var(--color-surface);
  --lp-muted: var(--color-bg);
  --lp-border: rgba(0, 0, 0, 0.06);
  --lp-border-strong: var(--color-border);
  --lp-text: var(--color-text);
  --lp-text-2: var(--color-text-secondary);
  --lp-text-3: var(--color-text-disabled);
  --lp-accent: var(--color-primary);
  --lp-accent-soft: var(--color-primary-soft);
  --lp-ok: var(--color-success);
  --lp-ok-soft: var(--color-success-bg);
  --lp-warn: var(--color-warning);
  --lp-warn-soft: var(--color-warning-bg);
  --lp-danger: var(--color-danger);
  --lp-danger-soft: var(--color-danger-bg);
}
