/* ============================================================
   COASE INSTITUTIONAL DESIGN SYSTEM — tokens v0.2
   Three layers. A component rule may reference the semantic or
   component layer, never a primitive. A document references
   nothing: it carries content and structure only.
   ============================================================ */

:root{

/* ---------- LAYER 1 — PRIMITIVE -------------------------------- */

  --navy-950:#142838;   /* covers, primary headers            */
  --navy-800:#244357;   /* secondary headers, chart series 1  */
  --paper:#F7F5F0;      /* editorial ground                   */
  --white:#FFFFFF;      /* tables and content blocks          */
  --ink:#171B1E;        /* primary text                       */
  --slate:#59656D;      /* secondary text, note body          */
  --muted:#7C858A;      /* metadata and uppercase labels only */
  --rule:#D8DCD9;       /* separators                         */
  --panel:#EDF0EC;      /* subtotals, neutral callout ground  */
  --copper:#A45F36;     /* COASE accent                       */
  --positive:#2F604E;
  --warning:#8C6115;
  --negative:#963D30;

  /* tinted grounds derived from the status hues */
  --wash-warning:#F6F1E6;
  --wash-negative:#F7EDEA;
  --wash-forecast:#FBFAF7;   /* forecast columns, barely differentiated */

  /* families */
  --f-sans:"COASE Sans","Source Sans 3","Liberation Sans",Arial,sans-serif;
  --f-serif:"COASE Serif","Source Serif 4",Georgia,"Times New Roman",serif;
  --f-mono:"COASE Mono","IBM Plex Mono","Liberation Mono",ui-monospace,monospace;

  /* type — screen */
  --t-title:44px;     --lh-title:48px;
  --t-section:27px;   --lh-section:32px;
  --t-sub:18px;       --lh-sub:24px;
  --t-body:16px;      --lh-body:25px;
  --t-table:13.5px;   --lh-table:19px;
  --t-label:10.5px;
  --t-note:12px;      --lh-note:17px;

  /* type — print */
  --p-title:28pt;     --plh-title:31pt;
  --p-section:17pt;   --plh-section:20pt;
  --p-sub:12pt;       --plh-sub:15pt;
  --p-body:9.5pt;     --plh-body:13.5pt;
  --p-table:8.5pt;    --plh-table:11pt;
  --p-label:7.5pt;
  --p-note:7.5pt;     --plh-note:10pt;

  /* spacing — the only distances permitted */
  --s-1:4px;  --s-2:8px;  --s-3:12px; --s-4:16px; --s-5:24px;
  --s-6:32px; --s-7:48px; --s-8:64px; --s-9:96px;

  --measure:1180px;   /* content width  */
  --gutter:64px;      /* desktop margin */
  --gutter-m:20px;    /* mobile margin  */

  --r-hair:1px; --r-mark:2px; --r-anchor:3px;

/* ---------- LAYER 2 — SEMANTIC --------------------------------- */

  --ground:var(--paper);
  --surface:var(--white);
  --text:var(--ink);
  --text-2:var(--slate);
  --text-3:var(--muted);
  --edge:var(--rule);
  --accent:var(--copper);
  --header:var(--navy-950);
  --header-2:var(--navy-800);

  --sans:var(--f-sans);
  --serif:var(--f-serif);
  --mono:var(--f-mono);

/* ---------- LAYER 3 — COMPONENT -------------------------------- */

  --cover-bg:var(--navy-950);
  --cover-fg:#F3F1EC;
  --cover-key:#8CA0B0;      /* labels on navy; copper is barred here */
  --cover-sub:#B8C4CE;
  /* status hues on the navy ground: the page colours fall to 2.1 there,
     so the cover carries lightened equivalents. Same meaning, legible. */
  --cover-neg:#D98A75;
  --cover-pos:#84BBA3;

  --mast-bg:var(--navy-950);
  --mast-fg:#F3F1EC;
  --mast-key:#8CA0B0;

  --table-head-bg:var(--navy-950);
  --table-head-fg:var(--white);
  --table-bg:var(--white);
  --table-sub-bg:var(--panel);
  --table-fc-bg:var(--wash-forecast);
  --table-split:var(--copper);       /* actual | forecast divider */

  --kpi-edge:var(--navy-950);
  --kpi-edge-key:var(--copper);      /* the determining KPI only */

  --note-insight:var(--navy-800);
  --note-attention:var(--warning);
  --note-critical:var(--negative);
  --note-action:var(--copper);

  --chart-1:var(--navy-800);
  --chart-2:var(--slate);
  --chart-3:var(--copper);
  --chart-neg:var(--negative);

/* ---------- LEGACY ALIASES ------------------------------------
   The founding documents carry inline styles naming per-document
   tokens. They resolve here so no inline rule renders transparent.
   Not for use in new work.
   ------------------------------------------------------------- */
  --bg:var(--ground); --carta:var(--ground); --pannello:var(--panel);
  --inchiostro:var(--text); --tenue:var(--text-2); --lieve:var(--text-3);
  --riga:var(--edge); --body:var(--serif); --disp:var(--sans);
  --soft:var(--text-2); --faint:var(--text-3); --line:var(--edge);
  --navy:var(--header); --blu:var(--header); --deep:var(--header);
  --deep2:var(--header-2);
  --red:var(--negative); --rosso:var(--negative); --neg:var(--negative);
  --blocked:var(--negative); --gap:var(--negative);
  --ochre:var(--warning); --ocra:var(--warning); --amber:var(--warning);
  --caveat:var(--warning); --hold:var(--warning); --warn:var(--warning);
  --green:var(--positive); --verde:var(--positive); --sound:var(--positive);
  --ok:var(--positive);
  --accent-lift:var(--copper); --badge-fg:var(--white);
  --panel2:var(--panel); --table-zebra:var(--white);
  --table-total-bg:var(--panel); --table-band-bg:var(--panel);
  --note-bg:var(--panel); --note-edge:var(--navy-800);
  --note-warn-bg:var(--wash-warning); --note-warn-edge:var(--warning);
  --bar-track:var(--edge); --bar-pos:var(--navy-800); --bar-neg:var(--negative);
  --row-neg-bg:var(--wash-negative);
  --mast-sub:var(--cover-sub); --mast-soft:var(--cover-key);
  --ident-bg:#0E1C27; --ident-fg:#D2DAE0;
}

/* Family is a label, never a colour. Declared for the running
   header, the cover and the audit; it changes no visual token. */
[data-family]{--accent:var(--copper)}
