/* ============================================================================
   TOKENS.CSS
   ============================================================================ */

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/SF-Pro.woff2') format('woff2');
  font-weight: 1 999;
  font-display: swap;
}

/* The small Latin cut of SF Pro (tools/font-latin-subset.py): the client quote page only, read through --font-stack-latin. */
@font-face {
  font-family: 'SF Pro Latin';
  src: url('/fonts/SF-Pro-latin.woff2?v=1') format('woff2');
  font-weight: 1 999;
  font-display: swap;
}

@font-face {
  font-family: 'tabler-icons';
  src: url('/fonts/tabler-icons.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* ---------- SEMANTIC PALETTE (shared across all themes) ----------
   These colours represent data, not decoration.
   Pipeline stages are the source of truth -- task types, email tags, and
   job badges all inherit from these via CSS variable references.
   User-customised pipeline colours from the DB are injected at runtime via
   applyPipelineColoursAsCSS() which overrides the defaults below. */

:root {
  /* Pipeline stages (DB overrides these at runtime) */
  --color-stage-lead:         #8b5cf6;   /* purple */
  --color-stage-to-quote:     #f97316;   /* orange */
  --color-stage-quoted:       #fde047;   /* yellow (lighter) */
  --color-stage-to-book:      #3b82f6;   /* blue */
  --color-stage-in-progress:  #15803d;   /* darker green */
  --color-stage-to-invoice:   #22c55e;   /* bright green */
  --color-stage-completed:    #6a6a6a;   /* grey */

  /* Task types -- Booking/Quote/Invoice inherit from pipeline stages above.
     Cert/Messages/Home Visit/General are fixed. */
  --color-task-booking:       var(--color-stage-to-book);
  --color-task-quote:         var(--color-stage-to-quote);
  --color-task-invoice:       var(--color-stage-to-invoice);
  --color-task-cert:          #8b5a2b;   /* brown */
  --color-task-messages:      #8b5cf6;   /* purple */
  --color-task-homevisit:     #1a5c2a;   /* dark green flag */
  --color-task-general:       #888888;   /* grey */

  /* Email categories -- Lead/To Book inherit from pipeline stages. Task/Unknown fixed. */
  --color-email-lead:         var(--color-stage-lead);
  --color-email-to-book:      var(--color-stage-to-book);
  --color-email-task:         #06b6d4;   /* cyan */
  --color-email-unknown:      #888888;   /* grey */

  /* Task priorities -- urgency (fixed) */
  --color-priority-survival:  #c0392b;
  --color-priority-stability: #d97706;
  --color-priority-growth:    #2471a3;

  /* Canonical glass blur. ALL glass surfaces -- nav pill, rail wrapper,
     filter wrapper -- reference this single value so they read
     identically and a future tweak lands in one place. */
  --blur-glass: blur(24px) saturate(180%);

  /* Softer topbar-band blur. The whole studio topbar uses this so
     content scrolling under the bar frosts subtly without competing
     with the stronger --blur-glass on the inner nav pill. One value
     shared across every studio page (survey, home, builder). */
  --blur-band: blur(8px);

  /* Default pill-button height. Every studio pill (home brief pair,
     .btn-pill-group buttons, .btn-primary, nav CTA, survey-add) uses this
     vertical padding, so changing it here resizes every pill app-wide.
     The glass wrapper hugs the pills, so it shrinks to match automatically. */
  --pill-pad-y: 7.5px;
  --pill-pad-x: 20px;
}

:root,
/* Classic themes RETIRED 14 Sep 2026 (Stage H) -- studio-light and studio-dark
   are the only themes. History: git log tokens.css. */

[data-theme="studio-light"] {
  --pres-veil:           rgba(232, 255, 88, 0.32); /* presence lock veil = studio neon yellow accent */
  --color-bg:            #ffffff;
  --color-surface-1:     #eeeeee;   /* small bubbles */
  --color-surface-2:     #d6d8dc;   /* large bubbles */
  --color-surface-3:     #e2e2e2;
  --color-surface-soft:  #f7f7f7;   /* halfway between bg and surface-1 */
  --color-text:          #0a0a0a;
  --color-text-dim:      #5a5a5a;
  --color-text-xdim:     #8a8a8a;
  --color-border:        rgba(0, 0, 0, 0.06);
  --color-border-lt:     rgba(0, 0, 0, 0.12);
  --color-accent:        #e8ff58;
  --color-accent-fg:     #0a0a0a;
  --color-accent-bg:     rgba(232, 255, 88, 0.25);
  /* STYLE LOCK 14 Sep 2026: the CONTROL LAYER. Inputs and secondary buttons
     never take their container's surface -- they sit on this dedicated layer
     (one step brighter than any container) so a control can never blend into
     the bubble it lives in. Accent = the single primary action only. */
  --control-bg:          #ffffff;
  /* desktop sidebar nav (31 Oct 2026): rail width, flyout width, and the
     push offset every screen reads (set to --sbar-w when the rail is open). */
  --sbar-w:              88px;
  --sbar-fly-w:          260px;
  --sbar-top:            82px;   /* rail starts under the top nav bar (standard studio bar height) */
  --sbar-offset:         0px;
  /* desktop job window (14 Oct 2026, visual pass) */
  --color-panel:         #f6f6f6;
  --color-hot:           var(--color-text);
  --color-hot-ink:       var(--color-bg);
  --color-stage-ink:     #ffffff;
  --color-stage-ink-light: #0a0a0a;
  --color-cal-ink-dark:  #000000;   /* calendar block ink on a light fill (calInkClass): pure black keeps >= 4.5:1 on every fill */
  --color-cal-off:       #0a0a0a;   /* scheduled non-billable calendar block (BUILD-CALENDAR-FINISH D8, R5): black */
  --color-cal-off-fg:    #ffffff;
  --color-cal-off-line:  var(--color-border);   /* its 1px hairline (black on white needs none stronger) */
  /* BUILD-CALENDAR-ROUND2 D11 + Jake 18 Nov 2026: a job block on a locked timesheet day = FROSTED OPAL --
     milky translucent base, fine frost grain + a coarser white frost mottle (SVG noise) and a milk veil over
     pastel opal fire, a frosted inner edge glow, top sheen (more frost, Jake 18 Nov 2026). Black ink reads on it. */
  --cal-done-base:  rgba(248, 249, 252, 0.86);
  --cal-done-bg:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.15 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='0.16' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23m)'/></svg>"),
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)),
    linear-gradient(165deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.4) 100%),
    radial-gradient(130% 60% at 0% 0%, rgba(255, 190, 222, 0.6) 0%, rgba(255, 190, 222, 0) 62%),
    radial-gradient(130% 60% at 100% 30%, rgba(160, 208, 255, 0.6) 0%, rgba(160, 208, 255, 0) 62%),
    radial-gradient(130% 60% at 0% 72%, rgba(176, 242, 214, 0.6) 0%, rgba(176, 242, 214, 0) 62%),
    radial-gradient(130% 60% at 100% 100%, rgba(214, 192, 255, 0.6) 0%, rgba(214, 192, 255, 0) 62%);
  --cal-done-line:  rgba(0, 0, 0, 0.12);
  --cal-done-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.85), 0 1px 3px rgba(0, 0, 0, 0.1);
  --cal-pill-lift:  0 1px 2px rgba(0, 0, 0, 0.22);   /* the job-number pill's soft lift (no ring line, Jake 18 Nov) */
  /* Every block = bevelled frosted glass in its own colour (Jake 18 Nov 2026). A diagonal reflection that only ever moves
     the colour AWAY from the ink: -lite washes white over black-ink blocks, -deep darkens the lower right of white-ink
     blocks. Edge lip / glare stay inside the padding; the frost grain is zero-mean (white + black speckle). */
  --cal-glass-lite:
    linear-gradient(155deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 44%, rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0px, rgba(255, 255, 255, 0) 3px),
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(100% - 4px), rgba(255, 255, 255, 0.3) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --cal-glass-deep:
    linear-gradient(155deg, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.1) 45%, rgba(0, 0, 0, 0.2) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0px, rgba(255, 255, 255, 0) 3px),
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(100% - 4px), rgba(255, 255, 255, 0.3) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --cal-glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 1px 0 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.22), inset -1px 0 0 rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.14), 0 3px 8px rgba(0, 0, 0, 0.08);
  --color-danger:        #a13f3f;
  --color-warning:       #b47d0d;
  /* BRAIN (BUILD-BRAIN-THEME, 4 Nov 2026): the Brain's three kinds. Playbooks = orange, standards = blue,
     systems = amber. Each reads as text on the page AND carries accent-fg ink as a fill. */
  --color-brain-playbook: #d9560a;
  --color-brain-standard: #2f7fb8;
  --color-brain-system:   #b8650a;
  /* MOBILE BUILD 16 Sep 2026 (spec 2.6 + 3.2): bubbles read ONE token so the
     dark theme can lift them off the ground without per-screen overrides.
     Light: bubble = surface-1. Divider = hairline inside a bubble. Hot card
     (inverted card: text fill, bg ink) carries its own chip + dim ink. */
  --color-bubble:        #eeeeee;
  --color-divider:       #e2e2e2;
  --color-hot-chip:      #242424;
  --color-hot-dim:       #a0a0a0;
  /* MOBILE TYPE SCALE (Jake, 7 Oct 2026): the spec's 3.12 sizes were drawn for a 300px
     mockup frame and read 30 percent too small on a real phone. Every mob- screen uses
     these; nothing on a phone renders below 14px (nav labels 12px are Jake's one exception).
     Mobile button type is 17px / 700 (style guide Type row: "Mobile button type 17px"). */
  --fs-mob-page-title:   34px;
  --fs-mob-screen-title: 28px;
  --fs-mob-bubble-title: 19px;
  --fs-mob-body:         17px;
  --fs-mob-small:        15px;
  --fs-mob-micro:        14px;
  --fs-mob-stat:         42px;
  --fs-mob-chip:         15px;
  --fs-mob-nav-label:    12px;
  --fs-mob-button:       17px;

  --font-stack:             'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-stack-latin:       'SF Pro Latin', -apple-system, BlinkMacSystemFont, sans-serif;   /* the client quote page: the small Latin cut */
  --font-mono:              ui-monospace, Menlo, Consolas, monospace;   /* FEATURE: bundle-editor: codes and part numbers */
  --color-scrim:            rgba(0, 0, 0, 0.6);   /* FEATURE: bundle-editor: the dimmed page behind a window */
  --weight-body:            600;    /* Studio baseline -- everything inherits this */
  --weight-emphasis:        600;
  --weight-heading:         600;
  --weight-label:           600;    /* stat labels, kv labels, meta */
  --weight-label-strong:    700;    /* section-label pills, nav shortcuts */
  --weight-button:          600;    /* default btn; primary CTAs can override to 700 */
  --weight-card-title:      700;    /* widget titles, list row titles, prominent card headings */
  --weight-editor:          500;    /* tkEd typing area: Chrome treats >= 600 as already bold, so execCommand bold would un-bold (FIX-TASKS-PANE-ASANA) */
  --transform-heading:      none;
  --transform-label:        none;
  /* STYLE LOCK 14 Sep 2026 (round 2): ONE tracking value everywhere -- Jake's
     ruling "all letter spacing is to be the same on every page". */
  --tracking-display:       -0.0425em;
  --tracking-heading:       -0.0425em;
  --tracking-card-title:    -0.0425em;
  --tracking-body:          -0.0425em;
  --tracking-small:         -0.0425em;
  --tracking-value:         -0.0425em;
  --tracking-stat-label:    var(--tracking-small);  /* STYLE LOCK 14 Sep 2026: no positive letter-spacing anywhere */
  --tracking-pill:          var(--tracking-small);
  --tracking-default:       -0.0425em;  /* body baseline */

  /* GLASS (Jake, 29 Oct 2026): ONE recipe per theme, set ONLY here. Every glass
     surface (nav, pill groups, brief, panes, search) reads --glass-bg/--glass-border.
     Light = grey tint so the glass shows on white. */
  --glass-bg:               rgba(230, 230, 230, 0.60);
  --glass-border:           rgba(255, 255, 255, 0.85);
  --glass-pane-bg:          var(--glass-bg);
  --glass-pane-border:      var(--glass-border);

  --radius-card:            22px;
  --radius-input:           999px;
  --radius-button:          999px;
  --radius-pill:            999px;
  --radius-small:           8px;

  --space-card-padding:     22px;
  --space-button-pad-x:     20px;
  --space-button-pad-y:     10px;
  --space-gap-tight:        8px;
  --space-gap-normal:       16px;
  --space-gap-loose:        32px;

  --size-text-xs:           12px;   /* labels, stat labels, stat sub, section-label pills */
  --size-text-sm:           13px;   /* small body, btn default, card descriptions */
  --size-text-base:         14px;   /* body copy, inputs, hero-cta, nav shortcuts */
  --size-text-lg:           16px;   /* widget titles, card h3, hero p */
  --size-text-xl:           24px;   /* stat values */
  --size-text-2xl:          28px;   /* section headings */
  --size-text-display:      46px;   /* hero numbers */
  --size-text-label:        0.85rem;
  --size-survey-section:    1.2rem;
  --size-input-min-height:  44px;

  --shadow-sm:              0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md:              0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  /* a floating window over a usable page (BUILD-POPUP-WINDOWS Stage 2, the job window): 1px ring + wide soft drop */
  --shadow-window:          0 0 0 1px rgba(0, 0, 0, 0.06), 0 24px 64px rgba(0, 0, 0, 0.22);
  --bubble-border:          none;
  --button-border:          none;
  --color-brief-inner-bg:   #ffffff;
  --color-brief-meta:          var(--color-text-dim);
  --color-brief-night-ink:     #ffffff;
  --brief-btn-pill-bg:         var(--glass-bg);
  --brief-btn-pill-blur:       blur(24px) saturate(180%);
  --brief-btn-pill-border:     1px solid var(--glass-border);
  --brief-btn-pill-pad:        5px;
  --brief-btn-pill-shadow:     var(--shadow-sm);
  --btn-pill-group-bg:         var(--glass-bg);
  --btn-pill-group-blur:       blur(24px) saturate(180%);
  --btn-pill-group-border:     1px solid var(--glass-border);
  --btn-pill-group-pad:        5px;
  --btn-pill-group-shadow:     var(--shadow-sm);
  --btn-pill-group-gap:        6px;

  /* Legacy aliases */
  --bg: var(--color-bg); --surface: var(--color-surface-1); --surface-2: var(--color-surface-2); --surface-3: var(--color-surface-3);
  --text: var(--color-text); --text-dim: var(--color-text-dim); --text-xdim: var(--color-text-xdim);
  --border: var(--color-border); --border-lt: var(--color-border-lt);
  --accent: var(--color-accent); --accent-bg: var(--color-accent-bg);
  --green: var(--color-accent); --green-bg: var(--color-accent-bg);
  --amber: var(--color-warning); --amber-bg: rgba(180, 125, 13, 0.08);
  --red: var(--color-danger); --red-bg: rgba(161, 63, 63, 0.08);
  --purple: #555555; --purple-bg: rgba(85, 85, 85, 0.06);
  --radius: var(--radius-card); --radius-sm: var(--radius-small);
  --theme-font: var(--font-stack);
  --theme-heading-transform: var(--transform-heading);
  --theme-heading-weight: var(--weight-heading);
  --theme-heading-spacing: var(--tracking-heading);
  --theme-body-weight: var(--weight-body);
  --theme-letter-spacing: var(--tracking-body);
  /* Charts (BUILD-TASKS-TEAMS-REPORTING Phase 4, FEATURE: task-charts): the dataviz method's categorical order, light steps,
     validated against the card surface #eeeeee (validate_palette.js: all hard checks PASS; contrast WARN on slots 2-5 =
     relief rule: every chart prints its values / legend). Fixed order, never cycled; pos / neg / neutral = deltas. */
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100;
  --viz-5: #e87ba4; --viz-6: #008300; --viz-7: #6250d6; --viz-8: #e34948;
  --viz-pos: #006300; --viz-neg: #d03b3b; --viz-neutral: #898781;
}

[data-theme="studio-dark"] {
  --pres-veil:           rgba(232, 255, 88, 0.20); /* presence lock veil = studio neon yellow accent */
  --color-bg:            #0a0a0a;
  --color-surface-1:     #1a1a1a;   /* small bubbles */
  --color-surface-2:     #242424;   /* large bubbles */
  --color-surface-3:     #2e2e2e;
  --color-surface-soft:  #131313;   /* halfway between bg and surface-1 */
  --color-text:          #ffffff;
  --color-text-dim:      #a0a0a0;
  --color-text-xdim:     #707070;
  --color-border:        rgba(255, 255, 255, 0.06);
  --color-border-lt:     rgba(255, 255, 255, 0.12);
  --color-accent:        #e8ff58;
  --color-accent-fg:     #0a0a0a;
  --color-accent-bg:     rgba(232, 255, 88, 0.22);
  /* MOBILE BUILD 16 Sep 2026 (spec 2.6): dark bubbles moved up to surface-2
     (#242424) because surface-1 was invisible on the #0a0a0a ground, so the
     control layer moves up one step with them (control = one step brighter
     than any bubble, per the 14 Sep lock). */
  --control-bg:          #2e2e2e;
  /* desktop sidebar nav (31 Oct 2026): rail width, flyout width, and the
     push offset every screen reads (set to --sbar-w when the rail is open). */
  --sbar-w:              88px;
  --sbar-fly-w:          260px;
  --sbar-top:            82px;   /* rail starts under the top nav bar (standard studio bar height) */
  --sbar-offset:         0px;
  /* desktop job window (14 Oct 2026, visual pass) */
  --color-panel:         #1a1a1a;
  --color-hot:           var(--color-text);
  --color-hot-ink:       var(--color-bg);
  --color-stage-ink:     #ffffff;
  --color-stage-ink-light: #0a0a0a;
  --color-cal-ink-dark:  #000000;   /* calendar block ink on a light fill (calInkClass): pure black keeps >= 4.5:1 on every fill */
  --color-cal-off:       #000000;   /* scheduled non-billable calendar block (BUILD-CALENDAR-FINISH D8, R5): black */
  --color-cal-off-fg:    #ffffff;
  --color-cal-off-line:  rgba(255, 255, 255, 0.32);   /* its hairline: --color-border (6% white) vanished on the #0a0a0a page (F9, seen on the P2 screenshots) */
  /* BUILD-CALENDAR-ROUND2 D11 + Jake 18 Nov 2026: frosted opal on a locked day; the base a step below white so
     it does not glare on the black page. */
  --cal-done-base:  rgba(226, 231, 240, 0.86);
  --cal-done-bg:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.13 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='0.16' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23m)'/></svg>"),
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)),
    linear-gradient(165deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.4) 100%),
    radial-gradient(130% 60% at 0% 0%, rgba(255, 190, 222, 0.5) 0%, rgba(255, 190, 222, 0) 62%),
    radial-gradient(130% 60% at 100% 30%, rgba(160, 208, 255, 0.5) 0%, rgba(160, 208, 255, 0) 62%),
    radial-gradient(130% 60% at 0% 72%, rgba(176, 242, 214, 0.5) 0%, rgba(176, 242, 214, 0) 62%),
    radial-gradient(130% 60% at 100% 100%, rgba(214, 192, 255, 0.5) 0%, rgba(214, 192, 255, 0) 62%);
  --cal-done-line:  rgba(255, 255, 255, 0.4);
  --cal-done-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5);
  --cal-pill-lift:  0 1px 2px rgba(0, 0, 0, 0.55);
  /* bevelled frosted glass: a touch less lip on the black page, deeper lift shadow */
  --cal-glass-lite:
    linear-gradient(155deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.1) 44%, rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0px, rgba(255, 255, 255, 0) 3px),
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(100% - 4px), rgba(255, 255, 255, 0.24) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --cal-glass-deep:
    linear-gradient(155deg, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.12) 45%, rgba(0, 0, 0, 0.24) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0px, rgba(255, 255, 255, 0) 3px),
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(100% - 4px), rgba(255, 255, 255, 0.24) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --cal-glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 1px 0 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.3), inset -1px 0 0 rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.35);
  --color-danger:        #a13f3f;
  --color-warning:       #b47d0d;
  --color-brain-playbook: #fb8a3c;
  --color-brain-standard: #5aaee6;
  --color-brain-system:   #e8a03a;
  --color-bubble:        #242424;
  --color-divider:       #3a3a3a;
  --color-hot-chip:      #eeeeee;
  --color-hot-dim:       #5a5a5a;
  /* MOBILE TYPE SCALE (Jake, 7 Oct 2026): the spec's 3.12 sizes were drawn for a 300px
     mockup frame and read 30 percent too small on a real phone. Every mob- screen uses
     these; nothing on a phone renders below 14px (nav labels 12px are Jake's one exception).
     Mobile button type is 17px / 700 (style guide Type row: "Mobile button type 17px"). */
  --fs-mob-page-title:   34px;
  --fs-mob-screen-title: 28px;
  --fs-mob-bubble-title: 19px;
  --fs-mob-body:         17px;
  --fs-mob-small:        15px;
  --fs-mob-micro:        14px;
  --fs-mob-stat:         42px;
  --fs-mob-chip:         15px;
  --fs-mob-nav-label:    12px;
  --fs-mob-button:       17px;

  --font-stack:             'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-stack-latin:       'SF Pro Latin', -apple-system, BlinkMacSystemFont, sans-serif;   /* the client quote page: the small Latin cut */
  --font-mono:              ui-monospace, Menlo, Consolas, monospace;   /* FEATURE: bundle-editor: codes and part numbers */
  --color-scrim:            rgba(0, 0, 0, 0.6);   /* FEATURE: bundle-editor: the dimmed page behind a window */
  --weight-body:            600;
  --weight-emphasis:        600;
  --weight-heading:         600;
  --weight-label:           600;
  --weight-label-strong:    700;
  --weight-button:          600;
  --weight-card-title:      700;    /* widget titles, list row titles, prominent card headings */
  --weight-editor:          500;    /* tkEd typing area: Chrome treats >= 600 as already bold, so execCommand bold would un-bold (FIX-TASKS-PANE-ASANA) */
  --transform-heading:      none;
  --transform-label:        none;
  /* STYLE LOCK 14 Sep 2026 (round 2): ONE tracking value everywhere -- Jake's
     ruling "all letter spacing is to be the same on every page". */
  --tracking-display:       -0.0425em;
  --tracking-heading:       -0.0425em;
  --tracking-card-title:    -0.0425em;
  --tracking-body:          -0.0425em;
  --tracking-small:         -0.0425em;
  --tracking-value:         -0.0425em;
  --tracking-stat-label:    var(--tracking-small);  /* STYLE LOCK 14 Sep 2026: no positive letter-spacing anywhere */
  --tracking-pill:          var(--tracking-small);
  --tracking-default:       -0.0425em;

  /* GLASS (Jake, 29 Oct 2026): ONE recipe per theme, set ONLY here.
     Dark = smoked white glass; the grey tint read too light on black. */
  --glass-bg:               rgba(255, 255, 255, 0.20);
  --glass-border:           rgba(255, 255, 255, 0.28);
  --glass-pane-bg:          var(--glass-bg);
  --glass-pane-border:      var(--glass-border);

  --radius-card:            22px;
  --radius-input:           999px;
  --radius-button:          999px;
  --radius-pill:            999px;
  --radius-small:           8px;

  --space-card-padding:     22px;
  --space-button-pad-x:     20px;
  --space-button-pad-y:     10px;
  --space-gap-tight:        8px;
  --space-gap-normal:       16px;
  --space-gap-loose:        32px;

  --size-text-xs:           12px;
  --size-text-sm:           13px;
  --size-text-base:         14px;
  --size-text-lg:           16px;
  --size-text-xl:           24px;
  --size-text-2xl:          28px;
  --size-text-display:      46px;
  --size-text-label:        0.85rem;
  --size-survey-section:    1.2rem;
  --size-input-min-height:  44px;

  --shadow-sm:              0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:              0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-window:          0 0 0 1px rgba(255, 255, 255, 0.10), 0 24px 64px rgba(0, 0, 0, 0.60);
  --bubble-border:          none;
  --button-border:          none;
  --color-brief-inner-bg:   #0a0a0a;
  --color-brief-meta:          var(--color-text-dim);
  --color-brief-night-ink:     #ffffff;
  --brief-btn-pill-bg:         var(--glass-bg);
  --brief-btn-pill-blur:       blur(24px) saturate(180%);
  --brief-btn-pill-border:     1px solid var(--glass-border);
  --brief-btn-pill-pad:        5px;
  --brief-btn-pill-shadow:     var(--shadow-sm);
  --btn-pill-group-bg:         var(--glass-bg);
  --btn-pill-group-blur:       blur(24px) saturate(180%);
  --btn-pill-group-border:     1px solid var(--glass-border);
  --btn-pill-group-pad:        5px;
  --btn-pill-group-shadow:     var(--shadow-sm);
  --btn-pill-group-gap:        6px;

  /* Legacy aliases */
  --bg: var(--color-bg); --surface: var(--color-surface-1); --surface-2: var(--color-surface-2); --surface-3: var(--color-surface-3);
  --text: var(--color-text); --text-dim: var(--color-text-dim); --text-xdim: var(--color-text-xdim);
  --border: var(--color-border); --border-lt: var(--color-border-lt);
  --accent: var(--color-accent); --accent-bg: var(--color-accent-bg);
  --green: var(--color-accent); --green-bg: var(--color-accent-bg);
  --amber: var(--color-warning); --amber-bg: rgba(180, 125, 13, 0.08);
  --red: var(--color-danger); --red-bg: rgba(161, 63, 63, 0.08);
  --purple: #a0a0a0; --purple-bg: rgba(160, 160, 160, 0.1);
  --radius: var(--radius-card); --radius-sm: var(--radius-small);
  --theme-font: var(--font-stack);
  --theme-heading-transform: var(--transform-heading);
  --theme-heading-weight: var(--weight-heading);
  --theme-heading-spacing: var(--tracking-heading);
  --theme-body-weight: var(--weight-body);
  --theme-letter-spacing: var(--tracking-body);
  /* Charts (Phase 4): the same eight hues stepped for the dark card surface #1a1a1a (validate_palette.js: all checks PASS) */
  --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500;
  --viz-5: #d55181; --viz-6: #008300; --viz-7: #9085e9; --viz-8: #e66767;
  --viz-pos: #0ca30c; --viz-neg: #d03b3b; --viz-neutral: #898781;
}
