/* studio/tokens.css: the token block of the new look ("studio"), the paper and mail re-pins, the print override, the keyboard flag and the dialog timing.
   Every rule starts with html[data-ui="studio"] (SPEC 2026-11-03 section 3; a static check enforces it; no :root, no bare html or body, no @keyframes,
   no @font-face, no @import, no !important in a studio file). Classic is public/app.css, untouched. Tools are neutral (R = G = B), never pure black
   (brand section 6); the one colour is the flag red, a shape on a panel and a word only on the void or the well. Values: panel/02-visual-system.md
   section 1, with tertiary text lifted to #b0b0b0 (4.63 to 1 on the raised grey, where #a3a3a3 fails the 4.5 floor). */

/* The overscroll area outside the page (Classic sets html{background:var(--bg-void)} above body). The door keeps its own #0d0d0d, so never there. */
html[data-ui="studio"]:not(:has(body.gate)){background:#1c1c1c}

/* The tokens live on the app body, never on :root or html, so the login door (body.gate) never sees one. Every token Classic's first :root defines is
   redefined here (a static check counts them), so nothing falls back to Wave's blue by omission. */
html[data-ui="studio"] body:not(.gate){
  color-scheme:dark;
  --pipe:rgba(240,240,240,.45);
  --font-ui:'Lato',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-brand:'Lato',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-num:'SF Mono','Menlo','Consolas','Roboto Mono',monospace;
  --maxw:1440px; --gutter:16px; --radius:16px; --radius-sm:8px; --radius-xs:8px; --pill:999px;
  /* Six sizes: 13 meta, 15 interface, 18 reading, 24 section, 28 title (Admin and Banner). --type-2xs keeps its name and equals the smallest step. */
  --type-2xs:13px; --type-xs:13px; --type-s:15px; --type-m:15px; --type-l:18px; --type-xl:28px; --type-xxl:28px;
  --hit:40px; --ease:cubic-bezier(.2,.7,.2,1); --ease-out:cubic-bezier(.2,.7,.2,1); --btn-h:40px; --side-w:280px; --bar-h:56px; --row-h:48px; --page-max:1040px; --page-pad:var(--gutter);
  --bg-void:#1c1c1c; --bg-panel:#262626; --bg-panel-2:#323232; --bg-raised:#424242; --bg-inset:#141414;
  --divider:#404040; --line-strong:#404040;
  --text-primary:#f0f0f0; --text-secondary:#c4c4c4; --text-tertiary:#b0b0b0; --text-nav:#f0f0f0;
  --accent:#d4d4d4; --on-accent:#1c1c1c; --btn-strong:#303030; --btn-strong-hover:#3b3b3b; --accent-hover:#e2e2e2; --accent-soft:#323232;
  --flag:#e2574a;
  /* Wave's status tints become no tint: a status word is weight and brightness only (panel 2 section 4, Status words). */
  --ok-bg:transparent; --ok-ink:#c4c4c4; --warn-bg:transparent; --bad-bg:transparent; --bad-ink:#f0f0f0; --grey-bg:transparent;
  --bar-bg:#1c1c1c; --bar-ink:#f0f0f0; --bar-ink-2:#c4c4c4; --bar-line:#404040; --bar-chip:#323232;
  /* Admin's extra names (hairlines in hex: the contrast test reads hex and hsl only). --hair is drawn on the void and the well only; a panel divides with --divider. */
  --hair:#2e2e2e; --row-hover:#2c2c2c; --stage:#0d0d0d; --shadow-raised:0 12px 40px rgba(0,0,0,.5);
  --space-3xs:2px; --space-2xs:4px; --space-xs:8px; --space-sm:12px; --space-md:16px; --space-lg:24px; --space-xl:40px; --space-2xl:64px; --space-3xl:96px;
  --control:40px; --control-s:36px; --row:48px;
  /* Motion names (panel 4 section 7): one curve, four durations. The rule and hair lines in hex, the same greys as above. */
  --t-hover:120ms; --t-press:140ms; --t-in:260ms; --t-out:180ms; --t-tip:125ms;
  --color-rule:#404040; --color-hair:#2e2e2e; --color-focus:#d4d4d4; --color-muted:#b0b0b0; --color-ink-2:#c4c4c4;
  /* The lockup's own size (shell.css reads it: Classic's 20px, 18 under 420, the desktop step from 960) and a field's size (16px under a finger, so iOS never zooms). */
  --type-brand:20px; --type-input:var(--type-m);
  -webkit-text-size-adjust:100%;
}
@media (max-width:420px){
  html[data-ui="studio"] body:not(.gate){--type-brand:18px}
}
@media (min-width:960px){
  html[data-ui="studio"] body:not(.gate){--gutter:24px;--page-pad:24px;--type-brand:28px}
}
@media (min-width:1440px){
  html[data-ui="studio"] body:not(.gate){--side-w:320px}
}
/* Under a finger every control is 48px (brand section 7; panel 3) and a field is 16px. The tests run with a fine pointer, so this block is unmeasured by them. */
@media (pointer:coarse){
  html[data-ui="studio"] body:not(.gate){--hit:48px;--control:48px;--type-input:16px}
}

/* Native controls take the dark palette too (Classic sets color-scheme:light inside input,select,textarea): the date picker, the select list, the scrollbars. */
html[data-ui="studio"] body:not(.gate) input,
html[data-ui="studio"] body:not(.gate) select,
html[data-ui="studio"] body:not(.gate) textarea{color-scheme:dark}
/* Chrome paints an autofilled field in its own pale yellow whatever the theme; this keeps the field the well with the page's ink. */
html[data-ui="studio"] body:not(.gate) input:-webkit-autofill{-webkit-text-fill-color:var(--text-primary);box-shadow:0 0 0 1000px var(--bg-inset) inset}

/* The paper (the on-screen invoice, estimate and statement) and the two mail previews stay light, exactly as Classic: each re-pins every token it reads.
   The statement sheet (.st-sheet, a .panel) reads the panel greys, the rules, the inks and the table tokens (primitives' .table rules reach inside it), so it
   re-pins those too, with the mono name pointed at the document face: a statement is a document, set in one face like the invoice paper. The customer Send
   dialogs' inbox preview (.cu-mail) is the same mail as .mail and takes the same light re-pin (review R, 3 Nov 2026). */
html[data-ui="studio"] .paper{--divider:#dbe3ea;--radius-xs:8px;--type-s:14px;--type-xs:14px;--type-xxl:28px;--text-primary:#182127;--text-secondary:#515f66;--text-tertiary:#566670;--font-ui:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;font-family:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;color-scheme:light}
html[data-ui="studio"] .st-sheet{--bg-panel:#ffffff;--bg-panel-2:#f3f6f9;--bg-raised:#e0f2ff;--row-hover:#f3f6f9;--divider:#dbe3ea;--line-strong:#b2cfeb;--radius:12px;--type-xs:14px;--type-s:14px;--type-m:16px;--type-xxl:28px;--text-primary:#182127;--text-secondary:#515f66;--text-tertiary:#566670;--font-ui:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;--font-num:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;font-family:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;background:#ffffff;color:#182127;border-color:#dbe3ea;color-scheme:light}
html[data-ui="studio"] .mail,html[data-ui="studio"] .cu-mail{--divider:#dbe3ea;--bg-panel-2:#ffffff;--radius:12px;--radius-sm:8px;--type-l:20px;--text-primary:#182127;--text-secondary:#515f66;--text-tertiary:#566670;--font-ui:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;font-family:'DM Sans','Lato',system-ui,-apple-system,'Segoe UI',sans-serif;color:#182127;color-scheme:light}

/* Print: white paper and Classic's print ink, whatever the look on screen (Classic's @media print body rule loses to the token rule above on specificity). */
@media print{
  html[data-ui="studio"]:not(:has(body.gate)),
  html[data-ui="studio"] body:not(.gate){background:#fff;color:#182127;color-scheme:light}
}

/* The dialog's timing (brand: in 260ms from .96 with opacity, out 180ms on opacity alone; one curve). The entrance is a transition from @starting-style,
   not Classic's keyframe: under the keyboard flag Chrome never creates a 0s keyframe animation, and the first pointer press (which lifts the flag) would
   start the entrance afresh under the click; a finished transition does not replay when its duration changes (2C proved it on its own dialogs; review R
   moved the shared dialog to the same footing, 3 Nov 2026). The exit is a transition set by form.js close(): it marks the dialog data-leaving, waits for
   the transition, then closes and removes it. Opened or closed by key, the keyboard flag below makes it instant; under reduced motion both end at once. */
html[data-ui="studio"] dialog.dlg[open]{animation:none;opacity:1;transform:none;transition-property:opacity,transform;transition-duration:260ms;transition-timing-function:var(--ease)}
html[data-ui="studio"] dialog.dlg[open]::backdrop{animation:none;opacity:1;transition-property:opacity;transition-duration:260ms;transition-timing-function:var(--ease)}
@starting-style{
  html[data-ui="studio"] dialog.dlg[open]{opacity:0;transform:matrix(.96,0,0,.96,0,0)}
  html[data-ui="studio"] dialog.dlg[open]::backdrop{opacity:0}
}
html[data-ui="studio"] dialog.dlg[data-leaving]{opacity:0;transition:opacity 180ms var(--ease);pointer-events:none}
html[data-ui="studio"] dialog.dlg[data-leaving]::backdrop{opacity:0;transition:opacity 180ms var(--ease)}
@media (prefers-reduced-motion:reduce){
  html[data-ui="studio"] dialog.dlg[open],html[data-ui="studio"] dialog.dlg[open]::backdrop,html[data-ui="studio"] dialog.dlg[data-leaving],html[data-ui="studio"] dialog.dlg[data-leaving]::backdrop{transition-duration:0s}
}

/* The keyboard flag: anything opened or changed by a key ends at once (the two listeners in app.js set data-input under the new look). Without !important
   (banned in a studio file) this is (0,2,1): it beats every one- and two-part Classic rule and every studio rule written on the same footing; a Classic
   rule with three class parts keeps its own duration (a known limit of release 1, DECISIONS.md). The two loading rings are constant motion, not a
   response to the key, so they keep turning. */
html[data-ui="studio"][data-input="keyboard"] *,
html[data-ui="studio"][data-input="keyboard"] *::before,
html[data-ui="studio"][data-input="keyboard"] *::after,
html[data-ui="studio"][data-input="keyboard"] dialog.dlg::backdrop{transition-duration:0s;animation-duration:0s}
/* The dialog rules above are (0,3,2), more than the star rule, so they take the flag by name. */
html[data-ui="studio"][data-input="keyboard"] dialog.dlg[open],
html[data-ui="studio"][data-input="keyboard"] dialog.dlg[open]::backdrop,
html[data-ui="studio"][data-input="keyboard"] dialog.dlg[data-leaving],
html[data-ui="studio"][data-input="keyboard"] dialog.dlg[data-leaving]::backdrop{transition-duration:0s;animation-duration:0s}
html[data-ui="studio"][data-input="keyboard"] .loading-ring{animation-duration:600ms}
html[data-ui="studio"][data-input="keyboard"] .spin{animation-duration:300ms}
