/* ============================================================================
   PDA base build — canonical tokens and scales, v2
   Derived 2026-09-05 from PDA Design Guide v1.0 (R75–R122).
   ONE source for both surfaces. Inlined verbatim into every prototype.

   BASE v1.0 (pkt-ui-p0, 2026-09-17): lifted near-verbatim from
   `_PDA tokens and scale v2.css` and served as app/static/pda-tokens.css,
   checked against PDA Design Guide v1.3. Where a comment or value here
   disagreed with a later Guide ruling, the Guide won and the line is marked
   `GUIDE-CORRECTION`. Where it is unclear which wins, the prototype value is
   kept and marked `OPERATOR-Q`. No value in this file changed at the lift.

   v2 changes, all from the feedback walk:
     R118  the type scale drops to THREE sizes. --t-meta moves 11px -> 13px
           and is separated from --t-label by weight, as heading/body already
           were. No size outside the set.
     R118  ALL CAPS withdrawn. --t-meta-caps-ls and .t-meta-caps are gone.
     R117  category accents are REVIEW MODE ONLY. a1/a2/a3 remain here
           because one sheet serves both surfaces; production surfaces
           carry no accent at all.
     R119  --ok no longer appears on a state chip. See the Guide §7.4.

   THE GUIDE IS THE AUTHORITY AND THIS SHEET IS ITS EXPRESSION.
   Where they differ, the Guide wins and this file is corrected.

   Why it exists: PF-43. Two prototypes built two days apart carried 11 and 12
   type sizes and 22 and 27 spacing values, because no scale existed to build
   against. Anything not in this file is drift.

   Every stated minimum below was computed, not chosen. See §0.
   ========================================================================= */

/* --- §0 VERIFIED MINIMA (WCAG relative luminance, both modes) --------------
   R80  recess against the sheet .................. 1.184 L / 1.152 D  (~1.2)
   R83  ink   on page / sheet ..... 15.16 / 17.95 L · 16.07 / 13.95 D  (>=4.5)
   R83  ink-2 on page / sheet .....  6.71 /  7.94 L ·  9.34 /  8.11 D  (>=4.5)
   R83  ink-3 on page / sheet .....  4.79 /  5.67 L ·  6.40 /  5.56 D  (>=4.5)
   R89  focus vs sheet / page / field border .. 7.25 / 6.12 / 4.36 L
                                                6.99 / 8.05 / 4.28 D  (>=3.0)
        primary label on primary ............... 7.25 L · 8.05 D       (>=4.5)
   R82  every semantic and every accent clears 4.5 on both grounds and on
        its own soft fill; no accent equals a reserved semantic in either mode.
   --------------------------------------------------------------------------- */

:root{
  color-scheme:light;

  /* --- R80 TWO GROUNDS, AND ONE DERIVED RECESSED ROLE --------------------
     There are exactly two grounds. The recessed role is DERIVED, not a third
     value: it is the OTHER ground, reused inside a component.

     Ruled out by measurement: a fill 1.2 below the sheet is darker than the
     page, which inverts the shell. The accent sheet's mix-toward-the-sheet
     recess measured 1.019 / 1.022 — PF-42's defect in a new place.

     THE CONSTRAINT: --recess is legal only INSIDE a sheet. On the page ground
     (rail, page) there is no recessed fill at all. R80's own escape applies —
     mark the inset with a rule, or lift it to --surface. Never invent a tone. */
  --paper:#E9ECF1;          /* page ground: page, rail                        */
  --surface:#FFFFFF;        /* sheet: the ONLY raised surface (R58)           */
  --recess:var(--paper);    /* inset inside a sheet. Never used on the page   */
  --field:#FFFFFF;

  /* --- R83 THREE INK ROLES, EACH BY MINIMUM RATIO ------------------------
     No role falls below 4.5 on any ground it carries text on. The single
     exception is a genuinely disabled control, which WCAG exempts; it is
     named here once so it cannot be argued per string. */
  --ink:#14171D;            /* full        */
  --ink-2:#4A5162;          /* secondary   */
  --ink-3:#5F6779;          /* muted       */
  --ink-disabled:#9AA1AF;   /* R83's one exception. Never on live text        */

  /* --- rules. A rule is not a tonal step and does not answer to R80 ------ */
  --rule:#DBDFE7;
  --rule-2:#EDEFF3;
  --rule-strong:#C3C9D4;

  /* --- R82 ONE PRIMARY ACCENT: the only colour meaning "you can act" -----
     Nothing else in this file may be used on anything actionable. */
  --primary:#175A8F;
  --primary-2:#0F4370;
  --primary-soft:#E2EDF7;
  --on-primary:#FFFFFF;

  /* --- R82 FOUR RESERVED SEMANTICS. Fixed. Never extracted from a brand -- */
  --ok:#256849;      --ok-soft:#E0EFE7;        /* done            */
  --held:#6B4E9E;    --held-soft:#EFEAF8;      /* held            */
  --flag:#8A5713;    --flag-soft:#F8F0DE;      /* needs attention */
  --danger:#8E2C24;  --danger-soft:#F7E5E3;    /* danger          */

  /* --- R82 CATEGORY ACCENTS. Extracted per client. Coding and interest ---
     THE EXCLUSION, which is the ruling's substance: an accent never touches
     anything you can act on and never occupies a semantic role. It codes a
     grouping and it may carry surface interest. That is all.
     Where a client has more groupings than accents, THE SET CYCLES.

     R117 — SCOPE: REVIEW MODE ONLY. Groupings are review-mode furniture
     (R94: the rail's top block holds the switcher, which in review mode is
     the groupings). Production mode has no groupings, so an accent there
     had nothing to code and was coding services instead — a job R82 never
     gave it. No dot, no band, no tint on any production surface.

     Mapping rule applied (R81/R82): the brand hue moves off the semantic one,
     never the reverse. The accent sheet's a3 resolved to #B49AE0 in dark —
     identical to --held. Moved to rose here. */
  --a1:#9E5430;  --a1-soft:#F5EAE3;
  --a2:#2A7168;  --a2-soft:#E3EFEC;
  --a3:#8E4A78;  --a3-soft:#F2E8EE;

  /* --- R89 FOCUS, CONSTRAINED BY RATIO -----------------------------------
     >=3:1 against both the element and its ground. Under R81 the accent is
     derived from a client's brand, so without this the ring's visibility is a
     function of their palette — and focus is how the product is used without
     a mouse. WCAG non-text contrast, not a preference. */
  --focus:#175A8F;
  --focus-width:2px;
  --focus-offset:2px;
  /* OPERATOR-Q: the ring's width and offset are dimensions, and Guide §9.4's
     closed set of five relationships names neither; §9.3 constrains the ring
     by ratio only. Prototype values kept. */

  /* --- R89 TWO DEPTH LEVELS, AND NO THIRD --------------------------------
     The sheet, and an overlay that arrives with its scrim. Popovers and menus
     take the overlay level rather than earning a third. Depth is the place
     where a level is nearly free at the time and expensive forever. */
  --sheet-shadow:0 1px 2px rgba(16,24,40,.06), 0 10px 26px -14px rgba(16,24,40,.30);
  --overlay-shadow:0 2px 4px rgba(16,24,40,.08), 0 24px 48px -20px rgba(16,24,40,.35);
  --scrim:rgba(16,24,40,.45);
  /* R124 -- a SECOND SCRIM STRENGTH, for the review welcome overlay only:
     the app behind it is barely visible. Not a third depth level; the depth
     set above is untouched. Values are Client Review Surface Prototype v3's
     `.scrim--heavy` (.86 light, .90 dark). */
  --scrim-heavy:rgba(16,24,40,.86);

  /* --- R89 RADIUS: A CLOSED SET OF FOUR, AND NOTHING BETWEEN -------------
     Under R58 the sheet is the only raised surface, and paper has square
     corners. At 8px the sheet reads as a card; at 3px it reads as a page. */
  --r-flush:0;
  --r:3px;                  /* containers, sheet, inputs, buttons             */
  --r-pill:999px;           /* pills and chips                               */
  --r-circle:50%;           /* dots, marks, avatars                          */

  /* --- R84/R118 FIVE TYPE ROLES, THREE SIZES, TWO FAMILY SLOTS, NO MONO --
     Each role fixes size, weight, line height and letter spacing. NO SIZE IS
     PERMITTED OUTSIDE THIS SET. THREE sizes carry five roles: heading/body
     share 16px and label/meta share 13px, each pair separated by weight.
     One principle applied twice, rather than a special case (R118).

     No mono slot. Numeric alignment comes from tabular numerals on the
     primary family; the mono's real job — counts, view-tab labels — is done
     by weight and spacing. One less family for an extraction to find,
     license and fall back from (R85).
     GUIDE-CORRECTION (Guide §8, R118): the sheet said "letter spacing and
     case"; case cannot do the job once caps are withdrawn. */
  --font:ui-sans-serif,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --font-heading:var(--font);   /* slot two. Falls back to slot one (R61)     */

  --t-title:21px;    --t-title-w:600;   --t-title-lh:1.25;  --t-title-ls:-.01em;
  --t-heading:16px;  --t-heading-w:600; --t-heading-lh:1.35; --t-heading-ls:-.005em;
  --t-body:16px;     --t-body-w:400;    --t-body-lh:1.55;   --t-body-ls:0;
  --t-label:13px;    --t-label-w:500;   --t-label-lh:1.4;   --t-label-ls:0;
  --t-meta:13px;     --t-meta-w:400;    --t-meta-lh:1.45;   --t-meta-ls:0;
  /* R118 — NO ALL CAPS. text-transform appears nowhere in this product.
     An eyebrow is meta in sentence case, distinguished by --ink-3. */

  /* --- R88 SPACING: SEMANTIC NAMES BOUND TO A CLOSED SET, 4px BASE -------
     The Guide is written in relationships; the build gets exact numbers.
     NOTHING OUTSIDE THIS SET, with one named exception: hairlines and optical
     nudges below 4px, named here so they cannot spread.

     This is the sharpest instance of PD-05-AC2. Rendering a section from its
     schema means deciding the gap between a label and its field, between one
     field and the next, and between a field group and the next — three design
     decisions per section if the Guide is silent, where the criterion asks
     for nil. */
  --sp-tight:4px;      /* a label to its field · an icon to its text         */
  --sp-inside:8px;     /* inside a control                                    */
  --sp-related:12px;   /* between related things                              */
  --sp-field:16px;     /* between one field and the next. NOT between two
                          lines of prose — see the Guide §9.1: prose in a
                          section head takes --sp-related. Applying the field
                          gap to a paragraph puts a form's rhythm on it.      */
  --sp-group:24px;     /* between field groups                                */
  --sp-block:32px;     /* between blocks of a page                            */
  --sp-region:48px;    /* between regions · sheet padding                     */
  --hair:1px;          /* THE NAMED EXCEPTION. Rules and optical nudges only  */

  /* --- R86 / R87 ONE MEASURE, ONE DENSITY, EVERYWHERE --------------------
     The kind vocabulary is dropped. The useful half was never the taxonomy —
     it is the prohibition: NO SURFACE INVENTS ITS OWN WIDTH.
     The expand overlay is sized by the viewport, not by a rule.
     Email is the one thing with no shell and no measure of ours. */
  --measure:780px;
  --rail:276px;
  --viewport:100vh;    /* the rail's height: fixed beside the page (RS-29)   */
  --phone:899px;       /* at or below: the phone READ view (R66)              */
}

@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]){
  color-scheme:dark;
  --paper:#0D1015; --surface:#1A1F27; --recess:var(--paper); --field:#1A1F27;
  --ink:#E8ECF2; --ink-2:#AEB6C4; --ink-3:#8D96A7; --ink-disabled:#666E7C;
  --rule:#272D37; --rule-2:#1F242D; --rule-strong:#3A4250;
  --primary:#78ADE2; --primary-2:#9CC6EE; --primary-soft:#152735; --on-primary:#0D1015;
  --ok:#6DBE97;   --ok-soft:#122420;
  --held:#B49AE0; --held-soft:#221C31;
  --flag:#E0B06A; --flag-soft:#2B2417;
  --danger:#E39089; --danger-soft:#2E1A18;
  --a1:#E09772; --a1-soft:#2A1D16;
  --a2:#6FC3B4; --a2-soft:#122623;
  --a3:#E2A0C4; --a3-soft:#2B1B24;   /* moved off --held. See the mapping rule */
  --focus:#78ADE2;
  --sheet-shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 26px -14px rgba(0,0,0,.8);
  --overlay-shadow:0 2px 4px rgba(0,0,0,.5), 0 24px 48px -18px rgba(0,0,0,.8);
  --scrim:rgba(0,0,0,.6);
  --scrim-heavy:rgba(0,0,0,.90);
}}

:root[data-theme="dark"]{
  color-scheme:dark;
  --paper:#0D1015; --surface:#1A1F27; --recess:var(--paper); --field:#1A1F27;
  --ink:#E8ECF2; --ink-2:#AEB6C4; --ink-3:#8D96A7; --ink-disabled:#666E7C;
  --rule:#272D37; --rule-2:#1F242D; --rule-strong:#3A4250;
  --primary:#78ADE2; --primary-2:#9CC6EE; --primary-soft:#152735; --on-primary:#0D1015;
  --ok:#6DBE97;   --ok-soft:#122420;
  --held:#B49AE0; --held-soft:#221C31;
  --flag:#E0B06A; --flag-soft:#2B2417;
  --danger:#E39089; --danger-soft:#2E1A18;
  --a1:#E09772; --a1-soft:#2A1D16;
  --a2:#6FC3B4; --a2-soft:#122623;
  --a3:#E2A0C4; --a3-soft:#2B1B24;
  --focus:#78ADE2;
  --sheet-shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 26px -14px rgba(0,0,0,.8);
  --overlay-shadow:0 2px 4px rgba(0,0,0,.5), 0 24px 48px -18px rgba(0,0,0,.8);
  --scrim:rgba(0,0,0,.6);
  --scrim-heavy:rgba(0,0,0,.90);
}

/* --- THE FIVE TYPE ROLES AS CLASSES ---------------------------------------
   Use these. Do not set font-size anywhere else. */
.t-title  {font:var(--t-title-w)   var(--t-title)/var(--t-title-lh)     var(--font-heading);letter-spacing:var(--t-title-ls)}
.t-heading{font:var(--t-heading-w) var(--t-heading)/var(--t-heading-lh) var(--font-heading);letter-spacing:var(--t-heading-ls)}
.t-body   {font:var(--t-body-w)    var(--t-body)/var(--t-body-lh)       var(--font);letter-spacing:var(--t-body-ls)}
.t-label  {font:var(--t-label-w)   var(--t-label)/var(--t-label-lh)     var(--font);letter-spacing:var(--t-label-ls)}
.t-meta   {font:var(--t-meta-w)    var(--t-meta)/var(--t-meta-lh)       var(--font);letter-spacing:var(--t-meta-ls)}
/* .t-meta-caps is DELETED at R118. Do not reintroduce a caps variant. */

/* tabular numerals, so no mono slot is needed (R84) */
.tnum{font-variant-numeric:tabular-nums}

/* --- R89 FOCUS, ONE DECLARATION FOR THE WHOLE APP ------------------------ */
:where(a,button,input,textarea,select,summary,[tabindex]):focus-visible{
  outline:var(--focus-width) solid var(--focus);
  outline-offset:var(--focus-offset);
  border-radius:var(--r);
}

/* --- R92 QUIET STATUS IS TEXT, NOT MOTION -------------------------------
   Saving… → Saved just now → clearing. The loud treatment is reserved for
   WRITTEN WORK AT RISK (R154, Guide §12). A spinner firing every few seconds becomes
   the most active thing on a writing surface. There is no spinner token.
   GUIDE-CORRECTION (R154, Guide §12 and §12.1): the sheet said "reserved for
   the moment the user must act", a clause that admitted a failed load; a
   failed load is a banner with Try again, never the loud treatment. */

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;transition-duration:.001ms!important}
}

/* BA-126: a client's skin can name Roboto, so the app serves it (font-src is 'self'). Without these a page falls back to the system font. */
@font-face{font-family:"Roboto";font-weight:400;font-style:normal;font-display:swap;src:url("fonts/Roboto-Regular.ttf") format("truetype")}
@font-face{font-family:"Roboto";font-weight:500;font-style:normal;font-display:swap;src:url("fonts/Roboto-Medium.ttf") format("truetype")}
@font-face{font-family:"Roboto";font-weight:700;font-style:normal;font-display:swap;src:url("fonts/Roboto-Bold.ttf") format("truetype")}
