/* ==========================================================================
   Dapple HTML Starter: plain CSS using real design tokens.
   This file is the single source of truth for every token and component
   style in this system, hand-written, no build step, no framework.
   ========================================================================== */
/* dapple-design-system v2.0.0, styles.css hash: ff142b6f08be (regenerate via html-starter/build-tokens.mjs --check) */


@font-face {
  font-family: "Geist";
  src: url("./fonts/Geist-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("./fonts/Geist-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("./fonts/Geist-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("./fonts/GeistMono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("./fonts/GeistMono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design Tokens (light mode)
   ========================================================================== */

:root {
  /* Native controls follow the theme. Without this the checkboxes,
     the scrollbars and the select popup stay light on a dark page,
     and a variant-less button falls through to the UA's own chrome. */
  color-scheme: light;

  /* Core surfaces. White ground, the same page the marketing site and the
     decks stand on, no tint. */
  --background: #FFFFFF;
  --foreground: #000000;
  --card: #FFFFFF;
  --card-foreground: #000000;
  --popover: #FFFFFF;
  --popover-foreground: #000000;

  /* Action. The primary button is Ink, the marketing site's black
     button, and it hovers to a neutral step of the same Ink. The brand is
     white, Ink and the seven business-area families: no hue is the house
     color, violet included (it is the Brand family, one of the seven, and
     it is picked like any other). */
  --primary: #000000;
  --primary-foreground: #FFFFFF;
  --primary-hover: #33363E; /* the action steps to a neutral, never to a hue: the brand is white, Ink and the seven families */
  --primary-hover-foreground: #FFFFFF;
  --secondary: #F3F4F6; /* quiet neutral fill: secondary buttons, chips */
  --secondary-foreground: #000000;
  --secondary-border: var(--secondary); /* the secondary button's edge: the fill itself in light (no visible edge), a hairline in dark where the fill barely lifts off the ground */
  --toggle-thumb: #7C808A; /* the off switch's knob and outline: 3.95:1 on white, 3.59:1 on its own track, so an off switch is a visible control */
  --muted-surface: #F9F9FB; /* near-white surface: rails, table heads, inspectors */
  --rail-surface: var(--muted-surface); /* sidebars and lists beside a page */
  --muted-foreground: #4C505C; /* body-grade gray, the landing's secondary text */
  --accent: #F3F4F6; /* neutral hover and selected fill, a whisper of gray */
  --accent-foreground: #000000;
  --destructive: #D6283A;
  --destructive-foreground: #FFFFFF;

  /* Borders and focus */
  --border: #E9EBF2; /* cool hairline */
  --input: #F9F9FB; /* a sunken control track (the radio cards in dark); fields draw on --card */
  --input-disabled: #EEEFF3; /* a field that is off: one clear step below the resting fill */
  --ring: #000000; /* Ink focus ring, the page color as the gap */
  --faint: #686C78; /* the quietest text that still reads: axis labels, placeholders */
  --edge: color-mix(in oklab, var(--faint) 75%, var(--card)); /* a control's edge at 3:1: fields, a pressed chip, the current page number */

  /* Business-area secondary families: accent / surface (40% tint) / text */
  --ba-executive-accent: #75BDE9;
  --ba-executive-surface: #B0DAF2;
  --ba-executive-text: #1F3D52;

  --ba-commercial-accent: #75BF65;
  --ba-commercial-surface: #AFDAA4;
  --ba-commercial-text: #2C521F;

  --ba-product-accent: #F48C69;
  --ba-product-surface: #F6C0A6;
  --ba-product-text: #5C2A14;

  --ba-infrastructure-accent: #3BB4C0;
  --ba-infrastructure-surface: #82CFD5;
  --ba-infrastructure-text: #17454A;

  --ba-customer-accent: #F183BF;
  --ba-customer-surface: #F5B8DA;
  --ba-customer-text: #5C1F42;

  --ba-corporate-accent: #F4BC40;
  --ba-corporate-surface: #F6D283;
  --ba-corporate-text: #5C4514;
  /* Corporate drawn as a line, not a fill: the accent is the lightest of
     the seven (1.73:1 on white) and disappears at 1-3px. This darker stop
     is the core's own thin-line exception (2.22:1). It is a legibility
     value, not a WCAG fix: the 3:1 graphics minimum is a separate open
     decision about the whole light-theme chart ramp. */
  --ba-corporate-line: #E0A400;

  /* Lifted from #8B4FE6. The other six accents sit between 0.71 and 0.83
     in OKLab lightness; this one sat at 0.58, a different weight of colour
     inside a ramp of pastels, and black on it fell to 4.36:1 while black
     on the others runs 8.5 to 12.1. At 0.74 it is in the band and takes
     black at 8.47:1 like the rest. Still to go back to the org core. */
  --ba-brand-accent: #B890FF;
  --ba-brand-surface: #CAB2F4;
  --ba-brand-text: #3A2073;
  --ba-brand-surface-soft: #E7D9FA; /* extra-soft lila, for a LARGE background where the surface would shout */
  /* Brand drawn as a mark rather than a fill: a chart series (--viz-7) and
     a badge's dot. The accent itself in light and dark; vibrant gives it
     a deep stop of its own (below), because there #B890FF is the one pastel
     in a ramp of deep, saturated accents. */
  --ba-brand-line: var(--ba-brand-accent);

  /* Data-viz tier: categorical palette for charts, map layers, path legs,
     any data encoding that is NOT brand chrome. Slots 1 to 7 alias onto
     the seven family accents in the documented series order (sky, coral,
     green, amber, pink, teal, lilac), so the physical palette stays one
     set and every theme's values flow through automatically. There are
     only seven families, so slot 8 is not one: it is a neutral remainder
     stop, the "other" bucket a categorical scale needs once it runs past
     the families. It is deliberately the only achromatic stop in the
     ramp, which is what separates it from lilac. Separation here is by
     hue, not by luminance — these stops sit at similar lightness on
     purpose, so do not read WCAG contrast between two stops as a
     quality signal. check-contrast.mjs guards the real property: every
     stop is perceptually distinct from every other in OKLab. Use these
     names in data contexts so a series never semantically claims a
     business area. Do not invent parallel per-project viz palettes. */
  --viz-1: var(--ba-executive-accent);
  --viz-2: var(--ba-product-accent);
  --viz-3: var(--ba-commercial-accent);
  --viz-4: var(--ba-corporate-accent);
  --viz-5: var(--ba-customer-accent);
  --viz-6: var(--ba-infrastructure-accent);
  --viz-7: var(--ba-brand-line);
  --viz-8: #6B7180;

  /* Elevation scale: hairline border at rest, shadow reserved for hover/
     focus and for surfaces that sit above the page (popovers, dropdowns,
     modals). xs/sm are not yet used by any component in html-starter
     today, they're reserved for the lighter-weight overlay components
     (tooltip, chip, toast) the pattern layer adds next, keep them rather
     than re-adding them later. */
  --shadow-xs: 0 1px 0 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);
  /* The ring's inner gap follows the surface the control sits on, not
     the page: --ring-gap defaults to the page ground and every raised
     surface overrides it for its own children. Hard-coding
     --background put a white band on a toast and a navy band on every
     control inside a dark card. */
  --ring-gap: var(--background);
  --shadow-focus: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--ring);

  /* Radius scale. --radius-xl (modals, large panels) has no consumer yet
     in html-starter, reserved for the generic modal/dialog component the
     pattern layer adds next. */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --tint-soft: 32%; /* badges, alerts, the session banner */
  --tint-strong: 58%; /* icon tiles */
  --tint-edge: 85%; /* a tinted slip's own edge */
  --radius-card: 18px; /* cards and panels; rows and tiles keep --radius-lg */

  /* Motion. --dur-1/--ease-out have no consumer yet in html-starter,
     reserved for the fast state-flip and exit/dismiss timing the
     upcoming .menu primitive and toast pattern need. */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* Press feedback. One value for a control and a far smaller one for a
     row, where a full scale reads as the list jumping. Transform only, so a
     press never changes a box and the layout cannot move under the finger. */
  --press: scale(0.97);
  --press-row: scale(0.995);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;

  /* Theme-invariant constants: values that stay FIXED regardless of the
     active theme (a scrim, a pin's white ring, a polyline casing under
     colored routes). The pattern: define once here in :root, never
     redefine in a theme block, comment what the value anchors. Apps add
     their own invariants the same way (e.g. --marker-ring,
     --route-casing), that is sanctioned, not a gotcha-12 deviation. */
  --overlay-backdrop: rgba(17, 18, 22, 0.45); /* scrim behind drawer/modal/inspector */

  /* Fluid display type scale, the dapple.co landing's statement type:
     large, tight, line-height at or under 1. Marketing and hero surfaces
     only, product UI uses h1 to h4 below. */
  --text-hero: clamp(38px, 5vw, 68px);
  --text-hero--line-height: 1;
  --text-hero--letter-spacing: -0.05em;

  --text-statement: clamp(40px, 5.2vw, 72px);
  --text-statement--line-height: 0.95;
  --text-statement--letter-spacing: -0.05em;

  --text-feature: clamp(22px, 2.5vw, 30px);
  --text-feature--line-height: 1.2;
  --text-feature--letter-spacing: -0.03em;

  --text-hero-subtitle: clamp(18px, 1.6vw, 22px);
  --text-hero-subtitle--line-height: 1.4;
  --text-hero-subtitle--letter-spacing: -0.015em;

  --text-callout: clamp(17px, 1.65vw, 22px);
  --text-callout--line-height: 1.55;
  --text-callout--letter-spacing: -0.01em;

  --text-display-body: clamp(16px, 1.2vw, 18px);
  --text-display-body--line-height: 1.7;
  --text-display-body--letter-spacing: -0.01em;

  /* Font stack */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Breakpoints. phone = base (<640) · tablet = 768+ · desktop = 1024+.
     Named for reference in comments/docs, plain CSS has no way to plug a
     custom property into a @media query condition, so these describe the
     same numbers @media (min-width: ...) rules below use directly. */
  --breakpoint-sm: 40rem;  /* 640px */
  --breakpoint-md: 48rem;  /* 768px */
  --breakpoint-lg: 64rem;  /* 1024px */
  --breakpoint-xl: 80rem;  /* 1280px */
  --breakpoint-2xl: 96rem; /* 1536px */

  /* Page shell and prose width caps. */
  --container-dapple: 80rem;      /* 1280px, .container's max-width */
  --container-dapple-text: 42rem; /* 672px, prose measure, ~70ch at 17px */

  /* Spacing scale. Fixed rem steps for gaps, padding, and margins.
     Negative steps exist for pulling a child past its parent's edge
     (e.g. an icon overlapping a card corner), not for typical layout. */
  --space-000: -0.25rem;
  --space-00: -0.125rem;
  --space-1: 0.125rem;
  --space-2: 0.25rem;
  --space-3: 0.5rem;
  --space-4: 0.75rem;
  --space-5: 1rem;
  --space-6: 1.25rem;
  --space-7: 1.5rem;
  --space-8: 1.75rem;
  --space-9: 2rem;
  --space-10: 2.5rem;
  --space-11: 3rem;
  --space-12: 4rem;
  --space-13: 4.5rem;
  --space-14: 5rem;
  --space-15: 6rem;

  /* Fluid spacing. Shrinks smoothly between the two bounds instead of
     jumping at a breakpoint, for page-level gutters and section gaps
     that should scale with viewport width rather than snap. */
  --space-fluid-1: clamp(0.5rem, 1vw + 0.35rem, 1rem);
  --space-fluid-2: clamp(1rem, 2vw + 0.5rem, 1.5rem);
  --space-fluid-3: clamp(1.5rem, 3vw + 0.75rem, 2.5rem);
  --space-fluid-4: clamp(2rem, 5vw + 1rem, 4rem);
  --space-fluid-5: clamp(3rem, 8vw + 1.5rem, 6rem);
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-theme="dark"] {
  color-scheme: dark;

  --background: #111216;
  --foreground: #FFFFFF;
  --card: #202125;
  --card-foreground: #FFFFFF;
  --popover: #26272A;
  --popover-foreground: #FFFFFF;

  --primary: #F5F4F6;
  --primary-foreground: #111216;
  --primary-hover: #C4C6CE;
  --primary-hover-foreground: #111216;
  --secondary: #26272A;
  --secondary-foreground: #FFFFFF;
  --secondary-border: #404144; /* hairline edge: #26272A on #111216 is 1.25:1, the box needs an outline to read as a button */
  --toggle-thumb: #A0A1A5; /* the off switch's knob and outline: 5.79:1 on its track, 7.25:1 on the ground */
  --muted-surface: #202125;
  --rail-surface: #15161A; /* a step below the cards, so a raised row lifts off it */
  --muted-foreground: #A0A1A5;
  --accent: #2E2E31;
  --accent-foreground: #FFFFFF;
  --destructive: #D6283A;
  --destructive-foreground: #FFFFFF;

  --border: #323335;
  --input: #19191B;
  --input-disabled: #242427;
  --ring: #FFFFFF;
  --faint: #8C8E94;

  /* The seven dark family surfaces are one band: OKLCH lightness 0.28 and
     chroma about 0.028, half of what they carried, each at its own hue.
     At full chroma (about 0.055) a family surface at this depth reads as a
     colour of its own rather than as a dark ground with a family in it:
     Executive came out navy (#062C40), Infrastructure a teal room
     (#003036), Corporate mud brown (#362602), Product a rust (#3F1E13). At
     half they read as black-leaning greys that are still recognisably sky,
     green, coral, teal, pink, amber and lilac, and each text holds its
     8.3 to 8.4:1. Not less: under about 0.02 OKLCH chroma a browser treats
     the hue as missing, and the tints mixed from these surfaces (the
     user's chat bubble, the open thread) came out a warm brown. */
  --ba-executive-surface: #1C2C36;
  --ba-executive-text: #A0CBE6;

  --ba-commercial-surface: #222D20;
  --ba-commercial-text: #B0CEAA;

  --ba-product-surface: #35231D;
  --ba-product-text: #E7B8A8;

  --ba-infrastructure-surface: #1A2E31;
  --ba-infrastructure-text: #96D0D6;

  --ba-customer-surface: #32222A;
  --ba-customer-text: #E2B5CB;

  --ba-corporate-surface: #2F2819;
  --ba-corporate-text: #D7C198;

  --ba-brand-surface: #2A2534;
  --ba-brand-text: #CABCE6;

  /* The remainder stop lifts off the Ink page, but only as far as the
     families themselves sit: it lands level with lilac, the lowest of
     them, so the "other" bucket still reads as the quiet one. Going
     lighter than the family ceiling would make slot 8 the loudest stop
     in a ramp it is supposed to recede behind. */
  --viz-8: #737B8C;

  --shadow-xs: 0 1px 0 0 rgba(0, 0, 0, 0.20);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24), 0 1px 0 rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.24), 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.40), 0 2px 6px rgba(0, 0, 0, 0.16);
}

/* ==========================================================================
   Vibrant Mode
   Third official theme. Same structure as light (white surface, near-
   black text, hairline borders, no shadow at rest) and the same neutrals:
   only the families change. --primary stays Ink (the action is black in
   every light theme), and six of the seven business-area families deepen
   from their light-mode pastel values to a punchier "-vibrant" ramp so
   decoration (badges, alerts, charts) can read as genuinely colorful.
   The greys are light's greys, no tint: a lavender page, field and
   hairline made violet the house colour again, which the brand is not.
   Brand keeps the lifted #B890FF accent in every theme, so black text
   sits on it here as it does in light and dark. Radius, shadow geometry,
   and motion timing are untouched.
   ========================================================================== */

[data-theme="vibrant"] {
  color-scheme: light;

  --background: #FFFFFF;
  --foreground: #111216;
  --card: #FFFFFF;
  --card-foreground: #111216;
  --popover: #FFFFFF;
  --popover-foreground: #111216;

  --primary: #111216;
  --primary-foreground: #FFFFFF;
  --primary-hover: #33363E;
  --primary-hover-foreground: #FFFFFF;
  --secondary: #F3F4F6;
  --secondary-foreground: #111216;
  --secondary-border: var(--secondary);
  --toggle-thumb: #7C808A;
  --muted-surface: #F9F9FB;
  --muted-foreground: #4C505C;
  --accent: #F3F4F6;
  --accent-foreground: #111216;
  --destructive: #D6283A;
  --destructive-foreground: #FFFFFF;

  --border: #E9EBF2;
  --input: #F9F9FB;
  --input-disabled: #EEEFF3;
  --ring: #111216;
  --faint: #686C78; /* light's grey: the vibrant neutrals carry no tint */

  --ba-executive-accent: #0A76B8;
  --ba-executive-surface: #B3D8EF;
  --ba-executive-text: #053E61;

  --ba-commercial-accent: #1C7E07;
  --ba-commercial-surface: #BEEFB3;
  --ba-commercial-text: #114E04;

  --ba-product-accent: #CB3B0B;
  --ba-product-surface: #EFC2B3;
  --ba-product-text: #611C05;

  --ba-infrastructure-accent: #0B828E;
  --ba-infrastructure-surface: #B3EAEF;
  --ba-infrastructure-text: #04474E;

  --ba-customer-accent: #D10574;
  --ba-customer-surface: #EFB3D4;
  --ba-customer-text: #610537;

  --ba-corporate-accent: #916608;
  --ba-corporate-surface: #EFDCB3;
  --ba-corporate-text: #4E3704;

  --ba-brand-accent: #B890FF; /* the lifted Brand accent, as in light and dark: black text at 8.47:1 (it was #6317CF, which only white could sit on) */
  --ba-brand-surface: #CCB3EF;
  --ba-brand-text: #3C0788;
  /* The Brand mark in vibrant: a chart series and a badge dot at the weight
     of the other six vibrant accents (OKLCH lightness 0.52 against their
     0.52 to 0.56). #B890FF stays the fill; as a mark beside #0A76B8 and
     #CB3B0B it read as a washed-out series and its dot vanished on the
     Brand surface. */
  --ba-brand-line: #773CD6;

  /* The vibrant families are deep and saturated, so the remainder stop
     goes deep too and keeps the ramp's optical weight even. */
  --viz-8: #3F4557;
}

/* ==========================================================================
    Accessibility: Reduced Motion
    ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
    Base Styles
    ========================================================================== */

* {
  box-sizing: border-box;
  --shadow-focus: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--ring);
}

/* hidden means hidden, whatever display a component sets */
[hidden] {
  display: none !important;
}

html {
  --bar-columns: auto minmax(0, 1fr) auto; /* header grid, see .nav-inner */
  font-family: var(--font-sans);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  transition: background-color var(--dur-2) var(--ease-in-out),
              color var(--dur-2) var(--ease-in-out);
}

.container {
  max-width: var(--container-dapple);
  margin: 0 auto;
  padding: 0 var(--space-9);
}

.section {
  margin-bottom: var(--space-13);
}

.section-head {
  margin-bottom: var(--space-9);
}

/* Documents: a live, isolated specimen of dapple-doc-template, not an app
   stylesheet applied to a document. Viewport sizes are real CSS pixels; the
   frame scales down to fit the stage without changing the document's layout. */
.documents-main {
  padding-top: var(--space-11);
  padding-bottom: var(--space-11);
}

.documents-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-7) var(--space-11);
  margin-bottom: var(--space-11);
}

.documents-intro h1 {
  margin: var(--space-3) 0 var(--space-5);
}

.documents-intro .lead {
  max-width: var(--container-dapple-text);
  margin: 0;
}

.documents-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.documents-source-link,
.documents-caption {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.documents-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.documents-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-6);
}

.documents-toolbar h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.0625rem;
}

.documents-toolbar p,
.documents-preview-footer p,
.documents-footer p {
  margin: 0;
}

.documents-viewports {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.documents-viewports[hidden] {
  display: none;
}

.documents-viewports .btn {
  min-height: 2.75rem;
  gap: var(--space-2);
}

.documents-viewports .btn[aria-pressed="true"] {
  border-color: var(--foreground);
  background: var(--accent);
  color: var(--foreground);
}

.documents-viewports span {
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.documents-stage {
  padding: var(--space-5);
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--muted-surface);
}

.documents-frame-size {
  position: relative;
  margin: 0 auto;
  outline: 1px solid var(--border);
}

.documents-frame {
  display: block;
  width: 100%;
  height: 50rem;
  border: 0;
  transform-origin: top left;
}

.documents-stage.is-sized .documents-frame {
  position: absolute;
  top: 0;
  left: 0;
}

.documents-preview-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-7);
  padding: var(--space-4) var(--space-6);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.documents-noscript {
  margin: 0;
  padding: var(--space-6);
}

.documents-guide {
  display: grid;
  gap: var(--space-11);
  margin-top: var(--space-12);
}

.documents-guide-heading h2 {
  margin: var(--space-3) 0 var(--space-5);
}

.documents-guide p {
  max-width: var(--container-dapple-text);
  margin: var(--space-3) 0 var(--space-5);
}

.documents-steps {
  display: grid;
  gap: var(--space-9);
  margin: 0;
  padding-left: var(--space-7);
  list-style: decimal-leading-zero;
}

.documents-steps li {
  padding-left: var(--space-3);
}

.documents-steps li::marker {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.documents-steps h3 {
  margin: 0;
}

.documents-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-12);
  padding-top: var(--space-7);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.documents-footer p {
  max-width: var(--container-dapple-text);
}

@media (min-width: 768px) {
  .documents-guide {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  }

  .documents-stage {
    padding: var(--space-7);
  }
}

/* Examples: worked examples built on the system (examples.html). A card
   per example: its icon tile, what it shows, what it depends on, one
   action. The examples themselves live in examples/ and
   assets/documents/examples/. */
.examples-main {
  padding-top: var(--space-11);
  padding-bottom: var(--space-11);
}

.examples-intro h1 {
  margin: var(--space-3) 0 var(--space-5);
}

.examples-intro .lead {
  max-width: var(--container-dapple-text);
  margin: 0;
}

.examples-main .examples-grid {
  margin-top: var(--space-11);
}

.examples-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.examples-card h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.examples-card .examples-meta {
  font-size: 0.8125rem;
}

.examples-card .card-action {
  margin-top: auto;
}

/* Icons: the icon module's showcase (icons.html), built like the documents
   page: an intro, the live specimen, the rules, the source of truth. The
   catalog is generated by build-icons.mjs from assets/icons/manifest.json;
   icons.js only swaps the family and rendering classes. */
.icons-main {
  padding-top: var(--space-11);
  padding-bottom: var(--space-11);
}

.icons-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-7) var(--space-11);
  margin-bottom: var(--space-11);
}

.icons-intro h1 {
  margin: var(--space-3) 0 var(--space-5);
}

.icons-intro .lead {
  max-width: var(--container-dapple-text);
  margin: 0;
}

.icons-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.icons-caption {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.icons-section {
  margin-bottom: var(--space-12);
}

.icons-section-head {
  margin-bottom: var(--space-7);
}

.icons-toolbar h2,
.icons-section-head h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.0625rem;
}

.icons-toolbar {
  display: grid;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}

.icons-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-7);
}

.icons-controls[hidden] {
  display: none;
}

.icons-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.icons-switch .btn {
  gap: var(--space-3);
}

.icons-switch .btn[aria-pressed="true"] {
  border-color: var(--foreground);
  background: var(--accent);
  color: var(--foreground);
}

.icons-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-pill);
  background-color: var(--family-accent);
}

.icons-search {
  flex: 1 1 14rem;
  max-width: 20rem;
}

.icons-group + .icons-group {
  margin-top: var(--space-9);
}

.icons-group h3 {
  margin: 0 0 var(--space-5);
  font-size: 0.9375rem;
}

.icons-group h3 span {
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.icons-grid,
.icons-glyphs,
.icons-logos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.icons-cell,
.icons-logo {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  text-align: center;
}

.icons-cell[hidden] {
  display: none;
}

.icons-cell .icon,
.icons-cell .glyph {
  margin-bottom: var(--space-3);
}

.icons-name {
  margin: 0;
  font-size: 0.875rem;
}

.icons-key {
  display: grid;
  gap: var(--space-1);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.icons-key code {
  font-size: 0.75rem;
}

.icons-status {
  margin-top: var(--space-5);
}

.icons-renderings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-7);
}

.icons-rendering {
  display: grid;
  align-content: start;
  gap: var(--space-4);
}

.icons-rendering-field {
  padding: var(--space-6);
  border-radius: var(--radius-md);
}

.icons-sizes {
  display: flex;
  align-items: flex-end;
  gap: var(--space-6);
  min-height: 4rem;
}

.icons-logos {
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}

.icons-logo svg {
  margin-bottom: var(--space-3);
}

.icons-guide {
  display: grid;
  gap: var(--space-11);
  margin-top: var(--space-12);
}

.icons-guide-heading h2 {
  margin: var(--space-3) 0 var(--space-5);
}

.icons-guide p {
  max-width: var(--container-dapple-text);
  margin: var(--space-3) 0 var(--space-5);
}

.icons-steps {
  display: grid;
  gap: var(--space-9);
  margin: 0;
  padding-left: var(--space-7);
  list-style: decimal-leading-zero;
}

.icons-steps li {
  padding-left: var(--space-3);
}

.icons-steps li::marker {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.icons-steps h3 {
  margin: 0;
}

.icons-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-12);
  padding-top: var(--space-7);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.icons-footer p {
  max-width: var(--container-dapple-text);
  margin: 0;
}

@media (min-width: 768px) {
  .icons-grid,
  .icons-glyphs {
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  }

  .icons-guide {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  }
}

.demo-grid {
  /* Each specimen is its own height: stretching them to the tallest left
     three of the four alerts with an empty bottom third. */
  align-items: start;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-7);
  margin-top: var(--space-7);
  /* Container query boundary for .card: cards adapt to the width of this
     grid's own column, not the raw viewport, see the Cards section. */
  container-type: inline-size;
  container-name: card-grid;
}

/* Cards are the exception: a row of them is one set of things, so they
   share a height and the row reads as a row. A row of specimens is not a
   set, which is why the grid starts them at the top by default. The cards
   become columns so their one action can sit at the bottom edge rather
   than floating wherever the copy happens to end. */
.demo-grid:has(> .card) {
  align-items: stretch;
}

.demo-grid:has(> .card) > .card {
  display: flex;
  flex-direction: column;
}

.demo-grid:has(> .card) > .card .card-action {
  margin-top: auto;
}

.demo-row {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  align-items: center;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* Eyebrow: a small sentence-case label with a little positive tracking,
   the decks' convention. Never uppercase, never a hue: color is
   reserved for the one action on the view, a label is not an action. */
.text-eyebrow {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

/* Quiet variant, composes with .text-eyebrow. Kept as a hook for
   data-dense panels where several eyebrows share the screen: same size
   and tracking, muted, so call sites that already use it keep working. */
.text-eyebrow.text-eyebrow-quiet {
  color: var(--muted-foreground);
}

.text-eyebrow-sm {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

/* Visually hidden but present for screen readers. Use when a label needs
   to disappear at a breakpoint (icon-only nav item, collapsed button
   label) without losing its accessible name, never delete the label
   text outright. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-caption {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted-foreground);
  margin: 0;
}

.text-muted {
  color: var(--muted-foreground);
}

/* ==========================================================================
   Icons
   Three sets, one job each (DAPPLE-DESIGN-SYSTEM.md section 6, Icons):

   1. Expressive icons (assets/icons/, 100 marks on a 24 grid). Each one is
      two solid blocks that overlap. The markup carries role classes, never
      colour: .ico-a is the back block, .ico-b the front block, .ico-x the
      front block clipped to the back block (the overlap), .ico-d an
      optional detail. The colour comes from the family set on the context
      (.family-* on the svg or any ancestor), so every icon works in all
      seven families. One drawing, three renderings:
        .icon              three tones of the family (the default)
        .icon-tonal        one family colour at 46%, 74% and 100%
        .icon-neutral      the same in the neutral grey, no family
      .icon-mono fills every layer with currentColor: the fallback for very
      small sizes and for an icon inside a button. A rendering class can sit
      on the svg or on any ancestor. Without a family, .icon renders
      neutral, never a borrowed family.
   2. Interface glyphs (assets/glyphs/, 43 strokes, .glyph): the controls'
      own marks (chevron, close, menu, theme, arrows). Stroke 1.75 in
      currentColor, never coloured by family (rule 10).
   3. Category logos (assets/logos/categories/, .category-logo) and the
      Dapple Intelligence mark (.intelligence-mark).

   The tones are derived here from the family roles, never declared as new
   hex: --icon-light, --icon-mid and --icon-dark are local to the svg, the
   same pattern as --field-surface. In dark the light tone becomes a pale
   tint of the accent and the dark tone sinks toward the page, the same
   order as the category logos' dark artwork, so the overlap still reads.
   ========================================================================== */

.icon {
  /* No family on the context: the neutral tonal rendering. */
  --icon-dark: color-mix(in oklch, var(--muted-foreground) 85%, var(--background));
  --icon-light: color-mix(in srgb, var(--icon-dark) 46%, transparent);
  --icon-mid: color-mix(in srgb, var(--icon-dark) 74%, transparent);

  display: inline-block;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-lg {
  width: 2.75rem;
  height: 2.75rem;
}

.icon-xl {
  width: 4rem;
  height: 4rem;
}

/* Three tones: light = the family surface with 30% of the accent, mid =
   the accent, dark = the accent 42% of the way to the family text. */
:is(.family-executive, .family-commercial, .family-product, .family-infrastructure, .family-customer, .family-corporate, .family-brand) .icon,
.icon:is(.family-executive, .family-commercial, .family-product, .family-infrastructure, .family-customer, .family-corporate, .family-brand) {
  --icon-light: color-mix(in oklch, var(--family-accent) 30%, var(--family-surface));
  --icon-mid: var(--family-accent);
  --icon-dark: color-mix(in oklch, var(--family-accent) 42%, var(--family-text));
}

/* Dark: the family surface and text roles invert (a dark surface, a light
   text), so the light and dark tones are taken from the accent instead.
   :where() keeps the theme out of the specificity, so .icon-tonal and
   .icon-neutral below still win in dark. */
:where([data-theme="dark"]) :is(.family-executive, .family-commercial, .family-product, .family-infrastructure, .family-customer, .family-corporate, .family-brand) .icon,
:where([data-theme="dark"]) .icon:is(.family-executive, .family-commercial, .family-product, .family-infrastructure, .family-customer, .family-corporate, .family-brand) {
  --icon-light: color-mix(in oklch, var(--family-accent) 55%, var(--foreground));
  --icon-dark: color-mix(in oklch, var(--family-accent) 42%, var(--background));
}

/* One colour of the family, c = the accent 45% of the way to the family
   text, at 46%, 74% and 100% over whatever ground it sits on. The right
   rendering on a family field or a coloured band. */
.icon-tonal .icon,
.icon.icon-tonal {
  --icon-dark: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 45%, var(--family-text, var(--muted-foreground)));
  --icon-light: color-mix(in srgb, var(--icon-dark) 46%, transparent);
  --icon-mid: color-mix(in srgb, var(--icon-dark) 74%, transparent);
}

/* The same in the neutral grey, whatever family the context sets. */
.icon-neutral .icon,
.icon.icon-neutral {
  --icon-dark: color-mix(in oklch, var(--muted-foreground) 85%, var(--background));
  --icon-light: color-mix(in srgb, var(--icon-dark) 46%, transparent);
  --icon-mid: color-mix(in srgb, var(--icon-dark) 74%, transparent);
}

/* An icon tile: the rounded square an icon sits on when it needs a ground
   of its own, a state or a figure. The tile is a family ground (the
   family surface, tinted), so in light the icon inside takes the tonal
   rendering: the three-tone light block would vanish into the tile. In
   dark the tile sinks toward the page and the three tones read again
   (the light tone is a pale tint of the accent there), so the icon keeps
   them. Never a circle: tiles, rows and avatars share one radius. */
.icon-tile {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background-color: color-mix(in oklch, var(--family-surface, var(--secondary)) var(--tint-strong), var(--card));
}

.icon-tile > .icon {
  --icon-dark: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 45%, var(--family-text, var(--muted-foreground)));
  --icon-light: color-mix(in srgb, var(--icon-dark) 46%, transparent);
  --icon-mid: color-mix(in srgb, var(--icon-dark) 74%, transparent);

  width: 1.75rem;
  height: 1.75rem;
}

:where([data-theme="dark"]) .icon-tile > .icon {
  --icon-light: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 55%, var(--foreground));
  --icon-mid: var(--family-accent, var(--muted-foreground));
  --icon-dark: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 42%, var(--background));
}

/* The neutral tile keeps to grays, for a state that already says what
   happened in words: the mark is a hint, not an alarm. Its icon takes the
   neutral rendering in every theme, whatever family the context sets. */
.icon-tile-neutral {
  background-color: var(--secondary);
}

.icon-tile.icon-tile-neutral > .icon {
  --icon-dark: color-mix(in oklch, var(--muted-foreground) 85%, var(--background));
  --icon-light: color-mix(in srgb, var(--icon-dark) 46%, transparent);
  --icon-mid: color-mix(in srgb, var(--icon-dark) 74%, transparent);
}

.icon .ico-a {
  fill: var(--icon-light);
}

.icon .ico-b {
  fill: var(--icon-mid);
}

.icon .ico-x,
.icon .ico-d {
  fill: var(--icon-dark);
}

/* Every layer in currentColor: a solid silhouette for 12 to 14px, or an
   icon inside a button, where three tones would fight the label. */
.icon-mono .ico-a,
.icon-mono .ico-b,
.icon-mono .ico-x,
.icon-mono .ico-d {
  fill: currentColor;
}

/* Interface glyphs. Components size their own glyphs (.nav-burger svg,
   .menu-item svg); .glyph is for a glyph placed anywhere else. */
.glyph {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.glyph-sm {
  width: 1rem;
  height: 1rem;
}

.glyph-lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Category logos: the solid block in the family surface, the line echo in
   the accent, and the echo over the block in --family-mark (the accent
   halfway to the text). In dark the block becomes a pale tint of the
   accent and the overlap sinks toward the page, as in the dark artwork. */
.category-logo {
  display: inline-block;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
}

.category-logo .logo-a {
  color: var(--family-surface, var(--secondary));
}

.category-logo .logo-b {
  color: var(--family-accent, var(--muted-foreground));
}

.category-logo .logo-x {
  color: var(--family-mark, var(--foreground));
}

[data-theme="dark"] .category-logo .logo-a {
  color: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 40%, var(--foreground));
}

[data-theme="dark"] .category-logo .logo-x {
  color: color-mix(in oklch, var(--family-accent, var(--muted-foreground)) 42%, var(--background));
}

/* Dapple Intelligence: the one Ink mark beside the seven family logos,
   black on light, white on dark. Never a family colour. */
.intelligence-mark {
  display: inline-block;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  color: var(--foreground);
}

/* index.html's icon catalog rows. */
.icon-demo {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7) var(--space-10);
}

.icon-demo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.icon-demo-mono .icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--foreground);
}

/* ==========================================================================
   Pattern
   The brand stripe is the one decorative device the system keeps: the
   marketing site's two-row vector (assets/stripe-pattern.svg), cropped
   to the box, transparent between the bars. It is artwork for marketing
   pages, decks and documents (assets/stripe-pattern-cover.svg is the deck
   cover's), not product chrome, so the index hero carries none of it. In
   the starter the vector appears in two places, both on the plain page
   ground: its own specimen, the catalog's Pattern section, and the login's
   cover panel (.auth-weave). The login is the one place the vector weave
   appears as a live drawing: login-weave.js draws the landing hero's
   weave as SVG bars, rows of thin vertical bars at the landing's measures,
   and moves it the way the hero moves it. The six-row field file is the
   panel's still fallback. The same device drawn as CSS rules in one family appears in exactly three
   places: the error field (.state-shell, and .auth-shell for a project
   that keeps the centred login card), the empty state's band, and a quiet
   band on a KPI tile, which is heavier-pitched (3px on 11px) and faint so
   a small box that reflows still renders it evenly. Nowhere else: not on
   a card, not over a coloured surface as a hairline pattern. Decorative
   only: aria-hidden it at the call site and never let it carry
   information.
   ========================================================================== */
.stripe-pattern {
  background-image: url("./assets/stripe-pattern.svg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

/* The full six-row field (assets/stripe-pattern-full.svg): the two-row
   vector three times over, each band shifted sideways so the bands do not
   line up. Give the box the field's own aspect ratio (1909 / 750) to show
   all six rows, or a shorter box to crop to a band. */
.stripe-pattern-full {
  background-image: url("./assets/stripe-pattern-full.svg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

/* Dark gets its own twin of each file rather than a filter: the bars are
   tuned per hue, lifted toward pale and pulled back in chroma, because the
   same saturated bar that reads as a wash on white reads as neon on black.
   The artwork's near-white bars go the other way, down to a neutral just
   above the ground, since their job is to be the quiet ones. */
[data-theme="dark"] .stripe-pattern {
  background-image: url("./assets/stripe-pattern-dark.svg");
}

[data-theme="dark"] .stripe-pattern-full {
  background-image: url("./assets/stripe-pattern-full-dark.svg");
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out);
}

.nav-inner {
  max-width: var(--container-dapple);
  margin: 0 auto;
  padding: 0 var(--space-9);
  height: 4rem;
  display: grid;
  grid-template-columns: var(--bar-columns);
  align-items: center;
  gap: var(--space-7);
}

/* One column template for both header tiers (rule 12): .nav-inner and the
   link-bearing .localnav-inner read the same variable, so the tier-1 links
   and the tier-2 links sit in the same centered column. Wide screens get
   an even left / center / right split (title and logo left, links dead
   center, action and controls right). Below the breakpoint the sides size
   to their content and the middle takes the rest: the links still center,
   and a long group scrolls instead of squeezing the sides. The breakpoint
   is the width where the widest link group plus both side columns fit. */
@media (min-width: 1200px) {
  html {
    --bar-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

/* The mark is a block that would stretch across its whole column. */
.nav-inner > .logo {
  justify-self: start;
}

/* Right column of the top bar: theme toggle, help, identity, burger. */
.nav-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-7);
}

/* Layout rule: the nav's horizontal bounds follow the page body's width
   class. Two cases, judged by the body as a whole, not by any one region
   inside it:

   - Centered, max-width body (index.html's `.container`: max-width: 80rem,
     centered, 2rem side padding): the nav matches, same max-width, same
     centering, plain `.nav-inner`.
   - Full-bleed app shell with a sidebar or rail (`.app-shell`,
     `.chat-shell`, `.split-shell`): the nav is full-bleed too,
     `.nav-inner--full` (max-width: none, no centering), and its gutter
     matches the shell gutter so the logo lines up with sidebar/rail items
     and trailing controls line up with the content edge.

   Centered-card pages (`login.html`, `error.html`, `wizard.html`) are the
   contained case: their cards/steps are the content column. The logo
   legitimately shifts between contained pages and sidebar-shell pages
   because it always aligns with the content directly beneath it. */
.nav-inner--full {
  max-width: none;
  /* Full-bleed shells: the logo's left edge lines up with the sidebar's
     own content (the app sidebar's padding is space-4), and the trailing
     controls mirror it on the right. Below md the phone rule at the end
     of this file already sets space-4. */
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

/* chat.html and split.html rails pad their content by space-5, so their
   header gutter follows, the logo still sits over the rail's first item. */
@media (min-width: 768px) {
  body:has(.chat-shell, .split-shell) .nav-inner--full {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }
}

.logo {
  display: inline-flex;
  align-items: center;
  color: var(--foreground);
  text-decoration: none;
}

.logo-mark {
  display: inline-block;
  height: 1.5rem;
  width: 7.45rem;
  background-color: currentColor;
  -webkit-mask: url("./assets/dapple-mark.svg") no-repeat center / contain;
          mask: url("./assets/dapple-mark.svg") no-repeat center / contain;
}

/* Optional product name next to the mark (DAPPLE-DESIGN-SYSTEM.md section 6,
   "Logo & app name"). Sized at the h4 scale, never smaller, so it reads as a
   paired identity with the 24px-tall mark instead of a caption-sized
   afterthought. Color is a call-site decision (brand accent apps may tint
   it), size/weight/line-height are not. */
.logo-title {
  margin-left: var(--space-3);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5rem;
  color: var(--foreground);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav-links a {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease-in-out),
              background-color var(--dur-2) var(--ease-in-out);
}

.nav-links a:hover {
  color: var(--foreground);
}

.nav-links a.active {
  color: var(--foreground);
  font-weight: 500;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out);
}

.theme-toggle:hover {
  background-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* The three icons are display-toggled below, and an element coming back
   from display:none restarts its animations, so the icon that arrives
   turns in. Only once the button has been pressed (theme.js adds
   .is-toggled on click): the icon that is there on load just is. */
.theme-toggle.is-toggled svg {
  animation: icon-turn var(--dur-3) var(--ease-out) both;
}

@keyframes icon-turn {
  from {
    opacity: 0;
    transform: rotate(-60deg) scale(0.7);
  }
}

/* Top-nav help entry point: same icon-button shape/tokens as .theme-toggle
   (border, radius, hover/focus treatment), a distinct class because it is
   a semantically different control (opens the help .menu, not a theme
   cycle), not a color or size variant of one. See
   APP-SHELL-REFERENCE.md, "Help & support" for when this belongs vs the
   contextual inline help popover below vs the marketing Support card. */
.help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out);
}

.help-trigger:hover {
  background-color: var(--accent);
}

.help-trigger:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.help-trigger svg {
  width: 18px;
  height: 18px;
}

/* Contextual inline help: a small "i" affordance sitting directly next to
   one non-obvious control (a settings field, a workspace switcher), not
   in the header. Deliberately smaller and borderless, it reads as part of
   the label row, not as a second global entry point. Opens the same
   .menu primitive, just holding a plain explanatory paragraph
   (.menu-note) instead of a list of destinations. */
.help-inline-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  padding: 0;
  margin-left: 0.35rem;
  background-color: transparent;
  color: var(--muted-foreground);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-in-out);
}

.help-inline-trigger:hover {
  color: var(--foreground);
}

.help-inline-trigger:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.help-inline-trigger svg {
  width: 100%;
  height: 100%;
}

/* Plain, non-interactive text content inside a .menu, for popovers that
   answer a question in a sentence rather than offering a list of
   destinations. Legitimate use of the .menu primitive alongside, or
   instead of, .menu-item, see menu.js's comment: only .menu-item entries
   participate in roving-tabindex/arrow-key navigation, a .menu-note does
   not need to. */
.menu-note {
  margin: 0;
  padding: var(--space-3) 0.65rem; /* spacing-exception */
  font-size: 0.8125rem;
  color: var(--popover-foreground);
  max-width: 15rem;
}

/* Touch-friendly minimum touch targets: 44px (WCAG 2.5.8 / iOS HIG) */
@media (pointer: coarse) {
  .theme-toggle {
    width: 2.75rem;
    height: 2.75rem;
  }

  .help-trigger {
    width: 2.75rem;
    height: 2.75rem;
  }

  .btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  /* a finger needs 44px whatever the control's resting size */
  .btn-sm,
  .menu-item,
  .chip-toggle,
  .pagination-btn,
  .sidebar-link {
    min-height: 2.75rem;
  }
}

/* The quick toggle cycles the theme MODE (light -> dark -> system), not the
   individual themes. Which concrete theme a mode resolves to (e.g. vibrant
   as your day theme) is chosen in settings.html. The icon shows the CURRENT
   mode. theme.js sets data-mode on <html>; before it runs, no icon shows,
   which also avoids a wrong-icon flash. */
.icon-sun,
.icon-moon,
.icon-auto {
  display: none;
}

html[data-mode="light"] .icon-sun {
  display: block;
}

html[data-mode="dark"] .icon-moon {
  display: block;
}

html[data-mode="system"] .icon-auto {
  display: block;
}

/* Day/night theme-slot toggle: a second, logically-different control from
   .theme-toggle above. .theme-toggle cycles the MODE (light/dark/system);
   this picks which concrete theme "day" (light mode, and system mode
   during the day) resolves to, light or vibrant, the same choice
   settings.html's Appearance section exposes as radio cards. A compact
   2-button segmented group, not a third full radio-card, since the header
   only has room for a quick toggle, not a labeled choice with hints. Same
   class is reused unchanged inside .nav-drawer-section below, the
   ancestor-scoped media query further down is what hides the header copy
   below md, not a separate drawer-only class.

   Opt-in, off by default in this reference: `_partials/topnav.html` does
   not render it, settings.html's Appearance section is the canonical home
   for this choice (see APP-SHELL-REFERENCE.md, "Two controls in one
   header"). Kept here for an app that wants the quick header toggle
   anyway, paste the markup back into the nav and drawer, this CSS and
   theme.js's wiring already handle it. */
.theme-slot-toggle {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2);
  gap: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.theme-slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem var(--space-4); /* spacing-exception */
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              color var(--dur-2) var(--ease-in-out);
}

.theme-slot-btn:hover {
  color: var(--foreground);
}

.theme-slot-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.theme-slot-btn[aria-pressed="true"] {
  background-color: var(--accent);
  color: var(--foreground);
  font-weight: 500;
}

/* Header copy only: below md it demotes into .nav-drawer-section instead
   of shrinking in place, same rule .nav-links already follows. Scoped to
   .nav-inner so the drawer's copy of the same .theme-slot-toggle class is
   unaffected. */
@media (max-width: 767.98px) {
  .nav-inner .theme-slot-toggle {
    display: none;
  }
}

/* Drawer copy: stretch to the section's full width instead of the
   header's compact inline sizing. */
.nav-drawer-section .theme-slot-toggle {
  width: 100%;
}

.nav-drawer-section .theme-slot-btn {
  flex: 1;
}

/* Compact top-nav identity affordance: an .avatar wrapped in a plain
   trigger button, .menu carries the name/email/actions detail. This is
   the default for any flat top-nav app (no sidebar to pin a full
   .user-account footer control to, see nav.html for that variant):
   collapse to the avatar at every viewport width, never inline a name or
   email in the header itself, the popover carries that detail instead. */
.nav-identity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity var(--dur-2) var(--ease-in-out);
}

/* No lift on hover anywhere in the system (section 2): shadow is for
   menus and dialogs. The chip is an avatar, so it quiets instead. */
.nav-identity:hover {
  opacity: 0.8;
}

.nav-identity:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Burger button: phone only. Mobile-first per the responsive contract,
   the unprefixed rule is the phone layout and md+ restores the inline
   links. 44x44 minimum touch target (WCAG 2.5.8 / iOS HIG). */
.nav-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out);
}

.nav-burger:hover {
  background-color: var(--accent);
}

.nav-burger:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.nav-burger svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 768px) {
  .nav-burger {
    display: none;
  }
}

/* Below md the inline links hide and live in the drawer instead. The rule
   set on .nav-links above still defines the desktop layout, this only
   gates visibility per tier. */
@media (max-width: 767.98px) {
  .nav-links {
    display: none;
  }
}

/* Mobile nav drawer: a native <dialog> opened with showModal(), which
   provides the focus trap, Escape-to-close, and backdrop for free, no
   focus-trap library. Slides in from the right. @starting-style powers the
   entry transition in modern browsers and degrades to an instant open
   elsewhere, functionality is identical either way. */
.nav-drawer {
  --ring-gap: var(--card);
  position: fixed;
  inset: 0 0 0 auto;
  width: min(20rem, 85vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur-2) var(--ease-in-out),
              overlay var(--dur-2) allow-discrete,
              display var(--dur-2) allow-discrete;
}

.nav-drawer[open] {
  transform: translateX(0);
}

@starting-style {
  .nav-drawer[open] {
    transform: translateX(100%);
  }
}

.nav-drawer::backdrop {
  background-color: var(--overlay-backdrop);
}

.nav-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* clear notches/home indicators on phones */
  padding: var(--space-5) var(--space-5) calc(1rem + env(safe-area-inset-bottom, 0px));
}

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-2) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.nav-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.nav-drawer-close:hover {
  background-color: var(--accent);
}

.nav-drawer-close:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.nav-drawer-close svg {
  width: 18px;
  height: 18px;
}

.nav-drawer-links {
  list-style: none;
  margin: 0;
  padding: var(--space-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-drawer-links a {
  display: block;
  padding: var(--space-4) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 1rem;
  transition: color var(--dur-2) var(--ease-in-out),
              background-color var(--dur-2) var(--ease-in-out);
}

.nav-drawer-links a:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.nav-drawer-links a.active {
  color: var(--foreground);
  font-weight: 500;
  background-color: var(--accent);
}

/* Labeled, non-link drawer section: for controls that demote into the
   drawer alongside the plain link list (e.g. the day/night theme-slot
   toggle) rather than being reachable only as a link. .nav-drawer-links
   stays a pure <ul> of page links, this is the general-purpose sibling for
   anything else a page's drawer needs to carry. Heading reuses
   .sidebar-label's exact visual style rather than inventing a second label
   treatment. */
.nav-drawer-section {
  padding: var(--space-4) var(--space-2) var(--space-2);
  border-top: 1px solid var(--border);
}

.nav-drawer-section .sidebar-label {
  padding: 0 var(--space-3);
}

/* ==========================================================================
   Local nav — tier 2 of the two-tier topbar (DAPPLE-DESIGN-SYSTEM.md
   section 7, rule 12; APP-SHELL-REFERENCE.md section 1).
   Apple's global + local nav pattern (developer.apple.com, apple.com
   product pages): a thin section bar directly under the global .nav.
   Section title on the left, section-scoped links on the right, optional
   page action after them. Optional per page: auth pages, error pages, and
   app shells whose sidebar or in-pane header already provides local
   navigation (nav.html, chat.html) omit it entirely.

   Single markup serves every width: a <details> wraps title (summary) and
   links. At md+ the links are forced visible and the summary is inert
   (chevron hidden), below md it behaves as a native disclosure, the links
   drop down as a panel, zero JavaScript. The mark stays top-left in tier 1
   at every width, tier 2 never carries a logo.
   ========================================================================== */

/* Anchor targets must scroll clear of the sticky header stack: without
   this, following a #section link puts the target at the very top of the
   viewport and the sticky .nav + .localnav (about 7.1rem together) sit
   ON TOP of the section heading, so the reader lands mid-lead with no
   title in sight. scroll-margin-top only participates in scroll-into-
   view positioning, it changes no layout, so applying it to every [id]
   is safe: 8rem = the 4rem nav + ~3.1rem localnav + breathing room.
   Pages without a localnav get a little extra air above the target,
   which reads fine. Keep in sync with .nav-inner and .localnav heights. */
[id] {
  scroll-margin-top: 8rem;
}

.localnav {
  position: sticky;
  top: var(--space-12); /* directly under .nav, keep in sync with .nav-inner height */
  z-index: 19; /* one under .nav's 20, above page content */
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  transition:
    background-color var(--dur-2) var(--ease-in-out),
    border-color var(--dur-2) var(--ease-in-out);
}

.localnav-inner {
  max-width: var(--container-dapple);
  margin: 0 auto;
  padding: 0 var(--space-9);
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.localnav-inner.nav-inner--full {
  max-width: none;
}

.localnav-d {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex: 1;
  min-width: 0;
}

.localnav-d summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem; /* spacing-exception */
  list-style: none;
  cursor: default;
}

.localnav-d summary::-webkit-details-marker {
  display: none;
}

.localnav-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
}

.localnav-sub {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.localnav-chevron {
  display: none; /* mobile-only affordance, see the media query below */
  width: 14px;
  height: 14px;
  color: var(--muted-foreground);
  transition: transform var(--dur-1) var(--ease-in-out);
}

.localnav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

/* Same size and padding as the tier-1 .nav-links a, so the two rows read as
   one family. */
.localnav-links a {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition:
    color var(--dur-2) var(--ease-in-out),
    background-color var(--dur-2) var(--ease-in-out);
}

.localnav-links a:hover {
  color: var(--foreground);
}

.localnav-links a.active {
  color: var(--foreground);
  font-weight: 500;
}

.localnav-action {
  flex: none;
}

/* Content starts 2rem below the tier-2 bar (rule 12): pages used to
   invent their own value (1.5rem here, 0 there), so the first heading
   sat on the bar's hairline. General sibling so a skip link or a
   comment between the bar and <main> does not defeat it. The value is
   the same on every page of an app, whatever comes first: a hero under
   the bar drops its own top padding entirely so its eyebrow starts where
   any other page's first heading starts, the bar-to-content gap must not
   change when the user switches pages (rule 17). */
.localnav ~ main {
  padding-top: var(--space-9);
}

.localnav ~ main > .hero:first-child {
  padding-top: 0;
}

@media (max-width: 767.98px) {
  .localnav-inner {
    padding: 0 var(--space-5);
  }

  /* Native disclosure below md: summary becomes the toggle, links drop
     down as a full-width panel under the bar. */
  .localnav-d {
    display: block;
    position: static;
  }

  .localnav-d summary {
    cursor: pointer;
    min-height: 2.75rem; /* 44px touch target */
  }

  .localnav-d summary:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
  }

  .localnav-chevron {
    display: block;
  }

  .localnav-d[open] .localnav-chevron {
    transform: rotate(180deg);
  }

  .localnav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: var(--space-2) var(--space-5) var(--space-4);
  }

  .localnav {
    position: sticky;
  }

  .localnav-links a {
    padding: 0.65rem var(--space-3); /* spacing-exception */
    font-size: 0.9375rem;
  }
}

@media (min-width: 768px) {
  /* The markup ships <details open>, so links are natively visible here.
     The summary is made inert so it cannot be collapsed at md+ (a closed
     details hides its content at the UA level, CSS cannot override it).
     nav.js guards the keyboard path the same way and closes the
     disclosure on mobile load, see its localnav block. */
  .localnav-d summary {
    pointer-events: none;
  }

  /* <details> wraps everything after <summary> in a ::details-content
     box, which as a single flex item swallows .localnav-links'
     margin-left: auto (links sat glued to the title instead of at the
     right edge, rule 12). display: contents lifts the children into
     .localnav-d's own flex row. Desktop only: below md the bar is
     display: block and the links are an absolutely positioned panel. */
  .localnav-d::details-content {
    display: contents;
  }

  /* A bar with section links shares the top nav's three columns: title in
     the left column, links centered in the middle one (right under the
     tier-1 links), the action in the right column. The <details> wrapper
     steps out of the way (display: contents) so its children are the
     grid items. A bar with a caption instead keeps the plain flex row. */
  .localnav-inner:has(.localnav-links) {
    display: grid;
    grid-template-columns: var(--bar-columns);
    gap: var(--space-7);
  }

  .localnav-inner:has(.localnav-links) .localnav-d {
    display: contents;
  }

  .localnav-inner:has(.localnav-links) .localnav-d summary {
    grid-column: 1;
    justify-self: start;
  }

  .localnav-inner:has(.localnav-links) .localnav-links {
    grid-column: 2;
    margin: 0;
    min-width: 0;
    overflow-x: auto;
    justify-content: safe center;
    scrollbar-width: thin;
  }

  .localnav-inner:has(.localnav-links) .localnav-action {
    grid-column: 3;
    justify-self: end;
  }
}

/* Narrow desktops: when the link group is wider than its column it scrolls
   sideways, and a soft fade on whichever edge has more links tells the
   reader there is more. The fade is driven by the scroll position itself
   (scroll-driven animation), so it is absent when everything fits. Browsers
   without it keep the thin scrollbar as the cue. */
@property --localnav-fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --localnav-fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@keyframes localnav-fade {
  0% {
    --localnav-fade-start: 0px;
    --localnav-fade-end: 2rem;
  }

  8%,
  92% {
    --localnav-fade-start: 2rem;
    --localnav-fade-end: 2rem;
  }

  100% {
    --localnav-fade-start: 2rem;
    --localnav-fade-end: 0px;
  }
}

@supports (animation-timeline: scroll()) {
  @media (min-width: 768px) {
    .localnav-links {
      scrollbar-width: none;
      mask-image: linear-gradient(
        to right,
        transparent,
        #000 var(--localnav-fade-start),
        #000 calc(100% - var(--localnav-fade-end)),
        transparent
      );
      animation: localnav-fade linear both;
      animation-timeline: scroll(self inline);
    }
  }
}


/* ==========================================================================
   Hero
   ========================================================================== */

/* The hero is type and nothing else: the statement headline across most of
   the measure, the subhead under it, the actions, and one hairline that
   closes the block, so the page's first section starts on a clear edge
   rather than drifting up into the hero. No stripe panel: the brand rules
   belong to the login's weave panel, the error field, the empty state's
   band and the KPI tile's band, and a fifth home for them at the top of
   the catalog made
   the device wallpaper. The Pattern section further down documents the
   artwork itself. */
.hero {
  padding: var(--space-14) 0 var(--space-11);
  margin-bottom: var(--space-11);
  border-bottom: 1px solid var(--border);
}

/* Stripe field, the landing's signature device: a family surface
   carrying vertical rules of the same family, ramping in from the text
   side so the copy sits on clean ground and the color gathers at the
   edge. A shell picks its family with a .family-* class. Decorative,
   behind the copy.

   Full-bleed shells (the state pages, and .auth-shell, the centred login
   card a project may keep; login.html itself is the split with the weave
   panel, see .auth-split) carry it at full strength; the empty state's band and the KPI tile's band are the only
   smaller boxes that do, each with its own rules (see .empty-state::after
   and .stat-card.field::after). A plain card stays flat (see .field). The
   bars are 4px on a 13px pitch, heavy enough to survive a fractional
   device pixel ratio, where the old 3px-on-7px read as a different weight
   per screen. */
.auth-shell::after,
.state-shell::after {
  --field-surface: var(--family-surface, var(--ba-executive-surface));
  --field-rule: var(--family-accent, var(--ba-executive-accent));
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--field-surface);
  background-image: repeating-linear-gradient(
    90deg,
    color-mix(in oklch, var(--field-rule) 78%, var(--field-surface)) 0 4px,
    transparent 4px 13px
  );
  /* Both edges, not one. The card is centred, so a single panel at the
     right left the composition leaning; rules at each edge frame it
     instead. The mask clears the middle 40%, which is where the card
     stands, so the form always sits on plain ground. */
  -webkit-mask-image: linear-gradient(to right, #000, transparent 30%, transparent 70%, #000);
          mask-image: linear-gradient(to right, #000, transparent 30%, transparent 70%, #000);
  pointer-events: none;
  z-index: -1;
}

@media (max-width: 1023.98px) {
  .hero {
    padding-top: var(--space-11);
  }
}

/* The chip above the title: a neutral pill a step darker than the page,
   never a tinted patch. */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem; /* spacing-exception */
  padding: 0.35rem var(--space-4); /* spacing-exception */
  margin-bottom: var(--space-7);
  background-color: var(--secondary);
  color: var(--foreground);
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
}

.hero h1 {
  /* Wide enough that the statement sets in two or three long lines and
     holds the width the panel used to; balanced so no line is a stub. */
  max-width: 54rem;
  text-wrap: balance;
  font-size: var(--text-hero);
  line-height: var(--text-hero--line-height);
  letter-spacing: var(--text-hero--letter-spacing);
  font-weight: 500;
  margin: 0 0 var(--space-6);
}

.hero-subhead {
  max-width: 38rem;
  font-size: var(--text-hero-subtitle);
  line-height: var(--text-hero-subtitle--line-height);
  letter-spacing: var(--text-hero-subtitle--letter-spacing);
  color: var(--muted-foreground);
  font-weight: 400;
  margin: 0 0 var(--space-9);
}

.hero-actions {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/* Product UI scale. Weight is one step (500) at every level, hierarchy
   comes from size plus tracking that tightens as the size grows, the
   landing's curve. Balanced wrapping keeps a two-line title even. */
h1 {
  font-size: 2rem;
  font-weight: 500;
  margin: 0 0 var(--space-3) 0;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 var(--space-3) 0;
  line-height: 1.2;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0 0 var(--space-3) 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h4 {
  font-size: 1.0625rem;
  font-weight: 500;
  margin: 0 0 var(--space-3) 0;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

p {
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 var(--space-5) 0;
  text-wrap: pretty;
}

.lead {
  font-size: var(--text-callout);
  line-height: var(--text-callout--line-height);
  letter-spacing: var(--text-callout--letter-spacing);
  color: var(--muted-foreground);
  max-width: 42rem;
}

.type-scale {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-9);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.type-scale > * {
  margin: 0;
}

.type-scale .text-caption {
  letter-spacing: 0.02em;
}

/* Color palette swatches (index.html's Color section). Each chip reads
   its color from the --sw custom property set inline on the element,
   i.e. the swatch IS the live token: switch mode or day theme in the
   header and the section re-renders itself, it cannot drift from this
   file. The hairline border keeps near-background chips (background,
   card, accent) visible on their own surface. */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: var(--space-5);
}

.swatch-group {
  margin-top: var(--space-9);
}

.swatch-group-title {
  font-size: 0.9375rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
}

.swatch-group-note {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0 0 var(--space-5);
  max-width: 42rem;
}

.swatch-chip {
  /* --sw is the chip's one parameter, set inline per swatch in the
     markup (style="--sw: var(--token)"). Defined here with a safe
     default so the token is canonical and a chip missing its inline
     value renders as an obvious hole, not a wrong color. */
  --sw: transparent;
  display: block;
  height: 3.5rem;
  border-radius: var(--radius-md);
  background-color: var(--sw);
  border: 1px solid var(--border);
}

.swatch code {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}


.swatch-family:last-child {
  border-bottom: none;
}



.swatch-family-chips .swatch-chip {
  height: 2.25rem;
}

@media (max-width: 767.98px) {
  .swatch-family {
    grid-template-columns: 1fr;
    gap: 0.4rem; /* spacing-exception */
  }
}

.type-body {
  font-size: var(--text-display-body);
  line-height: var(--text-display-body--line-height);
  letter-spacing: var(--text-display-body--letter-spacing);
  color: var(--foreground);
  max-width: 40rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-7);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.005em;
  /* A variant carries the fill. Without a base here a .btn with no
     variant (.btn.btn-icon) falls through to the UA's button chrome,
     which does not follow the theme. */
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out),
              color var(--dur-2) var(--ease-in-out),
              opacity var(--dur-2) var(--ease-in-out);
  text-decoration: none;
  font-family: var(--font-sans);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* Hover is a color step, never opacity or a lift: Ink goes to a neutral
   step of the same Ink (the marketing site's button), the button stays
   where it is. */
.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-hover-foreground);
}

/* Flat neutral fill, no hairline: the fill is the boundary. */
/* The edge is a token so dark can draw a hairline: its fill (#26272A) sits
   at 1.25:1 on the page ground and 1.1:1 on a card, so without one the
   box vanishes and the label reads as loose text (the dark error page's
   "Return to overview" was the visible case). Light and vibrant resolve
   the token to the fill itself, so nothing changes there. */
.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary-border);
}

.btn-secondary:hover {
  background-color: color-mix(in oklch, var(--secondary) 92%, var(--foreground));
}

/* A secondary button standing on a family field goes Ink. The neutral
   fill is close enough to a pastel tint that the button loses its edge and
   reads as a label, and white gave it a shape but not a weight. Ink is the
   one value that is certainly not the tile. It does mean a button on a
   tinted card looks like the primary one; the difference is carried by
   where they are, not by how they look. */
.field .btn-secondary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.field .btn-secondary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-hover-foreground);
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.btn:disabled {
  cursor: not-allowed;
  background-color: var(--muted-surface);
  color: var(--muted-foreground);
  border-color: var(--border);
  opacity: 1;
}

.btn:disabled:hover {
  background-color: var(--muted-surface);
}

/* ==========================================================================
   Cards
   ========================================================================== */

/* Flat: a hairline at rest and nothing on hover. A card that is a link
   adds its own hover at the call site (a border-color step or
   --shadow-md), the shared rule never lifts. */
.card {
  --ring-gap: var(--card);
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-9);
  transition: border-color var(--dur-3) var(--ease-in-out);
}

.card h3 {
  margin-top: 0;
}

.card p {
  color: var(--muted-foreground);
  margin-bottom: 0;
}

/* A card's one action. It is a button, not a link with an arrow: three
   cards in a row, two of them ending in an underlined label and the third
   in a filled button, read as three different kinds of thing. As secondary
   buttons beside the featured card's primary one, the row keeps the
   system's one-primary-action rule and still looks like one row. */
/* Full width, like the featured card's own action. Three cards in a row
   with three buttons of three different widths reads as three different
   kinds of control; one width makes the row a row. */
.card-action {
  margin-top: var(--space-5);
  width: 100%;
}

/* Container query: once a single card's own column drops below 22rem
   (a narrow sidebar rail, a stacked mobile column, a dense dashboard
   panel), tighten the padding rather than waiting for a viewport
   breakpoint that may not correlate with how wide this card actually
   renders. Falls back to an equivalent viewport check on browsers
   without container query support. */
@supports (container-type: inline-size) {
  @container card-grid (max-width: 22rem) {
    .card {
      padding: var(--space-7);
    }
  }
}

@supports not (container-type: inline-size) {
  @media (max-width: 22rem) {
    .card {
      padding: var(--space-7);
    }
  }
}

/* Featured: an Ink hairline instead of the gray one. Color is not how a
   card gets attention here, a family field is (see Family fields). */
.card-featured {
  position: relative;
  border-color: var(--foreground);
}

.card-badge {
  position: absolute;
  top: var(--space-8);
  right: var(--space-8);
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 0.35rem; /* spacing-exception */
  margin: var(--space-3) 0 var(--space-6);
}

.card-price-amount {
  font-size: var(--text-feature);
  line-height: var(--text-feature--line-height);
  letter-spacing: var(--text-feature--letter-spacing);
  font-weight: 500;
}

.card-price-period {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.card-list {
  list-style: none;
  margin: 0 0 var(--space-7);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem; /* spacing-exception */
}

.card-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem; /* spacing-exception */
  font-size: 0.9375rem;
  color: var(--card-foreground);
}

.card-list svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--primary);
}

.card-full-width {
  width: 100%;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.form-card {
  --ring-gap: var(--card);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-9);
  max-width: 34rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-7) var(--space-6);
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-3);
  color: var(--foreground);
}

.input,
textarea.input,
select.input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  font-size: 1rem;
  line-height: 1.125;
  font-family: var(--font-sans);
  border: 1px solid var(--edge);
  border-radius: 12px; /* the field's own step, between rows and cards */
  background-color: var(--card);
  color: var(--foreground);
  transition: border-color var(--dur-2) var(--ease-in-out),
              box-shadow var(--dur-2) var(--ease-in-out);
}

.input:hover {
  border-color: var(--faint);
}

.input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.input[type="number"] {
  font-variant-numeric: tabular-nums;
}

textarea.input {
  resize: vertical;
  min-height: 6rem;
  line-height: 1.5;
}

.input:focus,
textarea.input:focus,
select.input:focus {
  outline: none;
  border-color: var(--ring);
  /* a text field shows focus with its own edge and a soft halo; the hard
     double ring stays on buttons and links */
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 12%, transparent);
}

.input:disabled,
textarea.input:disabled,
select.input:disabled {
  cursor: not-allowed;
  background-color: var(--input-disabled);
  color: var(--muted-foreground);
  border-color: var(--border);
  opacity: 0.6;
}

.input-group {
  margin-bottom: var(--space-7);
}

.input-hint {
  margin: 0.4rem 0 0; /* spacing-exception */
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select.input {
  appearance: none;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* The field's arrow is the same stroked chevron every other control
   draws (the nav's More, the table's sort headers): a 24-unit path at a
   2-unit stroke, painted through a mask so it takes a token colour. It was
   a filled CSS triangle, the one solid arrow in the system. */
.select-wrapper::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.9rem; /* spacing-exception */
  width: 14px;
  height: 14px;
  background-color: var(--muted-foreground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: translateY(-50%);
  pointer-events: none;
}

/* The dropdown list itself, where the browser supports it.
   A native <select>'s open list is drawn by the operating system: square
   corners, the OS accent colour on the highlighted row, nothing a
   stylesheet can reach. Chromium's customizable select
   (appearance: base-select) hands the list back to CSS, so it can take the
   same shape as .menu, which is what it is: a small popover of choosable
   rows. Browsers without it keep the native list, unchanged and fully
   functional, so this is an enhancement and never a dependency.
   The field itself is untouched: the wrapper's own chevron still draws it,
   and the picker's built-in icon is hidden so there is only one arrow. */
@supports (appearance: base-select) {
  /* .select-wrapper select.input sets appearance: none further up and
     outweighs a bare select.input, so the wrapper is named here too. */
  select.input,
  .select-wrapper select.input,
  select.input::picker(select) {
    appearance: base-select;
  }

  .select-wrapper select.input::picker-icon {
    display: none;
  }

  select.input::picker(select) {
    padding: 0.35rem; /* spacing-exception */
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  @media (prefers-reduced-motion: no-preference) {
    select.input::picker(select) {
      transition:
        opacity var(--dur-1) var(--ease-out),
        transform var(--dur-1) var(--ease-out),
        overlay var(--dur-1) allow-discrete,
        display var(--dur-1) allow-discrete;
    }
  }

  select.input::picker(select):popover-open {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  @starting-style {
    select.input::picker(select):popover-open {
      opacity: 0;
      transform: translateY(-4px) scale(0.98);
    }
  }

  select.input option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0.65rem; /* spacing-exception */
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--popover-foreground);
    transition: background-color var(--dur-1) var(--ease-out);
  }

  select.input option:hover {
    background-color: var(--accent);
  }

  /* Keyboard focus moves through the same tint as hover, so it needs its
     own mark: an inset ring, which the popover's clipping cannot cut.
     :focus-visible only: opening the list with a pointer focuses the
     selected row too, and a heavy ring on it there is a keyboard mark on
     a mouse gesture, which .menu never shows. */
  select.input option:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
    background-color: var(--accent);
  }

  /* Same vocabulary as .menu-item[aria-current]: the accent tint hover
     already uses, plus a weight bump, rather than a new colour. */
  select.input option:checked {
    background-color: var(--accent);
    font-weight: 500;
  }

  select.input option::checkmark {
    order: 1;
    margin-left: auto;
    color: var(--muted-foreground);
  }
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background-color: var(--secondary);
  /* The outline is the knob's colour, not the hairline: an off switch is a
     control, and its boundary has to clear 3:1 against the page like any
     other (WCAG 1.4.11). The hairline left a white knob on a near-white
     pill with nothing at 3:1 anywhere. */
  border: 1px solid var(--toggle-thumb);
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out);
}

/* Off, the knob is a mid grey that clears 3:1 on both the track and the
   page in every theme (--toggle-thumb), so the off state reads as a switch
   rather than an empty pill. On, the track takes the action colour and the
   knob the colour that sits on it, --primary-foreground: white on Ink in
   light, Ink on near-white in dark. A grey knob on a white track, which
   dark had, is how a disabled switch looks. */
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background-color: var(--toggle-thumb);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-2) var(--ease-in-out);
}

.toggle input:checked ~ .toggle-track {
  background-color: var(--primary);
  border-color: var(--primary);
}

.toggle input:checked ~ .toggle-thumb {
  background-color: var(--primary-foreground);
  transform: translateX(16px);
}

.toggle input:focus-visible ~ .toggle-track {
  box-shadow: var(--shadow-focus);
}

.toggle input:disabled ~ .toggle-track {
  cursor: not-allowed;
  background-color: var(--muted-surface);
  border-color: var(--border);
  opacity: 0.6;
}

.toggle input:disabled ~ .toggle-thumb {
  background-color: var(--muted-foreground);
}

.toggle-label {
  font-size: 0.9375rem;
  color: var(--foreground);
}

/* ==========================================================================
   Badges
   ========================================================================== */

/* A status slip: a pale tint of its family with an edge in the same
   family, 6px, no dot. The word carries the state; the tint says which
   kind. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 1.625rem;
  padding: 0 var(--space-3);
  font-size: 0.8125rem;
  font-weight: 400;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge-executive { background-color: color-mix(in oklch, var(--ba-executive-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-executive-surface) var(--tint-edge), var(--card)); color: var(--ba-executive-text); }

.badge-commercial { background-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-edge), var(--card)); color: var(--ba-commercial-text); }

.badge-product { background-color: color-mix(in oklch, var(--ba-product-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-product-surface) var(--tint-edge), var(--card)); color: var(--ba-product-text); }

.badge-infrastructure { background-color: color-mix(in oklch, var(--ba-infrastructure-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-infrastructure-surface) var(--tint-edge), var(--card)); color: var(--ba-infrastructure-text); }

.badge-customer { background-color: color-mix(in oklch, var(--ba-customer-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-customer-surface) var(--tint-edge), var(--card)); color: var(--ba-customer-text); }

.badge-corporate { background-color: color-mix(in oklch, var(--ba-corporate-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-corporate-surface) var(--tint-edge), var(--card)); color: var(--ba-corporate-text); }

.badge-brand { background-color: color-mix(in oklch, var(--ba-brand-surface) var(--tint-soft), var(--card)); border-color: color-mix(in oklch, var(--ba-brand-surface) var(--tint-edge), var(--card)); color: var(--ba-brand-text); }

/* In dark the family surfaces are deep, near-black tints, so a badge in
   one is a dark pill on a dark page: it stops reading as a mark. There the
   ground is a pastel derived from the family's accent, which is the same
   value in both themes, and the label is the page itself. Derived rather
   than declared, so a family added later gets one for free, and mixed
   against --foreground, which is pure white in dark and therefore cannot
   drag the hue anywhere on the way. Black on every accent measures between
   8.5:1 and 12:1, so the label has room to spare. */
[data-theme="dark"] .badge-executive {
  background-color: color-mix(in oklch, var(--ba-executive-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-commercial {
  background-color: color-mix(in oklch, var(--ba-commercial-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-product {
  background-color: color-mix(in oklch, var(--ba-product-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-infrastructure {
  background-color: color-mix(in oklch, var(--ba-infrastructure-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-customer {
  background-color: color-mix(in oklch, var(--ba-customer-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-corporate {
  background-color: color-mix(in oklch, var(--ba-corporate-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

[data-theme="dark"] .badge-brand {
  background-color: color-mix(in oklch, var(--ba-brand-accent) 55%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

/* The one badge that is not a business area. A failed, overdue or
   blocked row is a state, and it has to read as the same object as the
   states beside it, so it is a badge and not loose red text. Derived
   from --destructive with the same recipe .alert-danger uses, so no new
   semantic color enters the system and every theme gets a matching
   tint: 7.2:1 light, 5.9:1 vibrant, the band the family badges already
   sit in. Dark has its own rule below. */
.badge-danger {
  background-color: color-mix(in oklch, var(--destructive) 16%, var(--background));
  border-color: color-mix(in oklch, var(--destructive) var(--tint-soft), var(--card));
  color: color-mix(in oklch, var(--destructive) 75%, var(--foreground));
}

/* a finished or inactive state: no family, the neutral slip */
.badge-neutral {
  background-color: var(--muted-surface);
  border-color: var(--border);
  color: var(--muted-foreground);
}

/* In dark the recipe above lands a dark red tint on a dark page: a dark
   slip nobody reads as a mark. Dark gives it the family badges' treatment
   instead, a pastel ground with no edge and the page as the label, with
   more red kept in the mix than the families keep of their accents, so it
   stays a warning red rather than reading as Product's coral: black on it
   measures 7.7:1. */
[data-theme="dark"] .badge-danger {
  background-color: color-mix(in oklch, var(--destructive) 60%, var(--foreground));
  border-color: transparent;
  color: var(--background);
}

/* ==========================================================================
   Accordion
   ========================================================================== */

/* Rows that open and close: an FAQ, disclosure rows, footer link groups.
   Each row is a native <details>, so it works without script and prints
   open. The marker is the chevron-down glyph, never a plus and minus, an
   arrow or a number: muted while the row is closed, the text colour once
   it is open, turned half a turn on open. */
.accordion {
  display: grid;
  border-top: 1px solid var(--border);
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: 2.75rem;
  padding-block: var(--space-5);
  list-style: none;
  cursor: pointer;
  color: var(--foreground);
  font-weight: 500;
}

.accordion-item > summary::-webkit-details-marker {
  display: none;
}

.accordion-item > summary::after {
  content: "";
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  background-color: var(--muted-foreground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--dur-3) var(--ease-out),
              background-color var(--dur-2) var(--ease-in-out);
}

.accordion-item[open] > summary::after {
  transform: rotate(180deg);
  background-color: var(--foreground);
}

.accordion-item > summary:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.accordion-content {
  padding-bottom: var(--space-6);
  color: var(--muted-foreground);
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem; /* spacing-exception */
  padding: var(--space-5) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background-color: var(--secondary);
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: var(--space-1);
}

.alert-title {
  margin: 0 0 var(--space-2);
  font-weight: 500;
  font-size: 0.9375rem;
}

.alert-text {
  margin: 0;
  font-size: 0.9375rem;
}

.alert-info {
  background-color: var(--secondary);
  border-color: transparent;
}

.alert-info .alert-icon,
.alert-info .alert-title {
  color: var(--foreground);
}

.alert-info .alert-text {
  color: var(--muted-foreground);
}

.alert-success {
  background-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-soft), var(--card));
  border-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-edge), var(--card));
}

.alert-success .alert-icon,
.alert-success .alert-title,
.alert-success .alert-text {
  color: var(--ba-commercial-text);
}

.alert-warning {
  background-color: color-mix(in oklch, var(--ba-corporate-surface) var(--tint-soft), var(--card));
  border-color: color-mix(in oklch, var(--ba-corporate-surface) var(--tint-edge), var(--card));
}

.alert-warning .alert-icon,
.alert-warning .alert-title,
.alert-warning .alert-text {
  color: var(--ba-corporate-text);
}

/* Danger is a field in its own color like the other three, derived from
   the destructive token so every theme gets a matching tint: a pale wash
   for the surface, the red pulled toward the foreground for the copy. */
.alert-danger {
  background-color: color-mix(in oklch, var(--destructive) 16%, var(--background));
  border-color: color-mix(in oklch, var(--destructive) var(--tint-soft), var(--card));
}

.alert-danger .alert-icon,
.alert-danger .alert-title {
  color: color-mix(in oklch, var(--destructive) 85%, var(--foreground));
}

.alert-danger .alert-text {
  color: color-mix(in oklch, var(--destructive) 55%, var(--foreground));
}

/* In dark the title's 85% red came to 3.6:1 on the dark danger tint below:
   the red is the darker of the two ends, so on a dark ground the mix has
   to lean further toward the white foreground. 65% is 5.1:1, and the body
   copy's 55% already clears 6:1. check-contrast.mjs asserts both. */
[data-theme="dark"] .alert-danger .alert-icon,
[data-theme="dark"] .alert-danger .alert-title {
  color: color-mix(in oklch, var(--destructive) 65%, var(--foreground));
}

/* In dark the family surfaces are deep tints, and a yellow at that depth
   is mud: the warning alert came out brown (#362602), the success one a
   saturated forest. Dark alerts sit on the neutral raised surface with a
   tenth of their colour mixed in, black-leaning like every other dark
   surface, and let the icon and the title carry the hue. */
[data-theme="dark"] .alert-success {
  background-color: color-mix(in oklch, var(--ba-commercial-accent) 10%, var(--secondary));
}

[data-theme="dark"] .alert-warning {
  background-color: color-mix(in oklch, var(--ba-corporate-accent) 10%, var(--secondary));
}

[data-theme="dark"] .alert-danger {
  background-color: color-mix(in oklch, var(--destructive) 12%, var(--secondary));
}

/* ==========================================================================
   Footer
   ========================================================================== */

/* ==========================================================================
   Markdown viewer (serve.py's generated wrapper) and any prose block
   inside an app page
   ========================================================================== */

.markdown-body {
  max-width: var(--markdown-max-width, 56rem);
  margin: 0 auto;
  padding: var(--space-11) 0 var(--space-13);
}

/* Inside a .container the reading column shares the container's left
   edge (rule 14): a centered narrower column under a left-aligned hero
   or section head reads as misaligned, not as a considered measure.
   Top padding drops too, the lead above already carries the gap, a
   section does not add a second block of air on top of it. Centered is
   only for a page that is nothing but prose (serve.py's markdown viewer,
   main.markdown-body with no container around it). */
.container .markdown-body {
  margin-left: 0;
  margin-right: 0;
  padding-top: 0;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 500;
  margin: var(--space-9) 0 var(--space-4);
}

.markdown-body h1 {
  font-size: var(--text-feature);
  margin-top: 0;
}

.markdown-body h2 {
  font-size: 1.5rem;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.markdown-body h3 {
  font-size: 1.2rem;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
  margin: 0 0 var(--space-5);
  line-height: 1.7;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: var(--space-7);
}

/* Square markers in the Brand accent: the system has no round decoration
   anywhere else, and a black disc at body size reads louder than the
   sentence it introduces. The colour is the one place a long document gets
   any, and it is the family the document itself belongs to. */
.markdown-body ul {
  list-style-type: square;
}

.markdown-body li {
  margin-bottom: 0.35rem; /* spacing-exception */
}

.markdown-body li::marker {
  color: var(--muted-foreground);
  font-size: 0.7em;
}

.markdown-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--muted-surface);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-xs);
}

.markdown-body pre {
  background-color: var(--muted-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  margin: 0 0 var(--space-5);
}

.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.markdown-body blockquote {
  border-left: 3px solid var(--foreground);
  padding-left: var(--space-5);
  color: var(--muted-foreground);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-9) 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-7);
  font-size: 0.9rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background-color: var(--muted-surface);
  font-weight: 500;
}

/* changelog.html: version headers and bullet lists read cramped at the
   default 56rem markdown measure (rule 14's right default for a prose
   doc, not for this page's shape), so this page opts into a wider
   column via the `--markdown-max-width` override .markdown-body already
   exposes for exactly this. App-specific (gotcha 12), not a change to
   the shared default. */
.changelog-body {
  --markdown-max-width: 76rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-10) 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-links {
  display: flex;
  gap: var(--space-7);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--dur-2) var(--ease-in-out);
}

.footer-links a:hover {
  color: var(--foreground);
}

/* ==========================================================================
   Small button variants (shared by sample pages)
   ========================================================================== */

.btn-sm {
  padding: var(--space-3) var(--space-4);
  font-size: 0.8125rem;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/* Restated here, after the sizing above. The shared coarse-pointer block
   near the top of this file sets the same 44px target, but it is declared
   1500 lines earlier at equal specificity, so the 2rem above was winning
   and the row actions stayed 32x32 on a touch device. Until the file is
   wrapped in layers, this has to be repeated after the component. */
@media (pointer: coarse) {
  .btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-social-icon {
  width: 16px;
  height: 16px;
  margin-right: var(--space-3);
}

.btn-icon-sm {
  width: 14px;
  height: 14px;
  margin-right: 0.35rem;
}

/* ==========================================================================
   Settings page (settings.html + settings.js)
   Mobile-first: sections stack. md+ adds a sticky section rail on the left.
   ========================================================================== */

/* padding-top/bottom only: a shorthand `padding: 1.5rem 0 4.5rem` here
   would zero out .container's own left/right padding (same element,
   .container's `padding: 0 2rem` loses to whichever rule comes later in
   the cascade at equal specificity), pulling the settings rail and
   sections in from the logo's left edge instead of aligning with it
   (DAPPLE-DESIGN-SYSTEM.md section 7 rule 9a). Longhand keeps the
   horizontal padding untouched. Top padding comes from the `.localnav ~ main`
   rule (rule 12), not from here, so it matches every other page under a
   tier-2 bar. */
.settings-page {
  padding-bottom: var(--space-13);
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-9);
  align-items: start;
}

.settings-rail {
  display: none;
}

@media (min-width: 768px) {
  .settings-layout {
    grid-template-columns: 200px 1fr;
  }

  .settings-rail {
    display: block;
    position: sticky;
    top: var(--space-14);
  }
}

.settings-rail a {
  display: block;
  padding: var(--space-3) 0.65rem; /* spacing-exception */
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color var(--dur-2) var(--ease-in-out),
              background-color var(--dur-2) var(--ease-in-out);
}

.settings-rail a:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.settings-section {
  margin-bottom: var(--space-7);
  /* card base look without the hover lift, settings sections are not
     clickable surfaces */
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-8);
}

.settings-section > h2 {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
}

.settings-section-desc {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  margin: 0 0 var(--space-5);
}

/* One setting per row: label + hint on the left, control on the right.
   Wraps to stacked on very narrow screens. */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
}

.settings-row:first-child {
  border-top: none;
  padding-top: 0;
}

.settings-row-label {
  min-width: 0;
}

.settings-row-label .label {
  margin-bottom: var(--space-1);
}

.settings-row-hint {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0;
}

.settings-row-control {
  flex-shrink: 0;
}

.settings-row-control .select-wrapper {
  min-width: 10rem;
}

/* Mode picker: three radio cards (Light / Dark / System). Real radio
   inputs, visually hidden, card styled via :has(). */
/* A track with the choice raised out of it, the segmented control's
   shape for choices that carry a hint. */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: 12px; /* the field's step */
  background-color: var(--muted-surface);
}

[data-theme="dark"] .radio-cards {
  background-color: var(--input);
}

.radio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: 0.85rem var(--space-3); /* spacing-exception */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background-color: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--dur-2) var(--ease-in-out),
              background-color var(--dur-2) var(--ease-in-out);
}

.radio-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.radio-card:hover {
  color: var(--foreground);
}

/* Selected: raised out of the track, the card's ground with the control
   edge and a soft lift, the way the segmented control marks its choice. */
.radio-card:has(input:checked) {
  border-color: var(--edge);
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
}

.radio-card:has(input:focus-visible) {
  box-shadow: var(--shadow-focus);
}

.radio-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: inherit;
}

.radio-card-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ==========================================================================
   App shell (sidebar nav sample)
   ========================================================================== */

/* A grid: an optional session banner across the whole view, then the
   sidebar and the page side by side. The sidebar's head and the page's
   header share one height, so their two hairlines read as one line. */
.app-shell {
  --app-bar-h: 4.25rem;
  --app-sidebar-w: 16.5rem;
  --app-max: 82rem;
  --app-pad: clamp(var(--space-5), 3.2vw, var(--space-11));
  display: grid;
  grid-template-columns: var(--app-sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100vh - 4rem);
  overflow: hidden;
}

/* Collapsed to an icon rail: the glyphs stay where they were and the
   words fade out of the way. nav.js sets the attribute before first
   paint, from the saved choice or, with none, from the window's width. */
:root[data-sidebar="rail"] .app-shell:has(.app-sidebar-head) {
  --app-sidebar-w: 4.3125rem;
}

.app-sidebar {
  --ring-gap: var(--rail-surface);
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--rail-surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  /* Container query boundary for the user-account identity chip: it
     adapts to this rail's own width (the collapsed icon rail), not the
     viewport, see .user-account-email below. */
  container-type: inline-size;
  container-name: app-sidebar;
}

/* A sidebar still built the 2.0 way (groups straight inside the aside, no
   head row and no scrolling body) keeps the padding and the scroll it had,
   and never turns into a rail. Copy the current nav.html markup to get the
   head row, the rail and the fades. */
.app-sidebar:not(:has(> .app-sidebar-body)) {
  padding: var(--space-5) var(--space-4);
  overflow-y: auto;
}

.app-sidebar:not(:has(> .app-sidebar-body)) > .workspace-switcher {
  width: 100%;
  margin: 0 0 var(--space-6);
}

.app-sidebar:not(:has(> .app-sidebar-body)) > .sidebar-group {
  margin-bottom: var(--space-7);
}

.app-sidebar-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--app-bar-h);
  padding-inline: 1.125rem var(--space-4); /* spacing-exception */
  border-bottom: 1px solid var(--border);
}

.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 0.625rem; /* spacing-exception */
  min-width: 0;
  min-height: 2.75rem;
  margin-left: calc(var(--space-3) * -1);
  padding: var(--space-2) var(--space-3);
  background-color: transparent;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--foreground);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.workspace-switcher:hover {
  background-color: var(--accent);
}

.workspace-switcher:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.workspace-mark {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* The Dapple workspace wears the mark's glyph instead of an initial, in Ink
   on the visit's family colour. theme.js picks one family per page load,
   the one the tab's favicon shows, and puts its surface and Ink in
   --visit-surface and --visit-ink on <html>. Both are the day theme's
   values in every theme, so in dark the tile stays a pastel under a black
   mark. Without JavaScript the tile is the Brand surface. */
.workspace-mark-glyph {
  background-color: var(--visit-surface, var(--ba-brand-surface));
  color: var(--visit-ink, var(--foreground));
}

.workspace-mark-glyph::before {
  content: "";
  width: 1.25rem;
  height: 0.875rem;
  background-color: currentColor;
  -webkit-mask: url("./assets/dapple-glyph.svg") no-repeat center / contain;
          mask: url("./assets/dapple-glyph.svg") no-repeat center / contain;
}

/* a grid, so the name and the plan are two lines whatever their length,
   and each can ellipsize on its own */
.workspace-info {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.workspace-name {
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-plan {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-switcher svg.chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--faint);
}

/* The rail's own control, collapsing the sidebar to its glyphs, and its
   twin in the page header that brings it back. A quiet square: no edge,
   the hover fill is its only surface. */
.sidebar-toggle {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background-color: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}

.sidebar-toggle:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

.sidebar-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.sidebar-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* The scrolling part of the rail. No scrollbar: when the list runs past
   the window, the edge with more behind it fades out instead (nav.js sets
   .more-above / .more-below). */
.app-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4) var(--space-4);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.app-sidebar-body::-webkit-scrollbar {
  display: none;
}

.app-sidebar-body.more-below {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent);
}

.app-sidebar-body.more-above {
  mask-image: linear-gradient(to bottom, transparent, #000 3rem);
}

.app-sidebar-body.more-above.more-below {
  mask-image: linear-gradient(to bottom, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
}

.sidebar-group {
  min-width: 0;
}

/* The last group (team, settings, help) sits at the foot of the rail,
   away from the destinations you move between all day. */
.sidebar-group-end {
  margin-top: auto;
  padding-top: 0.875rem; /* spacing-exception */
}

.sidebar-sep {
  flex-shrink: 0;
  height: 0;
  margin: 0.875rem var(--space-2); /* spacing-exception */
  border: 0;
  border-top: 1px dashed var(--border);
}

.sidebar-label {
  display: flex;
  align-items: center;
  gap: 0.375rem; /* spacing-exception */
  height: 2rem;
  margin: 0 0 var(--space-1);
  padding: 0 0.6875rem; /* spacing-exception */
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--faint);
  white-space: nowrap;
}

/* A label that folds its group: the same words, a button. */
button.sidebar-label {
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background-color: transparent;
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-in-out);
}

button.sidebar-label:hover {
  color: var(--foreground);
}

button.sidebar-label:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* The caret-right glyph: turned down while the group is open, pointing
   at the label while it is folded. */
.sidebar-label svg {
  width: 1rem;
  height: 1rem;
  transform: rotate(90deg);
  transition: transform var(--dur-2) var(--ease-out);
}

.sidebar-label[aria-expanded="false"] svg {
  transform: none;
}

/* The folded rows slide shut rather than blink out. */
.sidebar-collapse {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--dur-2) var(--ease-out);
}

.sidebar-collapse[data-open="false"] {
  grid-template-rows: 0fr;
}

.sidebar-collapse > * {
  min-height: 0;
  overflow: hidden;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
}

.sidebar-nav > li {
  min-width: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 2.625rem;
  padding-inline: 0.625rem; /* spacing-exception */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link svg {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
}

/* At rest an icon is one colour, the link's own, like the rest of the
   chrome: the tonal rendering in currentColor (44%, 72% and 100%), no
   family. */
.sidebar-link:not(.active, [aria-current="page"]) .icon {
  --icon-dark: currentColor;
  --icon-light: color-mix(in srgb, currentColor 44%, transparent);
  --icon-mid: color-mix(in srgb, currentColor 72%, transparent);
}

.sidebar-link:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

/* The rail clips its overflow, so the ring sits inside the row. */
.sidebar-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ring);
}

/* The page you are on is lifted out of the rail, a card with an edge, and
   only its icon lights up in its family's three tones (the link names its
   family). */
.sidebar-link.active,
.sidebar-link[aria-current="page"] {
  background-color: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
  font-weight: 500;
}

.sidebar-link.active:focus-visible,
.sidebar-link[aria-current="page"]:focus-visible {
  box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--ring);
}

.sidebar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--dur-1) var(--ease-out);
}

/* How many are waiting behind a destination, quiet and in step. */
.sidebar-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  transition: opacity var(--dur-1) var(--ease-out);
}

/* On a hovered row --faint drops under 4.5:1 in dark, so the count steps
   up to the muted grey along with the row. */
.sidebar-link:hover .sidebar-count {
  color: var(--muted-foreground);
}

/* A favourite has no glyph of its own: a dot in its family, on the same
   centre line as the glyphs above it. */
.sidebar-dot {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
}

.sidebar-dot::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background-color: var(--family-accent, var(--faint));
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

/* A <button>, not a <div>, since popovertarget only invokes a popover
   natively on <button>/<input type="button">, see the .menu contract
   comment above. Resets the button's UA border/background/font so it
   still reads as the plain identity chip it always was. */
.user-account {
  display: flex;
  align-items: center;
  gap: 0.6rem; /* spacing-exception */
  width: 100%;
  padding: var(--space-3) 0.6rem; /* spacing-exception */
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--foreground);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.user-account:hover {
  background-color: var(--accent);
}

.user-account:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Avatars take a family: surface behind the initials, the family's text
   role for them. The family comes from a .family-* class on the avatar
   (or an ancestor), Executive when none is set. Never the action color. */
.avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  background-color: var(--family-surface, var(--ba-executive-surface));
  color: var(--family-text, var(--ba-executive-text));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 500;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  font-size: 0.7rem;
}

.user-account-info {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.user-account-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-account-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Container query: if the sidebar this chip renders in narrows past a
   comfortable label width (a collapsed icon rail, a dense panel), drop
   the email line and keep just the name, rather than truncating both
   lines into ellipses. Falls back to an equivalent viewport check on
   browsers without container query support. */
@supports (container-type: inline-size) {
  @container app-sidebar (max-width: 12.5rem) {
    .user-account-email {
      display: none;
    }
  }
}

@supports not (container-type: inline-size) {
  @media (max-width: 12.5rem) {
    .user-account-email {
      display: none;
    }
  }
}

.user-account svg.chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

/* In the rail the account is a full-width row on the footer's hairline,
   the avatar on the glyphs' centre line. */
.app-sidebar .user-account {
  gap: var(--space-4);
  padding: 0.875rem var(--space-5); /* spacing-exception */
  border-radius: 0;
  white-space: nowrap;
}

.app-sidebar .user-account:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ring);
}

.app-sidebar .user-account .avatar {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.75rem;
}

.app-sidebar .user-account-name {
  font-size: 0.9375rem;
}

.app-sidebar .user-account-email {
  font-size: 0.8125rem;
}

.app-sidebar .user-account-info,
.app-sidebar .user-account svg.chevron {
  transition: opacity var(--dur-1) var(--ease-out);
}

.app-sidebar .user-account svg.chevron {
  color: var(--faint);
}

/* The rail: the head keeps only the workspace mark, the rows only their
   glyphs, the account only its avatar. Labels fold to nothing so the
   glyphs close up, and the favourites, which have no glyph, step out. */
:root[data-sidebar="rail"] .app-sidebar-head {
  justify-content: center;
  padding-inline: 0;
}

:root[data-sidebar="rail"] .app-sidebar:has(> .app-sidebar-head) .workspace-switcher {
  margin: 0;
}

:root[data-sidebar="rail"] .app-sidebar:has(> .app-sidebar-head) :is(.workspace-switcher svg.chevron, .sidebar-toggle, .sidebar-fold, .sidebar-sep-fold) {
  display: none;
}

/* The workspace's name leaves the eye, not the switcher's accessible
   name, which it still is. */
:root[data-sidebar="rail"] .app-sidebar:has(> .app-sidebar-head) .workspace-info {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

:root[data-sidebar="rail"] .app-sidebar:has(> .app-sidebar-head) :is(.sidebar-text, .sidebar-count, .user-account-info, .user-account svg.chevron) {
  opacity: 0;
}

:root[data-sidebar="rail"] .app-sidebar:has(> .app-sidebar-head) .sidebar-label {
  height: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
}

/* In the rail each glyph says its name on hover and focus. A fixed
   bubble, since the rail clips anything that leaves it. */
.sidebar-tip {
  position: fixed;
  z-index: 40;
  padding: var(--space-2) 0.625rem; /* spacing-exception */
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  white-space: nowrap;
  transform: translateY(-50%);
  animation: sidebar-tip-in var(--dur-1) var(--ease-out) both;
}

@keyframes sidebar-tip-in {
  from {
    opacity: 0;
    transform: translate(-3px, -50%);
  }
}

/* ==========================================================================
   Menu (Popover API + CSS anchor positioning, no fallback: modern browsers
   only, per the accepted browser-floor decision)
   ========================================================================== */

/* Markup contract: a trigger <button popovertarget="xId"> and a matching
   <div id="xId" popover class="menu"> holding .menu-item buttons/links
   (optionally split by a plain <hr class="menu-divider"> since <hr>'s
   implicit "separator" role and its exclusion from the .menu-item
   selector both come for free). Open/close, outside-click dismiss, and
   Escape all come from the platform via the Popover API, nothing here
   reimplements them. menu.js only adds arrow-key roving-tabindex
   navigation and keeps aria-expanded on the trigger in sync (there is no
   native event for that on the trigger, it listens to the popover's own
   `toggle` event instead). Positioning is anchor-name/position-anchor +
   position-area, with position-try-fallbacks: flip-block so a menu that
   would overflow the viewport edge flips to the other side automatically,
   no hand-rolled JS positioning math. anchor-name binds to one specific
   element, not a class, so each trigger/menu pair on a page needs its own
   pair of names, see the workspaceSwitcher and userAccount anchor rules
   below for the concrete pattern to copy for a new instance. (Never write
   a literal star-slash sequence inside this or any CSS comment: it
   terminates the comment early and the stray text that follows becomes a
   garbage prelude that swallows the NEXT rule whole. Exactly that bug
   shipped here once, killing .menu in every browser, see validate.mjs's
   comment-terminator check.) */
.menu {
  --ring-gap: var(--popover);
  margin: 0;
  padding: 0.35rem; /* spacing-exception */
  min-width: 12rem;
  max-width: 16rem;
  /* No `display` here, ON PURPOSE. The UA hides closed popovers with
     `[popover]:not(:popover-open) { display: none }`, and author rules
     beat UA rules regardless of specificity, so a `display: flex` in
     this base rule would UNHIDE every closed menu: invisible (opacity 0
     below) but hit-testable, anchored right over the header, silently
     swallowing clicks meant for the localnav underneath. That exact bug
     shipped once. `display: flex` lives on :popover-open below, and the
     allow-discrete display transition keeps it through the exit
     animation. flex-direction/gap are inert without display and safe
     here. */
  flex-direction: column;
  gap: var(--space-1);
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity var(--dur-1) var(--ease-out),
              transform var(--dur-1) var(--ease-out),
              overlay var(--dur-1) allow-discrete,
              display var(--dur-1) allow-discrete;
}

.menu:popover-open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  .menu:popover-open {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) 0.65rem; /* spacing-exception */
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--popover-foreground);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out);
}

.menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.menu-item:hover {
  background-color: var(--accent);
}

.menu-item:focus-visible {
  outline: none;
  background-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

/* Current-selection state for menus like the workspace switcher, a
   weight bump plus the same accent tint hover already uses rather than a
   new color, so switching context reads as an in-place highlight, not a
   different semantic. */
.menu-item[aria-current="true"] {
  background-color: var(--accent);
  font-weight: 500;
}

/* A destructive item (close, delete, revoke): the danger red, pulled
   toward the text colour so it reads as a label rather than an alert, and
   placed last, after a .menu-divider, so it is never the item under the
   pointer by accident. The same recipe as .badge-danger and .alert-danger,
   no new colour; 70% red keeps it at 4.5:1 or better on the popover and on
   its hover fill in every theme (check-contrast.mjs asserts it). The item
   only marks the action: anything that cannot be undone still asks first
   (the confirmation dialog, .btn-danger). */
.menu-item-danger {
  color: color-mix(in oklch, var(--destructive) 70%, var(--popover-foreground));
}

.menu-item-danger svg {
  color: currentcolor;
}

.menu-divider {
  height: 1px;
  margin: 0.35rem var(--space-1); /* spacing-exception */
  border: none;
  background-color: var(--border);
}

/* Non-interactive name/email header inside a .menu, for identity menus
   that have room for it (chat.html's top-nav identity chip). Reuses the
   same .user-account-name/.user-account-email text styles the sidebar's
   .user-account already defines, just in a plain wrapper instead of a
   button, since this block isn't itself clickable. */
.menu-identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) 0.65rem 0.65rem; /* spacing-exception */
}

/* Anchor pairs. anchor-name binds one specific element, so each of the
   four trigger/menu pairs on this page (workspace switcher and user
   account, each duplicated once for the desktop .app-sidebar and once for
   the <768px sidebarDrawer copy) gets its own name rather than sharing
   one across a class. */
#workspaceSwitcherDesktop { anchor-name: --workspace-anchor-desktop; }
#workspaceSwitcherMobile { anchor-name: --workspace-anchor-mobile; }
#userAccountDesktop { anchor-name: --user-anchor-desktop; }
#userAccountMobile { anchor-name: --user-anchor-mobile; }

/* Workspace switcher sits at the top of the sidebar: open below it,
   left-aligned with the trigger (position-area's span-right keyword).
   flip-block covers the case where the sidebar is short enough that
   "below" would overflow the bottom of the viewport. */
#workspaceMenuDesktop,
#workspaceMenuMobile {
  position-area: bottom span-right;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}
#workspaceMenuDesktop { position-anchor: --workspace-anchor-desktop; }
#workspaceMenuMobile { position-anchor: --workspace-anchor-mobile; }

/* User account sits at the bottom of the sidebar footer: open above it by
   default, since there is rarely room below a footer-pinned trigger.
   flip-block covers a very short viewport where even "above" would
   overflow the top edge. */
#userMenuDesktop,
#userMenuMobile {
  position-area: top span-right;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}
#userMenuDesktop { position-anchor: --user-anchor-desktop; }
#userMenuMobile { position-anchor: --user-anchor-mobile; }

/* chat.html's top-nav identity chip: sits at the top-right of the header,
   so its menu opens below and extends left (span-left) instead of right,
   so it doesn't clip past the viewport edge the way the sidebar's
   bottom-anchored menus (which extend right) don't need to worry about. */
#chatIdentityTrigger { anchor-name: --chat-identity-anchor; }
#chatIdentityMenu {
  position-anchor: --chat-identity-anchor;
  position-area: bottom span-left;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}

/* nav.html's top-nav help entry point, next to the theme controls, same
   anchoring shape as the chat identity chip above: opens below, extends
   left so it doesn't clip the viewport's right edge. */
#helpTrigger { anchor-name: --help-anchor; }
#helpMenu {
  position-anchor: --help-anchor;
  position-area: bottom span-left;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}

/* nav.html's notifications, at the right end of the page header: the
   same shape again, below and extending left. */
#notifTrigger { anchor-name: --notif-anchor; }
#notifMenu {
  position-anchor: --notif-anchor;
  position-area: bottom span-left;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
  width: min(22rem, calc(100vw - 2 * var(--space-5)));
}

/* The top-nav More overflow menu (rule 10's Priority+ pattern, every
   page): the trigger sits at the right end of the inline link list, in
   the middle stretch of the header, so the menu opens below and extends
   left like the other header menus. This pair was originally forgotten,
   which left navMoreMenu on the UA popover default (position: fixed,
   inset: 0, margin: auto), dead-center of the viewport: a menu that is
   not anchored does not fall back to "near its trigger", it falls back
   to CENTERED, so never ship a .menu without its anchor pair. */
#navMoreTrigger { anchor-name: --nav-more-anchor; }
#navMoreMenu {
  position-anchor: --nav-more-anchor;
  position-area: bottom span-left;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}

/* settings.html's contextual inline help popover, anchored to the small
   "i" trigger next to the Landing page field instead of a header control. */
#landingPageHelpTrigger { anchor-name: --landing-help-anchor; }
#landingPageHelpMenu {
  position-anchor: --landing-help-anchor;
  position-area: bottom span-right;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}

/* ==========================================================================
   Identity session states (signed out, switching workspace, impersonating)
   See APP-SHELL-REFERENCE.md, "Identity session states" for when each
   applies. Signed in is the existing .user-account/.nav-identity + .menu
   pattern above, these three add the states around it.
   ========================================================================== */

/* Switching workspace/account: a just-clicked .menu-item goes into a
   disabled, dimmed, spinner state for the (real or, here, simulated)
   duration of the switch, rather than closing the popover instantly as if
   the switch was synchronous. */
.menu-item.is-switching {
  opacity: 0.6;
  pointer-events: none;
  cursor: default;
}

/* The same mark as everywhere else, in a 14px box: the element carries
   .spinner as well, so there is one loading language in the system and one
   place to change it. */
.menu-item-spinner {
  width: 14px;
  height: 14px;
}

/* Impersonating: an admin viewing the product as another user. The
   corporate family's tint, the same one .alert-warning wears, drawn
   across the whole shell, over the sidebar and the page alike, so it
   reads as true for the whole view and leaves the line the two headers
   share intact. */
.impersonation-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--space-11);
  padding: var(--space-2) var(--space-5) var(--space-2) 1.125rem; /* spacing-exception */
  background-color: color-mix(in oklch, var(--ba-corporate-surface) var(--tint-soft), var(--card));
  color: var(--ba-corporate-text);
  border-bottom: 1px solid color-mix(in oklch, var(--ba-corporate-surface) var(--tint-edge), var(--card));
  font-size: 0.875rem;
}

.impersonation-banner-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.impersonation-banner-text {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.impersonation-banner-text strong {
  font-weight: 500;
}

.impersonation-exit {
  flex-shrink: 0;
}

.app-content {
  /* Positioned, so anything absolute inside (a screen-reader text, a
     chart's slip) scrolls with the content and never stretches the page
     past the shell. */
  position: relative;
  grid-row: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  overflow-y: auto;
  /* keyboard focus that scrolls into view stops below the sticky header */
  scroll-padding-top: var(--app-bar-h);
}

/* The page's header: search on the left, the page's few global actions
   on the right, the same height as the sidebar's head. It stays put while
   the page scrolls under it, frosted rather than opaque. */
.app-content-header {
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--app-bar-h);
  padding-inline: max(var(--app-pad), calc((100% - var(--app-max)) / 2 + var(--app-pad)));
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--background) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
          backdrop-filter: saturate(1.4) blur(14px);
}

/* Sidebar drawer trigger: hidden md+ (reuses .nav-burger's own display
   rule), phone-only otherwise. See the responsive block below for what
   happens to .app-sidebar at the same breakpoint. Edgeless here, like the
   rest of the header's quiet controls. */
.app-sidebar-burger {
  flex-shrink: 0;
  margin-left: calc(var(--space-3) * -1);
  border-color: transparent;
}

/* Brings the rail back to full width; only there while it is a rail. */
.sidebar-expand {
  display: none;
  margin-left: calc(var(--space-3) * -1);
}

@media (min-width: 768px) {
  :root[data-sidebar="rail"] .sidebar-expand {
    display: inline-grid;
  }
}

/* Search: a quiet field that shows its ground only on hover and focus,
   with the shortcut that reaches it from anywhere on the page. */
.app-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.625rem; /* spacing-exception */
  min-width: 0;
  max-width: 34rem;
  height: 2.625rem;
  margin-left: -0.625rem; /* spacing-exception */
  padding-inline: 0.625rem var(--space-3); /* spacing-exception */
  border-radius: var(--radius-lg);
  color: var(--faint);
  transition: background-color var(--dur-2) var(--ease-in-out),
              box-shadow var(--dur-2) var(--ease-in-out);
}

.app-search:hover {
  background-color: var(--accent);
}

.app-search:focus-within {
  background-color: var(--card);
  box-shadow: 0 0 0 1px var(--ring), 0 0 0 4px color-mix(in oklch, var(--ring) 12%, transparent);
}

.app-search > svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.app-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  text-overflow: ellipsis;
}

.app-search input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.app-search:hover input::placeholder {
  color: var(--muted-foreground);
}

.app-search input::-webkit-search-cancel-button {
  appearance: none;
}

.app-search-keys {
  display: flex;
  gap: var(--space-2);
}

/* A key, as the keyboard draws it: a small raised cap. */
.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding-inline: 0.3125rem; /* spacing-exception */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--card);
  box-shadow: 0 1px 0 var(--border);
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

/* The header's round actions (notifications): a disc with an edge, the
   one shape in the header that is a button and nothing else. */
.app-header-btn {
  position: relative;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--card);
  color: var(--muted-foreground);
  cursor: pointer;
}

.app-header-btn:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

.app-header-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.app-header-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Unread: one small dot in the danger colour, ringed off the disc. */
.app-header-btn-dot {
  position: absolute;
  top: var(--space-3);
  right: 0.5625rem; /* spacing-exception */
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: var(--radius-pill);
  background-color: var(--destructive);
  box-shadow: 0 0 0 2px var(--card);
}

.app-content-body {
  padding-block: var(--space-10) var(--space-13);
  padding-inline: max(var(--app-pad), calc((100% - var(--app-max)) / 2 + var(--app-pad)));
  /* Container query boundary: cards inside adapt to the column width they
     actually render in (this pane), not the raw viewport. See the .card
     rules further up for the adaptation itself. */
  container-type: inline-size;
  container-name: app-content;
}

/* The page's own title, outside any card, with the trail that led here
   above it and one line of context below. */
.app-page-head {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-9);
}

.app-page-head h1,
.app-page-head p {
  margin: 0;
}

.app-page-head p {
  max-width: 40rem;
  color: var(--muted-foreground);
}

/* The page's answer in one sentence (dashboard.html): the figures that
   carry it in the foreground at 500, the rest in the muted grey. */
.app-page-lede strong {
  color: var(--foreground);
  font-weight: 500;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem; /* spacing-exception */
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--foreground);
}

.breadcrumb .current {
  color: var(--foreground);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--muted-foreground);
}

/* The drawer carries the same parts in its own padding: the switcher and
   the account keep their chip shape at full width. */
.nav-drawer .workspace-switcher {
  width: 100%;
  margin: var(--space-4) 0 0;
}

.nav-drawer .workspace-info {
  flex: 1;
}

.nav-drawer .app-sidebar-body {
  padding: var(--space-5) 0 var(--space-4);
}

.nav-drawer .sidebar-footer {
  padding-top: var(--space-4);
}

/* Below md, .app-sidebar moves into the sidebar drawer dialog (same
   contents, duplicated markup, opened by .app-sidebar-burger above) instead
   of rendering in flow. .app-shell/.app-content also drop the fixed-height
   two-pane scroll model on phones in favor of natural page scroll, which
   is both simpler and friendlier to mobile browser chrome (address bar
   show/hide) than a nested overflow-y: auto pane. */
@media (max-width: 767.98px) {
  .app-sidebar {
    display: none;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: calc(100vh - 4rem);
    overflow: visible;
  }

  .app-content {
    overflow-y: visible;
  }

  .app-content-header {
    position: static;
  }

  .app-search {
    margin-left: 0;
  }

  .app-search-keys {
    display: none;
  }
}

/* Forced colours paint every ground as Canvas; the dots are the only mark
   that carries their meaning, so they keep their colour. */
@media (forced-colors: active) {
  .sidebar-dot::before,
  .app-header-btn-dot {
    forced-color-adjust: none;
  }

  /* A transparent edge is painted in the text colour here, so every row
     would get a box: rows at rest take the ground, the selected one
     Highlight. */
  .sidebar-link,
  .split-item,
  .thread-item {
    border-color: Canvas;
  }

  .sidebar-link[aria-current="page"],
  .split-item[aria-current="true"],
  .thread-item[aria-current="page"] {
    border-color: Highlight;
  }

  /* The workspace glyph is a mask over a background, which forced colours
     would wipe: it keeps the text colour. */
  .workspace-mark-glyph::before {
    forced-color-adjust: none;
    background-color: CanvasText;
  }
}

/* A finger needs 44px whatever the control's resting size. Restated here,
   after the components, for the same reason .btn-icon restates it: the
   shared coarse-pointer block sits earlier in the file. */
@media (pointer: coarse) {
  .sidebar-toggle,
  .app-header-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  button.sidebar-label {
    height: 2.75rem;
  }
}

/* ==========================================================================
   Login / auth sample
   ========================================================================== */

/* The auth shell is a color field (the marketing site's inner-page
   hero): one family surface edge to edge, its stripe rules at both edges,
   and the card a plain white panel on it, no hairline (the field is the
   boundary). The family comes from a .family-* class on the shell,
   Executive when none is set. Dark turns the field to the page ground
   (below). login.html no longer uses it: the reference login is the split
   further down (.auth-split, the form beside the weave panel). The shell
   and .auth-card stay for a project that wants the centred card, and the
   state pages share the shell. */
/* A full-bleed colour field with one panel centred on it. .auth-shell is
   the centred login's; .state-shell is the same shell for a page that has
   nothing to show (not found, failed to load), so the two read as one
   family of screens instead of two inventions. */
.auth-shell,
.state-shell {
  position: relative;
  isolation: isolate;
  /* The screen under the nav: its 4rem row plus its 1px hairline. Without
     the pixel the page scrolled by one, on a screen that is the whole page
     (no footer under it). */
  min-height: calc(100vh - 4rem - 1px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-11) var(--space-7);
  background-color: var(--family-surface, var(--ba-executive-surface));
  overflow: hidden;
}

/* In dark both shells, the login's and the state pages', go to the page's
   own ground. A family surface there is a deep, saturated tint, and a full
   screen of it behind a form or a message is a colour cast on the whole
   page rather than a field: the error page's coral read as a brown room.
   The family stays, but only in the rules, its accent knocked halfway into
   the ground so a screen of them is texture and not a row of lit tubes.
   One recipe for both, so sign-in and not-found read as one system and
   each still names its family. */
[data-theme="dark"] :is(.auth-shell, .state-shell) {
  background-color: var(--background);
}

[data-theme="dark"] :is(.auth-shell, .state-shell)::after {
  --field-surface: var(--background);
  --field-rule: color-mix(
    in oklch,
    var(--family-accent, var(--ba-executive-accent)) 50%,
    var(--background)
  );
}

/* The state panel: same white card on the field as the auth card, and the
   shell centres it, so the page needs no inline layout at the call site. */
.state-shell > .error-state,
.state-shell > .empty-state {
  width: 100%;
  max-width: 32rem;
  padding-block: var(--space-12);
  background-color: var(--card);
  border-color: transparent;
  text-align: center;
}

.auth-card {
  --ring-gap: var(--card);
  width: 100%;
  /* Wider than a stock auth card. The field behind it is the page's whole
     idea, and a narrow card on it reads as a form that wandered in. */
  max-width: 32rem;
  background-color: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  padding: var(--space-10);
}

/* On the dark ground the panel is a raised surface the way every dark card
   is: the card fill, its hairline and the large shadow, so it lifts clearly
   off the field. The login card used to be --secondary on a --card field,
   1.1:1, which read as the field with a faint patch on it. */
[data-theme="dark"] :is(.auth-card, .state-shell > .error-state, .state-shell > .empty-state) {
  --ring-gap: var(--card);
  background-color: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

/* The card's head is left-aligned like every other heading in the
   system: mark, title and subtext share the form's left edge. */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
}

/* The glyph alone (assets/dapple-glyph.svg, ratio 1.43), not the
   wordmark: the card's head is a brand marker, not a second masthead,
   and the nav one screen up already spells the name. The nav's mark is
   the only place the full wordmark is mandatory (rule 11). */
.auth-logo .logo-mark {
  height: 1.5rem;
  width: 2.15rem;
  /* The whole shorthand, not just the image: overriding mask-image alone
     leaves the -webkit- longhands out of step with the unprefixed ones
     and the glyph does not paint. */
  -webkit-mask: url("./assets/dapple-glyph.svg") no-repeat center / contain;
          mask: url("./assets/dapple-glyph.svg") no-repeat center / contain;
}

.auth-card h1,
.auth-split-content h1 {
  text-align: left;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-subtext {
  text-align: left;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  margin: 0 0 var(--space-8);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.label-row .label {
  margin-bottom: 0;
}

.text-link {
  font-size: 0.8125rem;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* The link already underlines at rest, so hover has to move something
   else: it steps to the action colour. */
.text-link:hover {
  color: var(--primary);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.85rem; /* spacing-exception */
  margin: var(--space-7) 0;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--border);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-7);
}

/* The login as a split, the way a deck cover is: the form on the left on
   the plain page ground, no card around it, and the brand weave on the
   right as a full-height cover panel, edge to edge (no radius, no border).
   The form keeps every class above (.auth-logo, .auth-subtext,
   .auth-divider, .auth-footer); only the box around it changes. Below md
   the panel becomes a band above the form (the phone block at the end of
   the file). */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  /* The screen under the nav, as in .auth-shell. */
  min-height: calc(100vh - 4rem - 1px);
  background-color: var(--background);
}

.auth-split-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-11) var(--space-9);
}

/* A comfortable measure for a form of two fields. */
.auth-split-content {
  width: 100%;
  max-width: 24rem;
}

/* The cover panel. login-weave.js draws the landing's weave into the
   inline SVG: rows across the panel, each a run of thin vertical bars.
   Then it sets .is-drawn, which takes the still artwork away. Without
   JavaScript the panel shows the six-row field, the same rows of vertical
   bars, cropped to the panel, and its dark twin in dark. The SVG takes no
   pointer: the panel listens for the swell. */
.auth-weave {
  position: relative;
  overflow: hidden;
  background-color: var(--background);
  background-image: url("./assets/stripe-pattern-full.svg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

[data-theme="dark"] .auth-weave {
  background-image: url("./assets/stripe-pattern-full-dark.svg");
}

html .auth-weave.is-drawn {
  background-image: none;
}

.auth-weave-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Forced colours: the weave is decoration, so it drops out and the panel
   is plain ground. login-weave.js stops its loop as well. This block comes
   after the base rule above so its display: none wins. */
@media (forced-colors: active) {
  .auth-weave,
  [data-theme="dark"] .auth-weave {
    background-image: none;
  }

  .auth-weave-art {
    display: none;
  }
}

/* ==========================================================================
   Chat sample
   ========================================================================== */

.chat-shell {
  display: flex;
  height: calc(100vh - 4rem);
  overflow: hidden;
}

/* The thread list stands a step of grey off the conversation's white:
   --secondary, the quiet neutral fill. A row darkens a touch on hover
   (--accent is that same grey and would vanish here, and the page white is
   the open thread's), and the New button does the same. Dark
   keeps the rail instead: the conversation is on the page ground and the
   list one neutral step lighter, where --secondary would rise above the
   open thread's card. */
.chat-sidebar {
  --chat-list: var(--secondary);
  --thread-hover: color-mix(in oklab, var(--secondary), var(--foreground) 4%);
  --ring-gap: var(--chat-list);
  width: 280px;
  flex-shrink: 0;
  background-color: var(--chat-list);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

[data-theme="dark"] .chat-sidebar {
  --chat-list: var(--rail-surface);
  --thread-hover: var(--accent);
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  flex-shrink: 0;
}

/* The list is the secondary fill itself in light and a step off it in
   dark, so a secondary button on it loses its box and reads as loose text.
   On the list it stands on the page ground with a hairline instead: a
   raised control, in every theme. */
.chat-sidebar .btn-secondary {
  background-color: var(--background);
  border-color: var(--border);
}

.chat-sidebar .btn-secondary:hover {
  background-color: var(--thread-hover, var(--accent));
}

.thread-list {
  list-style: none;
  margin: 0;
  padding: 0 0.65rem var(--space-5); /* spacing-exception */
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.thread-item {
  display: block;
  padding: 0.6rem var(--space-4); /* spacing-exception */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--foreground);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.thread-item:hover {
  background-color: var(--thread-hover, var(--accent));
}

.thread-item:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* The open conversation is lifted out of the list like the current page
   in the sidebar: a card with an edge and 500 on its title only. The
   conversation's own colour lives in its message bubbles. */
.thread-item.active,
.thread-item[aria-current="page"] {
  background-color: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.thread-item.active:focus-visible,
.thread-item[aria-current="page"]:focus-visible {
  box-shadow: var(--shadow-focus);
}

.thread-item.active .thread-item-title,
.thread-item[aria-current="page"] .thread-item-title {
  font-weight: 500;
}

.thread-item-title {
  font-size: 0.875rem;
  font-weight: 400;
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item-preview {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Below md, .chat-sidebar moves into the chat sidebar drawer dialog (same
   thread list, duplicated markup, opened by .chat-sidebar-burger in the
   chat header) instead of rendering in flow, the same treatment as
   .app-sidebar above and for the same reason: it removes the fixed 280px
   width that was forcing .chat-shell's overflow: hidden to clip instead of
   the page ever needing to scroll sideways, and drops the fixed-height
   two-pane scroll model in favor of natural page scroll on phones. */
@media (max-width: 767.98px) {
  .chat-sidebar {
    display: none;
  }

  .chat-shell {
    height: auto;
    min-height: calc(100vh - 4rem);
    overflow: visible;
  }

  .chat-messages {
    overflow-y: visible;
  }
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
}

.chat-main-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-7);
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  font-weight: 500;
  flex-shrink: 0;
}

.chat-main-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat sidebar drawer trigger: hidden md+ (reuses .nav-burger's own
   display rule), phone-only otherwise. */
.chat-sidebar-burger {
  flex-shrink: 0;
}

/* The conversation is on the page ground, white like the header and the
   composer, and the grey sits in the thread list beside it. In dark the
   same token is the Ink page, and the bubble's --card lifts off it. */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  background-color: var(--background);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: 42rem;
}

.message-user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-assistant {
  margin-right: auto;
}

/* Chat avatars follow the same rule as .avatar: a family surface and its
   text role, chosen per avatar with a .family-* class (chat.html gives
   the assistant the Brand family and the user Executive). */
.message-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background-color: var(--family-surface, var(--ba-executive-surface));
  color: var(--family-text, var(--ba-executive-text));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Every bubble carries a 1px edge, transparent unless a bubble needs it, so
   the two speakers' bubbles keep one size. */
.message-bubble {
  padding: var(--space-4) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.message-bubble p {
  margin: 0 0 0.6rem; /* spacing-exception */
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble strong {
  font-weight: 500;
}

/* The user's bubble takes a light tint of the conversation's family, Ink
   for the text. The family comes from the message list, not from each
   message, so a different conversation reads in a different colour
   without touching a single bubble. The tint rather than the full
   surface: a column of full-surface bubbles competes with the words in
   them, and the same reasoning already governs .field. The action color
   is never a speech surface. */
.message-user .message-bubble {
  background-color: color-mix(
    in oklch,
    var(--family-surface, var(--ba-executive-surface)) 45%,
    var(--card)
  );
  color: var(--foreground);
}

/* White on the white conversation, so a hairline draws the bubble: the
   cool --border, the same edge a card takes at rest. Not a grey fill, which
   would swallow the code blocks inside it (they are --secondary). */
.message-assistant .message-bubble {
  background-color: var(--card);
  border-color: var(--border);
  color: var(--foreground);
}

.message-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--secondary);
  padding: var(--space-1) 0.4rem; /* spacing-exception */
  border-radius: var(--radius-xs);
}

.message-bubble pre {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background-color: var(--secondary);
  padding: 0.85rem var(--space-5); /* spacing-exception */
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.6rem 0; /* spacing-exception */
}

.message-bubble pre code {
  background: none;
  padding: 0;
}

.chat-composer {
  border-top: 1px solid var(--border);
  padding: var(--space-5) var(--space-7) var(--space-6);
  flex-shrink: 0;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem; /* spacing-exception */
  padding: 0.6rem 0.6rem 0.6rem 0.9rem; /* spacing-exception */
  background-color: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-2) var(--ease-in-out),
              box-shadow var(--dur-2) var(--ease-in-out);
}

.composer-box:focus-within {
  border-color: var(--ring);
  box-shadow: var(--shadow-focus);
}

.composer-input {
  flex: 1;
  min-height: 1.5rem;
  max-height: 8rem;
  padding: var(--space-2) 0;
  border: none;
  background: none;
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.composer-input::placeholder {
  color: var(--muted-foreground);
}

/* ==========================================================================
   Feedback: toast / notification
   Fixed bottom-right stack, created lazily by toast.js. Variant classes
   mirror .alert's existing token mapping exactly (success = commercial
   family, warning = corporate family, danger = destructive token, info =
   muted surface), no new semantic color layer. Floating over the page, so
   unlike hairline-at-rest components it earns --shadow-lg immediately,
   the same "surface that sits above the page" exception .menu already
   uses.
   ========================================================================== */

.toast-region {
  position: fixed;
  bottom: var(--space-7);
  right: var(--space-7);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.6rem; /* spacing-exception */
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  --ring-gap: var(--muted-surface);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: 0.85rem var(--space-5); /* spacing-exception */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity var(--dur-2) var(--ease-in-out),
              transform var(--dur-2) var(--ease-in-out);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-text {
  margin: 0;
  font-size: 0.9375rem;
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--dur-1) var(--ease-out),
              background-color var(--dur-1) var(--ease-out);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.toast-close:hover {
  opacity: 1;
  background-color: color-mix(in oklch, currentColor 12%, transparent);
}

.toast-close:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.toast-info {
  background-color: var(--muted-surface);
  color: var(--foreground);
}

.toast-info .toast-text {
  color: var(--muted-foreground);
}

.toast-success {
  background-color: var(--ba-commercial-surface);
  border-color: transparent;
  color: var(--ba-commercial-text);
}

.toast-warning {
  background-color: var(--ba-corporate-surface);
  border-color: transparent;
  color: var(--ba-corporate-text);
}

.toast-danger {
  background-color: var(--muted-surface);
  border-color: var(--destructive);
  color: var(--destructive);
}

.toast-danger .toast-text {
  color: var(--muted-foreground);
}

/* ==========================================================================
   Feedback: inline form validation
   .input/textarea.input/select.input had no error state at all before this.
   Reuses --destructive exclusively, no new red. The error focus ring below
   is --shadow-focus's own geometry — the page color as a 2px gap, then a
   2px ring — with --destructive standing in for --ring, so an invalid
   field focuses as the same species of indicator as everything else and
   only the color carries the error.
   ========================================================================== */

.input-error,
textarea.input-error,
select.input-error,
.input[aria-invalid="true"],
textarea.input[aria-invalid="true"],
select.input[aria-invalid="true"] {
  border-color: var(--destructive);
}

.input-error:focus,
textarea.input-error:focus,
select.input-error:focus,
.input[aria-invalid="true"]:focus,
textarea.input[aria-invalid="true"]:focus,
select.input[aria-invalid="true"]:focus {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 16%, transparent);
}

.error-text {
  display: flex;
  align-items: center;
  gap: 0.35rem; /* spacing-exception */
  margin: 0.4rem 0 0; /* spacing-exception */
  font-size: 0.8125rem;
  /* Lightened toward the foreground like every other consumer of the
     token: the raw --destructive is 3.25:1 on a dark card, under the 4.5
     that 13px text needs. In light the mix barely moves it. */
  color: color-mix(in oklch, var(--destructive) 80%, var(--foreground));
}

/* ==========================================================================
   Feedback: modal / confirmation dialog
   A native <dialog> (not .menu), matching how .nav-drawer already uses
   showModal() for a real focus-trapped, blocking surface. .modal is the
   generic shape (arbitrary body content); a confirmation dialog is just a
   .modal with a one-sentence body and a footer holding one destructive
   .btn-danger plus one .btn-ghost cancel, never two competing primary
   actions. Uses --radius-xl, reserved for exactly this in the token
   comment above. Wired by modal.js.
   ========================================================================== */

.modal {
  --ring-gap: var(--popover);
  margin: auto;
  padding: 0;
  width: min(26rem, 90vw);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity var(--dur-2) var(--ease-in-out),
              transform var(--dur-2) var(--ease-in-out),
              overlay var(--dur-2) allow-discrete,
              display var(--dur-2) allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.modal::backdrop {
  background-color: var(--overlay-backdrop);
}

/* Wider variant for a generic modal holding real content (a form, a list),
   rather than a one-sentence confirmation. */
.modal-wide {
  width: min(34rem, 92vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-7) var(--space-7) 0;
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
}

/* .modal-close is a behavior hook before it is a look: modal.js closes
   the dialog from any element carrying it, and P4's markup contract puts
   it on two very different controls, the head's icon button and the
   footer's real .btn buttons. So the icon-button shape lives under
   .modal-head, where that control actually is. Unscoped it also landed on
   the footer, and because it sits later in this file than .btn, it won
   the cascade there: Cancel and the confirm button collapsed to 2rem
   squares with their labels spilling out, and the hover rule below
   repainted .btn-danger's red with the accent tint. A close control that
   is a .btn gets its metrics from .btn, that is the whole point of
   putting both classes on it. */
.modal-head .modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  flex-shrink: 0;
  background-color: transparent;
  color: var(--muted-foreground);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              color var(--dur-2) var(--ease-in-out);
}

.modal-head .modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-head .modal-close:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

.modal-head .modal-close:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.modal-body {
  padding: var(--space-6) var(--space-7);
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: 0 var(--space-7) var(--space-7);
}

/* Destructive action button, for the one-and-only primary action inside a
   confirmation dialog. Distinct from .btn-primary (Ink) so a destructive
   confirm never reads as the everyday brand action. */
.btn-danger {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

/* Hovers through a color step like every other button, not an opacity
   fade: an opacity fade lets the surface under it show through. */
.btn-danger:hover {
  background-color: color-mix(in oklch, var(--destructive) 88%, var(--foreground));
  border-color: color-mix(in oklch, var(--destructive) 88%, var(--foreground));
}

/* ==========================================================================
   States: spinner
   Twelve spokes on a ring, each a step behind the one before it, so a
   comet of brightness walks round and nothing actually rotates. The
   geometry is the classic one: a spoke is 24% of the box wide and 8% tall
   with a full round cap, pushed out from the centre by 146% of its own
   width, and the brightness runs from 1 to 0.15 across twelve steps.

   Markup is one element per spoke and nothing else:

     <span class="spinner" aria-hidden="true">
       <i></i><i></i><i></i><i></i><i></i><i></i>
       <i></i><i></i><i></i><i></i><i></i><i></i>
     </span>

   The twelve <i> carry no meaning, which is why the parent is the element
   that is aria-hidden, or that carries role="status" when the mark stands
   alone with nothing else to announce the wait.
   ========================================================================== */

.spinner {
  display: inline-block;
  position: relative;
  width: 1rem;
  height: 1rem;
  vertical-align: middle;
  flex-shrink: 0;
  /* One colour, and it is the family's wherever a view sets one, so a
     Customer screen loads in Customer without anyone choosing. The family's
     mark colour, not its accent: a pastel accent is under 3:1 on white.
     Everywhere else it is the text colour it sits in. */
  color: var(--family-mark, currentcolor);
}

/* A spinner with no spokes paints nothing, so a loading state would show
   no indicator at all. validate.mjs flags it (spinner-children); this keeps
   the page honest until it is fixed: a static ring. */
.spinner:empty::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid currentcolor;
  border-block-start-color: transparent;
  border-radius: 50%;
}

/* Each spoke starts centred on the mark's middle, turns to its own angle
   and is then pushed outward along its own length, so the ring needs no
   wrapper element and no trigonometry at the call site. */
.spinner i {
  position: absolute;
  top: 46%; /* spacing-exception */
  left: 38%; /* spacing-exception */
  width: 24%;
  height: 8%;
  border-radius: var(--radius-pill);
  background-color: currentcolor;
  transform: rotate(calc(var(--step) * 30deg)) translate(146%);
  animation: spinner-fade 1.2s steps(12) infinite;
  /* A negative delay starts each spoke further along the same cycle, which
     is what makes the bright one walk instead of all twelve blinking. */
  animation-delay: calc(1.2s * (var(--step) - 12) / 12);
}

@keyframes spinner-fade {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0.15;
  }
}

.spinner i:nth-child(1) {
  --step: 1;
}

.spinner i:nth-child(2) {
  --step: 2;
}

.spinner i:nth-child(3) {
  --step: 3;
}

.spinner i:nth-child(4) {
  --step: 4;
}

.spinner i:nth-child(5) {
  --step: 5;
}

.spinner i:nth-child(6) {
  --step: 6;
}

.spinner i:nth-child(7) {
  --step: 7;
}

.spinner i:nth-child(8) {
  --step: 8;
}

.spinner i:nth-child(9) {
  --step: 9;
}

.spinner i:nth-child(10) {
  --step: 10;
}

.spinner i:nth-child(11) {
  --step: 11;
}

.spinner i:nth-child(12) {
  --step: 12;
}

.spinner-lg {
  width: 2rem;
  height: 2rem;
  color: var(--family-mark, var(--primary));
}

/* On a filled button the family accent would be a colour on a ground it
   was never measured against, so there the mark stays the button's own
   text colour. */
.btn .spinner {
  margin-right: var(--space-3);
  color: currentcolor;
}

.btn[aria-busy="true"] {
  cursor: progress;
}

/* The blanket reduced-motion rule stops the animation but leaves every
   spoke at its declared opacity, which would be a ring at full strength.
   Instead the ring holds one frame of the comet: spoke 12 at full light,
   fading to 0.15 at spoke 1, so it still reads as a spinner without
   moving. A flat half light washed the whole mark out (and on dark, a
   family colour at half opacity read as slate). */
@media (prefers-reduced-motion: reduce) {
  .spinner i {
    animation: none;
    opacity: calc(0.15 + 0.85 * (var(--step) - 1) / 11);
  }
}

/* ==========================================================================
   States: skeleton loading
   Shimmer built from --border with a --muted-surface sheen, same
   reduced-motion coverage as .spinner above (blanket rule handles it).
   The shapes are the hairline's own grey: --muted-surface and --accent sit
   within a few per cent of white, so on a white card in light the
   skeleton was close to invisible, which is the opposite of its job. In
   dark the same two tokens put lighter bars on the ground with a darker
   sheen, the same relationship turned round.
   ========================================================================== */

.skeleton {
  background: linear-gradient(100deg, var(--border) 30%, var(--muted-surface) 50%, var(--border) 70%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 0.75rem;
  margin-bottom: var(--space-3);
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

.skeleton-text--sm {
  width: 55%;
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
}

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-8);
}

/* ==========================================================================
   States: empty state and error state
   Full-bounds states for when a whole section has nothing to show, or
   failed to load. .empty-state is a card with a family band across its
   head (drawn by ::after, no child element needed). .error-state has the
   same shape with no band, grey mark, red left to the words and the
   button: no new color family for either.
   ========================================================================== */

.empty-state,
.error-state {
  position: relative;
  text-align: center;
  padding: var(--space-11) var(--space-9);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

/* An empty state is a white card with a colour band across its head: the
   family surface with the stripe gathering at the right, and the icon
   sitting on it. The band, not the whole card, so a column of empty states
   does not turn the page into blocks of colour. */
.empty-state {
  isolation: isolate;
  /* The mark centres in the band: 24px above a 44px icon inside a 96px
     band puts its middle on the band's middle. */
  padding-top: var(--space-7);
}

/* The band is the family surface at full strength, with the rules showing
   only on the right. No mask: a mask fades the surface as well as the
   rules, which washed the colour out to nearly nothing on the left. The
   top layer is the surface itself, opaque across the left half and clearing
   by 62%, so it hides the rules there and leaves the colour untouched. */
.empty-state::after {
  --field-surface: var(--family-surface, var(--ba-executive-surface));
  --field-rule: var(--family-accent, var(--ba-executive-accent));
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6rem;
  background-color: var(--field-surface);
  background-image:
    linear-gradient(
      to right,
      var(--field-surface) 0 58%,
      transparent 78%
    ),
    repeating-linear-gradient(
      90deg,
      color-mix(in oklch, var(--field-rule) var(--band-rule-mix, 78%), var(--field-surface)) 0 6px,
      transparent 6px 13px
    );
  pointer-events: none;
  z-index: -1;
}

/* In dark the accent is a light mark on a dark ground, twice as loud as the
   same mix on a pastel, so the band's rules come down to under half
   strength: texture on the band, not a row of lit tubes. */
[data-theme="dark"] .empty-state::after {
  --band-rule-mix: 45%;
}

/* The mark sits on the band, a family ground, so it takes the tonal
   rendering (class icon-tonal in the markup): the three-tone light block
   would vanish into the band. Its bottom margin carries the heading clear
   of the band's edge. */
.empty-state .empty-state-icon {
  margin-bottom: var(--space-12);
}

/* The class can sit on the svg itself or on a wrapper around it, and both
   shapes ship in this repo. A wrapper is a <span>, so it needs a block
   display or width and height do nothing and the svg inside expands to the
   whole state. */
.empty-state-icon {
  display: block;
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto var(--space-6);
  color: var(--muted-foreground);
}

.empty-state-icon > svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Quieter than the copy it introduces: an error state already says what
   happened in words, so the mark is a hint, not an alarm. It sits on the
   neutral tile (.icon-tile-neutral), so the icon takes the neutral
   rendering and an error state inside a .family-* container does not pick
   up that family's colour. Red is left to the words and to the button. */
.error-state > .icon-tile {
  display: grid;
  margin: 0 auto var(--space-6);
}

/* A state page's own heading is its h1; it keeps the h3 size, so a state
   reads the same whether it fills a page or a section. */
.empty-state :is(h1, h3),
.error-state :is(h1, h3) {
  position: relative;
  margin: 0 0 var(--space-3);
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.empty-state p,
.error-state p {
  position: relative;
  color: var(--muted-foreground);
  margin: 0 0 var(--space-7);
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-state .btn,
.error-state .btn {
  position: relative;
}

/* ==========================================================================
   Data display: table
   A real interactive table, distinct from .markdown-body table (that one
   renders arbitrary Markdown content, this one is an app data grid).
   Sortable-looking headers are a visual affordance only, real sort JS is
   optional. Row actions reuse .menu/.menu-item, the exact "table row
   overflow actions" case the nav decision-rule already anticipated, not a
   second popover mechanism.
   ========================================================================== */

/* No box: the pale head row with its rounded ends and the hairlines
   between rows are the table's whole frame. */
.data-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
}

.data-table th {
  text-align: left;
  padding: var(--space-4) var(--space-6);
  background-color: var(--muted-surface);
  color: var(--muted-foreground);
  font-weight: 400;
  font-size: 0.875rem;
  white-space: nowrap;
}

.data-table th:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.data-table th:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable .sort-icon {
  width: 12px;
  height: 12px;
  margin-left: var(--space-2);
  vertical-align: middle;
}

.data-table td {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.data-table tbody tr {
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.data-table tbody tr:hover {
  background-color: var(--accent);
}

.data-table th.actions-cell,
.data-table td.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  position: sticky;
  right: 0;
}

/* the sticky column shows its edge only when there is more table under it */
.data-table-wrap[data-overflow='true'] .actions-cell {
  box-shadow: -1px 0 0 var(--border);
}

.data-table th.actions-cell {
  background-color: var(--muted-surface);
  z-index: 10;
}

.data-table tbody tr:hover td.actions-cell {
  background-color: var(--accent);
}

.data-table td.actions-cell {
  background-color: var(--background);
  z-index: 9;
}

/* Numeric/currency columns right-align (header included, so the digits'
   place values stack for at-a-glance comparison), everything else stays
   left. Never center a data column, centering makes digit place-values
   drift per row instead of lining up. See PATTERNS-REFERENCE.md, P6. */
.data-table th.numeric-cell,
.data-table td.numeric-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Row action menus: one anchor pair per row, same idiom as the sidebar's
   workspace switcher/user account menus above (anchor-name binds one
   specific element, not a class). Demo table on index.html has four rows. */
#rowMenuTrigger1 { anchor-name: --row-anchor-1; }
#rowMenuTrigger2 { anchor-name: --row-anchor-2; }
#rowMenuTrigger3 { anchor-name: --row-anchor-3; }
#rowMenuTrigger4 { anchor-name: --row-anchor-4; }

#rowMenu1 { position-anchor: --row-anchor-1; }
#rowMenu2 { position-anchor: --row-anchor-2; }
#rowMenu3 { position-anchor: --row-anchor-3; }
#rowMenu4 { position-anchor: --row-anchor-4; }

.table-foot {
  margin: var(--space-4) 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.data-table-wrap[data-state='empty'] ~ .pagination {
  display: none;
}

.data-table .menu {
  position-area: bottom span-left;
  position-try-fallbacks: flip-block;
  margin-block: 0.35rem;
}

/* ==========================================================================
   Data display: list
   A vertical list of records (label + secondary text + trailing action),
   distinct from .sidebar-nav which is navigation-specific.
   ========================================================================== */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0.9rem var(--space-6); /* spacing-exception */
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-body {
  flex: 1;
  min-width: 0;
}

.list-item-label {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--foreground);
}

.list-item-secondary {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.list-item-action {
  flex-shrink: 0;
}

/* ==========================================================================
   Data display: pagination
   Previous/next plus page numbers. Below 640px the word labels drop and
   only the arrow buttons remain, per the responsive rule already
   documented in DAPPLE-DESIGN-SYSTEM.md section 7.
   ========================================================================== */

.pagination {
  /* Its own air. Without this it sat flush against the table card, and
     one call site papered over it with an inline margin. */
  margin-top: var(--space-5);
  display: flex;
  align-items: center;
  gap: 0.35rem; /* spacing-exception */
}

/* display: flex above outranks the UA's [hidden]; a pager with no rows to
   page (table.js hides it under the skeleton and the empty state) goes. */
.pagination[hidden] {
  display: none;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem; /* spacing-exception */
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.65rem; /* spacing-exception */
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-in-out),
              border-color var(--dur-2) var(--ease-in-out),
              color var(--dur-2) var(--ease-in-out);
}

@media (pointer: coarse) {
  .pagination-btn {
    min-width: 2.75rem;
  }
}

.pagination-btn svg {
  width: 14px;
  height: 14px;
}

.pagination-btn:hover {
  background-color: var(--accent);
}

.pagination-btn[aria-current="page"] {
  background-color: var(--popover);
  border-color: var(--edge);
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
  font-weight: 500;
}

.pagination-btn:disabled {
  cursor: not-allowed;
  color: var(--muted-foreground);
  opacity: 0.5;
}

.pagination-btn:disabled:hover {
  background-color: transparent;
}

.pagination-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

@media (max-width: 639.98px) {
  .pagination-page,
  .pagination-label {
    display: none;
  }
}

/* ==========================================================================
   Tooltip
   Hover-triggered, but also focus-triggered (:focus-within on the wrapper
   fires from a keyboard-focused or tapped-then-focused trigger), never
   hover-only, per this system's own responsive rule 5.
   ========================================================================== */

.tooltip {
  position: relative;
  display: inline-flex;
}

.tooltip-bubble {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  /* Never wider than the page's own gutter allows, and it may wrap:
     hard-centring a nowrap bubble pushed it off-screen on any trigger
     near an edge (at 375 it rendered at x = -18px, first letter cut). */
  max-width: calc(100vw - 2 * var(--space-9));
  /* Its own width, not the trigger's: an absolute box shrinks to the space
     left of its containing block, which for a 40px icon trigger centred at
     50% is 20px, and "Sync status" broke onto two lines. */
  width: max-content;
  white-space: normal;
  padding: 0.35rem 0.65rem; /* spacing-exception */
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity var(--dur-1) var(--ease-out),
              transform var(--dur-1) var(--ease-out);
}

.tooltip:hover .tooltip-bubble,
.tooltip:focus-within .tooltip-bubble,
.tooltip.is-open .tooltip-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* A trigger at the edge of a column (the specimen's info icon sits on the
   text edge) would push a centred bubble past the page gutter on a phone.
   .tooltip-start lines the bubble up with the trigger's start edge instead,
   .tooltip-end with its end edge. */
.tooltip-start .tooltip-bubble {
  left: 0;
  transform: translateY(4px);
}

.tooltip-end .tooltip-bubble {
  right: 0;
  left: auto;
  transform: translateY(4px);
}

.tooltip-start:is(:hover, :focus-within, .is-open) .tooltip-bubble,
.tooltip-end:is(:hover, :focus-within, .is-open) .tooltip-bubble {
  transform: translateY(0);
}

/* ==========================================================================
   Tabs
   Real ARIA tabs (role="tablist"/"tab"/"tabpanel"), roving tabindex and
   arrow-key navigation wired by tabs.js, the same idiom menu.js already
   established for .menu-item.
   ========================================================================== */

.tabs {
  position: relative;
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* With tabs.js, one underline for the whole list that slides to the
   selected tab: --tab-x / --tab-w are its offset and width, measured by the
   script (and re-measured on resize). The per-tab underline below stays the
   no-script fallback. Same 2px, same place, so switching between the two
   draws nothing. */
.tabs[data-indicator]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px; /* spacing-exception */
  width: var(--tab-w, 0);
  height: 2px;
  background-color: var(--primary);
  transform: translateX(var(--tab-x, 0));
  transition:
    transform var(--dur-2) var(--ease-out),
    width var(--dur-2) var(--ease-out);
  pointer-events: none;
}

.tabs[data-indicator] .tab::after {
  display: none;
}

.tab {
  padding: 0.65rem var(--space-5); /* spacing-exception */
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-2) var(--ease-in-out);
}

/* The selected tab's underline. It is a pseudo-element rather than the
   bottom border so it can scale: a color swap made the mark teleport from
   one tab to the next. The border stays, transparent, so the tab's box is
   the height it always was and nothing shifts by 2px on selection. */
.tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -2px; /* spacing-exception */
  left: 0;
  height: 2px;
  background-color: var(--primary);
  transform: scaleX(0);
  transition: transform var(--dur-2) var(--ease-out);
}

.tab:hover {
  color: var(--foreground);
}

.tab[aria-selected="true"] {
  color: var(--foreground);
}

.tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

.tab:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-focus);
}

.tab-panels {
  padding: var(--space-7) 0;
}

.tab-panel[hidden] {
  display: none;
}

/* An element coming back from display:none restarts its animations, so
   the panel that arrives plays this and the one that leaves needs
   nothing: it is replaced, not watched. */
.tab-panel {
  animation: fade-rise var(--dur-3) var(--ease-out) both;
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(0.25rem);
  }
}

/* ==========================================================================
   Chip
   An interactive tag: removable or toggleable, distinct from .badge (a
   static status label). Reuses .secondary/.accent tokens, no new color.
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem; /* spacing-exception */
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-sans);
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out);
}

.chip-remove svg {
  width: 11px;
  height: 11px;
}

.chip-remove:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

.chip-remove:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* A chip that toggles selected state rather than being removed (e.g. a
   filter). aria-pressed carries the state, no separate class needed for
   the pressed look beyond the attribute selector below. */
.chip-toggle {
  cursor: pointer;
  background-color: var(--card);
  border-color: var(--border);
}

.chip-toggle:hover {
  background-color: var(--accent);
  border-color: var(--foreground);
}

/* Pressed is raised, not Ink: the card's own ground with the control edge
   and a soft lift, so the one Ink fill on a view stays its primary action. */
.chip-toggle[aria-pressed="true"] {
  background-color: var(--popover);
  border-color: var(--edge);
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
}

/* ==========================================================================
   Split view (split.html + split.js) — DAPPLE-DESIGN-SYSTEM.md section 7
   rule 9's full-bleed shell family, pattern per Apple HIG "Split views":
   a primary pane (the list) drives a secondary pane (the detail), with an
   optional tertiary inspector. Widths:
     >=1280px  list + detail + inspector (inspector toggleable)
     768-1279  list + detail, inspector becomes an overlay <dialog>
     <768      navigation stack: list OR detail full-screen, back returns,
               wired to location.hash so the browser back button works
               (split.js). data-view="list|detail" on the shell drives it.
   ========================================================================== */

.split-shell {
  display: flex;
  height: calc(100vh - 4rem);
  overflow: hidden;
}

/* -- primary pane: the list ------------------------------------------------ */

/* Every rail in the system sits on the muted surface: the app sidebar,
   the chat sidebar, and this view's own inspector. The list was the one
   exception, which left the page lopsided (an elevated rail on the right,
   a flush one on the left) and, in dark, indistinguishable from the
   detail pane beside it. */
.split-list {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  --ring-gap: var(--rail-surface);
  background-color: var(--rail-surface);
}

.split-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  flex-shrink: 0;
}

.split-list-title {
  font-size: 0.9375rem;
  font-weight: 500;
}

.split-list-count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.split-items {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-3) var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.split-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  font-family: inherit;
  cursor: pointer;
  padding: calc(var(--space-4) - 1px); /* spacing-exception */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.split-item:hover {
  background-color: var(--accent);
}

.split-item:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.split-item[aria-current='true'] {
  background-color: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* the selected row is the roving tab stop: its ring must win over its lift */
.split-item[aria-current='true']:focus-visible {
  box-shadow: var(--shadow-focus);
}

.split-item[aria-current='true'] .split-item-title {
  font-weight: 500;
}

.split-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.split-item-title {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--foreground);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-item-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex: none;
}

.split-item-preview {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: var(--space-1) 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -- secondary pane: the detail -------------------------------------------- */

.split-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
}

.split-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-7);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 3.5rem;
}

.split-back {
  display: none; /* phone-only, see the media query below */
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--foreground);
  cursor: pointer;
  flex: none;
  transition: background-color var(--dur-2) var(--ease-in-out);
}

.split-back:hover {
  background-color: var(--accent);
}

.split-back:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.split-back svg {
  width: 18px;
  height: 18px;
}

.split-detail-title {
  font-size: 0.9375rem;
  font-weight: 500;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-7);
  max-width: 46rem;
}

.split-detail-title:focus {
  outline: none;
}

.split-detail-body p {
  line-height: 1.7;
  margin: 0 0 var(--space-5);
}

.split-pane[hidden] {
  display: none;
}

/* -- tertiary pane: the inspector ------------------------------------------ */

.split-inspector {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background-color: var(--rail-surface);
  overflow-y: auto;
  padding: var(--space-6);
}

.split-inspector h3 {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted-foreground);
  margin: 0 0 var(--space-4);
}

.split-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem var(--space-5); /* spacing-exception */
  font-size: 0.8125rem;
  margin: 0;
}

.split-meta dt {
  color: var(--muted-foreground);
}

.split-meta dd {
  margin: 0;
  color: var(--foreground);
}

/* [hidden] loses to the class's display: grid at equal specificity, make
   the hidden state explicit, same guard .split-pane[hidden] has. */
.split-meta-pane[hidden] {
  display: none;
}

/* Inspector demotes to an overlay <dialog> below xl. The same markup is
   used in both renditions: split.js moves the inspector content into the
   dialog when the pane is hidden, so there is exactly one copy in the DOM
   at a time (same single-source stance as the localnav disclosure). */
/* Same right-edge sheet geometry and entry motion as .nav-drawer (the
   shared block lives with .nav-drawer's rules), only the padding differs:
   the drawer's inner wrapper pads itself, the inspector dialog holds
   plain content. */
.split-inspector-dialog {
  --ring-gap: var(--card);
  position: fixed;
  inset: 0 0 0 auto;
  width: min(20rem, 85vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: var(--space-6);
  border: none;
  border-left: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition:
    transform var(--dur-2) var(--ease-in-out),
    overlay var(--dur-2) allow-discrete,
    display var(--dur-2) allow-discrete;
}

.split-inspector-dialog[open] {
  transform: translateX(0);
}

@starting-style {
  .split-inspector-dialog[open] {
    transform: translateX(100%);
  }
}

.split-inspector-dialog::backdrop {
  background-color: var(--overlay-backdrop);
}

@media (max-width: 1279.98px) {
  .split-inspector {
    display: none;
  }
}

@media (min-width: 1280px) {
  .split-shell[data-inspector='closed'] .split-inspector {
    display: none;
  }
}

/* -- phone: navigation stack ------------------------------------------------ */

@media (max-width: 767.98px) {
  .split-list {
    width: 100%;
    border-right: none;
  }

  .split-shell[data-view='list'] .split-detail {
    display: none;
  }

  .split-shell[data-view='detail'] .split-list {
    display: none;
  }

  .split-back {
    display: inline-flex;
  }

  .split-detail-header {
    padding: var(--space-4) var(--space-5);
  }

  .split-detail-body {
    padding: var(--space-6) var(--space-5);
  }
}

/* ==========================================================================
   Wizard (wizard.html + wizard.js) — a multi-step form, Apple setup-flow
   anatomy: single centered column, one question group per step, generous
   spacing, one primary action, quiet back link. Native HTML validation
   gates each step (wizard.js calls checkValidity(), the browser paints
   :user-invalid), the review step summarizes everything with per-step
   edit links, then a success state. Prefer fewer steps over more chrome:
   if the whole thing fits one screen comfortably, use a plain form, not
   this.
   ========================================================================== */

.wizard-shell {
  max-width: 34rem;
  margin: 0 auto;
  padding: var(--space-11) var(--space-5) var(--space-13);
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0 0 var(--space-9);
  padding: 0;
}

.wizard-steps li {
  display: flex;
  align-items: center;
  gap: 0.4rem; /* spacing-exception */
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.wizard-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background-color: var(--card);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  flex: none;
  transition:
    background-color var(--dur-2) var(--ease-in-out),
    color var(--dur-2) var(--ease-in-out),
    border-color var(--dur-2) var(--ease-in-out);
}

.wizard-steps li[aria-current='step'] {
  color: var(--foreground);
  font-weight: 500;
}

.wizard-steps li[aria-current='step'] .wizard-step-dot {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

.wizard-steps li[data-done='true'] .wizard-step-dot {
  border-color: var(--foreground);
  color: var(--foreground);
}

/* Connector line between step labels. */
.wizard-steps li + li::before {
  content: '';
  width: 1.25rem;
  height: 1px;
  background-color: var(--border);
  margin-right: 0.4rem;
}

/* Phone: dots-and-labels collapse to plain "Step 2 of 4" text. */
.wizard-steps-compact {
  display: none;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0 0 var(--space-7);
}

@media (max-width: 767.98px) {
  .wizard-steps {
    display: none;
  }

  .wizard-steps-compact {
    display: block;
  }
}

.wizard-step {
  /* steps are <fieldset>s for semantics, drop the browser chrome */
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.wizard-step[hidden] {
  display: none;
}

.wizard-step h1:focus {
  outline: none;
}

.wizard-step h1 {
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0 0 0.35rem; /* spacing-exception */
}

.wizard-step-lead {
  color: var(--muted-foreground);
  margin: 0 0 var(--space-7);
}

.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-9);
}

.wizard-back {
  background: none;
  border: none;
  padding: var(--space-3) var(--space-2);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-in-out);
}

.wizard-back:hover {
  color: var(--foreground);
}

.wizard-back:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* Review step: definition list of everything entered, one block per step
   with a quiet edit link back to it. */
.wizard-review-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
}

.wizard-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.wizard-review-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

.wizard-review dl {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: var(--space-2) var(--space-6);
  font-size: 0.875rem;
  margin: 0;
}

.wizard-review dt {
  color: var(--muted-foreground);
}

.wizard-review dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* Success state. */
.wizard-done {
  text-align: center;
  padding: var(--space-11) 0;
}

.wizard-done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-strong), var(--card));
  margin-bottom: var(--space-5);
}

/* The markup also carries icon-tile and family-commercial, so the success
   icon renders like any tiled icon (tonal in light, three tones in dark). */
.wizard-done-icon .icon {
  width: 1.75rem;
  height: 1.75rem;
}

.wizard-done-actions {
  margin-top: var(--space-7);
}

/* Priority+ nav overflow (rule 10): the More trigger reads exactly like an
   inline .nav-links link, its chevron marks it as a menu. When the current
   page lives inside the overflow, the trigger carries .active the same way
   an inline link would. */
.nav-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  transition:
    color var(--dur-2) var(--ease-in-out),
    background-color var(--dur-2) var(--ease-in-out);
}

.nav-more:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.nav-more:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.nav-more[aria-current] {
  color: var(--foreground);
  font-weight: 500;
}

.nav-more svg {
  width: 14px;
  height: 14px;
}

.menu-item[aria-current='page'] {
  color: var(--foreground);
  font-weight: 500;
}

/* ==========================================================================
   Table page (table.html + table.js) — composes the P6 data-display
   pieces into a full CRUD page: toolbar (search + filters + demo state
   chips), selectable rows with a bulk bar, working sort on the sortable
   headers, pagination, and the loading/empty states inline. The template
   is the markup/CSS contract, a real app owns data behavior server-side,
   table.js only demonstrates the client contract.
   ========================================================================== */

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  /* No top margin: the gap under the tier-2 bar comes from `.localnav ~
     main` alone, the same 2rem as every other page (rule 17). */
  margin: 0 0 var(--space-5);
}

.table-search {
  max-width: 16rem;
}

.table-toolbar .select-wrapper {
  width: auto;
}

.table-toolbar .select-wrapper .input {
  width: auto;
  min-width: 9rem;
}

.table-states {
  display: flex;
  gap: 0.4rem; /* spacing-exception */
  margin-left: auto;
}

/* On the table page the bar takes the toolbar's first row instead of
   arriving between toolbar and table. In flow it pushed the table down 64px
   the moment you ticked the first row (and pulled it back on the last), so
   the row you had just ticked slid out from under the pointer.

   The bar is one control row tall (the 46px of a field) and is laid over
   the toolbar's first row; whatever sat on that row fades out underneath
   while a selection is open and fades back when it clears, and nothing
   below moves. Rows below the first stay as they are. The rule is the same
   at every width; only what shares the first row changes:
     - from 1024px the toolbar is one row, so the whole toolbar goes;
     - 768 to 1023px: search and the two filters (the demo state chips are
       moved to a row of their own below, so the first row is
       deterministic);
     - under 768px: the search field, the filters stay usable below.
   Sized to its content rather than to the toolbar: at 375 the toolbar is
   three rows (143px), and a bar stretched over all three was a large grey
   box with one line in it. The bar keeps its own fade-in. */
.table-controls {
  position: relative;
  margin: 0 0 var(--space-5);
}

.table-controls > .table-toolbar {
  margin: 0;
}

.table-controls > .table-toolbar,
.table-controls > .table-toolbar > * {
  transition:
    opacity var(--dur-2) var(--ease-out),
    visibility var(--dur-2);
}

.table-controls:has(> .bulk-bar:not([hidden])) .table-search {
  opacity: 0;
  visibility: hidden;
}

@media (min-width: 768px) {
  .table-controls:has(> .bulk-bar:not([hidden])) .table-toolbar > .select-wrapper {
    opacity: 0;
    visibility: hidden;
  }
}

@media (min-width: 1024px) {
  .table-controls:has(> .bulk-bar:not([hidden])) > .table-toolbar {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-width: 1023.98px) {
  .table-controls .table-states {
    flex-basis: 100%;
    margin-left: 0;
  }
}

.table-controls > .bulk-bar {
  position: absolute;
  inset: 0 0 auto;
  min-height: 2.875rem; /* spacing-exception: one field row, 46px */
  margin: 0;
  /* A step tighter than the stand-alone bar, so a row of small buttons
     fits the 46px row without spilling past it. */
  padding-block: var(--space-2);
  align-content: center;
  z-index: 1;
}

/* One line at every width: the count, then its actions pushed right. A
   long list of actions still wraps (the bar grows over the row below, it
   never pushes the table). */
.table-controls > .bulk-bar .bulk-count {
  flex-basis: auto;
  margin-right: auto;
}

/* Bulk bar: appears between toolbar and table once anything is selected.
   Mobile-first: the count sits on its own line with the actions wrapping
   in a row beneath it, so extra actions reflow instead of overflowing the
   375px floor. From 40rem up there is enough room to pull the count back
   inline with the actions on a single row. */
.bulk-bar {
  --ring-gap: var(--accent);
  /* The bar's fill equals --secondary in light, so a secondary button
     on it had no edge at all. Give its buttons the page hairline. */
  --secondary-border: var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  background-color: var(--accent);
  /* It arrives because you ticked a row, so it should look like it
     arrived. Same pattern as the toast: allow-discrete lets display
     participate, so the bar fades out on the way back instead of being
     cut. A browser without it opens and closes instantly, as before. */
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out),
    display var(--dur-2) allow-discrete;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.bulk-bar[hidden] {
  display: none;
  opacity: 0;
  transform: translateY(-0.25rem); /* spacing-exception */
}

@starting-style {
  .bulk-bar:not([hidden]) {
    opacity: 0;
    transform: translateY(-0.25rem); /* spacing-exception */
  }
}

.bulk-bar .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.bulk-count {
  font-size: 0.875rem;
  font-weight: 500;
  flex-basis: 100%;
}

@media (min-width: 640px) {
  .bulk-count {
    flex-basis: auto;
    margin-right: auto;
  }
}

.data-table .check-cell {
  width: 2.25rem;
  padding-right: 0;
}

.data-table .check-cell input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* Sortable headers are real buttons (keyboard, focus ring), inheriting
   the th's type treatment. aria-sort on the th drives the icon. */
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-xs);
}

.data-table th[aria-sort='ascending'] .sort-icon {
  transform: rotate(180deg);
}

.data-table th[aria-sort='ascending'],
.data-table th[aria-sort='descending'] {
  color: var(--foreground);
}

/* Demo states: the wrap swaps between table, loading skeleton, empty. */
.table-loading {
  padding: var(--space-6);
}

/* Whichever of the three is on screen has just come back from
   display:none, which restarts its animation, so the handover from the
   skeleton to the loaded table fades instead of cutting. A skeleton exists
   to keep that moment from jolting, and it was the one moment that did. */
.data-table-wrap .data-table,
.data-table-wrap .table-loading,
.data-table-wrap .table-empty {
  animation: fade-in var(--dur-3) var(--ease-out) both;
}

.data-table-wrap[data-state='loading'] .data-table,
.data-table-wrap[data-state='empty'] .data-table {
  display: none;
}

.data-table-wrap[data-state='default'] .table-loading,
.data-table-wrap[data-state='empty'] .table-loading {
  display: none;
}

.data-table-wrap[data-state='default'] .table-empty,
.data-table-wrap[data-state='loading'] .table-empty {
  display: none;
}

/* Priority-collapse columns (section 7 rule 6's order: reflow > collapse >
   scroll): the least important columns drop first as width shrinks, the
   wrap's overflow-x scroll only has to carry what survives. */
@media (max-width: 1023.98px) {
  .data-table .priority-3 {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .data-table .priority-2 {
    display: none;
  }
}

/* The last column to go. Below 40rem a status badge and a figure no longer
   both fit beside the name, and the figure is the one a reader came for:
   with both kept the figure was cut mid-number at the wrap's edge ("1,5").
   The status is still on the row's own page and in its menu. */
@media (max-width: 639.98px) {
  .data-table .priority-1 {
    display: none;
  }
}

@media (max-width: 767.98px) {

  .table-search {
    max-width: none;
    flex: 1 1 100%;
  }

  .table-states {
    margin-left: 0;
  }
}

/* ==========================================================================
   Dashboard (dashboard.html) — KPI stat cards, hand-written inline SVG
   charts (no chart library, the zero-build bar applies to charts too),
   and a recent-activity table reusing .data-table. Chart series take the
   --viz-1..8 aliases in order (sky, coral, green, amber, pink, teal,
   lilac, then a neutral remainder stop; section 9's chart rule applies
   on the web too). Single-series charts use --viz-1 only. Dashboard cards sit one
   step tighter than .card (--space-8, not --space-9) on purpose: they
   hold figures and marks, not prose.
   ========================================================================== */

.dashboard-kpis {
  display: grid;
  /* Two by two up to desktop, four across from 1280. The counts are stated
     per breakpoint rather than left to auto-fit: auto-fit packs as many
     14rem columns as happen to fit, so a four-tile row came out
     three-and-an-orphan everywhere between 800px and 1024px. A phone gets
     two by two as well (smaller tiles, see the phone block): one column
     stacked four 200px tiles, a screen of figures before the first chart. */
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-9);
  /* No top margin: the gap under the tier-2 bar is `.localnav ~ main`'s
     2rem on every page (rule 17), the grid does not add its own. No
     bottom margin either: the next section head owns its 3rem above. */
  margin: 0;
}

@media (min-width: 1280px) {
  .dashboard-kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* A KPI tile. Usually a family field (class="stat-card field
   family-executive"): the figure in Ink at display size at the top edge,
   the label under it in the family's text role, and the change note
   pinned to the bottom edge, so a row of tiles shares one baseline for
   the notes. The surface carries the family, and a family tile adds one
   quiet band of rules at its right edge (below); a plain tile is the same
   tile with a hairline and no band. */
.stat-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-8);
  /* A hair taller than its content asks for, so the figure has air
     under it and a row of tiles keeps one rhythm. */
  min-height: 12.5rem;
}

/* A family tile carries the brand rules at its right edge, the same device
   the login field and the empty state use, at a quarter of the strength
   and half the pitch: the tile is a quarter of their size, so the texture
   has to be finer to read as texture rather than as stripes. It ramps in
   from nothing, so the figure and the label always sit on clean ground and
   the colour only gathers where nothing is written. It stops a step short
   of the right edge: the tile keeps its hairline (see .field), and a rule
   landing against that hairline drew the edge twice. */
.stat-card.field {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.stat-card.field::after {
  --tile-rule: var(--family-accent, var(--ba-executive-accent));
  content: "";
  position: absolute;
  inset: 0 var(--space-3) 0 auto;
  width: 45%;
  background-image: repeating-linear-gradient(
    90deg,
    var(--tile-rule) 0 3px,
    transparent 3px 11px
  );
  opacity: 0.32;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 90%);
  mask-image: linear-gradient(to right, transparent, #000 90%);
  pointer-events: none;
  z-index: -1;
}

/* No band on a phone. Two tiles to a row leave each about 165px wide, so
   45% of it is the right-hand third of the text column: the wrapped change
   note ("1,200 added this / month") ran over the rules. A tile that small
   is the "small box that reflows" the pattern rule warns about anyway. */
@media (max-width: 767.98px) {
  .stat-card.field::after {
    display: none;
  }
}

/* Grey in dark, and quieter. In light the rules sit on the family's own
   tint and the accent belongs there. On a neutral card the same accent is
   a colour with nothing to belong to, and it is twice as loud besides: the
   accent is the same value in both themes, so on a near-black ground it is
   a light mark on a dark one. */
[data-theme="dark"] .stat-card.field::after {
  --tile-rule: var(--muted-foreground);
  opacity: 0.2;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 1rem;
  color: var(--muted-foreground);
  margin-top: var(--space-3);
}

/* The change note at the tile's bottom edge: a Dapple icon that fits the
   figure (inline, .icon.icon-tonal, class stat-delta-icon: the tonal
   rendering, because the tile is a family field) and small text in the
   family's text role. margin-top: auto pins it to the bottom of the flex
   column. */
.stat-delta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-5);
  font-size: 0.875rem;
  color: var(--family-text, var(--muted-foreground));
}

.stat-delta-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

/* One column at every width. Side by side, each plot was half the page and
   the bars sat almost on top of each other; full width gives the marks
   room to be read, which is the whole point of a chart. The second row
   (.dashboard-row) still packs, because those are summaries, not plots. */
.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-9);
  /* The second row belongs to the same section: the grid gap, not a
     section-sized gap. */
  margin-bottom: var(--space-6);
}

/* The period chips over the activity table. */
.dashboard-toolbar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Second row: as many cards as fit at 18rem each, three on desktop, two
   on a tablet, one on a phone. */
.dashboard-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-9);
  margin-bottom: 0;
}

/* Ring chart: a donut of stroked circles in an SVG, one per segment, the
   total set in the middle, a vertical legend beside it. Stroke and text
   sizes are in SVG units, the box scales the whole thing. */
.ring-chart {
  display: flex;
  align-items: center;
  gap: var(--space-7);
  flex-wrap: wrap;
}

@keyframes chart-settle {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

/* Scoped under .chart-card too: the card's own "svg fills the card" rule
   comes later in the file and would stretch the ring to the full width. */
.ring-chart svg,
.chart-card .ring-chart svg {
  width: 10rem;
  height: 10rem;
  flex-shrink: 0;
}

.ring-chart svg circle {
  fill: none;
  stroke-linecap: butt;
}

.ring-chart .ring-total {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.04em;
  fill: var(--foreground);
}

.ring-chart .ring-total-label {
  font-size: 11px;
  fill: var(--muted-foreground);
}

.ring-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  font-size: 0.9375rem;
  min-width: 8rem;
}

.ring-legend li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ring-legend i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.ring-legend-label {
  flex: 1;
  color: var(--foreground);
}

.ring-legend-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}

/* Bar list: a horizontal bar chart as a list, label, track and value.
   One series, one color (the first viz stop), the series-order rule
   applies to it like any chart. --value is the fill width, set inline
   per row, the same idiom as .swatch-chip's --sw. */
.bar-list {
  font-size: 0.9375rem;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.bar-list li {
  display: grid;
  grid-template-columns: 7rem 1fr 2.5rem;
  align-items: center;
  gap: var(--space-4);
  font-size: 0.875rem;
}

.bar-list-track {
  display: block;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background-color: var(--secondary);
  overflow: hidden;
}

.bar-list-fill {
  --value: 0%;
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background-color: var(--viz-1);
}

@keyframes bar-grow {
  from {
    width: 0;
  }
}

.bar-list-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}

/* A list inside a card drops its own frame and side padding, the card
   already provides both; rows keep their hairlines. */
.list-plain {
  border: 0;
  border-radius: 0;
}

.list-plain .list-item {
  padding-left: 0;
  padding-right: 0;
}

.list-plain .list-item:first-child {
  padding-top: 0;
}

.list-plain .list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Section header inside the dashboard: the section-header rhythm from
   DAPPLE-DESIGN-SYSTEM.md section 6 (heading, one-line description,
   then the content). */
/* A section title owns the space under it: it sat 16px above the charts
   it names and 48px below the block before, so it read as belonging to
   the wrong side. The name goes in a pill with its sentence beside it, so
   the head is one line of chrome rather than a second page heading. */
.dashboard-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-11);
  margin-bottom: var(--space-9);
}

/* The section's name, a plain title. It keeps its h2 so the page still
   has a heading structure to navigate by. */
.dashboard-section-head h2 {
  flex-shrink: 0;
  margin: 0;
}

.dashboard-section-head p {
  flex: 1;
  min-width: 14rem;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
}

/* ==========================================================================
   Dashboard in the app shell (dashboard.html)
   The sleek dashboard study, in system parts: a page head with the view's
   one primary action, KPI cards with their glyph in a family tile, and
   sections titled outside the cards. Colour is kept for the data and for
   the one selected thing.
   ========================================================================== */

/* A glyph inside a dashboard button (Export, New deal, the sort) sits on
   the label's line, a step from it. Scoped to the page: other pages size
   and space their button glyphs themselves. */
.dashboard .btn:has(> svg) {
  gap: var(--space-3);
}

.dashboard .btn > svg {
  width: 1.0625rem;
  height: 1.0625rem;
  flex-shrink: 0;
}

/* The page head with actions beside the title, wrapping under it when the
   column narrows. */
.app-page-head-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6) var(--space-9);
}

.app-page-head-text {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.app-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Two by two below a 60rem column, four across from it. Set here, not
   by the window: the 1280px rule above counts the window, and beside the
   sidebar a 1290px window leaves a 59rem column. */
.dashboard .dashboard-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-2);
}

@container app-content (min-width: 60rem) {
  .dashboard .dashboard-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* On a phone the KPIs stay two by two, as the system's tiles do: a
   tighter card and a smaller figure keep the label and the tile on one
   line. */
@container app-content (max-width: 35rem) {
  .dashboard .stat-card-plain {
    gap: var(--space-4);
    padding: var(--space-5);
  }

  .dashboard .stat-card-plain .stat-label {
    font-size: 0.875rem;
  }

  .dashboard .stat-card-plain .stat-value {
    font-size: 1.75rem;
  }

  .dashboard .stat-card-plain .icon-tile-sm {
    width: 2rem;
    height: 2rem;
  }

  .dashboard .stat-card-plain .icon-tile-sm > .icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* On a phone the months to come step out, so the nine with data share
     the width: each column stays a 24px target at least. Every other
     label shows, the bars keep all nine. */
  .bar-chart-months .bar-chart-group:has(> .chart-bar-future),
  .bar-chart-months .chart-labels .is-future {
    display: none;
  }

  .bar-chart-months.chart-bare .chart-plot {
    background: linear-gradient(var(--border), var(--border)) left bottom / 100% 1px no-repeat;
  }

  .bar-chart-months .chart-labels span:nth-child(even),
  .dashboard .chart-labels-points span:nth-child(even) {
    visibility: hidden;
  }

  /* A hold's GPUs and state drop under its name, so the name and place
     keep the width. */
  .hold-list .list-item {
    flex-wrap: wrap;
  }

  .hold-list .list-item-action {
    flex-basis: 100%;
    justify-content: flex-start;
    padding-left: calc(2.75rem + var(--space-5));
  }
}

/* A KPI on a white card: what it counts and its glyph on one line, the
   figure, then the change that matters. No field and no band. */
.stat-card.stat-card-plain {
  gap: var(--space-5);
  min-height: 0;
  padding: var(--space-7);
}

.stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
}

.stat-card-plain .stat-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
}

.stat-card-plain .stat-value {
  margin: 0;
}

.icon-tile-sm {
  width: 2.5rem;
  height: 2.5rem;
}

.icon-tile-sm > .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-tile-xs {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
}

.icon-tile-xs > .icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* A change, up: the arrow in a small green tile, the amount in the
   commercial text role, the period in the muted grey. */
.trend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.trend b {
  font-weight: 500;
  color: var(--ba-commercial-text);
}

.trend-mark {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-sm);
  background-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-strong), var(--card));
  color: var(--ba-commercial-text);
}

/* The arrow-up-right glyph keeps a margin inside its 24 grid, so it is
   drawn at 16px to read like a 12px arrow at the glyph stroke. */
.trend-mark svg {
  width: 1rem;
  height: 1rem;
}

/* Sections: the title outside the cards, an optional link right after it. */
.dashboard-section-head .text-link {
  font-size: 0.9375rem;
}

/* A link to more of the same: its words, then a chevron that steps on
   hover. */
.text-link-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

/* Two classes: the generic .chart-card svg rule would stretch it. */
.text-link.text-link-more svg {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform var(--dur-1) var(--ease-out);
}

.text-link.text-link-more:hover svg {
  transform: translateX(2px);
}

/* Chips on one track: the period filter reads as one control, the pressed
   chip raised on it. */
.chip-track {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--muted-surface);
}

.chip-track .chip {
  padding-inline: var(--space-4);
  border-color: transparent;
  background-color: transparent;
  color: var(--muted-foreground);
  font-weight: 400;
}

.chip-track .chip:hover {
  border-color: transparent;
  background-color: transparent;
  color: var(--foreground);
}

.chip-track .chip[aria-pressed="true"] {
  border-color: var(--edge);
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
  font-weight: 500;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7);
}

@container app-content (min-width: 52rem) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid-wide {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  }
}

.dashboard .chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.dashboard .chart-title {
  margin: 0;
  font-weight: 400;
  color: var(--muted-foreground);
}

.dashboard .chart-caption {
  margin: calc(var(--space-6) * -1 + var(--space-2)) 0 0;
  font-size: 0.875rem;
}

/* The card's own figure: the number, what it is, and its change. */
.chart-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}

.chart-figure-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.chart-figure-value small {
  margin-left: var(--space-3);
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted-foreground);
}

.chart-note {
  margin: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.chart-note b {
  font-weight: 500;
  color: var(--foreground);
}

.chart-card-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  margin: auto 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.chart-card-foot b {
  font-weight: 500;
  color: var(--foreground);
}

/* Months: one bar per month, January to December, the months to come as
   empty slots. Each bar is a button: the picked month shows its value and
   names its source under the chart; the others show theirs on hover and
   focus. */
.bar-chart-months {
  --bar-series: 1;
  --chart-height: 13rem;
}

/* The month is the whole column, so a short bar is as easy to hit as a
   tall one; the bar inside it draws the figure. */
.chart-pick {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.chart-pick .chart-bar {
  width: min(2.75rem, 80%);
  border-radius: var(--radius-md) var(--radius-md) 2px 2px;
  background-color: color-mix(in oklch, var(--family-accent, var(--foreground)) 26%, var(--card));
  transition: background-color var(--dur-2) var(--ease-out);
}

.chart-pick:hover .chart-bar {
  background-color: color-mix(in oklch, var(--family-accent, var(--foreground)) 42%, var(--card));
}

/* The month shown (.is-on: the picked one, or the one under the pointer)
   takes the accent darkened toward the family's text role, and its value. */
.chart-pick.is-on .chart-bar {
  background-color: color-mix(in oklch, var(--family-accent, var(--foreground)) 82%, var(--family-text, var(--foreground)));
}

.chart-pick:focus-visible {
  outline: none;
}

.chart-pick:focus-visible .chart-bar {
  box-shadow: var(--shadow-focus);
}

.chart-pick .bar-value {
  opacity: 0;
  transform: translate(-50%, 3px);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}

.chart-pick.is-on .bar-value {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart-bar-future {
  height: 0;
}

.chart-labels .is-future {
  color: var(--faint);
}

/* The label of the month or point being read. */
.chart-labels .is-current {
  color: var(--foreground);
}

/* A bare chart: no axis and no grid, the number is read where it is (the
   picked value, the line's slip). For a chart whose reading is on demand. */
.bar-chart.chart-bare,
.line-chart.chart-bare {
  grid-template-columns: minmax(0, 1fr);
  padding-right: 0;
}

.chart-bare .chart-labels,
.chart-bare .chart-legend-row {
  grid-column: 1;
}

.chart-bare .chart-plot {
  border-bottom: 0;
}

.chart-bare .chart-plot::before {
  display: none;
}

/* The months' baseline: solid through the last month with data, dotted
   over the months to come (nine of twelve equal columns, so 75%). */
.bar-chart-months.chart-bare .chart-plot {
  background:
    linear-gradient(var(--border), var(--border)) left bottom / 75% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--border) 0 3px, transparent 3px 7px) right bottom / 25% 1px no-repeat;
}

/* A bare line keeps a quiet ground of dots, a row every quarter. Its end
   labels sit inside the plot instead of centred off its edges. */
.line-chart.chart-bare .chart-plot::before {
  display: block;
  background-image: radial-gradient(circle at 50% 1px, color-mix(in oklch, var(--faint) 35%, var(--card)) 1px, transparent 1.4px);
  background-size: 0.875rem 25%;
  opacity: 1;
}

.chart-bare .chart-labels-points > :first-child {
  transform: none;
}

.chart-bare .chart-labels-points > :last-child {
  transform: translateX(-100%);
}

/* Reading a line: a dashed guide, a point and a dark slip follow the
   pointer, or the arrow keys, from point to point (dashboard.js, on a
   .line-chart[data-chart-reading]). The static points step back. */
.line-chart.is-reading .line-point:not(.chart-reading-point) {
  display: none;
}

.line-chart.is-reading .chart-plot {
  touch-action: pan-y;
}

.line-chart.is-reading .chart-plot:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-focus);
}

.chart-cross {
  --x: 0%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  border-left: 1px dashed var(--faint);
  opacity: 0.55;
  pointer-events: none;
}

.line-point.chart-reading-point {
  width: 0.875rem;
  height: 0.875rem;
  margin: 0 0 -0.4375rem -0.4375rem; /* spacing-exception */
  border-width: 2px;
  pointer-events: none;
}

/* The slip: Ink in the day themes, the raised popover in dark, a pill of
   the series colour, what is read and its value. */
.chart-tip {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  white-space: nowrap;
  pointer-events: none;
}

[data-theme="dark"] .chart-tip {
  border: 1px solid var(--border);
  background-color: var(--popover);
  color: var(--popover-foreground);
}

.chart-tip i {
  width: 0.3125rem;
  height: 0.8125rem;
  border-radius: var(--radius-pill);
  background-color: color-mix(in oklch, var(--family-accent, var(--viz-1)) 65%, var(--family-text, var(--foreground)));
}

.chart-tip span {
  opacity: 0.72;
}

.chart-tip b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.is-placed :is(.chart-cross, .chart-reading-point, .chart-tip) {
  transition:
    left var(--dur-2) var(--ease-out),
    bottom var(--dur-2) var(--ease-out),
    top var(--dur-2) var(--ease-out);
}

/* In a family card the line, its area, its points and a bar list take the
   family: the line its accent darkened toward the text role. */
.dashboard .line-chart-line {
  stroke: color-mix(in oklch, var(--family-accent, var(--viz-1)) 65%, var(--family-text, var(--foreground)));
  stroke-width: 2;
}

.dashboard .line-chart-area {
  fill: var(--family-accent, var(--viz-1));
}

.dashboard .line-point {
  border-color: color-mix(in oklch, var(--family-accent, var(--viz-1)) 65%, var(--family-text, var(--foreground)));
}

.dashboard .bar-list-fill {
  background-color: var(--family-accent, var(--viz-1));
}

/* Segmented tabs: the tabs on a pale track, the selected one raised as a
   white card that slides from tab to tab (tabs.js measures it, the same
   --tab-x / --tab-w the underline uses). */
.tabs-segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--muted-surface);
}

.tabs-segmented .tab {
  z-index: 1;
  margin: 0;
  padding: var(--space-3) var(--space-5);
  border-bottom: 0;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 400;
}

.tabs-segmented .tab::after {
  display: none;
}

.tabs-segmented .tab[aria-selected="true"] {
  font-weight: 500;
}

@media (pointer: coarse) {
  .tabs-segmented .tab {
    min-height: 2.75rem;
  }
}

/* Without the script the selected tab carries the card itself. */
.tabs-segmented:not([data-indicator]) .tab[aria-selected="true"] {
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
}

.tabs-segmented[data-indicator]::after {
  top: var(--space-1);
  bottom: var(--space-1);
  left: 0;
  width: var(--tab-w, 0);
  height: auto;
  border: 1px solid var(--edge);
  border-radius: var(--radius-pill);
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
}

.tab-panels .share-head + .share-bar {
  margin-top: var(--space-5);
}

/* A share: the whole as one bar split in its parts, then the parts as rows
   with their share and their count. */
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: 0;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
}

.count-chip {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  margin-left: var(--space-2);
  padding-inline: var(--space-2);
  border-radius: var(--radius-pill);
  background-color: var(--secondary);
  color: var(--foreground);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.share-bar {
  display: flex;
  gap: 3px; /* spacing-exception */
  height: 0.625rem;
  margin-top: var(--space-6);
}

.share-bar > i {
  flex: 0 1 var(--value);
  transition: opacity var(--dur-2) var(--ease-out);
  min-width: 0.25rem;
  border-radius: var(--radius-pill);
  background-color: var(--family-accent);
}

.share-list {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}

.share-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 4.5rem;
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-3);
  font-size: 0.9375rem;
}

.share-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-pct {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.share-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.share-mark {
  display: inline-block;
  width: 0.375rem;
  height: 0.875rem;
  border-radius: var(--radius-pill);
  background-color: var(--family-accent);
}

.share-neutral {
  --family-accent: var(--faint);
}

.share-mark-idle {
  --family-accent: var(--border);
}

/* A share row you can pick (dashboard.html, "Where the capacity is"): the
   row is a button over the same four columns. Picked, it lifts like any
   selected item (a card with an edge and --shadow-sm); the rows not picked
   step back to --faint, the quietest text that still reads, and their
   marks and bar parts fade. aria-pressed carries the state. */
.share-list li:has(> .share-row) {
  display: block;
  padding-block: 0;
}

.share-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 4.5rem;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-inline: calc(var(--space-4) * -1 - 1px);
  box-sizing: content-box;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: var(--dur-1);
  transition-timing-function: var(--ease-out);
}

/* Only where a pointer hovers: on touch the tapped row would keep it. */
@media (hover: hover) {
  .share-row:hover {
    background-color: var(--accent);
  }
}

.share-row:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.share-row[aria-pressed="true"] {
  border-color: var(--border);
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
}

.share-row[aria-pressed="true"]:focus-visible {
  box-shadow: var(--shadow-sm), var(--shadow-focus);
}

.has-pick .share-row[aria-pressed="false"],
.has-pick .share-row[aria-pressed="false"] .share-pct {
  color: var(--faint);
}

.has-pick .share-row[aria-pressed="false"] .share-mark,
.share-bar.has-pick > i:not(.is-picked) {
  opacity: 0.32;
}

/* The section's filter: the removable chip beside its heading, with the
   region's mark. */
.region-filter {
  align-self: center;
}

.region-filter[hidden] {
  display: none;
}

/* The holds outside the picked region step back the same way, their
   badges reduced to an outline. */
.hold-list .list-item.is-dimmed :is(.list-item-label, .list-item-secondary, .hold-gpus, .date-tile, .date-tile b) {
  color: var(--faint);
}

.hold-list .list-item.is-dimmed .badge {
  border-color: var(--border);
  background-color: transparent;
  color: var(--faint);
}

.hold-list .list-item.is-dimmed .date-tile.is-soon {
  border-color: var(--border);
  background-color: transparent;
}

/* A picked region with no holds says so above the list, in words. */
.hold-list-empty {
  margin: var(--space-5) 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
}

.hold-list-empty[hidden] {
  display: none;
}

/* A gauge: the share of a whole as an arc, the reading inside it. */
.gauge {
  position: relative;
  max-width: 17rem;
  margin-inline: auto;
}

.gauge svg {
  display: block;
  width: 100%;
  height: auto;
}

.gauge-track,
.gauge-value {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}

/* The track and the "not yet held" key are one token, --border, so the
   key names what the eye sees. */
.gauge-track {
  stroke: var(--border);
}

.gauge-value {
  stroke: var(--family-accent);
}

/* A tick every tenth of the scale, inside the arc, and a knob riding the
   end of the fill. */
.gauge-ticks line {
  stroke: var(--border);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.gauge-knob {
  fill: var(--card);
  stroke: var(--border);
  stroke-width: 1.5;
}

/* In dark the knob stays light, so it reads as a handle on the arc. */
[data-theme="dark"] .gauge-knob {
  fill: var(--primary);
}

/* The scale's ends, under the arc's two feet. */
.gauge-ends {
  position: relative;
  height: 1.5rem;
  font-size: 0.8125rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.gauge-ends span {
  --x: 0%;
  position: absolute;
  top: var(--space-1);
  left: var(--x);
  transform: translateX(-50%);
}

.gauge-read {
  position: absolute;
  inset: 34% 0 auto;
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.gauge-value-text {
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.gauge-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.gauge-stats > div:first-child {
  padding-right: var(--space-6);
}

.gauge-stats > div + div {
  padding-left: var(--space-6);
  border-left: 1px solid var(--border);
}

/* The card's reading in two lines: what it means, then since when. */
.chart-note-lead {
  padding-top: 0;
  border-top: 0;
}

.chart-note-lead b {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.9375rem;
}

.gauge-stats dt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.gauge-stats dd {
  margin: var(--space-2) 0 0;
  font-size: 1.25rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.gauge-stats dd small {
  margin-left: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted-foreground);
}

/* Holds: a date tile, the hold, its GPUs and its state. */
.hold-list .list-item {
  gap: var(--space-5);
}

.date-tile {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.6875rem;
  line-height: 1.1;
  color: var(--muted-foreground);
}

.date-tile b {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
}

.date-tile.is-soon {
  border-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-edge), var(--card));
  background-color: color-mix(in oklch, var(--ba-commercial-surface) var(--tint-soft), var(--card));
}

.hold-list .list-item-action {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.hold-gpus {
  font-variant-numeric: tabular-nums;
}

/* Recent activity: what happened, who did it, when, how many GPUs. */
.activity-cell,
.activity-owner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.activity-cell > span:last-child,
.activity-when {
  display: grid;
}

.activity-title {
  font-weight: 500;
}

.activity-meta {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.activity-empty {
  margin: 0;
  padding: var(--space-9) var(--space-5);
  text-align: center;
  color: var(--muted-foreground);
}

.dashboard .table-toolbar {
  justify-content: space-between;
}

/* Forced colours paint every ground as Canvas: the share and the gauge
   are the data itself, so they keep their colours. The months take system
   colours (GrayText, the picked one Highlight), their values keep the
   forced text colour, and focus is an outline, since a shadow is dropped. */
@media (forced-colors: active) {
  .share-bar > i,
  .share-mark,
  .trend-mark,
  .gauge svg {
    forced-color-adjust: none;
  }

  .chart-pick .chart-bar {
    forced-color-adjust: none;
    background-color: GrayText !important;
  }

  .chart-pick.is-on .chart-bar {
    background-color: Highlight !important;
  }

  .chart-tip {
    border: 1px solid CanvasText;
  }

  .chart-pick .bar-value {
    forced-color-adjust: auto;
  }

  .chart-pick:focus-visible .chart-bar {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

.chart-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-8);
}

.chart-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
}

/* The caption owns the gap to the plot. At 24px the subtitle read as part
   of the chart rather than as its introduction; the plot needs to start
   clearly below the words that name it, and clear of the value label that
   rides above its tallest bar. 64px was more than that asked for and left a
   dead band in every card. A list or a donut carries no labels above it,
   so the summary cards under the plots close up further. */
.chart-caption {
  font-size: 1rem;
  color: var(--muted-foreground);
  margin: 0 0 var(--space-10);
}

.dashboard-row .chart-caption {
  margin-bottom: var(--space-7);
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

/* The donut is still a drawing, and its labels are still in canvas units.
   It can be, because it is a fixed 10rem box that never stretches. */
.chart-card svg text {
  font-family: var(--font-sans);
  font-size: 8px;
  fill: var(--muted-foreground);
}




/* Legend: one spec for every chart on the page (.ring-legend below is
   the vertical form of the same thing): 0.875rem, labels in the
   foreground, a 0.6rem square key. */
.chart-legend {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-7);
  font-size: 0.875rem;
  color: var(--foreground);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.chart-legend i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  flex-shrink: 0;
  font-style: normal;
}

/* ==========================================================================
   Family fields
   The seven business-area families ARE the system's color, on equal
   footing with each other: white ground, one family per view or section,
   the way dapple.co fields its pages. Violet is the Brand family, one of
   the seven, not the house color. A .family-* class sets the family's
   three roles as local custom properties; .field paints the surface and
   recolors the secondary text, and the stat card, the hero and the auth
   shell read the same three properties. Compose at the call site:
   class="card field family-executive". Works in all three themes because
   the ba-* tokens already carry their dark and vibrant values. Sits after
   every component on purpose: a utility that recolors a component must
   win on equal specificity, so source order puts it last in layer 2.
   ========================================================================== */

/* --family-mark is the colour for a small mark drawn in the family, the
   spinner's spokes: halfway from the accent to the text role. The accent
   alone is a pastel that falls under 3:1 on white (sky is 2.1:1), the text
   role alone reads as near-black; halfway clears 3.5:1 on white for all
   seven in light and vibrant, and stays light on a dark ground. */
.family-executive {
  --family-accent: var(--ba-executive-accent);
  --family-surface: var(--ba-executive-surface);
  --family-text: var(--ba-executive-text);
  --family-mark: color-mix(in oklch, var(--ba-executive-accent) 50%, var(--ba-executive-text));
}

.family-commercial {
  --family-accent: var(--ba-commercial-accent);
  --family-surface: var(--ba-commercial-surface);
  --family-text: var(--ba-commercial-text);
  --family-mark: color-mix(in oklch, var(--ba-commercial-accent) 50%, var(--ba-commercial-text));
}

.family-product {
  --family-accent: var(--ba-product-accent);
  --family-surface: var(--ba-product-surface);
  --family-text: var(--ba-product-text);
  --family-mark: color-mix(in oklch, var(--ba-product-accent) 50%, var(--ba-product-text));
}

.family-infrastructure {
  --family-accent: var(--ba-infrastructure-accent);
  --family-surface: var(--ba-infrastructure-surface);
  --family-text: var(--ba-infrastructure-text);
  --family-mark: color-mix(in oklch, var(--ba-infrastructure-accent) 50%, var(--ba-infrastructure-text));
}

.family-customer {
  --family-accent: var(--ba-customer-accent);
  --family-surface: var(--ba-customer-surface);
  --family-text: var(--ba-customer-text);
  --family-mark: color-mix(in oklch, var(--ba-customer-accent) 50%, var(--ba-customer-text));
}

.family-corporate {
  --family-accent: var(--ba-corporate-accent);
  --family-surface: var(--ba-corporate-surface);
  --family-text: var(--ba-corporate-text);
  --family-mark: color-mix(in oklch, var(--ba-corporate-accent) 50%, var(--ba-corporate-text));
}

.family-brand {
  --family-accent: var(--ba-brand-accent);
  --family-surface: var(--ba-brand-surface);
  --family-text: var(--ba-brand-text);
  --family-mark: color-mix(in oklch, var(--ba-brand-accent) 50%, var(--ba-brand-text));
}

/* The field itself: the family surface edge to edge, no hairline (the
   color is the boundary), headings stay Ink, secondary copy takes the
   family's text role. Without a .family-* class it falls back to the
   neutral muted surface, so a stray .field is never invisible.

   Two rules hold this together. Flat: on a card the surface is the whole
   device, nothing is drawn on top of it, so it renders identically at
   every screen density (the full-bleed shells carry the stripe field, and
   a KPI tile adds one faint band at its edge, see .stat-card.field). Quiet: a card takes a light
   tint of the family surface, not the surface itself. A row of four
   tiles in four full family surfaces reads as four blocks of color with
   the numbers competing against them, and it gets worse as a dashboard
   grows. The tint keeps the family legible and gives the figures the
   page back. It is derived, not a new token, so a family added later
   gets its tint for free. Because a tint that quiet cannot be its own
   boundary (in dark it lands within a hair of the card), the card keeps
   its hairline. */
.field {
  background-color: color-mix(in oklch, var(--family-surface, var(--muted-surface)) 45%, var(--card));
  color: var(--foreground);
}

/* In dark the card is already dark, so a family tint on top of it reads as
   a muddy wash rather than a pastel: the sky tile comes out navy, the
   commercial one olive. The surface goes neutral there and the family
   stays where it still reads, in the label and the note. */
[data-theme="dark"] .field {
  background-color: var(--secondary);
}

/* A field card stacks: the title stays at the top, the body and its link
   sit at the bottom edge, so a row of cards of different heights keeps
   one baseline for the copy (the marketing site's card composition). */
.card.field {
  display: flex;
  flex-direction: column;
}

.card.field > h3 {
  margin-bottom: auto;
  padding-bottom: var(--space-7);
}

.card.field > p {
  margin-bottom: 0;
}

.field p,
.field .text-muted,
.field .text-caption,
.field .text-eyebrow,
.field .stat-label,
.field .chart-caption {
  color: var(--family-text, var(--muted-foreground));
}

/* In dark the field's ground went neutral (see above), and family-coloured
   body copy on a neutral ground reads as a mistake: a page of grey cards
   with blue paragraphs in them. The running text goes neutral with the
   ground it sits on, and the family keeps the label and the note, which is
   what the rule above was always for. */
[data-theme="dark"] .field p,
[data-theme="dark"] .field .text-muted,
[data-theme="dark"] .field .chart-caption {
  color: var(--muted-foreground);
}

/* ==========================================================================
   Phones: the edge system (the marketing site's phone rules). One 12px
   inset for every text column, and the catalog's cards stop being cards:
   radius 0, no side hairlines, surfaces and color run edge to edge.
   Appended last on purpose: on equal specificity, source order wins, and
   these must win over every component's own phone block above.
   ========================================================================== */

@media (max-width: 767.98px) {
  .container,
  .nav-inner,
  .localnav-inner {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .container .card,
  .container .form-card,
  .container .type-scale,
  .container .alert,
  .container .chart-card,
  .container .data-table-wrap,
  .container .settings-section,
  .container .skeleton-card,
  .container .empty-state,
  .container .error-state {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
  }

  .container .card,
  .container .form-card,
  .container .type-scale,
  .container .alert,
  .container .chart-card,
  .container .settings-section,
  .container .skeleton-card,
  .container .empty-state,
  .container .error-state {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  /* The session banner: the copy keeps a readable measure and the action
     drops to its own line, right-aligned, instead of squeezing the text
     into a narrow column beside it. */
  .impersonation-banner {
    flex-wrap: wrap;
    row-gap: var(--space-3);
    padding: var(--space-4);
  }

  .impersonation-banner-text {
    flex: 1 1 14rem;
  }

  /* Full-bleed cards in a stack share their hairlines. Each keeps a top and
     a bottom edge, so with the grid's gap between them every seam drew two
     lines with a strip of page between. The stack closes up and each card
     after the first drops its top edge: one line per seam, like a list.
     The dashboard's two chart grids are one stack, so the row under the
     plots joins it too. */
  .dashboard-charts,
  .dashboard-row,
  .demo-grid:has(> .empty-state) {
    row-gap: 0;
  }

  .dashboard-charts {
    margin-bottom: 0;
  }

  .dashboard-charts > .chart-card + .chart-card,
  .dashboard-row > .chart-card + .chart-card,
  .dashboard-charts + .dashboard-row > .chart-card:first-child,
  .demo-grid > :is(.empty-state, .error-state) + :is(.empty-state, .error-state) {
    border-top: 0;
  }

  /* KPI tiles stay tiles on a phone, two by two inside the text inset
     rather than four full-bleed bands: a smaller figure, a shorter box and
     a tighter gap, so the row is one screen-width glance again. */
  .dashboard-kpis {
    gap: var(--space-4);
  }

  .stat-card {
    min-height: 8.5rem;
    padding: var(--space-5);
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.875rem;
  }

  .stat-delta {
    font-size: 0.8125rem;
    align-items: flex-start;
  }

  .impersonation-banner .btn {
    margin-left: auto;
  }

  /* On a phone the form simply sits on the page. The rules are hidden at
     this size, so the field around a full-width card was left as two blank
     colour slabs above and below it; now the shell is the page ground and
     the card drops its cap, radius, edge and shadow, in every theme. The
     specificity matches the dark panel rule, which would otherwise win. */
  .auth-shell {
    align-items: flex-start;
    padding: var(--space-7) 0 var(--space-11);
  }

  html[data-theme] .auth-shell {
    background-color: var(--background);
  }

  html[data-theme] .auth-shell > .auth-card {
    --ring-gap: var(--background);
    max-width: none;
    border-radius: 0;
    border-color: transparent;
    box-shadow: none;
    background-color: var(--background);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .container .form-card {
    max-width: none;
  }

  .auth-shell::after,
  .state-shell::after {
    display: none;
  }

  /* The split login on a phone: the weave panel is a full-bleed band
     above the form, the same weave in two rows, like the landing's
     two-row field, and the form runs the full width inside the page
     gutter. No card. */
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: 0;
  }

  /* Without JavaScript the band shows the field's middle two rows, not
     all six squeezed into 9rem: the same two rows the live band draws. */
  .auth-weave {
    order: -1;
    height: 9rem;
    background-size: auto 300%;
  }

  .auth-split-form {
    padding: var(--space-7) var(--space-4) var(--space-11);
  }

  .auth-split-content {
    max-width: none;
  }
}

/* ==========================================================================
   Charts: bars and a line, built from HTML boxes and one SVG path
   No chart library and no hand-drawn canvas. Every datum is a percentage
   of the plot's height (bars) or a point in a 0-100 space (the line), set
   at the call site, so putting real numbers in is arithmetic, not drawing.
   Labels are HTML, so they are real text at a real font size and never
   scale with the card. The plot's height is one custom property.
   ========================================================================== */

.bar-chart,
.line-chart {
  --chart-height: 15rem;
  --chart-axis: 2.5rem;
  display: grid;
  grid-template-columns: var(--chart-axis) 1fr;
  column-gap: var(--space-4);
  /* Room at the right for what hangs past the plot's last point: the line's
     final label and value are centred on it. Both charts take it, so two
     stacked plots end on the same vertical. */
  padding-right: var(--space-5);
}

/* The value axis: evenly spaced labels against the plot's own height, so
   they line up with the gridlines without a single hard-coded offset. */
.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Each label is centred on its gridline: the column is one line taller
     than the plot and pulled half a line up at both ends, so the top label
     sits on the top line and "0" sits on the baseline. */
  height: calc(var(--chart-height) + 1lh);
  margin-block: -0.5lh;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-plot {
  position: relative;
  height: var(--chart-height);
  border-bottom: 1px solid var(--border);
}

/* Gridlines are a repeating background, not elements: one declaration
   instead of a line per rule, and they follow --chart-height for free. */
.chart-plot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(50% - 1px),
    var(--border) calc(50% - 1px),
    var(--border) 50%
  );
  opacity: 0.8;
  pointer-events: none;
}

/* The category axis sits under the plot, sharing its column. */
.chart-labels {
  grid-column: 2;
  display: flex;
  margin-top: var(--space-3);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.chart-labels > * {
  flex: 1;
  text-align: center;
}

/* A line chart's points sit AT 0%, 25%, 50%... not in the middle of a
   band, so each label sits at its own point: --x, the same percentage the
   point carries, centred on it. Spreading the labels with space-between
   put the ends flush with the plot and drifted the middle ones off their
   points by half the difference in label widths. */
.chart-labels-points {
  position: relative;
  display: block;
  height: 1lh;
}

.chart-labels-points > * {
  --x: 0%;
  position: absolute;
  top: 0;
  left: var(--x);
  transform: translateX(-50%);
  white-space: nowrap;
}

.chart-legend-row {
  grid-column: 2;
  margin-top: var(--space-5);
}

/* ---------- Bars ---------- */

.bar-chart-groups {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar-chart-group {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-2);
  height: 100%;
}

/* One number per bar. --value is the share of the plot's height, so a real
   figure becomes value / axis-max. Every bar is one width: 3.25rem, or on a
   narrow plot 80% of its group shared between the series (--bar-series on
   .bar-chart, the most bars any group holds, 2 by default). Growing each
   bar to fill its group gave a lone bar twice the width of a pair. */
.chart-bar {
  --value: 0%;
  position: relative;
  flex: 0 0 auto;
  width: min(3.25rem, calc(80% / var(--bar-series, 2)));
  height: var(--value);
  min-height: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background-color: var(--viz-1);
}

@keyframes bar-rise {
  from {
    height: 0;
  }
}

.chart-bar-2 {
  background-color: var(--viz-2);
}

.bar-value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Line ---------- */

.line-chart-plot {
  position: relative;
}

/* The only drawing left. It carries no text, so it can stretch to any box
   without a label growing with it; the stroke holds its weight through
   vector-effect. Points are HTML, because a circle in a stretched canvas
   would come out an ellipse. */
/* Scoped to the card: the generic `.chart-card svg` rule above is more
   specific than a bare class and was forcing height: auto, which made a
   100x100 canvas square instead of filling the plot. */
.chart-card .line-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The area is a wash under the line, not a second shape: it fades toward
   the baseline, so a large area never lands as a solid block of colour.
   Where a browser cannot mask an SVG shape it is the flat wash at the same
   opacity. Dark takes it lower, because the same accent over a dark card
   is a far louder mark than over white. */
.line-chart-area {
  fill: var(--viz-1);
  opacity: 0.32;
  -webkit-mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.15));
          mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.15));
}

[data-theme="dark"] .line-chart-area {
  opacity: 0.2;
}

@keyframes chart-wipe {
  from {
    clip-path: inset(0 100% 0 0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.line-chart-line {
  fill: none;
  stroke: var(--viz-1);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* A point sits at its own --x / --y, both percentages of the plot. */
.line-point {
  --x: 0%;
  --y: 0%;
  position: absolute;
  left: var(--x);
  bottom: var(--y);
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0 -0.25rem -0.25rem; /* spacing-exception */
  border: 1.5px solid var(--viz-1);
  border-radius: var(--radius-pill);
  background-color: var(--card);
}

.line-point-last {
  width: 0.625rem;
  height: 0.625rem;
  margin: 0 0 -0.3125rem -0.3125rem; /* spacing-exception */
  border-width: 2px;
}

.line-point .bar-value {
  bottom: 100%;
  margin-bottom: var(--space-3);
}

/* ==========================================================================
   Family cards (index.html's Color section)
   One card per business area, drawn the way the family is meant to be used:
   the surface fills the card, the accent is a short rule, and the family's
   text role labels it from inside. Matches the org core's own specimen, and
   keeps the catalog from showing the accent as a large fill, which the
   colour rule forbids.
   ========================================================================== */

.family-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-5);
}

.family-card-face {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  min-height: 9rem;
  border-radius: var(--radius-lg);
  background-color: var(--family-surface);
  color: var(--family-text);
}

.family-card-rule {
  display: block;
  width: 2rem;
  height: 3px;
  margin-bottom: auto;
  border-radius: var(--radius-pill);
  background-color: var(--family-accent);
}

.family-card-name {
  font-size: 0.8125rem;
}

.family-card-index {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.family-card-meta {
  margin-top: var(--space-4);
}

.family-card-title {
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
}

.family-card-hexes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ==========================================================================
   Press feedback
   The system had hover on every control and nothing on press: a click
   landed on silence. These two rules answer it everywhere, using the
   tokens above. The blanket prefers-reduced-motion rule at the top of this
   file already neutralises them, so no override is needed here.
   ========================================================================== */

.btn:active:not(:disabled),
.tab:active,
.toggle:has(input:active:not(:disabled)),
.chip-toggle:active,
.pagination-btn:active:not(:disabled),
.theme-toggle:active,
.help-trigger:active,
.nav-burger:active,
.sidebar-toggle:active,
.app-header-btn:active,
.toast-close:active,
.chip-remove:active {
  transform: var(--press);
}

.menu-item:active,
.sidebar-link:active,
.thread-item:active,
.split-item:active,
.list-item:active,
.radio-card:active,
.workspace-switcher:active,
.user-account:active,
.settings-rail a:active {
  transform: var(--press-row);
}

/* Most of these only transitioned colour, so the press would snap. Naming
   the properties here keeps every component rule untouched. */
.btn,
.tab,
.toggle,
.chip-toggle,
.pagination-btn,
.theme-toggle,
.help-trigger,
.nav-burger,
.sidebar-toggle,
.app-header-btn,
.toast-close,
.chip-remove,
.menu-item,
.sidebar-link,
.thread-item,
.split-item,
.list-item,
.radio-card,
.workspace-switcher,
.user-account,
.settings-rail a {
  transition-property: background-color, border-color, color, box-shadow, opacity, transform;
  transition-duration: var(--dur-1);
  transition-timing-function: var(--ease-out);
}

/* ==========================================================================
   Charts arrive when you reach them, once
   An entry animation that fires at page load has finished before you
   scroll to anything below the fold, which is where a dashboard's charts
   live: the motion happened, nobody saw it. A scroll-linked one is worse:
   it scrubs with the scrollbar, so a chart half in view at rest draws its
   bars short of their values, and scrolling back up shrinks them again.

   So a chart plays once, on a clock, the first time it is seen. theme.js
   sets data-arrive on <html> in <head> (only where IntersectionObserver
   exists and reduced motion is off), holds every chart at its first frame,
   and adds .is-visible to a .chart-card or .bar-list the first time a
   fifth of it is on screen, then stops watching it. Without the script, in
   print, or under reduced motion there is no data-arrive and no animation:
   the charts render in their final state.

   The bars rise to their datum, the line and its area wipe in from the
   left as one (a clip, not a stroke dash: the line uses non-scaling-stroke
   on a stretched canvas, where dashes and pathLength cannot be
   normalised), the points land after the line has been drawn under them,
   and the donut, whose segments are hand-set dash offsets, arrives whole.
   700ms, not --dur-3: that token is a control answering a click, and a
   chart telling you its shape should take longer than a button.
   ========================================================================== */

@media screen and (prefers-reduced-motion: no-preference) {
  html[data-arrive] .chart-bar {
    animation: bar-rise 700ms var(--ease-out) both;
  }

  html[data-arrive] .bar-list-fill {
    animation: bar-grow 700ms var(--ease-out) both;
  }

  html[data-arrive] .line-chart-svg {
    animation: chart-wipe 700ms var(--ease-out) both;
  }

  html[data-arrive] :is(.line-point, .chart-cross, .chart-tip) {
    animation: fade-in var(--dur-3) var(--ease-out) 500ms both;
  }

  html[data-arrive] .gauge-value {
    animation: gauge-fill 1100ms var(--ease-out) both;
  }

  html[data-arrive] .gauge-knob {
    animation: fade-in var(--dur-3) var(--ease-out) 900ms both;
  }

  html[data-arrive] .ring-chart {
    animation: chart-settle 700ms var(--ease-out) both;
  }

  /* Held at the first frame until seen. Only a chart theme.js is watching
     (.is-held): one inserted later is never paused. Paused, not absent, so the clock
     (and the points' delay) starts from zero the moment it is released. */
  html[data-arrive] :is(.chart-card, .bar-list).is-held:not(.is-visible) :is(
    .chart-bar,
    .bar-list-fill,
    .line-chart-svg,
    .line-point,
    .chart-cross,
    .chart-tip,
    .gauge-value,
    .gauge-knob,
    .ring-chart
  ) {
    animation-play-state: paused;
  }
}

@keyframes gauge-fill {
  from {
    stroke-dasharray: 0 100;
  }
}

/* ==========================================================================
   Arrival
   A block below the fold rises a little and fades in the first time you
   reach it, once, on a clock. The same mechanism as the charts above:
   theme.js sets data-arrive on <html> (only with IntersectionObserver and
   reduced motion off). On DOMContentLoaded it marks every block that starts
   below the viewport .is-pending, which holds it at the first frame, and
   swaps that for .is-arriving (and .is-visible) the moment any of it
   enters the viewport, then stops watching it. Not later: a block held
   until it was further up sat invisible in the strip at the bottom of the
   screen whenever you stopped scrolling there.

   It used to run on a view timeline, which scrubbed with the scrollbar: a
   block resting near the bottom edge sat part-faded for as long as you did
   not scroll, and scrolling back up faded blocks out again. Now whatever
   is on screen at load is never touched (no flicker on every visit), a
   block arrives once and stays, and there is nothing to scrub.

   Under a screen and a reduced-motion guard. Without the script, in print,
   or under reduced motion nothing is held and nothing animates: every block
   renders final.
   ========================================================================== */

@media screen and (prefers-reduced-motion: no-preference) {
  html[data-arrive] .is-pending {
    opacity: 0;
    transform: translateY(0.75rem);
  }

  html[data-arrive] .is-arriving {
    animation: block-rise var(--dur-3) var(--ease-out) both;
  }
}

/* Blocks that come into view together arrive one after another, a short
   step apart in reading order (theme.js sets each one's delay). */
@keyframes block-rise {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

/* ==========================================================================
   Print
   Paper gets the page's content and none of its controls. theme.js swaps
   to the day theme for the duration of a print (a dark page on paper is a
   sheet of ink, or white text on white once the browser drops backgrounds)
   and back afterwards; here the colours print as designed, the controls go,
   the bars stop being sticky, and no card, chart, alert or table row is cut
   in half across a page break. The arrival layer is screen-only already, so
   print always gets every block and chart in its final state.
   ========================================================================== */

@media print {
  html {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Controls: theme and help, the menu (its links were fitted to the
     screen's width, and on paper the logo printed over them), the
     section's action, the period chips and export, the table's filters,
     selection bar, pager and row menus, the chat composer. */
  .nav-links,
  .nav-more,
  .nav-burger,
  .nav-drawer,
  .nav-identity,
  .theme-toggle,
  .theme-slot-toggle,
  .help-trigger,
  .localnav-links,
  .localnav-chevron,
  .localnav-action,
  .table-controls,
  .table-toolbar,
  .bulk-bar,
  .pagination,
  .data-table .actions-cell,
  .data-table .check-cell,
  .chat-composer,
  .toast-region,
  .app-sidebar,
  .app-content-header,
  .sidebar-tip,
  .impersonation-exit,
  .app-page-actions,
  .tabs-segmented {
    display: none !important;
  }

  /* A dashboard on paper: every tab panel, one under the other, and every
     month's value, not only the picked one. */
  .dashboard .tab-panel[hidden] {
    display: block !important;
  }

  .dashboard .tab-panel + .tab-panel {
    margin-top: var(--space-7);
  }

  .chart-pick .bar-value {
    opacity: 1;
  }

  .nav,
  .localnav {
    position: static;
  }

  /* The app shell prints as one long page: no fixed height and no inner
     scroller, so nothing below the first screen is cut off. */
  .app-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .app-content {
    overflow: visible;
  }

  .card,
  .stat-card,
  .chart-card,
  .alert,
  .settings-section,
  .empty-state,
  .error-state,
  .data-table tr,
  .list-item {
    break-inside: avoid;
  }

  .section-head,
  .dashboard-section-head,
  .chart-title {
    break-after: avoid;
  }
}

/* While theme.js swaps to the day theme for printing, nothing transitions:
   the swap has to be finished in the frame paper is cut from. */
html[data-printing] *,
html[data-printing] *::before,
html[data-printing] *::after {
  transition: none !important;
}
