:root {
  --lg-canvas: #0b0b0c;
  --lg-canvas-mid: #161618;
  --lg-canvas-end: #0b0b0c;
  --lg-surface: #161618;
  --lg-text: #f5f5f7;
  --lg-text-2: #d1d1d6;
  --lg-text-3: #aeaeb2;
  --lg-accent: #0a84ff;
  --lg-on-accent: #ffffff; /* ink on an accent fill (the chosen calendar day), 12.4.0 */
  --lg-success: #4ee6a0;
  --lg-warning: #fbc531;
  --lg-danger: #ff9090;
  --lg-tint: #b8b8bd;
  --lg-orb-1: #3a3a3c;
  --lg-orb-2: #2c2c2e;
  --lg-orb-3: #48484a;
  --lg-orb-4: #3a3a3c;
  --lg-orb-5: #2c2c2e;
  --lg-seam: #48484a;
  --lg-radius: 32;
  --lg-rim: 18;
  --lg-refract: 20;
  --lg-chromatic: 0.04;
  --lg-frost: 0.82;
  --lg-liquid: 0.5;
  --lg-blur: 22;
  --lg-spec-power: 14;
  --lg-spec: 0.12;
  --lg-sheen: 0.055;
  --lg-edge: 0.23;
  --lg-shadow: 0.24; /* lens panel shadow alpha = --lg-shadow-1 (4 Nov 2026) */
  --lg-smin: 0.5;
  --lg-tint-mix: 0.08;
  /* Subtle moving background color; keep foreground ink visually dominant. */
  --lg-orb-gain: 0.13;
  --lg-contour: 0.0374;
  --lg-fallback-fill: rgba(28, 28, 30, 0.72);
  --lg-fallback-edge: rgba(238, 238, 238, 0.32);
  --lg-fallback-shadow: rgba(0, 0, 0, 0.24);
  --lg-chart-ink: #d1d1d6;
  --lg-chart-grid: rgba(239, 239, 239, 0.10);
  /* Medal identity (podium rims and labels); data colours, the same role in every theme. */
  --lg-medal-gold: #f5cf86;
  --lg-medal-silver: #d2d2d2;
  --lg-medal-bronze: #e8b58f;
  --lg-pointer-smooth: 0.1;
  --lg-grain: 0.02;
  --lg-dpr-cap: 1.5;
  --lg-backdrop-scale: 1;
  --lg-frost-scale: 0.22;
  --lg-orb-speed: 0.5;
  /* Backdrop headroom. 0 keeps the original linear orb sum, so every
     surface that does not opt in renders exactly as before.
     --lg-orb-knee   0-1  rolls off overlapping orbs (1 = Reinhard)
     --lg-orb-breath 0-.2 slow 30s luminance breath on the orb field
     --lg-vignette   0-.6 settles the far edges of a large panel */
  --lg-orb-knee: 0.62;
  --lg-orb-breath: 0.12;
  --lg-vignette: 0;
  --lg-max-panels: 32;
  --lg-paper: 0;
  --lg-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --lg-field:
    radial-gradient(42vw 38vh at 88% 8%, color-mix(in srgb, var(--lg-orb-1) 20%, transparent), transparent 70%),
    radial-gradient(38vw 34vh at 8% 92%, color-mix(in srgb, var(--lg-orb-3) 16%, transparent), transparent 72%),
    radial-gradient(52vw 48vh at 50% 42%, color-mix(in srgb, var(--lg-orb-2) 18%, transparent), transparent 68%),
    linear-gradient(135deg, var(--lg-canvas) 0%, var(--lg-canvas-mid) 28%, var(--lg-canvas-end) 72%);
}

/* Light (Fan, 16 November 2026): the one light palette. Canvas and near-white field as live since v6
   (orbs #e6e6e6-#ebebeb, seam #dedede, orb gain .10, contour .02); status ink #047857 / #92400e / #a34d5a. */
html.lg-light {
  --lg-canvas: #f6f6f6;
  --lg-canvas-mid: #f0f0f0;
  --lg-canvas-end: #f8f8f8;
  --lg-surface: #f2f2f2;
  --lg-text: #1d1d1f;
  --lg-text-2: #424245;
  --lg-text-3: #636366;
  --lg-tint: #ffffff;
  --lg-accent: #007aff;
  --lg-on-accent: #ffffff;
  --lg-divider: #3838381c;
  --lg-control-fill: #ffffff42;
  --lg-control-hover: #47474712;
  --lg-control-press: #47474720;
  --lg-success: #047857;
  --lg-warning: #92400e;
  --lg-danger: #a34d5a; /* muted rose (Fan, 5 November 2026; was #b91c1c) */
  --lg-frost: 0.86;
  --lg-blur: 26;
  --lg-spec: 0.08;
  --lg-sheen: 0.08;
  --lg-edge: 0.27;
  --lg-shadow: 0.132; /* light: .24 x .55 */
  --lg-tint-mix: 0.42;
  --lg-orb-1: #e6e6e6;
  --lg-orb-2: #e9e9e9;
  --lg-orb-3: #ebebeb;
  --lg-orb-4: #e6e6e6;
  --lg-orb-5: #e9e9e9;
  --lg-seam: #dedede;
  --lg-orb-gain: 0.10;
  --lg-contour: 0.02;
  --lg-fallback-fill: rgba(255, 255, 255, 0.68);
  --lg-fallback-edge: rgba(255, 255, 255, 0.90);
  --lg-fallback-shadow: rgba(53, 53, 53, 0.15);
  --lg-chart-ink: #424245;
  --lg-chart-grid: rgba(29, 29, 31, .10);
  --lg-medal-gold: #836633;
  --lg-medal-silver: #6c6c6c;
  --lg-medal-bronze: #906142;
  --lg-grain: 0.014;
  --lg-paper: 1;
  color-scheme: light;
}

/* Motion contract (Fan, 4 November 2026): small surfaces glide, large surfaces get a light spring.
   Small (menus, dropdowns, tooltips, toasts, small popovers): open --lg-dur-small on --lg-ease-glide from
   --lg-from-small with opacity 0 -> 1; close is a --lg-dur-close-small ease-in fade.
   Large (popups, dialogs, info popups, filter sheets, drawers, modals, sheet panels, overlays about 320px or more
   on both sides): open --lg-dur-large on --lg-ease-spring from --lg-from-large (about 3% of the travel past the
   end, so scale peaks near 1.001), with opacity on its own --lg-dur-fade ease-out so it never overshoots;
   close --lg-dur-close-large ease-in to opacity 0 at --lg-to-large. Reduced motion: no transform, a
   --lg-dur-reduced fade only. Surfaces use these tokens, never literals. */
:root {
  --lg-ease-glide: cubic-bezier(.22, 1, .36, 1);
  --lg-ease-spring: cubic-bezier(.34, 1.3, .64, 1);
  --lg-ease-fade: ease-out;
  --lg-ease-close: ease-in;
  --lg-dur-small: 200ms;
  --lg-dur-large: 320ms;
  --lg-dur-fade: 160ms;
  --lg-dur-close-small: 120ms;
  --lg-dur-close-large: 160ms;
  --lg-dur-reduced: 120ms;
  --lg-from-small: translateY(6px) scale(.97);
  --lg-from-large: translateY(10px) scale(.96);
  --lg-to-large: scale(.98);
}
@keyframes lg-glide-in { from { opacity: 0; transform: var(--lg-from-small); } to { opacity: 1; transform: none; } }
@keyframes lg-spring-in { from { transform: var(--lg-from-large); } to { transform: none; } }
@keyframes lg-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Size-aware corner scale (lg-radius.js, 4 November 2026): r = round(clamp(12, 2.6 * sqrt(s / k), 40) * k)
   (cap 40 since 16 November 2026, D13; menus, popovers and tooltips cap at --lg-radius-menu).
   1 everywhere; the Performance TV app's 4K layout sets 2. */
:root { --lg-radius-scale: 1; }
/* Reduced motion: no transform, a plain fade (the same tokens drive every surface). */
@media (prefers-reduced-motion: reduce) {
  :root {
    --lg-from-small: none; --lg-from-large: none; --lg-to-large: none;
    --lg-ease-glide: linear; --lg-ease-spring: linear; --lg-ease-fade: linear; --lg-ease-close: linear;
    --lg-dur-small: var(--lg-dur-reduced); --lg-dur-large: var(--lg-dur-reduced); --lg-dur-fade: var(--lg-dur-reduced);
    --lg-dur-close-small: var(--lg-dur-reduced); --lg-dur-close-large: var(--lg-dur-reduced);
  }
}

/* Press feedback (lg-press.js, Fan 4-5 November 2026): buttons swell softly to 1.03 (no bounce); large cards sink to
   .99 on their content (120ms ease-out, back over 180ms on the glide, no bounce; shell, shadow and plate unchanged)
   with a +4% white fill brighten; rows ripple only. The ripple is a tint of the element's own colour (currentColor
   22% -> 8% -> transparent), never white. Bound by role to every interactive element on every surface. */
:root {
  --lg-press-swell: 1.03;
  --lg-press-card: .99;
  --lg-press-release: 180ms;
  --lg-press-shimmer: 520ms;
  --lg-press-swell-field: 1.008; /* dropdown fields swell less */
  /* Release (Fan, 11 November 2026): waits for the peak, then returns from rest to rest, never on the glide. */
  --lg-press-return-ease: cubic-bezier(.4, 0, .2, 1);
}

/* Elevation (Fan, 4 November 2026): each layer is a step deeper than the one below. Surfaces keep their inset
   highlight lines alongside these drop shadows. Light mode uses the same geometry in rgba(57,57,57, alpha x .55).
   1 cards and panels (the WebGL engine draws this one for lens panels; CSS glass cards use the token)
   2 floating chrome: docked bars, floating and theme buttons, map controls, toasts
   3 menus, dropdowns, popovers, tooltips, popups, sheets, dialogs */
:root {
  --lg-shadow-1: 0 8px 24px rgba(0, 0, 0, .24);
  --lg-shadow-2: 0 12px 28px rgba(0, 0, 0, .38), 0 2px 6px rgba(0, 0, 0, .24);
  --lg-shadow-3: 0 20px 48px rgba(0, 0, 0, .42), 0 4px 12px rgba(0, 0, 0, .24);
}
html.lg-light {
  --lg-shadow-1: 0 8px 24px rgba(57, 57, 57, .132);
  --lg-shadow-2: 0 12px 28px rgba(57, 57, 57, .209), 0 2px 6px rgba(57, 57, 57, .132);
  --lg-shadow-3: 0 20px 48px rgba(57, 57, 57, .231), 0 4px 12px rgba(57, 57, 57, .132);
}
/* Night chrome that stays dark in a light page (the portal rail and summary band) uses the dark set directly. */
:root {
  --lg-shadow-1-dark: 0 8px 24px rgba(0, 0, 0, .24);
  --lg-shadow-2-dark: 0 12px 28px rgba(0, 0, 0, .38), 0 2px 6px rgba(0, 0, 0, .24);
  --lg-shadow-3-dark: 0 20px 48px rgba(0, 0, 0, .42), 0 4px 12px rgba(0, 0, 0, .24);
}

/* Graphite (Fan, 4 November 2026): the pack's named neutral dark palette. The portal's dark workspace uses it,
   and every dark-mode menu uses its menu material on every surface (the navy dashboards keep navy pages).
   Its shadows are the elevation levels in neutral black. The accent stays #0a84ff.
   lg-carbon.css reads page, orbs, seam, ink, tint and shadows from here (16 November 2026). */
:root {
  --lg-graphite-page: #0b0b0c;
  --lg-graphite-orb-1: #3a3a3c; --lg-graphite-orb-2: #2c2c2e; --lg-graphite-orb-3: #48484a;
  /* WebGL field (5 November): seam #48484a, orbs 1-5 = 1,2,3,1,2, default orb strength (no --lg-orb-gain override). */
  --lg-graphite-seam: #48484a;
  --lg-graphite-tint-rgb: 28, 28, 30;
  --lg-graphite-ink: #f5f5f7; --lg-graphite-ink-3: rgba(235, 235, 245, .6);
  --lg-graphite-edge: rgba(255, 255, 255, .16);
  --lg-graphite-menu-bg: linear-gradient(145deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .02)), rgba(36, 36, 38, .97);
  --lg-graphite-shadow-1: 0 8px 24px rgba(0, 0, 0, .24);
  --lg-graphite-shadow-2: 0 12px 28px rgba(0, 0, 0, .38), 0 2px 6px rgba(0, 0, 0, .24);
  --lg-graphite-shadow-3: 0 20px 48px rgba(0, 0, 0, .42), 0 4px 12px rgba(0, 0, 0, .24);
}
/* Loading (Fan, 4 November 2026): first load shows a skeleton in the real layout; refreshes update in place. */
:root { --lg-skeleton-a: rgba(239, 239, 239, .08); --lg-skeleton-b: rgba(239, 239, 239, .18); --lg-skeleton-sweep: 1.4s; --lg-count-dur: 1.1s; --lg-count-ease: cubic-bezier(.33, 1, .68, 1); }
html.lg-light { --lg-skeleton-a: rgba(29, 29, 31, .06); --lg-skeleton-b: rgba(29, 29, 31, .12); }
@keyframes lg-skeleton-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
/* Spacing (Fan, 4 November 2026): comfortable by default, roomy for hero blocks; inner label/value/caption steps.
   The TV doubles them. Rollout onto each surface's literals is listed in SURFACES.md. */
:root { --lg-pad: 24px; --lg-pad-hero: 32px; --lg-gap: 16px; --lg-gap-hero: 24px; --lg-gap-title: 16px; --lg-gap-inner: 8px; --lg-gap-inner-2: 4px; }
/* Control heights (Fan, 5 November 2026): three sizes. Compact 32px for small inline buttons (the portal rail dock
   button); standard 40px for pills, triggers, fields and labelled buttons; floating 44px for floating chrome, the
   portal rail account row and the IBC event form's fields (touch at events). */
:root { --lg-control-sm: 32px; --lg-control: 40px; --lg-control-float: 44px; }
/* Phone layer (fix plan P6.5, 16 November 2026; core/phone/lg-phone.css). Every target reaches the 44px touch minimum
   (hit slop when it draws smaller); bottom-sheet and search rows are 48px; the page gutter is 16px. One scrim behind
   sheets and dialogs in every theme for now (32% black); the dialog spec (S2.3) may set per-theme scrims. */
:root { --lg-touch-min: 44px; --lg-sheet-row: 48px; --lg-phone-gutter: 16px; --lg-scrim: rgba(0, 0, 0, .32); }
/* Light button fill (Fan, 5 November 2026, from the sign-in pages): .07 at rest and .12 on hover, chosen for
   contrast. Dark keeps each surface's own fill. */
html.lg-light { --lg-btn-a: .07; --lg-btn-hover-a: .12; }
/* Message icons (5 November 2026): 24-unit line icons, 1.75 stroke, used as masks by .lg-error/.lg-success/.lg-note. */
:root {
  --lg-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
  --lg-icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8h.01M11 12h1v4h1'/%3E%3C/svg%3E");
  --lg-icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}
/* Nested menus (Fan, 5 November 2026): a menu that opens inside a card or a blurred bar (the nested-glass exception,
   solid fill) takes this tight shadow; menus floating over the page keep --lg-shadow-3. Light is the dark value in the
   pack's neutral light shadow (57,57,57 at .55x the alpha). */
:root { --lg-shadow-nested: 0 2px 8px rgba(0, 0, 0, .28); }
html.lg-light { --lg-shadow-nested: 0 2px 8px rgba(57, 57, 57, .154); }
/* Value role (Fan, 5 November 2026): every large number (KPI and hero values, donut and ring centres, map stats, the
   portal KPIs and band, the TV at 2x) is weight 700 with -.02em tracking; sizes stay per surface. 600 read skinny
   beside the rest of the type, 800 too thick. */
:root { --lg-value-weight: 700; --lg-value-tracking: -.02em; }

/* ---- Scales (fix plan Phase 1, 16 November 2026) -----------------------------------------------------------------
   Every value below is what the engine draws today, so adding them changes nothing on screen. Moving the remaining
   literals onto them is fix plan Phase 3 (kit) and Phase 4 (engine). */

/* Type roles. Sizes are per role; dashboards may map a role to their own size (Renewals, Performance and the TV keep
   their type, 5 November 2026), but through these tokens. Uppercase roles: label and toolbar. */
:root {
  --lg-type-lead-size: 17px;     --lg-type-lead-weight: 600;   /* .lg-lead, a page's lead line when it has no h1 */
  --lg-type-label-size: 12px;    --lg-type-label-weight: 700;  --lg-type-label-tracking: .08em;
                                 /* card and section titles' case, KPI labels, table headers, menu group labels,
                                    kickers, donut and ring centre labels; uppercase, muted ink */
  --lg-type-toolbar-size: 12px;  --lg-type-toolbar-weight: 700; --lg-type-toolbar-tracking: .5px;
                                 /* toolbar buttons, filter pills and dropdown triggers (D9); uppercase */
  --lg-type-body-size: 13px;     /* body, captions, empty states, pills inside cards */
  --lg-type-meta-size: 12px;     /* small meta lines */
  --lg-type-tag-size: 13px;      --lg-type-tag-weight: 500;    /* filter tags */
  --lg-type-menu-size: 13.5px;   --lg-type-menu-weight: 500;   /* menu items */
  --lg-type-field-size: 13px;    /* text in fields; 16px on phones so iOS does not zoom */
  --lg-type-table-size: 15px;    /* table rows (dashboards keep their own) */
  --lg-type-axis-size: 11px;     /* chart axes and end labels, the one size under 12 */
  --lg-type-sheet-size: 16px;    --lg-type-sheet-weight: 500;  /* phone: bottom-sheet rows, search rows, Cancel */
  --lg-type-sheet-title-size: 17px; --lg-type-sheet-title-weight: 600; /* phone: a bottom sheet's title */
  /* Line heights: trimmed labels and pills, UI text, running text. */
  --lg-leading-tight: 1.25;
  --lg-leading-ui: 1.4;
  --lg-leading-body: 1.5;
}
@media (max-width: 600px) { :root { --lg-type-field-size: 16px; } }

/* Layers, bottom to top. Values are today's; the spec's order table (fix plan Phase 2) decides whether page menus
   should rise above floating chrome. */
:root {
  --lg-z-base: 0;              /* backdrops and lens canvases */
  --lg-z-raised: 1;            /* a control above its own track */
  --lg-z-thumb: 2;             /* a thumb or a bar's pop inside its control */
  --lg-z-sticky: 9;            /* the sticky menu bar */
  --lg-z-menu: 30;             /* menus anchored in the page */
  --lg-z-popover: 50;          /* popovers placed on the page (fixed) */
  --lg-z-picker: 55;           /* the date picker */
  --lg-z-float: 10000;         /* floating chrome: the theme button, the tuner toggle */
  --lg-z-float-menu: 10001;    /* a menu opened from floating chrome */
  --lg-z-sheet: 10010;         /* phone: a bottom sheet and its scrim (lg-phone.css) */
  --lg-z-search: 10012;        /* phone: the full-screen search page, above a sheet it opens from */
  --lg-z-notice: 2147483000;   /* notices */
  --lg-z-press: 2147483646;    /* the press ripple layer (lg-press.js) */
  --lg-z-debug: 2147483647;    /* engine diagnostics */
}

/* Breakpoints. Media queries cannot read custom properties, so write the literal in @media and read these from JS.
   Phone is 600px and below; desktop rules start at 901px; 601-900px is closed by fix plan Phase 6. */
:root { --lg-bp-phone: 600px; --lg-bp-tablet: 900px; --lg-bp-laptop: 1280px; --lg-bp-wide: 1450px; }

/* Keyboard focus: a 2px accent ring 3px outside the control; -2px inside a clipping track or list. */
:root {
  --lg-focus-width: 2px;
  --lg-focus-offset: 3px;
  --lg-focus-offset-inset: -2px;
  --lg-focus-color: var(--lg-accent);
}

/* Corner tiers (Fan, 16 November 2026). Panels and cards: r = round(clamp(min, 2.6 * sqrt(s / k), max) * k), read by
   lg-radius.js; max 40px (was 56) so large panels never look heavy. Menus, popovers and tooltips cap at the menu tier.
   Rows inside menus and lists 12px; inner tiles never below 4px; labelled controls are capsules. */
:root {
  --lg-radius-min: 12px;
  --lg-radius-max: 40px;
  --lg-radius-menu: 28px;
  --lg-radius-row: 12px;
  --lg-radius-inner-min: 4px;
  --lg-radius-capsule: 999px;
}

/* Disabled controls: one opacity everywhere (the labelled button's .42 today), no pointer. */
:root { --lg-disabled-opacity: .42; }

/* Popover material: the readable menu fill (--lg-popover-rgb at --lg-popover-alpha, set per theme in lg-material.css)
   behind a light blur with one saturation. */
:root { --lg-popover-blur: 12px; --lg-popover-saturate: 1.2; }
