/* Proneia design tokens — TWO LAYERS. Read this before adding anything.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * WHY THERE ARE NOW TWO LAYERS
 * ─────────────────────────────────────────────────────────────────────────
 * v2.0 shipped one flat set named by HUE: --proneia-blue, -blue-mid,
 * -blue-light, -blue-tint, four surfaces, three borders. Not one of them said
 * what it was FOR. A builder styling an active rail tab had to choose between
 * four blues on appearance alone, at 11pm, with no way to be right.
 *
 * That is not a naming inconvenience. It is the mechanism that produced the
 * 1,658 hardcoded literals: when the token layer describes hue, picking a
 * token is an AESTHETIC JUDGEMENT — and an aesthetic judgement gets typed as
 * a literal.
 *
 * The evidence is not theoretical. Measured 2026-09-03 across 81 module
 * stylesheets: 93 references to 23 tokens THAT HAVE NEVER EXISTED —
 * --proneia-primary, --proneia-accent, --proneia-text, --proneia-hover,
 * --proneia-danger, --proneia-link, --proneia-surface-subtle,
 * --proneia-success-soft ... Every one of those is a ROLE NAME. Builders
 * reached for the role-named token by instinct, found nothing, and their
 * declarations were silently dropped by the browser. The names below are
 * therefore not invented here; most of them are the names people already
 * tried to type.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * THE RULE
 * ─────────────────────────────────────────────────────────────────────────
 * MODULE CSS MAY REFERENCE THE ROLE LAYER ONLY.
 * The palette is private to this file. Referencing a palette token from a
 * module stylesheet fails the gate exactly as a raw hex does — because it is
 * the same mistake one step earlier.
 *
 * The section markers below are MACHINE-READ by tools/check_design_tokens.py.
 * It parses this file rather than duplicating the lists, because a second copy
 * of a list is a second thing to keep in step, and the copy that drifts is
 * always the one the gate reads. Do not remove or reword the ===== markers.
 */

/* ===== BEGIN PALETTE — PRIVATE. Do not reference from module CSS. =====
 *
 * The raw ramp. These names describe appearance, so they cannot answer
 * "which one do I use here?" — that is the role layer's job. Values are
 * UNCHANGED from v2.0: this reorganisation repaints nothing.
 */
:root {
  /* Brand ramp */
  --proneia-navy:          #002F69;
  --proneia-navy-dark:     #001E47;
  --proneia-navy-dim:      #1A3A6E;
  --proneia-blue:          #3884C6;
  --proneia-blue-mid:      #5A9EC0;
  --proneia-blue-light:    #6BAADF;
  --proneia-blue-tint:     #D6E8F7;

  /* Neutral ramp */
  --proneia-surface:       #FFFFFF;
  --proneia-surface-raised:#F4F6F9;
  --proneia-surface-overlay:#E8EEF5;
  --proneia-surface-inset: #EFF2F7;
  --proneia-surface-warm:  #F7F4F1;

  /* Line ramp.
     WARNING (review 2.7): --proneia-border-strong is 1.75:1 on white. It is a
     token named "strong" that MAY NOT legally bound any interactive control,
     sitting one line above the token that may. It is for DECORATIVE DIVIDERS
     ONLY. For anything a user can click, use the --proneia-control-border
     role, which clears WCAG 2.1 SC 1.4.11. */
  --proneia-border:        #DDE3EC;
  --proneia-border-strong: #B8C5D6;
  --proneia-border-focus:  #3884C6;

  /* Ink ramp */
  --proneia-text-primary:  #1A2332;
  --proneia-text-secondary:#555B73;
  /* DARKENED 2026-09-03 (Daniel's call) so metadata actually meets AA.
     Was #767D8F, which the v1.0 spec asserted "reaches 4.5:1 on white (WCAG
     AA)" - measured, it was 4.12 on white, 3.80 on panel-bg and 3.67 on
     input-bg. The claim was written down and never checked, which is how it
     survived a year in the document that calls itself the source of truth.
     #686E7F clears 4.54 on the WORST surface it lands on (input-bg) and still
     reads as muted: 5.09 on white against body text at 15.78. */
  --proneia-text-muted:    #686E7F;
  --proneia-text-inverse:  #FFFFFF;
  /* Darkened 2026-09-03: #3884C6 was 3.97 on white, so EVERY HYPERLINK in the
     product was below AA. #3275AF clears 4.51 and is still recognisably the
     brand blue. --proneia-blue itself is unchanged - this is the link role. */
  --proneia-text-link:     #3275AF;
  --proneia-text-link-hover:#002F69;
  /* Darkened 2026-09-03: #8C95A6 was 2.69 on --proneia-input-bg, the worst
     failure in the set. #656F82 clears 4.51 and still sits far lighter than an
     entered value (#1A2332 at 15.78 on white), so an empty field does not read
     as filled. */
  --proneia-text-placeholder: #656F82;

  /* Status ramp */
  --proneia-success:       #2E7D5B;
  --proneia-success-bg:    #EAF5EF;
  --proneia-warning:       #B8732A;
  --proneia-warning-bg:    #FEF5E7;
  --proneia-error:         #C0392B;
  --proneia-error-bg:      #FDEDEC;
  --proneia-error-dim:     #A93226;
  --proneia-error-dark:    #8C2A20;
  --proneia-critical:      #8B1A1A;
  --proneia-info:          #3884C6;
  --proneia-info-bg:       #EDF4FB;

  /* Domain ramps — calendar event blocks and the capacity bar ONLY (DS §2.2).
     These are already role-shaped: each name states its clinical meaning. */
  --proneia-clinical-therapy:        #8FBF9F;
  --proneia-clinical-therapy-high:   #5A9A6F;
  --proneia-clinical-documentation:  #7BA7C7;
  --proneia-clinical-assessment:     #9B8EC4;
  --proneia-clinical-supervision:    #7AABA8;
  --proneia-clinical-consultation:   #6B9E9B;
  --proneia-clinical-cpd:            #D4956A;
  --proneia-clinical-travel:         #D4AA6A;
  --proneia-clinical-admin:          #C8C8C8;
  --proneia-clinical-leave:          #AEAEAE;

  --proneia-cap-low:       #7A9CB8;
  --proneia-cap-approaching:#D4AA6A;
  --proneia-cap-caution:   #C87941;
  --proneia-cap-met:       #C8A84B;
  --proneia-cap-over:      #C47A7A;
}
/* ===== END PALETTE ===== */


/* ===== BEGIN ROLE LAYER — the ONLY tokens module CSS may reference. =====
 *
 * Every entry answers "what is this for?", not "what colour is it?". Each
 * resolves to a palette value, so this layer is a pure alias set: adding it
 * changes nothing visually until something references it.
 *
 * If the role you need is not here, ADD IT HERE FIRST and then use it
 * (DS §0 rule 1). Do not reach into the palette, and do not type a literal.
 */
:root {

  /* ---- SURFACES: what am I painting? ---- */
  --proneia-page-bg:          var(--proneia-surface);
  --proneia-card-bg:          var(--proneia-surface);
  --proneia-panel-bg:         var(--proneia-surface-raised);
  --proneia-input-bg:         var(--proneia-surface-inset);
  --proneia-row-hover:        var(--proneia-surface-overlay);
  --proneia-row-selected:     var(--proneia-blue-tint);
  --proneia-compassionate-bg: var(--proneia-surface-warm);

  /* ---- NAVIGATION CHROME ---- */
  --proneia-nav-bg:           var(--proneia-navy);
  --proneia-nav-text:         rgba(255, 255, 255, 0.85);
  --proneia-nav-text-active:  #FFFFFF;
  --proneia-nav-active-bg:    rgba(255, 255, 255, 0.08);

  /* ---- LINES: decorative vs interactive is the whole distinction ----
     A DIVIDER separates things and may be faint. A CONTROL BORDER bounds
     something a user can operate and is governed by WCAG 2.1 SC 1.4.11 (3:1).
     Confusing the two is what put unchecked checkboxes at 1.29:1. */
  --proneia-divider:              var(--proneia-border);
  --proneia-divider-strong:       var(--proneia-border-strong);  /* decorative only */
  --proneia-control-border:       #6B7D96;   /* 4.20 white / 3.88 raised / 3.74 inset */
  --proneia-control-border-hover: #4A5A73;
  --proneia-control-checked:      var(--proneia-navy);
  --proneia-focus-ring:           rgba(56, 132, 198, 0.20);
  --proneia-scrim:                rgba(0, 47, 105, 0.35);

  /* ---- INK ---- */
  --proneia-body-text:        var(--proneia-text-primary);
  --proneia-label-text:       var(--proneia-text-secondary);
  --proneia-meta-text:        var(--proneia-text-muted);
  --proneia-inverse-text:     var(--proneia-text-inverse);
  --proneia-link-text:        var(--proneia-text-link);
  --proneia-link-text-hover:  var(--proneia-text-link-hover);
  --proneia-placeholder-text: var(--proneia-text-placeholder);

  /* ---- ACTION: the primary weight, and the accent that is not it ---- */
  --proneia-action-bg:         var(--proneia-navy);
  --proneia-action-bg-hover:   var(--proneia-navy-dim);
  --proneia-action-bg-active:  var(--proneia-navy-dark);
  --proneia-action-text:       var(--proneia-text-inverse);
  --proneia-control-accent:    var(--proneia-blue);
  --proneia-accent-soft:       var(--proneia-blue-tint);

  /* ---- DESTRUCTIVE ---- */
  --proneia-destructive-bg:        var(--proneia-error);
  --proneia-destructive-bg-hover:  var(--proneia-error-dim);
  --proneia-destructive-bg-active: var(--proneia-error-dark);
  --proneia-destructive-text:      var(--proneia-text-inverse);

  /* ---- STATUS: named by what it MEANS, never by its hue.
     "problem" and "critical" are different severities, not different reds —
     see DS §10 on why Critical is structurally distinct from Error. ---- */
  --proneia-status-ok:            var(--proneia-success);
  --proneia-status-ok-bg:         var(--proneia-success-bg);
  --proneia-status-caution:       var(--proneia-warning);
  --proneia-status-caution-bg:    var(--proneia-warning-bg);
  --proneia-status-problem:       var(--proneia-error);
  --proneia-status-problem-bg:    var(--proneia-error-bg);
  --proneia-status-critical:      var(--proneia-critical);
  --proneia-status-info:          var(--proneia-info);
  --proneia-status-info-bg:       var(--proneia-info-bg);

  /* ---- STATUS TEXT ON ITS OWN TINT (added 2026-09-03) ------------------
   * A status badge puts small text ON the matching tint, and the DS s10 pairs
   * do not survive that at the 10-11px s10 itself specifies. Measured in the
   * browser on dev:
   *
   *     success #2E7D5B on #EAF5EF = 4.48   FAIL
   *     warning #B8732A on #FEF5E7 = 3.52   FAIL
   *     info    #3884C6 on #EDF4FB = 3.58   FAIL
   *     error   #C0392B on #FDEDEC = 4.79   pass
   *
   * s0 rule 5 makes AA the floor, so the badge palette has been below its own
   * standard since April. The FOREGROUND is darkened rather than the brand
   * colour, because --proneia-success and --proneia-blue are brand values used
   * far beyond badges; only text-on-tint needs the extra weight.
   *
   * Use these ONLY where status text sits on the matching -bg tint. */
  --proneia-status-ok-on-tint:      #2D7B5A;   /* 4.60 on tint, 5.13 on white */
  --proneia-status-caution-on-tint: #9F6324;   /* 4.53 on tint, 4.90 on white */
  --proneia-status-problem-on-tint: var(--proneia-error);   /* 4.79 already */
  --proneia-status-info-on-tint:    #3173AC;   /* 4.53 on tint, 5.03 on white */

  /* Accent TEXT on --proneia-blue-tint (selected rows, count pills). The plain
     accent is 3.17 there; this clears 4.56. */
  --proneia-accent-on-tint:         #2D6A9F;

  /* ---- GEOMETRY: already role-shaped, kept here so the role layer is the
     complete surface a module needs. 8px grid; navy-tinted elevation. ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 3px rgba(0, 47, 105, 0.08);
  --shadow-2: 0 4px 12px rgba(0, 47, 105, 0.12);
  --shadow-3: 0 8px 24px rgba(0, 47, 105, 0.16);
  --shadow-4: 0 16px 40px rgba(0, 47, 105, 0.20);

  --proneia-rail-width: 196px;
  --proneia-chatter-strip: 26px;   /* the always-present chatter edge strip, DS s19.1 */

  /* ---- RAIL GROUP RULES (DS s18.4, added 2026-09-12) ----------------------
   * The thin left rule on each rail tab that says which department the tab
   * belongs to (Daniel, 2026-09-11: "colour the rail options to highlight
   * department"). Four fixed steps down the NEUTRAL ramp, and deliberately
   * so: in this system saturation means danger, and a coloured tab would
   * compete with a restriction chip. The header label carries the name; the
   * rule only has to make "these tabs belong together" legible at a glance.
   * Keyed by group KEY in form_shell.scss; a key outside the four gets the
   * default. Person is darkest because the person is the point; the
   * administration bin, where stock Odoo pages fall, is the faintest. */
  --proneia-rail-rule-person:         var(--proneia-text-secondary);  /* #555B73 ink */
  --proneia-rail-rule-service:        var(--proneia-control-border);  /* #6B7D96 slate */
  --proneia-rail-rule-record:         var(--proneia-border-strong);   /* #B8C5D6 */
  --proneia-rail-rule-administration: var(--proneia-border);          /* #DDE3EC */
  --proneia-rail-rule-default:        var(--proneia-border-strong);

  /* ---- CATEGORICAL DATA (review 3.8) --------------------------------------
   * Behaviour support runs on frequency charts, ABC data and incident trends.
   * Until now the system had seven brand colours, all navy-to-blue, and no
   * categorical set at all -- so the first person to build a chart would pick
   * a palette by eye, in chart config, where the CSS gate cannot see it.
   *
   * DERIVED, NOT CHOSEN. Candidates were generated across the hue circle at
   * professional saturation, then selected by greedy max-min perceptual
   * separation (CIE76 dE in Lab) evaluated simultaneously under NORMAL
   * VISION AND THREE DICHROMACIES (deuteranopia, protanopia, tritanopia).
   * Every pair clears dE >= 16.0 in all four, and every swatch clears 3:1 on
   * white (WCAG 2.1 SC 1.4.11 -- a chart mark is a graphical object).
   *
   * THE PROCESS IS THE POINT. The first palette here was picked by eye and
   * measured at dE 3.3 between plum and slate under protanopia -- visually
   * identical for ~1 in 12 men. An unconstrained optimiser then produced a
   * mathematically excellent set of hot pinks and magentas, which is the
   * consumer register DS s16.3 prohibits. Both failures are why this set is
   * generated under BOTH constraints and verified, rather than assembled.
   *
   * SIX IS THE LIMIT, and it is a measured limit, not a stylistic one: at
   * this saturation with one red and no magenta, 7 series fall to dE 13.0 and
   * 8 to 12.5. BEYOND SIX SERIES, COLOUR CANNOT CARRY THE DISTINCTION --
   * use direct labelling, small multiples, or explicit patterns. See DS s22.
   *
   * ONE RED ONLY (cat-2). Red is semantically loaded in this product: error,
   * and NDIS critical incident. A chart with four reds in it competes with
   * the two things red is supposed to mean. */
  --proneia-cat-1: #1F4E79;   /* blue   - 8.66:1 */
  --proneia-cat-2: #B03B3B;   /* red    - 5.94:1  (the only red) */
  --proneia-cat-3: #5A4735;   /* bronze - 8.80:1 */
  --proneia-cat-4: #983BB0;   /* violet - 5.85:1 */
  --proneia-cat-5: #4E406D;   /* indigo - 9.22:1 */
  --proneia-cat-6: #898943;   /* olive  - 3.67:1 */

  /* ---- PRESENCE (added 2026-09-03, s3.6) --------------------------------
   * Clock-derived presence spans and break blocks on the calendar grid.
   * Named by MEANING: presence is the CANVAS the diary sits on, not content
   * competing with an appointment, so every value here is deliberately
   * low-contrast. "at-work" borrows the success hue so it reads as the same
   * family as on-track elsewhere; a break is the ABSENCE of presence, so it is
   * neutral grey rather than another work colour. ---- */
  /* The RAIL treatment (2026-09-03), retuned 2026-09-05 after MEASURING it.
     The first attempt used rgba(46,125,91,.55) rail against rgba(120,120,120,.50)
     break: that measures 1.16:1 on white and 1.15:1 over an Available block -
     i.e. NOT distinguishable by luminance anywhere. The whole distinction rested
     on hue (green vs grey), which is the failure mode for colour-vision
     deficiency and the same defect the v2.2 chart-palette work documented.

     Now: an OPAQUE rail, and the break carries a near-black EDGE. The border
     changes what each colour has to achieve - the edge supplies the boundary
     (15.78:1 on white), so the break fill only has to separate from the rail
     fill, which it does at 4.46:1. Measured: edge-vs-rail 3.16:1,
     rail-vs-break 4.46:1, rail-vs-white 5.00:1. All clear WCAG 1.4.11 (3:1). */
  --proneia-presence-rail:          var(--proneia-success);
  --proneia-presence-rail-edge:     var(--proneia-text-primary);
  /* Break colours - Daniel's call 2026-09-05: the neutral break block was too
     quiet to spot on the diary. Named by MEANING (paid / unpaid break), NOT by
     hue, even though they resolve to the warning and error ramps - a break is
     not a caution and an unpaid break is not an error.

     MEASURED, and the numbers decide two things that must not be undone:
     - Neither can carry itself against the rail: orange 1.31:1, red 1.09:1
       (red is near-identical in brightness to the green). The near-black EDGE
       is what makes them visible - it is load-bearing, not decoration.
     - Under DEUTERANOPIA orange and red both collapse to olive (#8F8F20 vs
       #7C7C1A, separation 49 where ~100 is the readability floor). Colour
       therefore CANNOT be the only channel: the unpaid hatch is what actually
       carries paid-vs-unpaid, and colour is the redundant second channel. */
  --proneia-presence-break-paid:    var(--proneia-warning);
  --proneia-presence-break-unpaid:  var(--proneia-error);
  /* Hatch on the UNPAID break: a DARK red, not a pale one. The first attempt
     alternated red with --proneia-error-bg (near-white) every 3px, which
     averaged the block out to pale pink and undid the colour it was meant to
     carry. Dark-on-red keeps the texture that makes paid/unpaid survive colour
     blindness without diluting the red. */
  --proneia-presence-break-hatch:   var(--proneia-error-dark);
  /* Separate token for the STILL-CLOCKED-IN hatch. It shared the break hatch
     until 2026-09-05, so making that one dark red would have turned the
     in-progress rail green-and-red. Different meaning, different token. */
  --proneia-presence-open-hatch:    var(--proneia-surface);
}
/* ===== END ROLE LAYER ===== */
