/* @kurthlabs/design static styles (no Tailwind, no JS, no external URLs; see packages/design/docs/STATIC_MARKUP.md). Generated by scripts/build.ts; edit src/styles. */

@layer base, design, components;

/*
 * Kurth Labs Design tokens. Generated from src/tokens/*.ts by `pnpm docs:gen`; edit those, not this file.
 *
 * Three layers, each built only from the one before it:
 *
 *   1. Primitives  --kl-*      raw palette, type, radius and motion values.
 *                                  Never used by components directly.
 *   2. Semantic    --m-*           roles: surfaces, text, borders, accent,
 *                                  status, focus. Themes (light/dark) and skins
 *                                  set these. Components read only these and
 *                                  layer 3.
 *   3. Component   --m-<part>-*    sizes and choices for a family of parts
 *                                  (control height, nav height, body size),
 *                                  derived from semantic tokens and density.
 *
 * Every selector is wrapped in :where(), so all rules have zero specificity,
 * and the rules sit in three cascade layers, declared below in this order:
 * design.defaults (this file), design.skins and design.modes (skins.css).
 * Layer order, not load order, decides between them: defaults, then skins,
 * then density and the floors. A rule outside any layer, such as an app's,
 * beats all three, so an app overrides any token with a plain selector.
 *
 * Zero config: the default look sits on :root and follows the OS light/dark
 * setting. ThemeProvider (or data-theme / data-skin / data-density on any
 * element) switches a subtree.
 */

@layer design.defaults, design.skins, design.modes;

@layer design.defaults {
  /* ── 1. Primitives ─────────────────────────────────────────────────────── */

  :root {
    /* Neutral (zinc): the default skin's grounds. */
    --kl-zinc-0: #ffffff;
    --kl-zinc-25: #f8f8f9;
    --kl-zinc-50: #f2f2f4;
    --kl-zinc-100: #ececef;
    --kl-zinc-150: #e4e4e8;
    --kl-zinc-200: #cdcdd3;
    --kl-zinc-500: #6b6b74;
    --kl-zinc-600: #4a4a52;
    --kl-zinc-700: #3a3a41;
    --kl-zinc-750: #2a2a30;
    --kl-zinc-800: #222227;
    --kl-zinc-850: #1a1a1e;
    --kl-zinc-900: #131316;
    --kl-zinc-950: #0a0a0c;
    --kl-zinc-990: #060608;

    /* Ink (blue-black): the Control Center skin's grounds. */
    --kl-ink-0: #ffffff;
    --kl-ink-25: #f7f8fa;
    --kl-ink-50: #f1f3f6;
    --kl-ink-75: #eef1f5;
    --kl-ink-100: #eceef2;
    --kl-ink-150: #e3e6ec;
    --kl-ink-200: #cbd0da;
    --kl-ink-500: #697186;
    --kl-ink-600: #475063;
    --kl-ink-700: #394254;
    --kl-ink-750: #262d3b;
    --kl-ink-800: #1e2433;
    --kl-ink-850: #171c27;
    --kl-ink-900: #10141c;
    --kl-ink-950: #07090d;
    --kl-ink-990: #04060a;

    /* Graphite and pewter: the pewter skin. */
    --kl-graphite-950: #0b0b0c;
    --kl-graphite-900: #141416;
    --kl-graphite-850: #1c1c1f;
    --kl-graphite-800: #232327;
    --kl-graphite-750: #2a2a2e;
    --kl-graphite-700: #46464d;
    --kl-silver-25: #fafafb;
    --kl-silver-50: #eeeff1;
    --kl-silver-100: #e5e6e9;
    --kl-silver-150: #dfe0e4;
    --kl-silver-200: #d4d5da;
    --kl-silver-300: #a9aab2;
    --kl-pewter-300: #d3c3b5;
    --kl-pewter-400: #b9a698;
    --kl-pewter-700: #77624f;
    --kl-pewter-800: #5e4a39;
    --kl-crimson-400: #ec5a60;
    --kl-crimson-500: #c42a33;
    --kl-crimson-700: #a8192a;

    /* Hues. */
    --kl-indigo-300: #a5abff;
    --kl-indigo-400: #8b93ff;
    --kl-indigo-600: #4f46e5;
    --kl-periwinkle-400: #8aa6ff;
    --kl-periwinkle-700: #3554d1;
    --kl-teal-400: #6cb6c4;
    --kl-teal-700: #2a6a73;
    --kl-green-400: #5ad19a;
    --kl-green-700: #1f9d63;
    --kl-green-800: #177343;
    --kl-amber-400: #e8b86a;
    --kl-amber-700: #b7791f;
    --kl-amber-800: #845b00;
    --kl-red-400: #ef6f7a;
    --kl-red-700: #bf3242;
    --kl-red-800: #b3261e;
    --kl-violet-400: #c49bff;
    --kl-violet-700: #7b3fd1;

    /* Type. */
    --kl-font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;
    --kl-font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    --kl-font-serif-display: "Alegreya SC", "Iowan Old Style", Georgia, serif;
    --kl-font-old-style-display: "Fraunces Variable", "Fraunces", "Iowan Old Style", Georgia, serif;
    --kl-font-grotesk: "Hanken Grotesk Variable", "Hanken Grotesk", "Helvetica Neue", system-ui, sans-serif;
    --kl-font-technical-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --kl-font-geometric-display: "Space Grotesk Variable", "Space Grotesk", "Avenir Next", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
    --kl-font-condensed-display: "Oswald Variable", "Oswald", "Bahnschrift", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;

    /* Motion. */
    --kl-duration-1: 90ms;
    --kl-duration-2: 160ms;
    --kl-duration-3: 240ms;
    --kl-duration-4: 360ms;
    --kl-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --kl-ease-in-out: cubic-bezier(0.6, 0, 0.3, 1);
  }

  /* ── 2. Semantic: tokens derived from other semantic tokens ──────────────
   * Declared on every element that sets a scheme or a skin, so a derived token
   * always follows the element's own values (a custom property's var() resolves
   * where it is declared, not where it is used). Skins below may override any
   * of them. --m-brand-font-body and --m-brand-font-display come from a Brand
   * (BrandProvider, or brandCss() for server pages); unset, the skin decides. */

  :where(:root, [data-theme], [data-skin]) {
    --m-signal: var(--m-accent);
    --m-signal-soft: var(--m-accent-soft);
    --m-signal-text: var(--m-accent);
    --m-signal-contrast: var(--m-accent-contrast);
    --m-accent-strong: var(--m-text);
    --m-select: var(--m-accent);
    --m-select-soft: var(--m-accent-soft);
    --m-mark: var(--m-warning);
    --m-mark-soft: var(--m-warning-soft);
    --m-font-sans: var(--m-brand-font-body, var(--kl-font-sans)); /* a Brand's body font, when one is set */
    --m-font-mono: var(--kl-font-mono);
    --m-font-display: var(--m-brand-font-display, var(--m-font-sans)); /* a Brand's display font, when one is set */
    --m-radius-xs: 4px; /* chips, tags, small buttons inside a control */
    --m-radius-sm: 6px; /* list rows, menu items, icon buttons */
    --m-radius-md: 8px; /* cards, sections, popovers */
    --m-radius-lg: 12px; /* dialogs, sheets, large panels */
    --m-radius-control: var(--m-radius-sm); /* buttons, text fields, segmented controls: pill or square without touching cards */
    --m-shadow-raised: inset 0 1px 0 0 var(--m-highlight), 0 1px 2px 0 rgb(0 0 0 / 0.18); /* raised buttons and handles */
    --m-shadow-popover: 0 12px 32px -12px rgb(0 0 0 / 0.6);
    --m-shadow-overlay: 0 24px 64px -12px rgb(0 0 0 / 0.6); /* dialogs, drawers and panels over a scrim */
    --m-shadow-glow: 0 0 0 1px var(--m-accent-soft); /* selected cards and slots */
    --m-focus-width: 3px; /* reach of the focus halo */
    --m-focus-edge: var(--m-accent); /* the solid 1px line inside the halo; measured at 3:1 */
    --m-icon-stroke: 2; /* stroke width of every Lucide icon */
    --m-font-features: var(--m-brand-font-features, "cv11", "ss01", "ss03"); /* Inter's stylistic sets; normal under a Brand body font */
    --m-heading-weight: 600; /* headings, dialog and panel titles */
    --m-heading-tracking: -0.01em; /* heading letter spacing; the page title (PageLayout) sets it at twice this */
    --m-heading-case: none; /* text-transform of headings (page title, brand name): none or uppercase */
    --m-title-font: var(--m-font-sans); /* font of component titles (Section, Modal, panels); the display face in a skin that wants one */
    --m-title-tracking: 0em; /* letter spacing of component titles */
    --m-label-case: none; /* text-transform of field labels */
    --m-label-tracking: 0em; /* letter spacing added to labels; eyebrow labels (always uppercase) add it to their own */
    --m-eyebrow-font: var(--m-font-mono); /* font of small uppercase eyebrow labels (stat labels, nav section labels) */
    --m-button-font: var(--m-font-sans); /* font of buttons */
    --m-button-case: none; /* text-transform of button text */
    --m-button-tracking: 0em; /* letter spacing of button text */
    --m-nav-case: none; /* text-transform of navigation items (type-nav, LeftNav items) */
    --m-nav-tracking: 0em; /* letter spacing of navigation items */
    --m-border-width: 1px; /* border width of cards and controls */
    --m-border-control: color-mix(in oklab, var(--m-bg-elevated), var(--m-text) 46%); /* a text field's, select's and combobox's border: 3:1 against --m-bg-elevated (WCAG 1.4.11); separators and cards keep --m-border */
    --m-edge-width: var(--m-border-width); /* a card's accent edge (the top border with the edge prop); equal to the border until a skin raises it */
    --m-edge-color: var(--m-border); /* colour of the accent edge; the skin's accent when it has an edge */
    --m-edge-neutral: var(--m-border); /* colour of the neutral edge (edge="neutral") */
    --m-radius-pill: 9999px; /* pills, chips, avatars, switch tracks: stays round in a square skin */
    --m-on-dark-text: #ededf0; /* text on --m-bg-dark (snapshot chips, captions) */
    --m-on-dark-mark: var(--kl-amber-400); /* mark colour on --m-bg-dark */
    --m-on-dark-danger: var(--kl-red-400); /* danger colour on --m-bg-dark */
    --m-bg-dark: var(--kl-zinc-990); /* stays dark in both themes: a ground for pictures drawn for a dark background */
    --m-dur-1: var(--kl-duration-1); /* hover, press */
    --m-dur-2: var(--kl-duration-2); /* popovers, tabs, toggles */
    --m-dur-3: var(--kl-duration-3); /* panels, sheets */
    --m-dur-4: var(--kl-duration-4); /* large moves */
    --m-ease-out: var(--kl-ease-out);
    --m-ease-in-out: var(--kl-ease-in-out);
    --m-message-user-bg: var(--m-accent-soft); /* the fill of a user's turn in a chat thread */
    --m-message-radius: var(--m-radius-lg); /* corners of a chat message's fill (a user turn, a bubble) */
    --m-message-gap: 20px; /* space between chat messages */
    --m-message-max: 46rem; /* reading width of a chat thread's messages */
    --m-auth-backdrop: none; /* the tessellation behind the auth page (.m-auth, AuthCard page): `block` draws it, `none` leaves the plain ground */
    --m-eyebrow-tile: none; /* the small signal tile before an eyebrow label (.m-eyebrow-tile, PageLayout eyebrow): `block` shows it, `none` hides it */
    --m-bar-bg: var(--m-bg-elevated); /* frame: global bar (one step lighter than the page, white in lattice light) */
    --m-crumb-bg: var(--m-bg); /* frame: breadcrumb row (the page ground) */
    --m-bar-border: var(--m-border); /* frame: hairline under the bar */
    --m-rail-bg: var(--m-bg-elevated); /* frame: product rail */
    --m-rail-border: var(--m-border); /* frame: hairline right of the rail */
    --m-rail-current-bg: var(--m-bg-subtle); /* frame: current rail item */
    --m-staff: #70549b; /* frame: staff bar fill; the bar only, never text or a line */
    --m-staff-contrast: #ffffff; /* frame: text on the staff bar */
    --m-primary-bg: var(--m-accent); /* frame: primary button fill (the frame sets the signal) */
    --m-primary-fg: var(--m-accent-contrast); /* frame: primary button text */
    --m-primary-hover-bg: var(--m-accent); /* frame: primary hover fill (the frame sets ink) */
    --m-primary-hover-fg: var(--m-accent-contrast); /* frame: primary hover text */
    --m-shadow-card: none; /* frame: card shadow; none is the hairline card */
    --m-pill-case: uppercase; /* status pill text-transform: uppercase or none */
    --m-pill-tracking: 0.04em; /* status pill letter spacing (frame: 0.08em) */
    --m-tile-radius: 18%; /* corner of a laid tile, as a share of its side */
    --m-tile-hover-opacity: 0.6; /* nav tile opacity on hover */
    --m-tile-art-strength: 1; /* tile artwork strength, 0 to 1 (frame: 0.5); see .m-tile-art */
  }

  /* ── 3. Component tokens (density "comfortable" by default) ──────────────
   * Declared on :root and on skinned elements only, so a nested data-theme or
   * data-density keeps the body size and control size it inherits. A density
   * element derives --m-control-h again itself (skins.css, layer design.modes). */

  :where(:root, [data-skin]) {
    --m-font-size-body: 0.875rem;
    --m-line-height-body: 1.5;
    --m-control-size: 2rem; /* control height on a mouse or pen; skins, density and data-controls set it */
    --m-control-h: var(--m-control-size); /* what controls use: --m-control-size, at least --m-touch-target on touch */
    --m-control-h-sm: 1.5rem;
    --m-touch-target: 44px; /* minimum hit area on coarse pointers */
    --m-input-font-size: 0.8125rem; /* text in fields (inputs, selects, textareas); 16px on touch */
    --m-page-title-size: 1.25rem; /* size of the page title (the h1 of PageLayout) */
    --m-page-title-leading: 1.4; /* line height of the page title; an app that sets a large title (a clamp up to 132px) tightens it to about 1 */
    --m-nav-h: 48px;
    --m-sticky-top: calc(var(--m-nav-h) + env(safe-area-inset-top, 0px)); /* where sticky parts of a page stick: just under the sticky TopNav; an app with its own banner raises it */
    --m-row-h: 32px; /* row height of windowed lists (Combobox); 44px on touch */
    --m-overlay: rgb(0 0 0 / 0.55); /* the scrim behind dialogs and drawers */
    --m-type-scale: 1; /* multiplies every text size (text-xs to text-xl); Lucide icons scale by half as much; ambient density sets 2 */
    --m-timeout-scale: 1; /* multiplies the default life of a toast; ambient density sets 2.5. A toast with its own duration is left alone */
    --m-input-font-floor: 16px; /* the least field text on touch (iOS zooms into smaller); ambient density raises it, nothing lowers it */
    --m-hover-reveal: 0; /* opacity of a control that appears on hover (row actions) before it does; ambient density sets 1, so nothing waits for a pointer */
    --m-font-size-display-1: 6rem; /* the largest display size (a clock); ambient density sets about 300px, fluid with the viewport */
    --m-font-size-display-2: 3rem; /* a headline on a display; ambient density sets 64px */
    --m-font-size-display-3: 2rem; /* an item or a value on a display; ambient density sets 40px */
    --m-font-size-display-4: 1.375rem; /* the smallest display size (a label, a caption); ambient density sets 28px */
    --m-line-height-display: 1.1; /* line height of the display sizes; a one-line clock tightens it to 1 */
  }

  /* ── Default skin: light (zero config, and data-theme="light") ─────────── */

  :where(:root),
  :where([data-theme="light"]) {
    --m-bg: var(--kl-zinc-25);
    --m-bg-elevated: var(--kl-zinc-0);
    --m-bg-subtle: var(--kl-zinc-50);
    --m-bg-inset: var(--kl-zinc-100);
    --m-surface-hover: #eeeef1;
    --m-text: #111114;
    --m-text-muted: var(--kl-zinc-600);
    --m-text-subtle: var(--kl-zinc-500);
    --m-border: var(--kl-zinc-150);
    --m-border-strong: var(--kl-zinc-200);
    --m-accent: var(--kl-indigo-600);
    --m-accent-soft: rgb(79 70 229 / 0.1);
    --m-accent-contrast: #ffffff;
    --m-info: var(--kl-teal-700);
    --m-info-soft: rgb(42 106 115 / 0.1);
    --m-success: var(--kl-green-800);
    --m-success-soft: rgb(31 157 99 / 0.12);
    --m-warning: var(--kl-amber-800);
    --m-warning-soft: rgb(183 121 31 / 0.12);
    --m-danger: var(--kl-red-700);
    --m-danger-soft: rgb(201 53 69 / 0.1);
    --m-focus: rgb(79 70 229 / 0.35);
    --m-highlight: rgb(255 255 255 / 0.6);
    --m-shadow-popover: 0 16px 40px -18px rgb(20 20 30 / 0.28);
    --m-syn-comment: #7a8296;
    --m-syn-keyword: var(--kl-violet-700);
    --m-syn-string: #15803d;
    --m-syn-number: #b45309;
    --m-syn-function: var(--kl-indigo-600);
    --m-syn-tag: #c2344d;
    --m-syn-property: #0e7490;
    --m-syn-punctuation: #5b6478;
    --m-staff-line: var(--m-staff);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where(:root:not([data-theme="light"])) {
      --m-bg: var(--kl-zinc-950);
      --m-bg-elevated: var(--kl-zinc-900);
      --m-bg-subtle: var(--kl-zinc-850);
      --m-bg-inset: var(--kl-zinc-990);
      --m-surface-hover: var(--kl-zinc-800);
      --m-text: #ededf0;
      --m-text-muted: #b3b3bb;
      --m-text-subtle: #85858f;
      --m-border: #27272c;
      --m-border-strong: var(--kl-zinc-700);
      --m-accent: var(--kl-indigo-400);
      --m-accent-soft: rgb(139 147 255 / 0.16);
      --m-accent-contrast: var(--kl-zinc-950);
      --m-info: var(--kl-teal-400);
      --m-info-soft: rgb(108 182 196 / 0.13);
      --m-success: var(--kl-green-400);
      --m-success-soft: rgb(90 209 154 / 0.14);
      --m-warning: var(--kl-amber-400);
      --m-warning-soft: rgb(232 184 106 / 0.14);
      --m-danger: var(--kl-red-400);
      --m-danger-soft: rgb(239 111 122 / 0.14);
      --m-focus: rgb(139 147 255 / 0.5);
      --m-highlight: rgb(255 255 255 / 0.05);
      --m-shadow-popover: 0 12px 32px -12px rgb(0 0 0 / 0.6);
      --m-syn-comment: #6b7385;
      --m-syn-keyword: var(--kl-violet-400);
      --m-syn-string: #7fd8a6;
      --m-syn-number: #f0b774;
      --m-syn-function: var(--kl-indigo-300);
      --m-syn-tag: #ff8f9d;
      --m-syn-property: #7fcfe8;
      --m-syn-punctuation: #8b93a5;
      --m-staff-line: #b6a0da;
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-theme="dark"]) {
    --m-bg: var(--kl-zinc-950);
    --m-bg-elevated: var(--kl-zinc-900);
    --m-bg-subtle: var(--kl-zinc-850);
    --m-bg-inset: var(--kl-zinc-990);
    --m-surface-hover: var(--kl-zinc-800);
    --m-text: #ededf0;
    --m-text-muted: #b3b3bb;
    --m-text-subtle: #85858f;
    --m-border: #27272c;
    --m-border-strong: var(--kl-zinc-700);
    --m-accent: var(--kl-indigo-400);
    --m-accent-soft: rgb(139 147 255 / 0.16);
    --m-accent-contrast: var(--kl-zinc-950);
    --m-info: var(--kl-teal-400);
    --m-info-soft: rgb(108 182 196 / 0.13);
    --m-success: var(--kl-green-400);
    --m-success-soft: rgb(90 209 154 / 0.14);
    --m-warning: var(--kl-amber-400);
    --m-warning-soft: rgb(232 184 106 / 0.14);
    --m-danger: var(--kl-red-400);
    --m-danger-soft: rgb(239 111 122 / 0.14);
    --m-focus: rgb(139 147 255 / 0.5);
    --m-highlight: rgb(255 255 255 / 0.05);
    --m-shadow-popover: 0 12px 32px -12px rgb(0 0 0 / 0.6);
    --m-syn-comment: #6b7385;
    --m-syn-keyword: var(--kl-violet-400);
    --m-syn-string: #7fd8a6;
    --m-syn-number: #f0b774;
    --m-syn-function: var(--kl-indigo-300);
    --m-syn-tag: #ff8f9d;
    --m-syn-property: #7fcfe8;
    --m-syn-punctuation: #8b93a5;
    --m-staff-line: #b6a0da;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }
}

/*
 * Built-in skins. Generated from src/tokens/*.ts by `pnpm docs:gen`; edit those, not this file.
 * Each is made with defineSkin() in src/tokens/skins.ts; see
 * packages/design/docs/STYLE_GUIDE.md, "Make a new skin". `control` is the worked example.
 *
 * Each skin has three blocks, in this order (all zero specificity):
 *   light       :where([data-skin="x"])
 *   OS dark     @media (prefers-color-scheme: dark) :where([data-skin="x"]:not([data-theme="light"]))
 *   forced dark :where([data-skin="x"][data-theme="dark"])
 *
 * A skin with accent variants adds the same three blocks per variant, keyed on
 * [data-skin="x"][data-accent="y"] and holding only the accent ramp; they follow the skin's own.
 *
 * The skins sit in the design.skins layer, density and the floors in
 * design.modes after it (tokens.css explains the order).
 */

@layer design.defaults, design.skins, design.modes;

@layer design.skins {
  /* ── control: Dense operator tools (the Control Center): blue-black ink grounds, periwinkle accent, compact density (30px controls, 13px body). */

  :where([data-skin="control"]) {
    --m-font-size-body: 0.8125rem;
    --m-line-height-body: 1.45;
    --m-control-size: 1.875rem;
    --m-bg-dark: var(--kl-ink-990);
    --m-message-gap: 12px;
    --m-message-radius: var(--m-radius-sm);
    --m-message-max: 56rem;
    --m-bg: var(--kl-ink-25);
    --m-bg-elevated: var(--kl-ink-0);
    --m-bg-subtle: var(--kl-ink-50);
    --m-bg-inset: var(--kl-ink-100);
    --m-surface-hover: var(--kl-ink-75);
    --m-text: #0f1623;
    --m-text-muted: var(--kl-ink-600);
    --m-text-subtle: var(--kl-ink-500);
    --m-border: var(--kl-ink-150);
    --m-border-strong: var(--kl-ink-200);
    --m-accent: var(--kl-periwinkle-700);
    --m-accent-soft: rgb(53 84 209 / 0.1);
    --m-accent-contrast: #ffffff;
    --m-info: var(--kl-periwinkle-700);
    --m-info-soft: rgb(53 84 209 / 0.1);
    --m-focus: rgb(53 84 209 / 0.35);
    --m-syn-function: var(--kl-periwinkle-700);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="control"]:not([data-theme="light"])) {
      --m-bg: var(--kl-ink-950);
      --m-bg-elevated: var(--kl-ink-900);
      --m-bg-subtle: var(--kl-ink-850);
      --m-bg-inset: var(--kl-ink-990);
      --m-surface-hover: var(--kl-ink-800);
      --m-text: #eef0f5;
      --m-text-muted: #b4bac6;
      --m-text-subtle: #7d8494;
      --m-border: var(--kl-ink-750);
      --m-border-strong: var(--kl-ink-700);
      --m-accent: var(--kl-periwinkle-400);
      --m-accent-soft: rgb(138 166 255 / 0.16);
      --m-accent-contrast: var(--kl-ink-950);
      --m-info: var(--kl-periwinkle-400);
      --m-info-soft: rgb(138 166 255 / 0.16);
      --m-focus: rgb(138 166 255 / 0.5);
      --m-syn-function: var(--kl-periwinkle-400);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="control"][data-theme="dark"]) {
    --m-syn-function: var(--kl-periwinkle-400);
    --m-focus: rgb(138 166 255 / 0.5);
    --m-info-soft: rgb(138 166 255 / 0.16);
    --m-info: var(--kl-periwinkle-400);
    --m-accent-contrast: var(--kl-ink-950);
    --m-accent-soft: rgb(138 166 255 / 0.16);
    --m-accent: var(--kl-periwinkle-400);
    --m-border-strong: var(--kl-ink-700);
    --m-border: var(--kl-ink-750);
    --m-text-subtle: #7d8494;
    --m-text-muted: #b4bac6;
    --m-text: #eef0f5;
    --m-surface-hover: var(--kl-ink-800);
    --m-bg-inset: var(--kl-ink-990);
    --m-bg-subtle: var(--kl-ink-850);
    --m-bg-elevated: var(--kl-ink-900);
    --m-bg: var(--kl-ink-950);
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── pewter: Calm consumer apps, dark first: graphite and silver grounds, pewter-copper accent, crimson signal for the one call to action, serif display face. */

  :where([data-skin="pewter"]) {
    --m-font-display: var(--m-brand-font-display, var(--kl-font-serif-display));
    --m-bg-dark: #070708;
    --m-message-user-bg: var(--m-bg-subtle);
    --m-message-gap: 28px;
    --m-message-radius: 16px;
    --m-message-max: 40rem;
    --m-bg: var(--kl-silver-50);
    --m-bg-elevated: var(--kl-silver-25);
    --m-bg-subtle: var(--kl-silver-100);
    --m-bg-inset: var(--kl-silver-150);
    --m-surface-hover: #e2e3e7;
    --m-text: #131316;
    --m-text-muted: #44454c;
    --m-text-subtle: #5f6068;
    --m-border: var(--kl-silver-200);
    --m-border-strong: var(--kl-silver-300);
    --m-accent: var(--kl-pewter-700);
    --m-accent-strong: var(--kl-pewter-800);
    --m-accent-soft: rgb(119 98 79 / 0.08);
    --m-accent-contrast: var(--kl-silver-25);
    --m-focus: rgb(119 98 79 / 0.45);
    --m-highlight: rgb(255 255 255 / 0.8);
    --m-signal: var(--kl-crimson-700);
    --m-signal-soft: rgb(168 25 42 / 0.09);
    --m-signal-text: var(--kl-crimson-700);
    --m-signal-contrast: #ffffff;
    --m-success: var(--kl-green-800);
    --m-success-soft: rgb(23 115 67 / 0.08);
    --m-warning: var(--kl-amber-800);
    --m-warning-soft: rgb(138 95 0 / 0.1);
    --m-danger: var(--kl-red-800);
    --m-danger-soft: rgb(179 38 30 / 0.09);
    --m-info: var(--kl-teal-700);
    --m-info-soft: rgb(42 106 115 / 0.1);
    --m-mark: #8a6a3a;
    --m-mark-soft: rgb(138 106 58 / 0.12);
    --m-select: #1f6fb2;
    --m-select-soft: rgb(31 111 178 / 0.12);
    --m-shadow-popover: 0 16px 40px -18px rgb(20 20 30 / 0.28);
    --m-shadow-glow: 0 0 0 1px rgb(119 98 79 / 0.35), 0 0 22px -10px rgb(119 98 79 / 0.4);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="pewter"]:not([data-theme="light"])) {
      --m-bg: var(--kl-graphite-950);
      --m-bg-elevated: var(--kl-graphite-900);
      --m-bg-subtle: var(--kl-graphite-850);
      --m-bg-inset: #070708;
      --m-surface-hover: var(--kl-graphite-800);
      --m-text: #ececee;
      --m-text-muted: #b4b4ba;
      --m-text-subtle: #88888f;
      --m-border: var(--kl-graphite-750);
      --m-border-strong: var(--kl-graphite-700);
      --m-accent: var(--kl-pewter-400);
      --m-accent-strong: var(--kl-pewter-300);
      --m-accent-soft: rgb(185 166 152 / 0.13);
      --m-accent-contrast: var(--kl-graphite-950);
      --m-focus: rgb(185 166 152 / 0.6);
      --m-highlight: rgb(255 255 255 / 0.045);
      --m-signal: var(--kl-crimson-500);
      --m-signal-soft: rgb(196 42 51 / 0.16);
      --m-signal-text: var(--kl-crimson-400);
      --m-signal-contrast: #ffffff;
      --m-success: #6fcf93;
      --m-success-soft: rgb(111 207 147 / 0.13);
      --m-warning: #e9c46a;
      --m-warning-soft: rgb(233 196 106 / 0.12);
      --m-danger: #ff6b7a;
      --m-danger-soft: rgb(255 107 122 / 0.13);
      --m-info: #86bcc4;
      --m-info-soft: rgb(134 188 196 / 0.12);
      --m-mark: #dcc3a0;
      --m-mark-soft: rgb(220 195 160 / 0.12);
      --m-select: #5aa9e6;
      --m-select-soft: rgb(90 169 230 / 0.16);
      --m-shadow-popover: 0 1px 0 0 rgb(255 255 255 / 0.04) inset, 0 16px 40px -16px rgb(0 0 0 / 0.8);
      --m-shadow-glow: 0 0 0 1px rgb(185 166 152 / 0.4), 0 0 26px -10px rgb(185 166 152 / 0.45);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="pewter"][data-theme="dark"]) {
    --m-shadow-glow: 0 0 0 1px rgb(185 166 152 / 0.4), 0 0 26px -10px rgb(185 166 152 / 0.45);
    --m-shadow-popover: 0 1px 0 0 rgb(255 255 255 / 0.04) inset, 0 16px 40px -16px rgb(0 0 0 / 0.8);
    --m-select-soft: rgb(90 169 230 / 0.16);
    --m-select: #5aa9e6;
    --m-mark-soft: rgb(220 195 160 / 0.12);
    --m-mark: #dcc3a0;
    --m-info-soft: rgb(134 188 196 / 0.12);
    --m-info: #86bcc4;
    --m-danger-soft: rgb(255 107 122 / 0.13);
    --m-danger: #ff6b7a;
    --m-warning-soft: rgb(233 196 106 / 0.12);
    --m-warning: #e9c46a;
    --m-success-soft: rgb(111 207 147 / 0.13);
    --m-success: #6fcf93;
    --m-signal-contrast: #ffffff;
    --m-signal-text: var(--kl-crimson-400);
    --m-signal-soft: rgb(196 42 51 / 0.16);
    --m-signal: var(--kl-crimson-500);
    --m-highlight: rgb(255 255 255 / 0.045);
    --m-focus: rgb(185 166 152 / 0.6);
    --m-accent-contrast: var(--kl-graphite-950);
    --m-accent-soft: rgb(185 166 152 / 0.13);
    --m-accent-strong: var(--kl-pewter-300);
    --m-accent: var(--kl-pewter-400);
    --m-border-strong: var(--kl-graphite-700);
    --m-border: var(--kl-graphite-750);
    --m-text-subtle: #88888f;
    --m-text-muted: #b4b4ba;
    --m-text: #ececee;
    --m-surface-hover: var(--kl-graphite-800);
    --m-bg-inset: #070708;
    --m-bg-subtle: var(--kl-graphite-850);
    --m-bg-elevated: var(--kl-graphite-900);
    --m-bg: var(--kl-graphite-950);
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── foundry: Industrial and field-service tools: square, flat, hard borders, tracked capitals in a condensed display face, a top edge on cards. Safety orange on near-black (dark) or warm paper (light). */

  :where([data-skin="foundry"]) {
    --m-radius-pill: 9999px;
    --m-radius-xs: 0px;
    --m-radius-sm: 0px;
    --m-radius-md: 0px;
    --m-radius-lg: 0px;
    --m-radius-control: 2px;
    --m-shadow-raised: 0 0 #00000000;
    --m-shadow-popover: 0 0 0 1px var(--m-border-strong);
    --m-shadow-overlay: 0 0 0 1px var(--m-border-strong);
    --m-heading-case: uppercase;
    --m-heading-tracking: 0.02em;
    --m-title-font: var(--m-font-display);
    --m-title-tracking: 0.02em;
    --m-label-case: uppercase;
    --m-label-tracking: 0.06em;
    --m-eyebrow-font: var(--m-font-sans);
    --m-button-font: var(--m-font-display);
    --m-button-case: uppercase;
    --m-button-tracking: 0.08em;
    --m-nav-case: uppercase;
    --m-nav-tracking: 0.06em;
    --m-border-width: 1px;
    --m-border: var(--m-border-strong);
    --m-edge-width: 3px;
    --m-edge-color: #ea580c;
    --m-edge-neutral: var(--m-border-strong);
    --m-font-display: var(--m-brand-font-display, var(--kl-font-condensed-display));
    --m-bg-dark: #050505;
    --m-message-radius: var(--m-radius-md);
    --m-bg: #f3f0e8;
    --m-bg-elevated: #fdfbf6;
    --m-bg-subtle: #e9e5da;
    --m-bg-inset: #e1dccf;
    --m-surface-hover: #e3dfd3;
    --m-text: #18181b;
    --m-text-muted: #4a4a52;
    --m-text-subtle: #62626b;
    --m-border-strong: #6b6b72;
    --m-accent: #b83c0a;
    --m-accent-soft: rgb(184 60 10 / 0.05);
    --m-accent-contrast: #ffffff;
    --m-signal: #f97316;
    --m-signal-soft: rgb(249 115 22 / 0.14);
    --m-signal-text: #b83c0a;
    --m-signal-contrast: #18181b;
    --m-focus: rgb(184 60 10 / 0.35);
    --m-highlight: rgb(255 255 255 / 0.6);
    --m-info: #1d5f9e;
    --m-info-soft: rgb(29 95 158 / 0.1);
    --m-success: #136c34;
    --m-success-soft: rgb(19 108 52 / 0.08);
    --m-warning: #7a4f00;
    --m-warning-soft: rgb(138 90 0 / 0.12);
    --m-danger: #b91c1c;
    --m-danger-soft: rgb(185 28 28 / 0.09);
    --m-mark: #7a4f00;
    --m-mark-soft: rgb(138 90 0 / 0.12);
    --m-select: #b83c0a;
    --m-select-soft: rgb(184 60 10 / 0.1);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="foundry"]:not([data-theme="light"])) {
      --m-bg: #0a0a0a;
      --m-bg-elevated: #18181b;
      --m-bg-subtle: #27272a;
      --m-bg-inset: #050505;
      --m-surface-hover: #2f2f33;
      --m-text: #f4f4f5;
      --m-text-muted: #a8a8b0;
      --m-text-subtle: #9c9ca5;
      --m-border-strong: #3f3f46;
      --m-accent: #f97316;
      --m-accent-soft: rgb(249 115 22 / 0.16);
      --m-accent-contrast: #0a0a0a;
      --m-signal: #f97316;
      --m-signal-soft: rgb(249 115 22 / 0.16);
      --m-signal-text: #f97316;
      --m-signal-contrast: #0a0a0a;
      --m-edge-color: var(--m-accent);
      --m-focus: rgb(249 115 22 / 0.5);
      --m-highlight: rgb(255 255 255 / 0.04);
      --m-info: #60a5fa;
      --m-info-soft: rgb(96 165 250 / 0.14);
      --m-success: #4ade80;
      --m-success-soft: rgb(74 222 128 / 0.13);
      --m-warning: #fbbf24;
      --m-warning-soft: rgb(251 191 36 / 0.13);
      --m-danger: #ff5a4d;
      --m-danger-soft: rgb(255 90 77 / 0.15);
      --m-mark: #fbbf24;
      --m-mark-soft: rgb(251 191 36 / 0.13);
      --m-select: #fb923c;
      --m-select-soft: rgb(251 146 60 / 0.16);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="foundry"][data-theme="dark"]) {
    --m-select-soft: rgb(251 146 60 / 0.16);
    --m-select: #fb923c;
    --m-mark-soft: rgb(251 191 36 / 0.13);
    --m-mark: #fbbf24;
    --m-danger-soft: rgb(255 90 77 / 0.15);
    --m-danger: #ff5a4d;
    --m-warning-soft: rgb(251 191 36 / 0.13);
    --m-warning: #fbbf24;
    --m-success-soft: rgb(74 222 128 / 0.13);
    --m-success: #4ade80;
    --m-info-soft: rgb(96 165 250 / 0.14);
    --m-info: #60a5fa;
    --m-highlight: rgb(255 255 255 / 0.04);
    --m-focus: rgb(249 115 22 / 0.5);
    --m-edge-color: var(--m-accent);
    --m-signal-contrast: #0a0a0a;
    --m-signal-text: #f97316;
    --m-signal-soft: rgb(249 115 22 / 0.16);
    --m-signal: #f97316;
    --m-accent-contrast: #0a0a0a;
    --m-accent-soft: rgb(249 115 22 / 0.16);
    --m-accent: #f97316;
    --m-border-strong: #3f3f46;
    --m-text-subtle: #9c9ca5;
    --m-text-muted: #a8a8b0;
    --m-text: #f4f4f5;
    --m-surface-hover: #2f2f33;
    --m-bg-inset: #050505;
    --m-bg-subtle: #27272a;
    --m-bg-elevated: #18181b;
    --m-bg: #0a0a0a;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── foundry · violet: the foundry skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="foundry"][data-accent="violet"]) {
    --m-accent: #6d28d9;
    --m-accent-soft: rgb(109 40 217 / 0.1);
    --m-accent-contrast: #ffffff;
    --m-focus: rgb(109 40 217 / 0.35);
    --m-signal: #6d28d9;
    --m-signal-soft: rgb(109 40 217 / 0.1);
    --m-signal-text: #6d28d9;
    --m-signal-contrast: #ffffff;
    --m-select: var(--m-accent);
    --m-select-soft: var(--m-accent-soft);
    --m-edge-color: var(--m-accent);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="foundry"][data-accent="violet"]:not([data-theme="light"])) {
      --m-accent: #a78bfa;
      --m-accent-soft: rgb(167 139 250 / 0.16);
      --m-accent-contrast: #050505;
      --m-focus: rgb(167 139 250 / 0.5);
      --m-signal: #a78bfa;
      --m-signal-soft: rgb(167 139 250 / 0.16);
      --m-signal-text: #a78bfa;
      --m-signal-contrast: #050505;
      --m-select: var(--m-accent);
      --m-select-soft: var(--m-accent-soft);
      --m-edge-color: var(--m-accent);
    }
  }

  :where([data-skin="foundry"][data-accent="violet"][data-theme="dark"]) {
    --m-edge-color: var(--m-accent);
    --m-select-soft: var(--m-accent-soft);
    --m-select: var(--m-accent);
    --m-signal-contrast: #050505;
    --m-signal-text: #a78bfa;
    --m-signal-soft: rgb(167 139 250 / 0.16);
    --m-signal: #a78bfa;
    --m-focus: rgb(167 139 250 / 0.5);
    --m-accent-contrast: #050505;
    --m-accent-soft: rgb(167 139 250 / 0.16);
    --m-accent: #a78bfa;
  }

  /* ── inscribed: Brand surfaces for engineers: bone on near-black (dark) or ink on warm stone (light), small radii, hairline borders, a serif display face, tracked capital labels. Copper is the one signal. */

  :where([data-skin="inscribed"]) {
    --m-radius-pill: 9999px;
    --m-radius-xs: 2px;
    --m-radius-sm: 2px;
    --m-radius-md: 3px;
    --m-radius-lg: 6px;
    --m-radius-control: 3px;
    --m-edge-width: 3px;
    --m-edge-color: #b8763d;
    --m-edge-neutral: var(--m-border-strong);
    --m-auth-backdrop: block;
    --m-eyebrow-tile: block;
    --m-font-display: var(--m-brand-font-display, var(--kl-font-old-style-display));
    --m-title-font: var(--m-font-display);
    --m-label-case: uppercase;
    --m-label-tracking: 0.08em;
    --m-focus-edge: var(--m-signal);
    --m-bg-dark: #07080a;
    --m-message-radius: var(--m-radius-md);
    --m-bg: #f4f2ed;
    --m-bg-elevated: #fbfaf7;
    --m-bg-subtle: #ece9e2;
    --m-bg-inset: #e7e3da;
    --m-surface-hover: #e4e0d6;
    --m-text: #111214;
    --m-text-muted: #4d4b46;
    --m-text-subtle: #66635d;
    --m-border: #dcd8cf;
    --m-border-strong: #8f8a80;
    --m-accent: #111214;
    --m-accent-strong: #000000;
    --m-accent-soft: rgb(17 18 20 / 0.06);
    --m-accent-contrast: #f4f2ed;
    --m-signal: #9c5f2a;
    --m-signal-soft: rgb(156 95 42 / 0.10);
    --m-signal-text: #8a5323;
    --m-signal-contrast: #ffffff;
    --m-focus: rgb(156 95 42 / 0.40);
    --m-highlight: rgb(255 255 255 / 0.6);
    --m-success: #1f6b3d;
    --m-success-soft: rgb(31 107 61 / 0.08);
    --m-warning: #7a5200;
    --m-warning-soft: rgb(122 82 0 / 0.10);
    --m-danger: #b42318;
    --m-danger-soft: rgb(180 35 24 / 0.08);
    --m-info: #285e86;
    --m-info-soft: rgb(40 94 134 / 0.08);
    --m-mark: #8a5323;
    --m-mark-soft: rgb(138 83 35 / 0.10);
    --m-select: #285e86;
    --m-select-soft: rgb(40 94 134 / 0.10);
    --m-shadow-popover: 0 10px 28px -16px rgb(17 18 20 / 0.28);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="inscribed"]:not([data-theme="light"])) {
      --m-bg: #0a0b0d;
      --m-bg-elevated: #121317;
      --m-bg-subtle: #16171c;
      --m-bg-inset: #07080a;
      --m-surface-hover: #1c1d22;
      --m-text: #e8e6e1;
      --m-text-muted: #a9a6a0;
      --m-text-subtle: #8a877f;
      --m-border: #24262c;
      --m-border-strong: #44464e;
      --m-accent: #e8e6e1;
      --m-accent-strong: #ffffff;
      --m-accent-soft: rgb(232 230 225 / 0.07);
      --m-accent-contrast: #0a0b0d;
      --m-signal: #c8915b;
      --m-signal-soft: rgb(200 145 91 / 0.14);
      --m-signal-text: #d9a877;
      --m-signal-contrast: #0a0b0d;
      --m-edge-color: #c8915b;
      --m-focus: rgb(200 145 91 / 0.55);
      --m-highlight: rgb(255 255 255 / 0.04);
      --m-success: #7ccf9a;
      --m-success-soft: rgb(124 207 154 / 0.13);
      --m-warning: #e6bf6a;
      --m-warning-soft: rgb(230 191 106 / 0.12);
      --m-danger: #f2787f;
      --m-danger-soft: rgb(242 120 127 / 0.13);
      --m-info: #8fb3c9;
      --m-info-soft: rgb(143 179 201 / 0.12);
      --m-mark: #d9a877;
      --m-mark-soft: rgb(217 168 119 / 0.12);
      --m-select: #8fb3c9;
      --m-select-soft: rgb(143 179 201 / 0.16);
      --m-shadow-popover: 0 0 0 1px var(--m-border), 0 10px 24px -14px rgb(0 0 0 / 0.7);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="inscribed"][data-theme="dark"]) {
    --m-shadow-popover: 0 0 0 1px var(--m-border), 0 10px 24px -14px rgb(0 0 0 / 0.7);
    --m-select-soft: rgb(143 179 201 / 0.16);
    --m-select: #8fb3c9;
    --m-mark-soft: rgb(217 168 119 / 0.12);
    --m-mark: #d9a877;
    --m-info-soft: rgb(143 179 201 / 0.12);
    --m-info: #8fb3c9;
    --m-danger-soft: rgb(242 120 127 / 0.13);
    --m-danger: #f2787f;
    --m-warning-soft: rgb(230 191 106 / 0.12);
    --m-warning: #e6bf6a;
    --m-success-soft: rgb(124 207 154 / 0.13);
    --m-success: #7ccf9a;
    --m-highlight: rgb(255 255 255 / 0.04);
    --m-focus: rgb(200 145 91 / 0.55);
    --m-edge-color: #c8915b;
    --m-signal-contrast: #0a0b0d;
    --m-signal-text: #d9a877;
    --m-signal-soft: rgb(200 145 91 / 0.14);
    --m-signal: #c8915b;
    --m-accent-contrast: #0a0b0d;
    --m-accent-soft: rgb(232 230 225 / 0.07);
    --m-accent-strong: #ffffff;
    --m-accent: #e8e6e1;
    --m-border-strong: #44464e;
    --m-border: #24262c;
    --m-text-subtle: #8a877f;
    --m-text-muted: #a9a6a0;
    --m-text: #e8e6e1;
    --m-surface-hover: #1c1d22;
    --m-bg-inset: #07080a;
    --m-bg-subtle: #16171c;
    --m-bg-elevated: #121317;
    --m-bg: #0a0b0d;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── inscribed · lapis: the inscribed skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="inscribed"][data-accent="lapis"]) {
    --m-signal: #4930cf;
    --m-signal-soft: rgb(73 48 207 / 0.1);
    --m-signal-text: #4930cf;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #4930cf;
    --m-focus: rgb(73 48 207 / 0.35);
    --m-mark: #4930cf;
    --m-mark-soft: rgb(73 48 207 / 0.1);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="inscribed"][data-accent="lapis"]:not([data-theme="light"])) {
      --m-signal: #9c90ff;
      --m-signal-soft: rgb(156 144 255 / 0.16);
      --m-signal-text: #9c90ff;
      --m-signal-contrast: #07080a;
      --m-edge-color: #9c90ff;
      --m-focus: rgb(156 144 255 / 0.5);
      --m-mark: #9c90ff;
      --m-mark-soft: rgb(156 144 255 / 0.12);
    }
  }

  :where([data-skin="inscribed"][data-accent="lapis"][data-theme="dark"]) {
    --m-mark-soft: rgb(156 144 255 / 0.12);
    --m-mark: #9c90ff;
    --m-focus: rgb(156 144 255 / 0.5);
    --m-edge-color: #9c90ff;
    --m-signal-contrast: #07080a;
    --m-signal-text: #9c90ff;
    --m-signal-soft: rgb(156 144 255 / 0.16);
    --m-signal: #9c90ff;
  }

  /* ── inscribed · violet: the inscribed skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="inscribed"][data-accent="violet"]) {
    --m-signal: #8a2bb8;
    --m-signal-soft: rgb(138 43 184 / 0.1);
    --m-signal-text: #8a2bb8;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #8a2bb8;
    --m-focus: rgb(138 43 184 / 0.35);
    --m-mark: #8a2bb8;
    --m-mark-soft: rgb(138 43 184 / 0.1);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="inscribed"][data-accent="violet"]:not([data-theme="light"])) {
      --m-signal: #c98cf0;
      --m-signal-soft: rgb(201 140 240 / 0.16);
      --m-signal-text: #c98cf0;
      --m-signal-contrast: #07080a;
      --m-edge-color: #c98cf0;
      --m-focus: rgb(201 140 240 / 0.5);
      --m-mark: #c98cf0;
      --m-mark-soft: rgb(201 140 240 / 0.12);
    }
  }

  :where([data-skin="inscribed"][data-accent="violet"][data-theme="dark"]) {
    --m-mark-soft: rgb(201 140 240 / 0.12);
    --m-mark: #c98cf0;
    --m-focus: rgb(201 140 240 / 0.5);
    --m-edge-color: #c98cf0;
    --m-signal-contrast: #07080a;
    --m-signal-text: #c98cf0;
    --m-signal-soft: rgb(201 140 240 / 0.16);
    --m-signal: #c98cf0;
  }

  /* ── basalt: Platform and operator tools, dark first: volcanic graphite and one mineral-teal signal, sharp corners, flat elevation, brisk motion, compact density, Hanken Grotesk over Geist Mono. */

  :where([data-skin="basalt"]) {
    --m-radius-pill: 9999px;
    --m-radius-xs: 2px;
    --m-radius-sm: 3px;
    --m-radius-md: 4px;
    --m-radius-lg: 6px;
    --m-radius-control: 3px;
    --m-shadow-raised: 0 0 #00000000;
    --m-shadow-popover: 0 0 0 1px var(--m-border-strong);
    --m-shadow-overlay: 0 0 0 1px var(--m-border-strong);
    --m-dur-1: 68ms;
    --m-dur-2: 120ms;
    --m-dur-3: 180ms;
    --m-dur-4: 270ms;
    --m-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --m-font-size-body: 0.8125rem;
    --m-line-height-body: 1.45;
    --m-control-size: 1.875rem;
    --m-font-sans: var(--m-brand-font-body, var(--kl-font-grotesk));
    --m-font-display: var(--m-brand-font-display, var(--kl-font-grotesk));
    --m-font-mono: var(--kl-font-technical-mono);
    --m-font-features: normal;
    --m-bg-dark: #07090a;
    --m-message-radius: var(--m-radius-md);
    --m-bg: #eceff0;
    --m-bg-elevated: #f8fafa;
    --m-bg-subtle: #e3e7e9;
    --m-bg-inset: #d9dee0;
    --m-surface-hover: #dde2e4;
    --m-text: #0d1215;
    --m-text-muted: #3f484e;
    --m-text-subtle: #566167;
    --m-border: #d0d6d9;
    --m-border-strong: #929ca2;
    --m-accent: #006f65;
    --m-accent-soft: rgb(0 111 101 / 0.07);
    --m-accent-contrast: #ffffff;
    --m-signal: #00796d;
    --m-signal-soft: rgb(0 121 109 / 0.09);
    --m-signal-text: #006d62;
    --m-signal-contrast: #ffffff;
    --m-focus: rgb(0 111 101 / 0.4);
    --m-highlight: rgb(255 255 255 / 0.7);
    --m-success: #13663a;
    --m-success-soft: rgb(19 102 58 / 0.08);
    --m-warning: #7a5400;
    --m-warning-soft: rgb(122 84 0 / 0.1);
    --m-danger: #ad2536;
    --m-danger-soft: rgb(173 37 54 / 0.07);
    --m-info: #245f69;
    --m-info-soft: rgb(36 95 105 / 0.08);
    --m-mark: #7a5400;
    --m-mark-soft: rgb(122 84 0 / 0.1);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="basalt"]:not([data-theme="light"])) {
      --m-bg: #0b0e10;
      --m-bg-elevated: #13171a;
      --m-bg-subtle: #1a1f22;
      --m-bg-inset: #07090a;
      --m-surface-hover: #1f2326;
      --m-text: #eceeef;
      --m-text-muted: #b0b5b9;
      --m-text-subtle: #81878c;
      --m-border: #232a2e;
      --m-border-strong: #353e43;
      --m-accent: #1fb5a6;
      --m-accent-soft: rgb(31 181 166 / 0.16);
      --m-accent-contrast: #050608;
      --m-signal: #2ad4c0;
      --m-signal-soft: rgb(42 212 192 / 0.16);
      --m-signal-text: #2ad4c0;
      --m-signal-contrast: #050608;
      --m-focus: rgb(31 181 166 / 0.5);
      --m-highlight: rgb(255 255 255 / 0.05);
      --m-success: #5ad19a;
      --m-success-soft: rgb(90 209 154 / 0.14);
      --m-warning: #e8b86a;
      --m-warning-soft: rgb(232 184 106 / 0.14);
      --m-danger: #ef6f7a;
      --m-danger-soft: rgb(239 111 122 / 0.14);
      --m-info: #6cb6c4;
      --m-info-soft: rgb(108 182 196 / 0.13);
      --m-mark: #e8b86a;
      --m-mark-soft: rgb(232 184 106 / 0.14);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="basalt"][data-theme="dark"]) {
    --m-mark-soft: rgb(232 184 106 / 0.14);
    --m-mark: #e8b86a;
    --m-info-soft: rgb(108 182 196 / 0.13);
    --m-info: #6cb6c4;
    --m-danger-soft: rgb(239 111 122 / 0.14);
    --m-danger: #ef6f7a;
    --m-warning-soft: rgb(232 184 106 / 0.14);
    --m-warning: #e8b86a;
    --m-success-soft: rgb(90 209 154 / 0.14);
    --m-success: #5ad19a;
    --m-highlight: rgb(255 255 255 / 0.05);
    --m-focus: rgb(31 181 166 / 0.5);
    --m-signal-contrast: #050608;
    --m-signal-text: #2ad4c0;
    --m-signal-soft: rgb(42 212 192 / 0.16);
    --m-signal: #2ad4c0;
    --m-accent-contrast: #050608;
    --m-accent-soft: rgb(31 181 166 / 0.16);
    --m-accent: #1fb5a6;
    --m-border-strong: #353e43;
    --m-border: #232a2e;
    --m-text-subtle: #81878c;
    --m-text-muted: #b0b5b9;
    --m-text: #eceeef;
    --m-surface-hover: #1f2326;
    --m-bg-inset: #07090a;
    --m-bg-subtle: #1a1f22;
    --m-bg-elevated: #13171a;
    --m-bg: #0b0e10;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── basalt-home: Household screens such as the kitchen board: basalt's type with warm charcoal grounds and paper, one lamp-yellow signal, softer corners. Made for ambient density. */

  :where([data-skin="basalt-home"]) {
    --m-font-sans: var(--m-brand-font-body, var(--kl-font-grotesk));
    --m-font-display: var(--m-brand-font-display, var(--kl-font-grotesk));
    --m-font-mono: var(--kl-font-technical-mono);
    --m-font-features: normal;
    --m-bg-dark: #110f0c;
    --m-bg: #f4efe4;
    --m-bg-elevated: #fdfaf3;
    --m-bg-subtle: #ebe4d5;
    --m-bg-inset: #e4dccb;
    --m-surface-hover: #e8e0cf;
    --m-text: #1f1a12;
    --m-text-muted: #554c3e;
    --m-text-subtle: #6b6253;
    --m-border: #ddd4c1;
    --m-border-strong: #c4b9a2;
    --m-accent: #736600;
    --m-accent-soft: rgb(115 102 0 / 0.07);
    --m-accent-contrast: #ffffff;
    --m-signal: #736600;
    --m-signal-soft: rgb(115 102 0 / 0.07);
    --m-signal-text: #736600;
    --m-signal-contrast: #ffffff;
    --m-focus: rgb(115 102 0 / 0.35);
    --m-highlight: rgb(255 255 255 / 0.6);
    --m-success: #177343;
    --m-success-soft: rgb(23 115 67 / 0.08);
    --m-warning: #845b00;
    --m-warning-soft: rgb(183 121 31 / 0.12);
    --m-danger: #bf3242;
    --m-danger-soft: rgb(191 50 66 / 0.04);
    --m-info: #2a6a73;
    --m-info-soft: rgb(42 106 115 / 0.1);
    --m-mark: #845b00;
    --m-mark-soft: rgb(183 121 31 / 0.12);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="basalt-home"]:not([data-theme="light"])) {
      --m-bg: #1d1a16;
      --m-bg-elevated: #26231e;
      --m-bg-subtle: #2e2a24;
      --m-bg-inset: #161310;
      --m-surface-hover: #36312a;
      --m-text: #f3eee3;
      --m-text-muted: #c0b8a9;
      --m-text-subtle: #a0978a;
      --m-border: #38332b;
      --m-border-strong: #4d463b;
      --m-accent: #e6d34f;
      --m-accent-soft: rgb(230 211 79 / 0.16);
      --m-accent-contrast: #161310;
      --m-signal: #e6d34f;
      --m-signal-soft: rgb(230 211 79 / 0.16);
      --m-signal-text: #e6d34f;
      --m-signal-contrast: #161310;
      --m-focus: rgb(230 211 79 / 0.5);
      --m-highlight: rgb(255 255 255 / 0.05);
      --m-success: #5ad19a;
      --m-success-soft: rgb(90 209 154 / 0.14);
      --m-warning: #e8b86a;
      --m-warning-soft: rgb(232 184 106 / 0.14);
      --m-danger: #ef6f7a;
      --m-danger-soft: rgb(239 111 122 / 0.1);
      --m-info: #6cb6c4;
      --m-info-soft: rgb(108 182 196 / 0.13);
      --m-mark: #e8b86a;
      --m-mark-soft: rgb(232 184 106 / 0.14);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="basalt-home"][data-theme="dark"]) {
    --m-mark-soft: rgb(232 184 106 / 0.14);
    --m-mark: #e8b86a;
    --m-info-soft: rgb(108 182 196 / 0.13);
    --m-info: #6cb6c4;
    --m-danger-soft: rgb(239 111 122 / 0.1);
    --m-danger: #ef6f7a;
    --m-warning-soft: rgb(232 184 106 / 0.14);
    --m-warning: #e8b86a;
    --m-success-soft: rgb(90 209 154 / 0.14);
    --m-success: #5ad19a;
    --m-highlight: rgb(255 255 255 / 0.05);
    --m-focus: rgb(230 211 79 / 0.5);
    --m-signal-contrast: #161310;
    --m-signal-text: #e6d34f;
    --m-signal-soft: rgb(230 211 79 / 0.16);
    --m-signal: #e6d34f;
    --m-accent-contrast: #161310;
    --m-accent-soft: rgb(230 211 79 / 0.16);
    --m-accent: #e6d34f;
    --m-border-strong: #4d463b;
    --m-border: #38332b;
    --m-text-subtle: #a0978a;
    --m-text-muted: #c0b8a9;
    --m-text: #f3eee3;
    --m-surface-hover: #36312a;
    --m-bg-inset: #161310;
    --m-bg-subtle: #2e2a24;
    --m-bg-elevated: #26231e;
    --m-bg: #1d1a16;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── lattice: Company and product surfaces: ink on warm paper (light) or paper on ink (dark), modular 4 and 8px corners, hairline borders instead of shadows, Space Grotesk titles over Inter. Signal Blue is the one signal. */

  :where([data-skin="lattice"]) {
    --m-radius-pill: 9999px;
    --m-radius-xs: 2px;
    --m-radius-sm: 4px;
    --m-radius-md: 8px;
    --m-radius-lg: 12px;
    --m-radius-control: 6px;
    --m-shadow-raised: 0 0 #00000000;
    --m-shadow-glow: 0 0 0 1px var(--m-signal-soft);
    --m-eyebrow-tile: block;
    --m-font-display: var(--m-brand-font-display, var(--kl-font-geometric-display));
    --m-title-font: var(--m-font-display);
    --m-heading-tracking: -0.02em;
    --m-title-tracking: -0.01em;
    --m-focus-edge: var(--m-signal);
    --m-bg-dark: #15171c;
    --m-message-radius: var(--m-radius-md);
    --m-bg: #f6f5f1;
    --m-bg-elevated: #ffffff;
    --m-bg-subtle: #efede8;
    --m-bg-inset: #e9e7e1;
    --m-surface-hover: #ecebe5;
    --m-text: #15171c;
    --m-text-muted: #4d5264;
    --m-text-subtle: #646979;
    --m-border: #dedcd5;
    --m-border-strong: #a6a39a;
    --m-accent: #15171c;
    --m-accent-strong: #000000;
    --m-accent-soft: rgb(21 23 28 / 0.06);
    --m-accent-contrast: #f6f5f1;
    --m-signal: #2e6aff;
    --m-signal-soft: rgb(46 106 255 / 0.10);
    --m-signal-text: #1f4fd6;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #2e6aff;
    --m-focus: rgb(46 106 255 / 0.35);
    --m-highlight: rgb(255 255 255 / 0.6);
    --m-select: #1f4fd6;
    --m-select-soft: rgb(46 106 255 / 0.10);
    --m-success: #1d6b3c;
    --m-success-soft: rgb(29 107 60 / 0.08);
    --m-warning: #7a5200;
    --m-warning-soft: rgb(122 82 0 / 0.10);
    --m-danger: #b42318;
    --m-danger-soft: rgb(180 35 24 / 0.08);
    --m-info: #1e6475;
    --m-info-soft: rgb(30 100 117 / 0.08);
    --m-mark: #7a5200;
    --m-mark-soft: rgb(122 82 0 / 0.10);
    --m-shadow-popover: 0 0 0 1px var(--m-border), 0 12px 32px -18px rgb(21 23 28 / 0.22);
    --m-shadow-overlay: 0 0 0 1px var(--m-border), 0 24px 64px -24px rgb(21 23 28 / 0.3);
    --m-show-light: block;
    --m-show-dark: none;
    --m-scheme-light: 1;
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"]:not([data-theme="light"])) {
      --m-bg: #15171c;
      --m-bg-elevated: #1e2127;
      --m-bg-subtle: #24272e;
      --m-bg-inset: #101216;
      --m-surface-hover: #2a2e36;
      --m-text: #f6f5f1;
      --m-text-muted: #a8adb9;
      --m-text-subtle: #8b909c;
      --m-border: #33373f;
      --m-border-strong: #4b505a;
      --m-accent: #f6f5f1;
      --m-accent-strong: #ffffff;
      --m-accent-soft: rgb(246 245 241 / 0.07);
      --m-accent-contrast: #15171c;
      --m-signal: #2e6aff;
      --m-signal-soft: rgb(46 106 255 / 0.18);
      --m-signal-text: #8aaaff;
      --m-signal-contrast: #ffffff;
      --m-edge-color: #2e6aff;
      --m-focus: rgb(46 106 255 / 0.55);
      --m-highlight: rgb(255 255 255 / 0.04);
      --m-select: #8aaaff;
      --m-select-soft: rgb(138 170 255 / 0.14);
      --m-success: #7ccf9a;
      --m-success-soft: rgb(124 207 154 / 0.13);
      --m-warning: #e6bf6a;
      --m-warning-soft: rgb(230 191 106 / 0.12);
      --m-danger: #f2787f;
      --m-danger-soft: rgb(242 120 127 / 0.13);
      --m-info: #7cc4d2;
      --m-info-soft: rgb(124 196 210 / 0.12);
      --m-mark: #e6bf6a;
      --m-mark-soft: rgb(230 191 106 / 0.12);
      --m-shadow-popover: 0 0 0 1px var(--m-border), 0 12px 32px -16px rgb(0 0 0 / 0.7);
      --m-shadow-overlay: 0 0 0 1px var(--m-border), 0 24px 64px -20px rgb(0 0 0 / 0.75);
      --m-show-light: none;
      --m-show-dark: block;
      --m-scheme-light: 0;
      color-scheme: dark;
    }
  }

  :where([data-skin="lattice"][data-theme="dark"]) {
    --m-shadow-overlay: 0 0 0 1px var(--m-border), 0 24px 64px -20px rgb(0 0 0 / 0.75);
    --m-shadow-popover: 0 0 0 1px var(--m-border), 0 12px 32px -16px rgb(0 0 0 / 0.7);
    --m-mark-soft: rgb(230 191 106 / 0.12);
    --m-mark: #e6bf6a;
    --m-info-soft: rgb(124 196 210 / 0.12);
    --m-info: #7cc4d2;
    --m-danger-soft: rgb(242 120 127 / 0.13);
    --m-danger: #f2787f;
    --m-warning-soft: rgb(230 191 106 / 0.12);
    --m-warning: #e6bf6a;
    --m-success-soft: rgb(124 207 154 / 0.13);
    --m-success: #7ccf9a;
    --m-select-soft: rgb(138 170 255 / 0.14);
    --m-select: #8aaaff;
    --m-highlight: rgb(255 255 255 / 0.04);
    --m-focus: rgb(46 106 255 / 0.55);
    --m-edge-color: #2e6aff;
    --m-signal-contrast: #ffffff;
    --m-signal-text: #8aaaff;
    --m-signal-soft: rgb(46 106 255 / 0.18);
    --m-signal: #2e6aff;
    --m-accent-contrast: #15171c;
    --m-accent-soft: rgb(246 245 241 / 0.07);
    --m-accent-strong: #ffffff;
    --m-accent: #f6f5f1;
    --m-border-strong: #4b505a;
    --m-border: #33373f;
    --m-text-subtle: #8b909c;
    --m-text-muted: #a8adb9;
    --m-text: #f6f5f1;
    --m-surface-hover: #2a2e36;
    --m-bg-inset: #101216;
    --m-bg-subtle: #24272e;
    --m-bg-elevated: #1e2127;
    --m-bg: #15171c;
    --m-show-light: none;
    --m-show-dark: block;
    --m-scheme-light: 0;
    color-scheme: dark;
  }

  /* ── lattice · copper: the lattice skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="lattice"][data-accent="copper"]) {
    --m-signal: #9c5f2a;
    --m-signal-soft: rgb(156 95 42 / 0.1);
    --m-signal-text: #8a5323;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #b8763d;
    --m-focus-edge: #9c5f2a;
    --m-focus: rgb(156 95 42 / 0.35);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"][data-accent="copper"]:not([data-theme="light"])) {
      --m-signal: #aa6401;
      --m-signal-soft: rgb(170 100 1 / 0.18);
      --m-signal-text: #d9a877;
      --m-signal-contrast: #ffffff;
      --m-edge-color: #aa6401;
      --m-focus-edge: #aa6401;
      --m-focus: rgb(170 100 1 / 0.55);
    }
  }

  :where([data-skin="lattice"][data-accent="copper"][data-theme="dark"]) {
    --m-focus: rgb(170 100 1 / 0.55);
    --m-focus-edge: #aa6401;
    --m-edge-color: #aa6401;
    --m-signal-contrast: #ffffff;
    --m-signal-text: #d9a877;
    --m-signal-soft: rgb(170 100 1 / 0.18);
    --m-signal: #aa6401;
  }

  /* ── lattice · lapis: the lattice skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="lattice"][data-accent="lapis"]) {
    --m-signal: #4930cf;
    --m-signal-soft: rgb(73 48 207 / 0.1);
    --m-signal-text: #4930cf;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #4930cf;
    --m-focus-edge: #4930cf;
    --m-focus: rgb(73 48 207 / 0.35);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"][data-accent="lapis"]:not([data-theme="light"])) {
      --m-signal: #7a55ff;
      --m-signal-soft: rgb(122 85 255 / 0.18);
      --m-signal-text: #9c90ff;
      --m-signal-contrast: #ffffff;
      --m-edge-color: #7a55ff;
      --m-focus-edge: #7a55ff;
      --m-focus: rgb(122 85 255 / 0.55);
    }
  }

  :where([data-skin="lattice"][data-accent="lapis"][data-theme="dark"]) {
    --m-focus: rgb(122 85 255 / 0.55);
    --m-focus-edge: #7a55ff;
    --m-edge-color: #7a55ff;
    --m-signal-contrast: #ffffff;
    --m-signal-text: #9c90ff;
    --m-signal-soft: rgb(122 85 255 / 0.18);
    --m-signal: #7a55ff;
  }

  /* ── lattice · violet: the lattice skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="lattice"][data-accent="violet"]) {
    --m-signal: #70549b;
    --m-signal-soft: rgb(112 84 155 / 0.10);
    --m-signal-text: #70549b;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #70549b;
    --m-focus-edge: #70549b;
    --m-focus: rgb(112 84 155 / 0.35);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"][data-accent="violet"]:not([data-theme="light"])) {
      --m-signal: #b6a0da;
      --m-signal-soft: rgb(182 160 218 / 0.14);
      --m-signal-text: #b6a0da;
      --m-signal-contrast: #15171c;
      --m-edge-color: #b6a0da;
      --m-focus-edge: #b6a0da;
      --m-focus: rgb(182 160 218 / 0.5);
    }
  }

  :where([data-skin="lattice"][data-accent="violet"][data-theme="dark"]) {
    --m-focus: rgb(182 160 218 / 0.5);
    --m-focus-edge: #b6a0da;
    --m-edge-color: #b6a0da;
    --m-signal-contrast: #15171c;
    --m-signal-text: #b6a0da;
    --m-signal-soft: rgb(182 160 218 / 0.14);
    --m-signal: #b6a0da;
  }

  /* ── lattice · teal: the lattice skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="lattice"][data-accent="teal"]) {
    --m-signal: #0f7b6c;
    --m-signal-soft: rgb(15 123 108 / 0.1);
    --m-signal-text: #0d6e61;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #0f7b6c;
    --m-focus-edge: #0f7b6c;
    --m-focus: rgb(15 123 108 / 0.35);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"][data-accent="teal"]:not([data-theme="light"])) {
      --m-signal: #068471;
      --m-signal-soft: rgb(6 132 113 / 0.18);
      --m-signal-text: #4fd1b8;
      --m-signal-contrast: #ffffff;
      --m-edge-color: #068471;
      --m-focus-edge: #068471;
      --m-focus: rgb(6 132 113 / 0.55);
    }
  }

  :where([data-skin="lattice"][data-accent="teal"][data-theme="dark"]) {
    --m-focus: rgb(6 132 113 / 0.55);
    --m-focus-edge: #068471;
    --m-edge-color: #068471;
    --m-signal-contrast: #ffffff;
    --m-signal-text: #4fd1b8;
    --m-signal-soft: rgb(6 132 113 / 0.18);
    --m-signal: #068471;
  }

  /* ── lattice · green: the lattice skin with its accent ramp replaced; nothing else changes */

  :where([data-skin="lattice"][data-accent="green"]) {
    --m-signal: #2f7d1f;
    --m-signal-soft: rgb(47 125 31 / 0.1);
    --m-signal-text: #2a7019;
    --m-signal-contrast: #ffffff;
    --m-edge-color: #2f7d1f;
    --m-focus-edge: #2f7d1f;
    --m-focus: rgb(47 125 31 / 0.35);
  }

  @media (prefers-color-scheme: dark) {
    :where([data-skin="lattice"][data-accent="green"]:not([data-theme="light"])) {
      --m-signal: #388601;
      --m-signal-soft: rgb(56 134 1 / 0.18);
      --m-signal-text: #8bdb69;
      --m-signal-contrast: #ffffff;
      --m-edge-color: #388601;
      --m-focus-edge: #388601;
      --m-focus: rgb(56 134 1 / 0.55);
    }
  }

  :where([data-skin="lattice"][data-accent="green"][data-theme="dark"]) {
    --m-focus: rgb(56 134 1 / 0.55);
    --m-focus-edge: #388601;
    --m-edge-color: #388601;
    --m-signal-contrast: #ffffff;
    --m-signal-text: #8bdb69;
    --m-signal-soft: rgb(56 134 1 / 0.18);
    --m-signal: #388601;
  }
}

@layer design.modes {
  /* ── Frame (opt in with data-frame; nothing here applies without it) ── */

  :where([data-frame], [data-frame] [data-theme], [data-frame] [data-skin]) {
    --m-page-title-size: 2.125rem;
    --m-page-title-leading: 1.18;
    --m-eyebrow-tile: block;
    --m-primary-bg: var(--m-signal);
    --m-primary-fg: var(--m-signal-contrast);
    --m-primary-hover-bg: var(--m-text);
    --m-primary-hover-fg: var(--m-bg);
    --m-pill-tracking: 0.08em;
    --m-tile-art-strength: 0.5;
  }

  /* ── Density (in design.modes, so an explicit data-density wins over any skin) ── */

  :where([data-density="compact"]) {
    --m-font-size-body: 0.8125rem;
    --m-line-height-body: 1.45;
    --m-control-size: 1.875rem;
  }

  :where([data-density="comfortable"]) {
    --m-font-size-body: 0.875rem;
    --m-line-height-body: 1.5;
    --m-control-size: 2rem;
  }

  /* Ambient: a screen read from a metre or more away. Text scales by --m-type-scale (the text-* sizes multiply it) and
   * icons by half as much, as spacing does (so an icon fills the box Tailwind sizes for it), and the floors below only
   * rise: --m-touch-target and --m-input-font-floor are raised here. */

  :where([data-density="ambient"]) {
    --m-font-size-body: 28px;
    --m-line-height-body: 1.4;
    --m-control-size: 72px;
    --m-control-h-sm: 48px;
    --m-touch-target: 72px;
    --m-row-h: 72px;
    --m-input-font-size: 26px;
    --m-input-font-floor: 26px;
    --m-page-title-size: 40px;
    --m-nav-h: 72px;
    --m-type-scale: 2;
    --m-timeout-scale: 2.5;
    --m-hover-reveal: 1;
    --m-font-size-display-1: clamp(96px, 15.625vw, 300px);
    --m-font-size-display-2: 64px;
    --m-font-size-display-3: 40px;
    --m-font-size-display-4: 28px;
    --spacing: 0.375rem;
  }

  :where([data-density="ambient"]) svg.lucide {
    zoom: calc(1 + (var(--m-type-scale) - 1) / 2);
  }

  /* ── Control size on its own: a 14px body with 30px controls is
   *    data-density="comfortable" data-controls="compact". These come after
   *    density's rules, so they win. */

  :where([data-controls="compact"]) {
    --m-control-size: 1.875rem;
  }

  :where([data-controls="comfortable"]) {
    --m-control-size: 2rem;
  }

  /* --m-control-h is derived from --m-control-size where it is declared, so a
   * density or control-size element derives its own and nothing else. */

  :where([data-density], [data-controls]) {
    --m-control-h: var(--m-control-size);
  }

  /* ── Floors that no skin, density or app rule can lower (an important
   *    declaration in a layer beats every normal one, inline styles included) ── */

  @media (pointer: coarse) {
    :where(:root, [data-theme], [data-skin], [data-density], [data-controls]) {
      --m-control-h: max(var(--m-control-size), var(--m-touch-target)) !important;
      --m-input-font-size: max(16px, 1rem, var(--m-input-font-floor)) !important; /* iOS zooms into a field whose text is smaller; ambient raises the floor */
      --m-row-h: var(--m-touch-target) !important;
    }
  }

  /* The same floor for everything inside an element that asks for touch sizing (previews, tests). */
  :where([data-pointer="coarse"], [data-pointer="coarse"] :where([data-theme], [data-skin], [data-density], [data-controls])) {
    --m-control-h: max(var(--m-control-size), var(--m-touch-target)) !important;
    --m-input-font-size: max(16px, 1rem, var(--m-input-font-floor)) !important;
    --m-row-h: var(--m-touch-target) !important;
  }

  @media (prefers-reduced-motion: reduce) {
    :where(:root, [data-theme], [data-skin], [data-density], [data-controls]) {
      --m-dur-1: 0ms !important;
      --m-dur-2: 0ms !important;
      --m-dur-3: 1ms !important; /* crossfade only; components switch transforms off */
      --m-dur-4: 1ms !important;
    }
  }

  /* "More contrast" preference (macOS Increase contrast, Windows contrast themes
   * that stay in normal colour mode): borders and secondary text take the full
   * text colour. Custom properties resolve per element, so scoped providers
   * follow too. */

  @media (prefers-contrast: more) {
    :where(:root, [data-theme], [data-skin], [data-density], [data-controls]) {
      --m-border-strong: var(--m-text) !important;
      --m-border: var(--m-border-strong) !important;
      --m-text-muted: var(--m-text) !important;
      --m-text-subtle: var(--m-text) !important;
    }
  }

  /* ── Ambient in dark: grounds and text kept low-glare (computed per skin; see tokens/ambient.ts) ── */

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"]:not([data-skin]):not([data-theme="light"]), [data-density="ambient"][data-skin="default"]:not([data-theme="light"])) {
      --m-text: #dedee0;
      --m-text-muted: #c1c1c9;
      --m-text-subtle: #92929c;
      --m-accent-strong: #dedee0;
      --m-bg: #141416;
      --m-bg-elevated: #1d1d20;
      --m-bg-subtle: #242429;
      --m-bg-inset: #0f0f11;
      --m-surface-hover: #2d2d32;
    }
  }

  :where([data-density="ambient"]:not([data-skin])[data-theme="dark"], [data-density="ambient"][data-skin="default"][data-theme="dark"]) {
    --m-surface-hover: #2d2d32;
    --m-bg-inset: #0f0f11;
    --m-bg-subtle: #242429;
    --m-bg-elevated: #1d1d20;
    --m-bg: #141416;
    --m-accent-strong: #dedee0;
    --m-text-subtle: #92929c;
    --m-text-muted: #c1c1c9;
    --m-text: #dedee0;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="control"]:not([data-theme="light"])) {
      --m-text: #dcdee3;
      --m-text-muted: #c4cad6;
      --m-text-subtle: #8c93a4;
      --m-accent-strong: #dcdee3;
      --m-bg: #111418;
      --m-bg-elevated: #1b2028;
      --m-bg-subtle: #232834;
      --m-bg-inset: #0d1015;
      --m-surface-hover: #2a3140;
    }
  }

  :where([data-density="ambient"][data-skin="control"][data-theme="dark"]) {
    --m-surface-hover: #2a3140;
    --m-bg-inset: #0d1015;
    --m-bg-subtle: #232834;
    --m-bg-elevated: #1b2028;
    --m-bg: #111418;
    --m-accent-strong: #dcdee3;
    --m-text-subtle: #8c93a4;
    --m-text-muted: #c4cad6;
    --m-text: #dcdee3;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="pewter"]:not([data-theme="light"])) {
      --m-text: #dedee0;
      --m-text-muted: #c1c1c7;
      --m-text-subtle: #94949b;
      --m-bg: #141415;
      --m-bg-elevated: #1d1d1f;
      --m-bg-subtle: #252529;
      --m-bg-inset: #0f0f10;
      --m-surface-hover: #2d2d31;
    }
  }

  :where([data-density="ambient"][data-skin="pewter"][data-theme="dark"]) {
    --m-surface-hover: #2d2d31;
    --m-bg-inset: #0f0f10;
    --m-bg-subtle: #252529;
    --m-bg-elevated: #1d1d1f;
    --m-bg: #141415;
    --m-text-subtle: #94949b;
    --m-text-muted: #c1c1c7;
    --m-text: #dedee0;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="foundry"]:not([data-theme="light"])) {
      --m-text: #dededf;
      --m-text-muted: #acacb4;
      --m-text-subtle: #9f9fa9;
      --m-accent-strong: #dededf;
      --m-bg: #0c0c0c;
      --m-bg-elevated: #1b1b1e;
      --m-bg-subtle: #2a2a2d;
      --m-bg-inset: #070707;
      --m-surface-hover: #323236;
    }
  }

  :where([data-density="ambient"][data-skin="foundry"][data-theme="dark"]) {
    --m-surface-hover: #323236;
    --m-bg-inset: #070707;
    --m-bg-subtle: #2a2a2d;
    --m-bg-elevated: #1b1b1e;
    --m-bg: #0c0c0c;
    --m-accent-strong: #dededf;
    --m-text-subtle: #9f9fa9;
    --m-text-muted: #acacb4;
    --m-text: #dededf;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="inscribed"]:not([data-theme="light"])) {
      --m-text: #e0ded9;
      --m-text-muted: #b6b3ad;
      --m-text-subtle: #96938b;
      --m-accent-strong: #dedede;
      --m-bg: #131416;
      --m-bg-elevated: #1b1c20;
      --m-bg-subtle: #1f2026;
      --m-bg-inset: #0f1013;
      --m-surface-hover: #26272c;
    }
  }

  :where([data-density="ambient"][data-skin="inscribed"][data-theme="dark"]) {
    --m-surface-hover: #26272c;
    --m-bg-inset: #0f1013;
    --m-bg-subtle: #1f2026;
    --m-bg-elevated: #1b1c20;
    --m-bg: #131416;
    --m-accent-strong: #dedede;
    --m-text-subtle: #96938b;
    --m-text-muted: #b6b3ad;
    --m-text: #e0ded9;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="basalt"]:not([data-theme="light"])) {
      --m-text: #dcdedf;
      --m-text-muted: #b9bec2;
      --m-text-subtle: #8a9095;
      --m-accent-strong: #dcdedf;
      --m-bg: #111416;
      --m-bg-elevated: #191e21;
      --m-bg-subtle: #212629;
      --m-bg-inset: #0d0f10;
      --m-surface-hover: #262a2d;
    }
  }

  :where([data-density="ambient"][data-skin="basalt"][data-theme="dark"]) {
    --m-surface-hover: #262a2d;
    --m-bg-inset: #0d0f10;
    --m-bg-subtle: #212629;
    --m-bg-elevated: #191e21;
    --m-bg: #111416;
    --m-accent-strong: #dcdedf;
    --m-text-subtle: #8a9095;
    --m-text-muted: #b9bec2;
    --m-text: #dcdedf;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="basalt-home"]:not([data-theme="light"])) {
      --m-text: #e2ded3;
      --m-accent-strong: #e2ded3;
    }
  }

  :where([data-density="ambient"][data-skin="basalt-home"][data-theme="dark"]) {
    --m-accent-strong: #e2ded3;
    --m-text: #e2ded3;
  }

  @media (prefers-color-scheme: dark) {
    :where([data-density="ambient"][data-skin="lattice"]:not([data-theme="light"])) {
      --m-text: #dfdeda;
      --m-accent-strong: #dedede;
    }
  }

  :where([data-density="ambient"][data-skin="lattice"][data-theme="dark"]) {
    --m-accent-strong: #dedede;
    --m-text: #dfdeda;
  }
}

/*
 * Base rules for static.css: a small reset (the parts of Tailwind's preflight
 * the .m-* classes rely on), the body defaults Kurth Labs Design's base.css sets, and
 * the one focus ring. No Tailwind, no external URLs, no fonts: a page brings
 * its own @font-face (brandCss, or the host's font stylesheet).
 */

@layer base {
  *,
  ::before,
  ::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0 solid;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    line-height: 1.5;
    scrollbar-color: var(--m-border-strong) transparent;
  }

  /* scrollbar-width is not inherited: thin on every scroller, at zero specificity. */
  :where(*) {
    scrollbar-width: thin;
  }

  body {
    min-height: 100%;
    background: var(--m-bg);
    color: var(--m-text);
    font-family: var(--m-font-sans);
    font-size: var(--m-font-size-body);
    line-height: var(--m-line-height-body);
    font-feature-settings: var(--m-font-features);
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4, p { font-size: inherit; font-weight: inherit; }

  a { color: inherit; text-decoration: inherit; }

  img, svg, picture { display: block; max-width: 100%; }
  img { height: auto; }

  button, input, select, textarea {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    background-color: transparent;
    border-radius: 0;
  }

  button { cursor: pointer; }

  :focus-visible {
    outline: none;
    box-shadow:
      0 0 0 1px var(--m-focus-edge),
      0 0 0 var(--m-focus-width) var(--m-focus);
  }

  /* A heading focused by script (tabindex=-1) is a reading position, not a control: no ring. */
  :where(h1, h2, h3, [role="heading"])[tabindex="-1"]:focus-visible {
    box-shadow: none;
  }

  svg.lucide { stroke-width: var(--m-icon-stroke); }

  ::selection { background: var(--m-accent-soft); }

  .m-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }
}

/*
 * Framework-free component classes (.m-*). Plain CSS that reads only
 * semantic and component tokens. Two users:
 *
 *   - React components whose look must also exist without React (BrandMark,
 *     CodeInput, Alert, AuthCard) use these classes directly;
 *   - server-rendered pages (no JS, strict CSP) use them through static.css,
 *     following packages/design/docs/STATIC_MARKUP.md. The .m-btn, .m-input and .m-field
 *     rules mirror Button, TextInput and Field.
 *
 * Everything sits in @layer components, so Tailwind utilities (and an app's
 * unlayered rules) still win.
 */

@keyframes m-spin {
  to { transform: rotate(360deg); }
}

@layer components {
  /* The hidden attribute must win over the display set by any .m-* class
   * (.m-btn is inline-flex). !important so it beats them in any layer. */
  :where([class^="m-"], [class*=" m-"])[hidden] { display: none !important; }

  /* ── Brand mark: a logo per scheme, or the name in the display face ── */

  .m-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--m-accent-strong);
    text-decoration: none;
    --m-brand-h: 24px;
  }
  .m-brand-sm { --m-brand-h: 20px; }
  .m-brand-lg { --m-brand-h: 32px; }
  .m-brand-logo {
    display: block;
    height: var(--m-brand-h);
    width: auto;
    max-width: 100%;
  }
  .m-brand-logo > svg,
  .m-brand-logo > img {
    display: block;
    height: 100%;
    width: auto;
  }
  /* --m-show-light / --m-show-dark follow the nearest data-theme (or the OS). */
  .m-brand-logo-light { display: var(--m-show-light, block); }
  .m-brand-logo-dark { display: var(--m-show-dark, none); }
  /* MadeBy: the parent-brand line, styled here too so pages without Tailwind (static.css) draw it the same. */
  .m-made-by {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    color: var(--m-text-muted);
    text-decoration: none;
  }
  a.m-made-by:hover { color: var(--m-text); }
  a.m-made-by:focus-visible {
    outline: none;
    border-radius: var(--m-radius-xs);
    box-shadow: 0 0 0 1px var(--m-focus-edge), 0 0 0 var(--m-focus-width) var(--m-focus);
  }
  .m-made-by-mark { width: 1.15em; height: 1.15em; flex-shrink: 0; }
  .m-made-by-mark > svg { width: 100%; height: 100%; }
  /* Kurth Labs: official kit graphics keep full ink/white contrast; their small scale keeps them quiet. */
  .m-kurth-labs-mark,
  .m-kurth-labs-lockup {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: -0.125em;
  }
  .m-kurth-labs-brand {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: fit-content;
    color: var(--m-text);
    border-radius: var(--m-radius-xs);
    text-decoration: none;
  }
  .m-kurth-labs-brand-copy {
    font-size: calc(0.8125rem * var(--m-type-scale, 1));
    line-height: 1.2;
    white-space: nowrap;
    transition: color var(--m-dur-1) var(--m-ease-out);
  }
  .m-kurth-labs-brand-copy[data-tone="muted"] { color: var(--m-text-muted); }
  .m-kurth-labs-brand:hover .m-kurth-labs-brand-copy { color: var(--m-accent-strong); }
  .m-kurth-labs-brand:hover .m-kurth-labs-brand-copy[data-tone="muted"] { color: var(--m-text); }
  .m-kurth-labs-brand:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px var(--m-focus-edge), 0 0 0 var(--m-focus-width) var(--m-focus);
  }
  :where([data-pointer="coarse"]) .m-kurth-labs-brand::after {
    position: absolute;
    inset: -12px;
    content: "";
  }
  @media (any-pointer: coarse) {
    .m-kurth-labs-brand::after {
      position: absolute;
      inset: -12px;
      content: "";
    }
  }
  @media (forced-colors: active) {
    .m-kurth-labs-mark-signal { fill: currentColor; }
  }
  .m-brand-name {
    overflow: hidden;
    font-family: var(--m-font-display);
    font-size: calc(var(--m-brand-h) * 0.75);
    font-weight: 600;
    line-height: var(--m-brand-h);
    letter-spacing: calc(var(--m-heading-tracking) + 0.03em); /* 0.02em by default */
    text-transform: var(--m-heading-case);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Text ── */

  .m-heading {
    margin: 0;
    font-family: var(--m-font-display);
    font-size: calc(1.25rem * var(--m-type-scale, 1));
    font-weight: var(--m-heading-weight);
    line-height: 1.3;
    letter-spacing: var(--m-heading-tracking);
    text-transform: var(--m-heading-case);
    color: var(--m-text);
  }
  /* A component title (Section, Modal, panels): the skin's title face, case and tracking. */
  .m-title {
    font-family: var(--m-title-font);
    letter-spacing: var(--m-title-tracking);
    text-transform: var(--m-heading-case);
  }
  /* A navigation item or tab: the skin's nav case and tracking. */
  .m-nav {
    letter-spacing: var(--m-nav-tracking);
    text-transform: var(--m-nav-case);
  }
  .m-text {
    margin: 0;
    font-size: var(--m-font-size-body);
    line-height: var(--m-line-height-body);
    color: var(--m-text);
  }
  .m-text-muted { color: var(--m-text-muted); }
  .m-text-subtle { color: var(--m-text-subtle); }
  .m-small {
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    line-height: 1.333;
  }
  /* The display ladder (a clock, a headline, a value, a label): the --m-font-size-display-* tokens, large in ambient density. */
  .m-display-1,
  .m-display-2,
  .m-display-3,
  .m-display-4 {
    margin: 0;
    font-family: var(--m-font-display);
    font-weight: var(--m-heading-weight);
    line-height: var(--m-line-height-display);
    font-variant-numeric: tabular-nums;
  }
  .m-display-1 { font-size: var(--m-font-size-display-1); }
  .m-display-2 { font-size: var(--m-font-size-display-2); }
  .m-display-3 { font-size: var(--m-font-size-display-3); }
  .m-display-4 { font-size: var(--m-font-size-display-4); }
  .m-link {
    color: var(--m-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    border-radius: calc(var(--m-radius-xs) / 2);
  }
  .m-link:hover { text-decoration-thickness: 2px; }
  .m-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* ── Buttons (mirror Button) ── */

  .m-btn {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--m-control-h);
    padding: 0 12px;
    border: var(--m-border-width) solid transparent;
    border-radius: var(--m-radius-control);
    font: inherit;
    font-family: var(--m-button-font);
    font-size: calc(0.8125rem * var(--m-type-scale, 1));
    font-weight: 500;
    line-height: 1.428;
    letter-spacing: var(--m-button-tracking);
    text-transform: var(--m-button-case);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition:
      color var(--m-dur-1) var(--m-ease-out),
      background-color var(--m-dur-1) var(--m-ease-out),
      border-color var(--m-dur-1) var(--m-ease-out);
  }
  @media (pointer: coarse) {
    .m-btn { padding: 0 16px; }
  }
  .m-btn:disabled,
  .m-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.5;
  }
  /* A disabled filled button turns neutral instead of fading, so it can't read as the live call to action; a busy one
   * (aria-busy) keeps its colour and shows its spinner. */
  .m-btn-primary:disabled,
  .m-btn-signal:disabled,
  .m-btn-primary[aria-disabled="true"]:not([aria-busy="true"]),
  .m-btn-signal[aria-disabled="true"]:not([aria-busy="true"]) {
    border-color: var(--m-border);
    background: var(--m-bg-subtle);
    color: var(--m-text-subtle);
    opacity: 1;
  }
  /* Busy (aria-busy="true", set by the page or by Button's `pending`): a spinner before the label, drawn
   * with CSS only. currentColor keeps it readable on every variant; it sits in the flex row, so the gap
   * and the centring stay those of the button. Pair it with aria-disabled="true" (not `disabled`, which
   * drops focus). .m-pending is the class React's Button adds so both draw the same ring. */
  /* The compound selector makes busy beat any aria-disabled cursor rule, whatever the source order. */
  .m-btn[aria-busy="true"], .m-btn[aria-busy="true"][aria-disabled="true"] { cursor: progress; }
  :is(.m-btn, .m-pending)[aria-busy="true"]::before {
    content: "";
    flex: none;
    box-sizing: border-box;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: m-spin 0.7s linear infinite;
  }
  @media (prefers-reduced-motion: reduce) {
    /* A still dot instead of a spinning ring; the box keeps its 1em so nothing shifts. */
    :is(.m-btn, .m-pending)[aria-busy="true"]::before {
      width: 0.5em;
      height: 0.5em;
      margin: 0.25em;
      border: 0;
      background: currentColor;
      animation: none;
    }
  }
  .m-btn-block { width: 100%; }
  .m-btn-lg {
    min-height: max(calc(var(--m-control-h) + 0.75rem), 3rem);
    padding: 0 24px;
    font-size: calc(1rem * var(--m-type-scale, 1));
  }
  .m-btn-primary {
    background: var(--m-accent);
    color: var(--m-accent-contrast);
  }
  .m-btn-signal {
    background: var(--m-signal);
    color: var(--m-signal-contrast);
  }
  .m-btn-primary:hover:not(:disabled):not([aria-disabled="true"]),
  .m-btn-signal:hover:not(:disabled):not([aria-disabled="true"]) { filter: brightness(1.1); }
  /* A destructive action: danger text with a faint danger border, filled softly on hover (Button variant="danger"). */
  .m-btn-danger {
    border-color: color-mix(in srgb, var(--m-danger) 40%, transparent);
    background: transparent;
    color: var(--m-danger);
  }
  .m-btn-danger:hover:not(:disabled):not([aria-disabled="true"]),
  .m-btn-danger:active:not(:disabled):not([aria-disabled="true"]) { background: var(--m-danger-soft); }
  /* The final confirm of a destructive action, solid (Button variant="destructive"). */
  .m-btn-destructive {
    border-color: transparent;
    background: var(--m-danger);
    color: var(--m-bg-elevated);
  }
  .m-btn-destructive:hover:not(:disabled):not([aria-disabled="true"]) { filter: brightness(1.1); }
  .m-btn-destructive:active:not(:disabled):not([aria-disabled="true"]) { filter: brightness(0.95); }
  .m-btn-secondary {
    border-color: var(--m-border);
    background: var(--m-bg-elevated);
    color: var(--m-text);
    box-shadow: var(--m-shadow-raised);
  }
  .m-btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: var(--m-border-strong);
    background: var(--m-surface-hover);
  }
  .m-btn-ghost {
    background: transparent;
    color: var(--m-text-muted);
  }
  .m-btn-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--m-surface-hover);
    color: var(--m-text);
  }
  /* A "Continue with <name>" button for an upstream identity provider: a 20px logo (one image, or one per
   * scheme) and a name that truncates on one line. No provider colours: it is a plain secondary button. */
  .m-provider { min-width: 0; gap: 10px; }
  .m-provider-logo {
    display: block;
    flex: none;
    width: 20px;
    height: 20px;
    object-fit: contain;
  }
  .m-provider-logo-light { display: var(--m-show-light, block); }
  .m-provider-logo-dark { display: var(--m-show-dark, none); }
  .m-provider-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .m-btn-link {
    height: auto;
    padding: 0;
    background: none;
    color: var(--m-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  /* Real height, not an overlay: a link beside a field or button must not take that control's taps. */
  @media (pointer: coarse) {
    .m-btn-link { min-height: var(--m-touch-target, 44px); }
  }
  .m-btn:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 1px var(--m-focus-edge),
      0 0 0 var(--m-focus-width) var(--m-focus);
  }

  /* ── Fields (mirror Field and TextInput) ── */

  .m-field {
    --m-field-gap: 4px;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--m-field-gap);
  }
  .m-label {
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    font-weight: 500;
    line-height: 1.333;
    letter-spacing: var(--m-label-tracking);
    text-transform: var(--m-label-case);
    color: var(--m-text-muted);
  }
  .m-hint,
  .m-field-error {
    margin: 0;
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    line-height: 1.333;
    color: var(--m-text-subtle);
  }
  .m-field-error { color: var(--m-danger); }
  /* A hint or error rendered empty (a live region waiting for a message) takes no space in the field's stack:
   * its gap is cancelled instead of hiding it, so it stays in the accessibility tree and its first message is announced. */
  .m-field > .m-hint:empty,
  .m-field > .m-field-error:empty { margin-top: calc(-1 * var(--m-field-gap)); }
  .m-select,
  .m-input {
    width: 100%;
    min-height: var(--m-control-h);
    padding: 0 10px;
    border: var(--m-border-width) solid var(--m-border-control);
    border-radius: var(--m-radius-control);
    background: var(--m-bg-elevated);
    color: var(--m-text);
    font: inherit;
    font-size: var(--m-input-font-size); /* 16px on touch: iOS zooms into smaller fields */
    line-height: 1.428;
    transition: border-color var(--m-dur-1) var(--m-ease-out);
  }
  .m-input::placeholder { color: var(--m-text-subtle); }
  .m-input:hover,
  .m-input:focus-visible,
  .m-select:hover,
  .m-select:focus-visible { border-color: var(--m-text-muted); }
  .m-input:focus-visible,
  .m-select:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 1px var(--m-focus-edge),
      0 0 0 var(--m-focus-width) var(--m-focus);
  }
  .m-input:disabled,
  .m-select:disabled { opacity: 0.5; }
  .m-input[aria-invalid="true"],
  .m-select[aria-invalid="true"] { border-color: var(--m-danger); }
  /* A native select with the same box as .m-input. The chevron is two gradients, so it takes a token (an SVG background can't). */
  .m-select {
    appearance: none;
    padding-right: 28px;
    cursor: pointer;
    background-image:
      linear-gradient(45deg, transparent calc(50% - 0.75px), var(--m-text-subtle) calc(50% - 0.75px), var(--m-text-subtle) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
      linear-gradient(-45deg, transparent calc(50% - 0.75px), var(--m-text-subtle) calc(50% - 0.75px), var(--m-text-subtle) calc(50% + 0.75px), transparent calc(50% + 0.75px));
    background-size: 6px 6px;
    background-position: right 15px center, right 10px center;
    background-repeat: no-repeat;
  }
  @media (forced-colors: active) {
    .m-select { appearance: auto; background-image: none; padding-right: 10px; }
  }

  /* ── Checkbox (static markup; the React Checkbox draws the same box with utilities) ──
   * <label class="m-checkbox"><input type="checkbox"><span>text</span></label>. The whole row is the hit
   * target, at least the touch size tall, and the text wraps beside the box. The tick is clipped from the
   * accent-contrast colour, so there is no image. aria-invalid on the input turns the box border danger. */
  .m-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: var(--m-touch-target);
    padding-block: calc((var(--m-touch-target) - 20px) / 2);
    color: var(--m-text);
    font-size: calc(0.875rem * var(--m-type-scale, 1));
    line-height: 20px;
    cursor: pointer;
  }
  .m-checkbox > span { min-width: 0; overflow-wrap: anywhere; }
  .m-checkbox > input {
    position: relative;
    flex: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    border: var(--m-border-width) solid var(--m-border-strong);
    border-radius: var(--m-radius-xs);
    background: var(--m-bg-elevated);
    cursor: inherit;
    transition:
      border-color var(--m-dur-1) var(--m-ease-out),
      background-color var(--m-dur-1) var(--m-ease-out);
  }
  @media (pointer: coarse) {
    .m-checkbox > input { width: 20px; height: 20px; margin-top: 0; }
  }
  .m-checkbox:hover > input:not(:disabled) { border-color: var(--m-text-subtle); }
  .m-checkbox > input::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--m-accent-contrast);
    clip-path: polygon(14% 52%, 24% 42%, 42% 60%, 76% 26%, 86% 36%, 42% 80%);
    opacity: 0;
  }
  .m-checkbox > input:checked {
    border-color: var(--m-accent);
    background: var(--m-accent);
  }
  .m-checkbox > input:checked::before { opacity: 1; }
  .m-checkbox > input[aria-invalid="true"] { border-color: var(--m-danger); }
  .m-checkbox > input:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 1px var(--m-focus-edge),
      0 0 0 var(--m-focus-width) var(--m-focus);
  }
  .m-checkbox:has(> input:disabled) {
    cursor: not-allowed;
    opacity: 0.5;
  }

  /* ── One-time code: one input drawn as six cells ──
   * The input sits over six decorative cells; letter-spacing puts each digit
   * in its cell. Works with no JS (autofill, paste, screen readers see one
   * plain input). Cell width follows the container, so it fits 375px. */

  .m-code {
    --m-code-gap: 8px;
    --m-code-cell: calc((100cqw - 5 * var(--m-code-gap)) / 6);
    position: relative;
    /* The input is one cell plus a gap wider than the cells (so the last
     * digit's letter-spacing never scrolls it). Clip that extra width, or
     * it widens the page and an autofocused field pans it sideways. The 4px
     * padding keeps the focus ring from being clipped; the margin and the
     * 4px off the width cancel it out. */
    box-sizing: content-box;
    width: calc(100% - 4px);
    max-width: 328px;
    height: 52px;
    margin-inline: -4px 0;
    padding-inline: 4px;
    overflow-x: clip;
    container-type: inline-size;
  }
  .m-code-input {
    position: absolute;
    inset: 0 auto 0 4px;
    z-index: 1;
    width: calc(100% + var(--m-code-cell) + var(--m-code-gap));
    height: 100%;
    margin: 0;
    padding: 0 0 0 calc((var(--m-code-cell) - 1ch) / 2);
    border: 0;
    background: transparent;
    color: var(--m-text);
    caret-color: var(--m-accent);
    font-family: var(--m-font-mono);
    font-size: calc(1.375rem * var(--m-type-scale, 1));
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: calc(var(--m-code-cell) + var(--m-code-gap) - 1ch);
    clip-path: inset(0 calc(var(--m-code-cell) + var(--m-code-gap)) 0 0);
    outline: none;
  }
  .m-code-input:focus-visible { box-shadow: none; }
  .m-code-input:disabled { opacity: 0.5; cursor: not-allowed; }
  .m-code-cells {
    position: absolute;
    inset: 0 4px;
    display: flex;
    gap: var(--m-code-gap);
    pointer-events: none;
  }
  .m-code-cell {
    flex: 1 1 0;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-md);
    background: var(--m-bg-elevated);
    transition:
      border-color var(--m-dur-1) var(--m-ease-out),
      box-shadow var(--m-dur-1) var(--m-ease-out);
  }
  .m-code:hover .m-code-cell { border-color: var(--m-border-strong); }
  .m-code-input:focus + .m-code-cells .m-code-cell {
    border-color: var(--m-focus-edge);
    box-shadow: 0 0 0 var(--m-focus-width) var(--m-focus);
  }
  .m-code-input[aria-invalid="true"] + .m-code-cells .m-code-cell { border-color: var(--m-danger); }
  .m-code-input:disabled + .m-code-cells { opacity: 0.5; }

  /* ── Alert ── */

  .m-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border: var(--m-border-width) solid var(--m-alert-color);
    border-radius: var(--m-radius-md);
    background: var(--m-alert-soft);
    color: var(--m-alert-color);
    font-size: calc(0.8125rem * var(--m-type-scale, 1));
    line-height: 1.428;
    --m-alert-color: var(--m-info);
    --m-alert-soft: var(--m-info-soft);
  }
  .m-alert-danger { --m-alert-color: var(--m-danger); --m-alert-soft: var(--m-danger-soft); }
  .m-alert-success { --m-alert-color: var(--m-success); --m-alert-soft: var(--m-success-soft); }
  .m-alert-warning { --m-alert-color: var(--m-warning); --m-alert-soft: var(--m-warning-soft); }
  .m-alert-icon {
    flex: none;
    width: 14px;
    height: 14px;
    margin-top: 2px;
  }
  .m-alert-body { min-width: 0; }
  /* With an action: the row wraps by its own width, so the action sits under the text when the body has less
     than 16rem and at the end when there is room. */
  .m-alert-row {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-width: 0;
  }
  .m-alert-row > .m-alert-body { flex: 1 1 16rem; }
  .m-alert-action {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .m-alert-title {
    font-family: var(--m-title-font);
    font-weight: 600;
    letter-spacing: var(--m-title-tracking);
    text-transform: var(--m-heading-case);
  }

  /* ── Error summary (the GOV.UK pattern; FormErrorSummary draws the same box) ──
   * <div class="m-error-summary" role="alert" tabindex="-1" aria-labelledby="t"><h2 class="m-error-summary-title" id="t">…</h2>
   * <ul class="m-error-summary-list"><li><a href="#field-id">message</a></li></ul></div>. Each link is at least the
   * touch size tall; the summary takes the focus ring when a script focuses it after a failed submit. */
  .m-error-summary {
    padding: 12px 16px;
    border: var(--m-border-width) solid var(--m-danger);
    border-inline-start-width: 4px;
    border-radius: var(--m-radius-md);
    background: var(--m-danger-soft);
    color: var(--m-text);
    font-size: calc(0.875rem * var(--m-type-scale, 1));
    line-height: 1.428;
  }
  .m-error-summary:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 1px var(--m-focus-edge),
      0 0 0 var(--m-focus-width) var(--m-focus);
  }
  .m-error-summary-title {
    margin: 0 0 4px;
    font-family: var(--m-title-font);
    font-size: calc(0.9375rem * var(--m-type-scale, 1));
    font-weight: 600;
    letter-spacing: var(--m-title-tracking);
    text-transform: var(--m-heading-case);
    color: var(--m-danger);
  }
  .m-error-summary-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .m-error-summary-list a {
    display: inline-block;
    padding-block: 4px;
    color: var(--m-danger);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }
  .m-error-summary-list a:hover { text-decoration-thickness: 2px; }
  @media (pointer: coarse) {
    .m-error-summary-list a { padding-block: calc((var(--m-touch-target) - 20px) / 2); }
  }

  /* ── Request an invite (mirror InviteRequest) ──
   * <section class="m-invite"><header class="m-invite-header"><h2 class="m-heading">…</h2><p class="m-text m-text-muted">…</p></header>
   * <form class="m-invite-form" method="post">fields (.m-field), <div class="m-invite-trap" aria-hidden="true">honeypot</div>,
   * <div class="m-invite-check"><div class="m-turnstile">widget</div></div>, a signal .m-btn</form></section>.
   * A result replaces the form: <div class="m-invite-note" role="status" tabindex="-1">. */
  .m-invite {
    display: flex;
    width: 100%;
    max-width: 28rem;
    flex-direction: column;
    gap: 16px;
  }
  .m-invite-header { display: flex; flex-direction: column; gap: 6px; }
  .m-invite-form { display: flex; flex-direction: column; gap: 16px; }
  .m-textarea { padding-block: 6px; resize: vertical; }
  .m-invite-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .m-invite-check { display: flex; flex-direction: column; gap: 6px; }
  .m-turnstile { min-height: 65px; }
  .m-invite-footer a { color: var(--m-text-muted); }
  .m-invite-note {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: var(--m-border-width) solid var(--m-border);
    border-radius: var(--m-radius-lg);
    background: var(--m-bg-elevated);
  }
  .m-invite-note p { margin: 0; }
  .m-invite-note-title { font-weight: 600; color: var(--m-text); }
  .m-invite-steps { margin: 0; padding-left: 20px; font-size: calc(0.875rem * var(--m-type-scale, 1)); color: var(--m-text-muted); display: flex; flex-direction: column; gap: 4px; }

  /* ── Auth page shell and card ── */

  .m-auth {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px 16px;
    background: var(--m-bg);
    /* The tessellation of a skin that wants one (--m-auth-backdrop: block) sits behind the card, in ::before and ::after. */
    position: relative;
    isolation: isolate;
    --m-tess-mask: radial-gradient(ellipse 70% 60% at 50% 42%, black 12%, transparent 74%);
    --m-tess-x: min(round(down, calc(50% + 264px), var(--m-tess-size, 64px)), calc(100% - 2 * var(--m-tess-size, 64px)));
    --m-tess-y: max(var(--m-tess-size, 64px), round(down, calc(50% - 290px), var(--m-tess-size, 64px)));
  }
  .m-auth::before, .m-auth::after { display: var(--m-auth-backdrop, none); }
  .m-auth-card {
    display: flex;
    width: 100%;
    max-width: 400px;
    flex-direction: column;
    gap: 20px;
    padding: 28px 24px;
    border: var(--m-border-width) solid var(--m-border);
    border-radius: var(--m-radius-lg);
    background: var(--m-bg-elevated);
    box-shadow: var(--m-shadow-popover);
  }
  @media (max-width: 420px) {
    .m-auth-card { padding: 24px 20px; }
  }
  .m-auth-brand {
    display: flex;
    justify-content: center;
  }
  /* On the auth card the name is the page's identity: it wraps, balanced and centred, instead of being cut off. */
  .m-auth-brand .m-brand { max-width: 100%; }
  .m-auth-brand .m-brand-name {
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .m-auth-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
  .m-auth-footer {
    margin: 0;
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    line-height: 1.5;
    color: var(--m-text-subtle);
    text-align: center;
  }
  .m-auth-footer a { color: var(--m-text-muted); }

  /* ── Approval request (mirror ApprovalCard) ──
   * <article class="m-approval" data-state="approval_required" aria-labelledby="t">: kind, title, who, facts, risk,
   * actions, scope, then the always-present status region. Decided states drop risk, actions and scope and fill the
   * status with .m-approval-outcome[data-tone]. */
  .m-approval {
    display: flex;
    width: 100%;
    max-width: 440px;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    border: var(--m-border-width) solid var(--m-border);
    border-radius: var(--m-radius-lg);
    background: var(--m-bg-elevated);
    box-shadow: var(--m-shadow-popover);
    color: var(--m-text);
    font-size: calc(0.875rem * var(--m-type-scale, 1));
    line-height: 1.5;
  }
  @media (max-width: 420px) {
    .m-approval { padding: 20px 16px; }
  }
  .m-approval > .m-brand { align-self: flex-start; }
  .m-approval-kind {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--m-radius-pill);
    background: var(--m-text);
    color: var(--m-bg-elevated);
    font-family: var(--m-font-mono);
    font-size: calc(0.6875rem * var(--m-type-scale, 1));
    font-weight: 500;
    letter-spacing: 0.02em;
  }
  .m-approval-title {
    margin: 0;
    font-family: var(--m-title-font);
    font-size: calc(1.25rem * var(--m-type-scale, 1));
    font-weight: var(--m-heading-weight, 600);
    line-height: 1.3;
    letter-spacing: var(--m-title-tracking);
    /* The action is a sentence to read, not a label: never set in a caps skin's capitals. */
    text-transform: none;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }
  .m-approval-who {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  /* The agent: a square tile in the inverted colours (dark on a light card, light on a dark one), so it never reads as a
   * person's round avatar. */
  .m-approval-agent {
    display: grid;
    flex: none;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: var(--m-radius-sm);
    background: var(--m-text);
    color: var(--m-bg-elevated);
    font-family: var(--m-font-mono);
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    font-weight: 600;
  }
  .m-approval-who-text { min-width: 0; overflow-wrap: anywhere; }
  .m-approval-client,
  .m-approval-for { color: var(--m-text-muted); font-size: calc(0.8125rem * var(--m-type-scale, 1)); }
  .m-approval-for strong { color: var(--m-text); }
  .m-approval-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
    margin: 0;
    padding: 12px 0;
    border-block: var(--m-border-width) solid var(--m-border);
  }
  .m-approval-facts > div { display: contents; }
  .m-approval-facts dt { color: var(--m-text-muted); font-size: calc(0.8125rem * var(--m-type-scale, 1)); }
  .m-approval-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
  @media (max-width: 359px) {
    .m-approval-facts { grid-template-columns: 1fr; gap: 2px; }
    .m-approval-facts dd + dt, .m-approval-facts > div + div dt { margin-top: 8px; }
  }
  .m-approval-mono { font-family: var(--m-font-mono); font-size: 0.92em; }
  .m-approval-risk {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: var(--m-border-width) solid var(--m-warning);
    border-inline-start-width: 4px;
    border-radius: var(--m-radius-md);
    background: var(--m-warning-soft);
    color: var(--m-text);
  }
  .m-approval-risk > [aria-hidden] { flex: none; color: var(--m-warning); }
  /* Deny and Allow: equal size, side by side; stacked in the same order (Deny, then Allow) on a phone under 360px, so the
   * tab order matches what is seen. */
  .m-approval-actions {
    display: flex;
    gap: 8px;
  }
  .m-approval-actions > * { flex: 1 1 0; min-width: 0; }
  @media (pointer: coarse) {
    .m-approval-actions > * { min-height: var(--m-touch-target); }
  }
  @media (max-width: 359px) {
    .m-approval-actions { flex-direction: column; }
  }
  /* Choices: what a person lets an agent do, ticked or not, before Allow (a consent page). A borderless fieldset whose
   * legend reads as a label; group labels (.m-approval-group) per app; each checkbox row is followed by its hint, which
   * the input names with aria-describedby. A second fieldset (an opt-in such as "Everything I can do") sits apart under a
   * hairline. <details class="m-approval-more"> hides the rows behind a 44px summary with no script. */
  .m-approval-choices {
    display: flex;
    min-width: 0;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .m-approval-choices > legend {
    margin-bottom: 4px;
    padding: 0;
    color: var(--m-text);
    font-size: calc(0.875rem * var(--m-type-scale, 1));
    font-weight: 600;
  }
  .m-approval-choices + .m-approval-choices {
    padding-top: 12px;
    border-top: var(--m-border-width) solid var(--m-border);
  }
  .m-approval-group {
    margin: 8px 0 0;
    color: var(--m-text-muted);
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    font-weight: 500;
    letter-spacing: var(--m-label-tracking);
  }
  .m-approval-choices .m-checkbox + .m-hint { margin: -6px 0 4px 30px; }
  .m-approval-choices .m-checkbox:has(> input:disabled) { color: var(--m-text-muted); cursor: not-allowed; }
  .m-approval-more > summary {
    display: flex;
    min-height: var(--m-touch-target);
    align-items: center;
    gap: 8px;
    color: var(--m-text);
    font-size: calc(0.875rem * var(--m-type-scale, 1));
    cursor: pointer;
    list-style: none;
  }
  .m-approval-more > summary::-webkit-details-marker { display: none; }
  /* The marker the flex row removes, drawn back as a chevron that turns when open, so the row says it opens. */
  .m-approval-more > summary::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform var(--m-dur-1) var(--m-ease-out);
  }
  .m-approval-more[open] > summary::before { transform: rotate(45deg); }
  .m-approval-more > summary:hover { color: var(--m-accent); }
  .m-approval-more > summary:focus-visible { border-radius: var(--m-radius-xs); }
  .m-approval-scope {
    margin: -4px 0 0;
    color: var(--m-text-muted);
    font-size: calc(0.75rem * var(--m-type-scale, 1));
  }
  .m-approval-scope .m-approval-mono { color: var(--m-text-subtle); }
  /* Empty while pending, but in the tree from the start so its content is announced; it takes no room then. */
  .m-approval-status:empty { margin-top: -16px; }
  .m-approval-outcome {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: var(--m-border-width) solid var(--m-outcome-color, var(--m-border));
    border-radius: var(--m-radius-md);
    background: var(--m-outcome-soft, var(--m-bg-subtle));
    color: var(--m-text);
  }
  /* Focused by script when a decision lands (tabindex=-1): it is not a control, so no ring. */
  .m-approval-outcome:focus { outline: none; }
  .m-approval-outcome > [aria-hidden] { flex: none; color: var(--m-outcome-color, var(--m-text-muted)); font-weight: 600; }
  .m-approval-outcome[data-tone="success"] { --m-outcome-color: var(--m-success); --m-outcome-soft: var(--m-success-soft); }
  .m-approval-outcome[data-tone="warning"] { --m-outcome-color: var(--m-warning); --m-outcome-soft: var(--m-warning-soft); }
  .m-approval-outcome[data-tone="danger"] { --m-outcome-color: var(--m-danger); --m-outcome-soft: var(--m-danger-soft); }
  .m-approval-outcome[data-tone="info"] { --m-outcome-color: var(--m-info); --m-outcome-soft: var(--m-info-soft); }

  /* ── Tessellation: the hairline grid and the one signal tile of the inscribed signature ──
   * The grid is a pseudo-element, so its mask fades the lines and not the tile. `.m-auth` draws the same two
   * pseudo-elements when the skin sets --m-auth-backdrop: block, which is why both selectors share the rules. */

  .m-tessellation {
    position: absolute;
    inset: 0;
    overflow: hidden;
    isolation: isolate;
    pointer-events: none;
    --m-tess-mask: radial-gradient(ellipse 60% 75% at 82% 38%, black 10%, transparent 72%);
  }
  .m-tessellation[data-fade="top-right"] { --m-tess-mask: radial-gradient(ellipse 90% 60% at 90% 10%, black 10%, transparent 70%); }
  .m-tessellation[data-fade="center"] { --m-tess-mask: radial-gradient(ellipse 70% 70% at 50% 45%, black 12%, transparent 76%); }
  .m-tessellation[data-fade="none"] { --m-tess-mask: none; }
  @media (max-width: 899px) {
    .m-tessellation:not([data-fade]) { --m-tess-mask: radial-gradient(ellipse 90% 60% at 90% 10%, black 10%, transparent 70%); }
  }
  .m-tessellation::before,
  .m-auth::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
      linear-gradient(var(--m-tess-line, var(--m-border)) 1px, transparent 1px),
      linear-gradient(90deg, var(--m-tess-line, var(--m-border)) 1px, transparent 1px);
    background-size: var(--m-tess-size, 64px) var(--m-tess-size, 64px);
    background-position: var(--m-tess-origin, -1px -1px);
    -webkit-mask-image: var(--m-tess-mask, none);
    mask-image: var(--m-tess-mask, none);
  }
  .m-tessellation::after,
  .m-auth::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    width: calc(var(--m-tess-size, 64px) - 1px);
    height: calc(var(--m-tess-size, 64px) - 1px);
    left: var(--m-tess-x, calc(100% - 2 * var(--m-tess-size, 64px)));
    top: var(--m-tess-y, var(--m-tess-size, 64px));
    background: var(--m-tess-tile, var(--m-signal));
    box-shadow: var(--m-tess-glow, 0 0 80px -10px color-mix(in srgb, var(--m-tess-tile, var(--m-signal)) 45%, transparent));
  }
  @supports (left: round(down, 1px, 1px)) {
    .m-tessellation::after {
      left: var(--m-tess-x, min(round(down, calc(50% + 4 * var(--m-tess-size, 64px)), var(--m-tess-size, 64px)), calc(100% - 2 * var(--m-tess-size, 64px))));
      top: var(--m-tess-y, max(var(--m-tess-size, 64px), round(down, 25%, var(--m-tess-size, 64px))));
    }
  }
  /* Narrow layouts have no clear space for the decorative tile beside the copy or auth card. Keep the grid. */
  @media (max-width: 899px) {
    .m-tessellation::after,
    .m-auth::after { display: none; }
  }
  .m-tessellation[data-tile="off"]::after { display: none; }
  /* Lines this faint are noise in forced colours and at more contrast; the page still reads without them. */
  @media (forced-colors: active), (prefers-contrast: more) {
    .m-tessellation,
    .m-auth::before,
    .m-auth::after { display: none; }
  }

  /* ── Eyebrow: a small tracked label, with the signal tile when the skin (or the tile prop) wants it ── */

  .m-eyebrow {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
    font-family: var(--m-eyebrow-font);
    font-size: calc(0.6875rem * var(--m-type-scale, 1));
    letter-spacing: calc(0.08em + var(--m-label-tracking));
    text-transform: uppercase;
    color: var(--m-text-subtle);
  }
  .m-eyebrow-tile {
    display: var(--m-eyebrow-tile, none);
    flex: none;
    width: 8px;
    height: 8px;
    background: var(--m-signal);
  }
  .m-eyebrow[data-tile="on"] > .m-eyebrow-tile { display: block; }
  .m-eyebrow[data-tile="off"] > .m-eyebrow-tile { display: none; }
  .m-eyebrow[data-tone="neutral"] > .m-eyebrow-tile { background: var(--m-border-strong); }

  /* ── Kurth Labs Design grid: cells set apart by 1px hairlines (gap over a border ground) ──
   * The frame is the container and the inner element the grid, because a container query cannot restyle its own container. */

  .m-design-grid {
    container-type: inline-size;
    overflow: hidden;
    border: var(--m-border-width) solid var(--m-border);
    border-radius: var(--m-radius-md);
  }
  .m-design-cells {
    display: grid;
    gap: 1px;
    background: var(--m-border);
    grid-template-columns: repeat(var(--m-design-cols, 1), minmax(0, 1fr));
  }
  .m-design-cells[data-columns="auto"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
  .m-design-cell {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 20px 24px;
    background: var(--m-bg-elevated);
    grid-column: span var(--m-span, 1);
  }
  .m-design-cell[data-flush] { padding: 0; }
  .m-design-cell[data-span="full"] { grid-column: 1 / -1; }
  @container (max-width: 599px) {
    .m-design-cells,
    .m-design-cells[data-columns="auto"] { grid-template-columns: minmax(0, 1fr); }
    .m-design-cell,
    .m-design-cell[data-span="full"] { grid-column: auto; }
  }
  .m-divider {
    height: 1px;
    border: 0;
    margin: 0;
    background: var(--m-border);
  }
  /* A labelled divider: "or" between sign-in methods. */
  .m-divider-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    line-height: 1.333;
    color: var(--m-text-subtle);
  }
  .m-divider-label::before,
  .m-divider-label::after {
    content: "";
    flex: 1 1 0;
    height: 1px;
    background: var(--m-border);
  }
  /* Inline code in running text. */
  .m-inline-code {
    padding: 1px 6px;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-xs);
    background: var(--m-bg-subtle);
    color: var(--m-text);
    font-family: var(--m-font-mono);
    font-size: 0.92em;
    overflow-wrap: anywhere;
  }
  /* A short vertical list with a dot marker (what a grant allows, features). */
  .m-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: calc(0.875rem * var(--m-type-scale, 1)); line-height: 1.5; color: var(--m-text); }
  .m-list > li { position: relative; padding-left: 16px; overflow-wrap: anywhere; }
  .m-list > li::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 6px; height: 6px; border-radius: 50%; background: var(--m-text-subtle); }
  /* Key/value rows on a <dl> of <div><dt><dd></div>, like KeyValueList: key above value on phones, two columns from 480px. */
  .m-facts { margin: 0; font-family: var(--m-font-mono); font-size: calc(0.75rem * var(--m-type-scale, 1)); line-height: 1.5; }
  .m-facts > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }
  .m-facts > div + div { border-top: 1px solid var(--m-border); }
  .m-facts dt { color: var(--m-text-subtle); }
  .m-facts dd { min-width: 0; margin: 0; color: var(--m-text); overflow-wrap: anywhere; }
  @media (min-width: 480px) {
    .m-facts { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); column-gap: 16px; }
    .m-facts > div { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; gap: 0 16px; }
  }
  /* ── Prose: long-form text (markdown output, docs, a chat message) ── */
  .m-prose { max-width: 76ch; overflow-wrap: break-word; font-size: calc(0.875rem * var(--m-type-scale, 1)); line-height: 1.65; color: var(--m-text); }
  .m-prose h1 { margin: 0 0 16px; font-family: var(--m-font-display); font-weight: var(--m-heading-weight); font-size: calc(1.625rem * var(--m-type-scale, 1)); line-height: 1.2; letter-spacing: calc(var(--m-heading-tracking) * 2); text-transform: var(--m-heading-case); }

  .m-prose h2 { margin: 36px 0 10px; padding-top: 14px; border-top: 1px solid var(--m-border); font-family: var(--m-font-display); font-weight: var(--m-heading-weight); font-size: calc(1.1875rem * var(--m-type-scale, 1)); line-height: 1.3; letter-spacing: var(--m-heading-tracking); text-transform: var(--m-heading-case); }
  .m-prose h3 { margin: 24px 0 8px; font-family: var(--m-font-display); font-weight: var(--m-heading-weight); font-size: calc(0.9375rem * var(--m-type-scale, 1)); line-height: 1.4; letter-spacing: var(--m-heading-tracking); text-transform: var(--m-heading-case); }
  .m-prose :is(h4, h5, h6) { margin: 20px 0 8px; font-family: var(--m-font-display); font-weight: var(--m-heading-weight); line-height: 1.4; letter-spacing: var(--m-heading-tracking); text-transform: var(--m-heading-case); }
  .m-prose h4 { font-size: calc(0.90625rem * var(--m-type-scale, 1)); }
  .m-prose :is(h5, h6) { font-size: calc(0.875rem * var(--m-type-scale, 1)); }
  .m-prose > :first-child { margin-top: 0; }
  .m-prose > h2:first-child { padding-top: 0; border-top: 0; }
  .m-prose :is(p, ul, ol, table, pre, blockquote) { margin: 0 0 12px; }
  .m-prose :is(ul, ol) { padding-left: 22px; }
  .m-prose ul { list-style: disc; }
  .m-prose ol { list-style: decimal; }
  .m-prose li { margin: 3px 0; }
  .m-prose li::marker { color: var(--m-text-subtle); }
  /* Always underlined: in skins whose accent is the text colour (argus, inscribed) the underline is the only cue, and a
     refused link (drawn as text) must not look like a real one (#395, WCAG 1.4.1). */
  .m-prose a { color: var(--m-accent); text-decoration: underline; text-underline-offset: 2px; }
  .m-prose code { padding: 0 4px; border: 1px solid var(--m-border); border-radius: var(--m-radius-xs); background: var(--m-bg-inset); font-family: var(--m-font-mono); font-size: calc(0.78125rem * var(--m-type-scale, 1)); }
  .m-prose pre { overflow-x: auto; padding: 12px; border: 1px solid var(--m-border); border-radius: var(--m-radius-md); background: var(--m-bg-inset); }
  .m-prose pre code { padding: 0; border: 0; background: none; font-size: calc(0.75rem * var(--m-type-scale, 1)); line-height: 1.6; }
  .m-prose table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: calc(0.8125rem * var(--m-type-scale, 1)); }
  .m-prose :is(th, td) { padding: 6px 10px; border: 1px solid var(--m-border); text-align: left; vertical-align: top; }
  .m-prose th { background: var(--m-bg-subtle); font-weight: 600; }
  .m-prose blockquote { padding: 4px 12px; border-left: 3px solid var(--m-accent); border-radius: 0 var(--m-radius-md) var(--m-radius-md) 0; background: var(--m-accent-soft); color: var(--m-text-muted); }
  .m-prose hr { margin: 24px 0; border: 0; border-top: 1px solid var(--m-border); }

  /* ── Card (mirrors Section). .m-edge on a card draws the skin's accent edge; it stays last in this layer. ── */

  .m-card {
    min-width: 0;
    border: var(--m-border-width) solid var(--m-border);
    border-radius: var(--m-radius-lg);
    background: var(--m-bg-elevated);
  }
  .m-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--m-border);
  }
  .m-card-title {
    margin: 0;
    font-family: var(--m-title-font);
    font-size: calc(0.8125rem * var(--m-type-scale, 1));
    font-weight: var(--m-heading-weight);
    line-height: 1.428;
    letter-spacing: var(--m-title-tracking);
    text-transform: var(--m-heading-case);
  }
  .m-card-description {
    margin: 2px 0 0;
    font-size: calc(0.75rem * var(--m-type-scale, 1));
    line-height: 1.333;
    color: var(--m-text-subtle);
  }
  .m-card-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .m-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--m-border);
  }

  /* ── Pill (mirrors StatusPill): a dot and a word. A tone sets the text, soft fill and dot colours. ── */

  .m-pill {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--m-radius-pill);
    background: var(--m-pill-soft);
    color: var(--m-pill-color);
    font-family: var(--m-font-mono);
    font-size: calc(0.6875rem * var(--m-type-scale, 1));
    line-height: var(--m-line-height-body);
    letter-spacing: var(--m-pill-tracking, 0.04em);
    text-transform: var(--m-pill-case, uppercase);
    white-space: nowrap;
    --m-pill-color: var(--m-text-muted);
    --m-pill-soft: var(--m-bg-subtle);
    --m-pill-dot: var(--m-text-subtle);
  }
  .m-pill-neutral { --m-pill-color: var(--m-text-muted); --m-pill-soft: var(--m-bg-subtle); --m-pill-dot: var(--m-text-subtle); }
  .m-pill-success { --m-pill-color: var(--m-success); --m-pill-soft: var(--m-success-soft); --m-pill-dot: var(--m-success); }
  .m-pill-warning { --m-pill-color: var(--m-warning); --m-pill-soft: var(--m-warning-soft); --m-pill-dot: var(--m-warning); }
  .m-pill-danger { --m-pill-color: var(--m-danger); --m-pill-soft: var(--m-danger-soft); --m-pill-dot: var(--m-danger); }
  .m-pill-info { --m-pill-color: var(--m-info); --m-pill-soft: var(--m-info-soft); --m-pill-dot: var(--m-info); }
  .m-pill-dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--m-pill-dot);
  }

  /* Last in the layer, so it wins over a card's own `border` shorthand (`m-auth-card`, any card class).
     An accent edge on a card: its top border, 3px in the accent in a skin with an edge, and the card's own border otherwise. */
  .m-edge {
    border-top-width: var(--m-edge-width);
    border-top-color: var(--m-edge-color);
  }
  .m-edge-neutral {
    border-top-width: var(--m-edge-width);
    border-top-color: var(--m-edge-neutral);
  }
}

/*
 * Windows High Contrast and other forced-colors modes strip box-shadow and
 * background colours, which is how the focus ring and the selected segment are
 * drawn. Outside the layers on purpose, so it wins over utilities: every
 * keyboard-focused element gets a real outline, a selected radio, tab or page
 * link gets one in the text colour, and the code cells light their border.
 */
@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  /* A chosen control keeps its CanvasText marker below, drawn inset on its own border, because this mode strips
   * the background that normally says "on". One outline cannot be both, so a focused chosen control gets a
   * double ring in Highlight: it differs from the plain solid focus ring (focus visible, state still visible) and
   * from the unfocused CanvasText marker. These selectors outrank both rules (#397). */
  [role="radio"][aria-checked="true"]:focus-visible,
  [aria-pressed="true"]:focus-visible,
  [aria-current="page"]:focus-visible,
  [aria-selected="true"]:focus-visible {
    outline: 4px double Highlight;
    outline-offset: 2px;
  }
  [role="radio"][aria-checked="true"],
  [aria-pressed="true"],
  [aria-current="page"],
  [aria-selected="true"] {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }
  .m-code-input:focus + .m-code-cells .m-code-cell {
    border-color: Highlight;
    outline: 2px solid Highlight;
    outline-offset: 1px;
  }
  /* Checkbox and Switch draw their state with a background, which this mode replaces. */
  [data-m-toggle] {
    forced-color-adjust: none;
    border-color: ButtonText;
    background: Canvas;
  }
  [data-m-toggle]:checked,
  [data-m-toggle]:indeterminate {
    border-color: Highlight;
    background: Highlight;
  }
  [data-m-toggle]:checked ~ svg,
  [data-m-toggle]:indeterminate ~ svg {
    color: HighlightText;
  }
  [data-m-toggle] ~ [data-m-thumb] {
    forced-color-adjust: none;
    background: ButtonText;
  }
  [data-m-toggle]:checked ~ [data-m-thumb] {
    background: HighlightText;
  }
  /* The static checkbox draws its state with a background, which this mode replaces. */
  .m-checkbox > input {
    forced-color-adjust: none;
    border-color: ButtonText;
    background: Canvas;
  }
  .m-checkbox > input:checked {
    border-color: Highlight;
    background: Highlight;
  }
  .m-checkbox > input::before { background: HighlightText; }
  .m-checkbox > input:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  .m-error-summary:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  /* BottomPanel's grip pill is a background, which this mode replaces. */
  [data-bottom-panel-grip] > span {
    forced-color-adjust: none;
    background: ButtonText;
  }
  /* A pill's dot is a background, which this mode replaces. */
  .m-pill-dot {
    forced-color-adjust: none;
    background: ButtonText;
  }
}

/* Lightbox: a photo slides in from the side it came from. Not under reduced motion: the photo just appears. */
@keyframes m-lightbox-from-next { from { transform: translateX(10%); opacity: 0; } }
@keyframes m-lightbox-from-prev { from { transform: translateX(-10%); opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .m-lightbox-photo[data-dir="next"] { animation: m-lightbox-from-next var(--m-dur-3) var(--m-ease-out); }
  .m-lightbox-photo[data-dir="prev"] { animation: m-lightbox-from-prev var(--m-dur-3) var(--m-ease-out); }
}

/* In forced colours backgrounds are replaced, so the grout and the eyebrow tile are drawn in system colours. */
@media (forced-colors: active) {
  .m-design-cells {
    forced-color-adjust: none;
    background: CanvasText;
  }
  .m-design-cell {
    forced-color-adjust: auto;
    background: Canvas;
  }
  .m-eyebrow-tile {
    forced-color-adjust: none;
    background: CanvasText;
  }
}
