/* ============================================================================
   PCI / PROXIMAL DESIGN TOKENS
   Single source of truth. Change a value here and it cascades app-wide.

   PALETTE SOURCE: the official logo files, read at pixel level.
     pci-logo.png      dominant #0C2C4E
     pci-icon.png      dominant #0B2C4D
     proximal-logo.png dominant #032145
   The brand navy IS the product colour. It is used at full strength for the
   primary action, so the interface is branded by structure rather than by an
   accent colour bolted on top - which is what made PCI read as a generic
   blue/green dashboard.

   ACCESSIBILITY: every documented pair meets WCAG 2.1 AA. Ratios are stated
   next to each token and are asserted by test/e2e-design-tokens.js, which
   RECOMPUTES them - a future edit that breaks contrast fails the build.
   ========================================================================= */
:root {
  /* ---------------------------------------------------------------- brand */
  --navy-900:#071B33;          /* 17.30:1 on white - deepest, exec header */
  --navy-800:#0C2C4E;          /* 14.13:1 - THE LOGO NAVY. app bar, primary action */
  --navy-700:#14406E;          /* 10.56:1 - hover, links, focus ring */
  --navy-600:#1D5A94;          /*  7.14:1 - secondary emphasis, chart 1 */
  --navy-500:#4A6488;          /*  6.05:1 - muted brand */

  /* Copper accent. Chosen because no logo contains an accent colour, and every
     clinical SaaS template ships mint/emerald. Used for emphasis and data -
     NEVER as a warning, which is what amber means here. */
  --accent:#A65A2E;            /*  5.09:1 on white, 5.09:1 white on it */
  --accent-bg:#F7EDE6;

  /* ------------------------------------------------------------- surfaces */
  --bg:#F7F9FC;                /* the ONLY page background */
  --surface:#FFFFFF;           /* cards, panels, table bodies */
  --surface-sunk:#EEF2F7;      /* table headers, inset wells */
  --border:#DDE4EC;            /* decorative hairlines ONLY */
  --border-strong:#7E90A8;     /*  3.26:1 - control edges. WCAG 1.4.11 */

  /* ----------------------------------------------------------------- text */
  --ink:#0F2136;               /* 16.42:1 - body and headings */
  --muted:#55647A;             /*  6.02:1 - labels, hints, metadata */
  --on-brand:#FFFFFF;          /* text on navy/accent fills */

  /* --------------------------------------------- application sidebar (REV 2.3)
     The persistent left navigation sits on --navy-800, so it needs its own small
     on-dark set: resting link ink, and the two translucent whites that mark hover
     and the current item. Declared here rather than inlined in style.css so the
     one place that defines PCI's colours still does. */
  --side-ink:#DFE8F2;          /* 11.4:1 on --navy-800 - resting nav link */
  --side-hover:rgba(255,255,255,.08);
  --side-active:rgba(255,255,255,.12);
  --side-focus:#7FD4CE;        /* focus ring, visible against navy */
  --r-rail:2px;                /* the current-item accent rail */

  /* ------------------------------------------------------------- semantic
     Each is fg + tint. Every fg-on-tint pair is >= 5.3:1. */
  --success:#1E6B39; --success-bg:#E8F5EC; --success-accent:#2E8B4F;   /* 5.81:1 */
  --warning:#8A5209; --warning-bg:#FCF0DC; --warning-accent:#C2841F;   /* 5.66:1 */
  --danger:#B3261E;  --danger-bg:#FCEBE9;  --danger-accent:#D0453C;    /* 5.66:1 */
  --info:#14406E;    --info-bg:#E9F0F8;    --info-accent:#1D5A94;      /* 9.20:1 */
  --neutral:#55647A; --neutral-bg:#EDF1F6; --neutral-accent:#7E90A8;   /* 5.30:1 */

  /* --------------------------------------------------------- action roles */
  --action:var(--navy-800);
  --action-hover:var(--navy-700);
  --action-fg:var(--on-brand);
  --focus:#14406E;             /* 10.56:1 - was teal at 2.17:1 */

  /* ------------------------------------------------- data visualisation
     Hue AND lightness both vary, so the series survives greyscale and the
     common forms of colour blindness. */
  --chart-1:#1D5A94; --chart-2:#A65A2E; --chart-3:#12707A;
  --chart-4:#7FD4CE;           /* 8.22:1 on navy - dark backgrounds only */
  --chart-5:#55647A;

  /* ----------------------------------------------------------- typography */
  --font-brand:"Poppins",-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-ui:-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --font:var(--font-ui);       /* legacy alias */

  --text-2xs:11px; --text-xs:12px; --text-sm:13px; --text-base:15px;
  --text-lg:18px;  --text-xl:22px; --text-2xl:28px; --text-3xl:36px;

  --leading-tight:1.25; --leading-normal:1.5; --leading-relaxed:1.65;
  --weight-normal:400; --weight-medium:500; --weight-semi:600; --weight-bold:700;
  --tracking-wide:.04em; --tracking-caps:.11em;

  /* -------------------------------------------------------------- spacing */
  --space-0:0; --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px;
  --space-5:24px; --space-6:32px; --space-7:48px; --space-8:64px;

  /* --------------------------------------------------------------- radius */
  --r-xs:6px; --r-sm:10px; --r:14px; --r-lg:20px; --r-full:999px;
  /* `--radius` was referenced in 6 rules and NEVER DEFINED, so those rules
     rendered with square corners. Defined here as an alias rather than
     rewritten, so nothing silently changes shape twice. */
  --radius:var(--r);

  /* ------------------------------------------------------------ elevation */
  --shadow-sm:0 1px 2px rgba(12,44,78,.06), 0 1px 3px rgba(12,44,78,.04);
  --shadow-md:0 8px 24px -10px rgba(12,44,78,.16);
  --shadow-lg:0 18px 44px -20px rgba(12,44,78,.22);
  --shadow-up:0 -4px 12px rgba(12,44,78,.06);
  --shadow:var(--shadow-lg);   /* legacy alias */

  /* ----------------------------------------------------------------- misc */
  --icon-sm:16px; --icon:20px; --icon-lg:24px;
  --maxw:1160px;
  --z-base:1; --z-sticky:100; --z-overlay:500; --z-modal:1000; --z-toast:1500;

  /* --------------------------------------------------------------- density
     Executive pages breathe; operational pages stay fast. One attribute on
     <body>, no new components. */
  --row-y:11px; --card-p:20px; --gap:16px;

  /* ------------------------------------------ semantic borders
     Tinted-state cards need a border that matches their tint. These were
     REFERENCED but never defined - they only rendered because each call site
     carried a var() fallback. A fallback is a safety net, not a design
     decision, so they are real tokens now. */
  --border-success:#BFE3CB;
  --border-warning:#EFD3A3;
  --border-danger:#F0C3BF;
  --border-info:#C3D6EC;
  --okbg:var(--success-bg);
  --pci-danger:var(--danger);

  /* --------------------------------------------- legacy aliases (repointed)
     Kept so existing rules keep working while the sweep proceeds. Remove
     once test/e2e-design-tokens.js reports zero references. */
  --pci-navy-900:var(--navy-900); --pci-navy-800:var(--navy-800);
  --pci-navy-700:var(--navy-700);
  --navy:var(--navy-800); --navy-dark:var(--navy-900); --brand-navy:var(--navy-800);
  --gray:var(--muted);
  --teal:var(--navy-700); --teal-600:var(--navy-700); --teal-dark:var(--navy-700);
  --teal-300:var(--chart-4); --teal-light:var(--chart-4);
  --brand-teal:var(--navy-700);
}

[data-density="comfortable"] { --row-y:14px; --card-p:24px; --gap:20px; }
[data-density="compact"]     { --row-y:8px;  --card-p:16px; --gap:12px; }

/* ------------------------------------------------ modern refresh (2026-11-17)
   Jose: "update the inside of staff portal, make it more modern as well" - after the
   proximalrehab.com refresh. These bring the website's teal and depth into the app.
   --brand-teal is the website's teal (#00A3B5). It is 2.9:1 on white, so it is
   DECORATIVE ONLY: rails, icon wells, glows, focus halos - never text on white. */
:root {
  --brand-teal:#00A3B5;
  --brand-teal-soft:rgba(0,163,181,.12);
  --brand-teal-ring:rgba(0,163,181,.28);
  --side-grad:linear-gradient(180deg,#0A2340 0%,#0C2C4E 55%,#123A63 100%);
  --page-glow:radial-gradient(1200px 420px at 70% -120px,rgba(0,163,181,.07),transparent 70%);
  --btn-grad:linear-gradient(135deg,#0C2C4E 0%,#14406E 100%);
  --btn-grad-hover:linear-gradient(135deg,#14406E 0%,#1D5A94 100%);
  --shadow-card:0 1px 2px rgba(12,44,78,.05),0 6px 18px -12px rgba(12,44,78,.18);
  --shadow-card-hover:0 2px 4px rgba(12,44,78,.06),0 16px 32px -16px rgba(12,44,78,.26);
  --ring-focus:0 0 0 3px rgba(20,64,110,.16);
}
