
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  /* Neutralise the UA stylesheet for [popover]. PositionController promotes
     floating panels to the top layer, and the UA rules for a popover include
     a solid border, padding, a canvas background and inset:0/margin:auto —
     enough to inflate a measured panel by 14px and to paint a border no
     component asked for. :where() keeps this at zero specificity so it beats
     the UA origin but loses to every rule a component writes for itself. */
  :where([popover]) {
    border: 0;
    padding: 0;
    margin: 0;
    inset: auto;
    width: auto;
    height: auto;
    background: none;
    color: inherit;
    overflow: visible;
  }

  :host {
    transition: opacity var(--transition-fast);

    
    /* Generated from shared/tokens.js by scripts/generate/host-tokens.js. */
    /* Do not edit by hand — edit the token tree instead. */

    --font-body: var(--font-body-family, 'Host Grotesk'), var(--font-body-fallback, system-ui, sans-serif);
    --font-label: var(--font-label-family, 'Tomorrow'), var(--font-label-fallback, system-ui, -apple-system, Segoe UI, sans-serif);
    --font-mono: var(--font-mono-family, 'JetBrains Mono'), var(--font-mono-fallback, ui-monospace, monospace);
    --font-quote: var(--font-quote-family, Georgia), var(--font-quote-fallback, serif);
    --font-display: var(--font-display-family, var(--font-body-family, 'Host Grotesk')), var(--font-display-fallback, var(--font-body-fallback, system-ui, sans-serif));
    --font-accent: var(--font-label);

    /* Private mirrors: components read these, consumers override --text-*. */
    --_text-xs: var(--text-xs, 12px);
    --_text-sm: var(--text-sm, 16px);
    --_text-md: var(--text-md, 17px);
    --_text-lg: var(--text-lg, clamp(18px, 1.5vw, 20px));
    --_text-xl: var(--text-xl, clamp(22px, 2.5vw, 26px));
    --_text-2xl: var(--text-2xl, clamp(28px, 3vw, 36px));
    --_text-3xl: var(--text-3xl, clamp(36px, 5vw, 52px));

    --display-xl-size: var(--_text-3xl);
    --display-xl-weight: var(--font-display-weight, 500);
    --display-xl-spacing: -1px;
    --heading-size: var(--_text-xl);
    --heading-weight: var(--font-display-weight, 500);
    --heading-lh: 1.2;
    --body-size: var(--_text-md);
    --body-weight: var(--font-body-weight, 500);
    --body-lh: 1.7;
    --wordmark-size: clamp(20px, 2.5vw, 28px);
    --wordmark-weight: var(--font-display-weight, 500);
    --wordmark-spacing: clamp(8px, 1.2vw, 14px);
    --section-title-size: var(--_text-xs);
    --section-title-weight: var(--font-label-weight, 600);
    --section-title-spacing: 2px;
    --ui-accent-size: 16px;
    --ui-accent-weight: var(--font-label-weight, 600);
    --ui-accent-spacing: 0.5px;
    --code-size: 14px;
    --code-lh: 1.8;
    --label-inline-size: 10px;
    --label-inline-spacing: 0.75px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;
    --space-3xl: 96px;
    --space-4xl: 128px;

    /* Radii */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions and motion */
    --transition-fast: var(--duration-fast) var(--ease-standard);
    --transition-base: var(--duration-base) var(--ease-standard);
    --transition-slow: var(--duration-slow) var(--ease-standard);
    --transition-enter: var(--duration-enter) var(--ease-out);
    --transition-exit: var(--duration-exit) var(--ease-in);
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 400ms;
    --duration-enter: 500ms;
    --duration-exit: 300ms;
    --ease-out-expo: var(--ease-out);
    --ease-in-out: var(--ease-standard);

    /* Z-index */
    --z-base: 0;
    --z-dropdown: 1000;
    --z-tooltip: 1100;
    --z-overlay: 1200;
    --z-modal: 1300;
    --z-toast: 1400;
    --z-max: 9999;

    /* Glow and focus */
    --glow-xs: 0 0 6px rgba(var(--accent-primary-rgb), 0.3);
    --glow-sm: 0 0 8px rgba(var(--accent-primary-rgb), 0.3);
    --glow-md: 0 0 12px rgba(var(--accent-primary-rgb), 0.25);
    --glow-status: 0 0 12px rgba(var(--_status-rgb), var(--glow-status-alpha, 0.15));
    --glow-status-alpha: 0.15;
    --glow-hover: 0 0 12px rgba(var(--accent-primary-rgb), 0.15);
    --focus-ring: 0 0 0 1px rgba(var(--accent-primary-rgb),0.25);
    --focus-glow: 0 0 0 1px rgba(var(--accent-primary-rgb),0.2), 0 0 6px rgba(var(--accent-primary-rgb),0.35), 0 0 16px rgba(var(--accent-primary-rgb),0.2), 0 0 40px rgba(var(--accent-secondary-rgb),0.12);
    --focus-error: 0 0 0 2px var(--surface-base), 0 0 0 4px var(--color-error), 0 0 16px rgba(var(--color-error-rgb), 0.2);
    --focus-inset: inset 0 0 0 2px var(--interactive);
    --focus-thumb: 0 0 8px rgba(var(--interactive-rgb), 0.5), 0 0 20px rgba(var(--interactive-rgb), 0.25);

    /* Semantic aliases */
    --interactive: var(--accent-primary);
    --interactive-rgb: var(--accent-primary-rgb);
    --interactive-hover: var(--glow-hover);
    --interactive-active: var(--glow-primary);
    --interactive-focus: var(--focus-glow);
    --interactive-focus-ring: var(--focus-ring);
    --interactive-focus-error: var(--focus-error);
    --interactive-focus-inset: var(--focus-inset);
    --interactive-focus-thumb: var(--focus-thumb);
    --interactive-muted: var(--text-ghost);
    --surface-base: var(--bg-deep);
    --surface-primary: var(--bg-surface);
    --surface-raised: var(--bg-card);
    --surface-overlay: var(--bg-elevated);
    --surface-hover: var(--bg-hover);
    --divider: var(--border-subtle);
    --on-accent: var(--surface-base);

    /* Interactive and layout */
    --touch-min: 24px;
    --touch-pad: 4px;
    --max-width: 1120px;
    --max-width-sm: 720px;
    --nav-height: 64px;
    --nav-row-inset: var(--space-sm);

  }

  
  @media (pointer: coarse) {
    :host {
      --touch-min: 36px;
      --touch-pad: 8px;
    }
  }


  /* Reduced motion, once, for every component that adopts these styles.

     This was copy-pasted verbatim into sixty-nine component files while fifteen
     animating components had no guard at all — which is the usual outcome when
     a cross-cutting rule is a convention rather than a place. Components keep
     their own blocks only for what this cannot express: scroll-behavior,
     animation-play-state, a transform that must be neutralised rather than
     shortened.

     0.01ms rather than "animation: none" on purpose. A component that removes
     itself on animationend — the exiting toast and snackbar both do — would
     wait forever for an event that a canceled animation never fires. A
     duration this short is imperceptible and still completes. */
  @media (prefers-reduced-motion: reduce) {
    :host *,
    :host *::before,
    :host *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

      :host {
        display: block;
        position: sticky;
        top: var(--nav-height);
        height: calc(100vh - var(--nav-height));
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        scrollbar-color: var(--border-default) transparent;
      }

      :host([collapsed]) { width: 0; overflow: hidden; }

      .sidebar {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-lg);
        min-height: 100%;
        position: relative;
        box-sizing: border-box;
      }

      /* Ambient glow — faint accent bleed from the right edge */
      :host([glow]) .sidebar::before {
        content: '';
        position: absolute;
        top: 0;
        inset-inline-end: 0;
        width: 80%;
        height: 50%;
        background: radial-gradient(
          ellipse at 100% 10%,
          rgba(var(--accent-primary-rgb), 0.03),
          transparent 60%
        );
        pointer-events: none;
      }

      /* Border line — solid default (right edge) */
      .sidebar::after {
        content: '';
        position: absolute;
        top: 0;
        inset-inline-end: 0;
        bottom: 0;
        width: 1px;
        background: var(--divider);
      }

      /* Right position — border on left edge */
      :host([position="right"]) .sidebar::after {
        right: auto;
        left: 0;
      }

      :host([position="right"][glow]) .sidebar::before {
        right: auto;
        left: 0;
        background: radial-gradient(
          ellipse at 0% 10%,
          rgba(var(--accent-primary-rgb), 0.03),
          transparent 60%
        );
      }

      /* Glow border variant */
      :host([glow]) .sidebar::after {
        background: var(--glow-line-blue);
        opacity: 0.6;
      }

      /* ── Section ── */
      .sidebar__section {
        display: flex;
        flex-direction: column;
      }

      /* ── Static heading (non-collapsible) ── */
      /* The gradient lives on the inner text span, not here: background-clip
         text with a transparent fill clips every descendant, so an icon placed
         inside a gradient-painted box renders as nothing at all. */
      .sidebar__heading {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        font-family: var(--font-label);
        font-weight: var(--font-label-weight, 600);
        font-size: var(--_text-xs);
        letter-spacing: 2px;
        text-transform: uppercase;
        padding: var(--space-sm);
        margin-bottom: var(--space-xs);
      }

      .sidebar__heading-text {
        background: var(--gradient-accent-text);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }

      /* Headings read as one rank, so their icons stay quieter than the link
         icons below them rather than competing for the same attention. */
      .sidebar__heading-icon {
        color: var(--text-ghost);
        flex-shrink: 0;
        -webkit-text-fill-color: unset;
      }

      /* ── Collapsible heading (toggle) ── */
      .sidebar__toggle {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        font-family: var(--font-label);
        font-weight: var(--font-label-weight, 600);
        font-size: var(--_text-xs);
        letter-spacing: 2px;
        text-transform: uppercase;
        padding: var(--space-sm);
        margin-bottom: 2px; /* cosmetic micro-spacing */
        border-radius: var(--radius-sm);
        border: none;
        background: none;
        cursor: pointer;
        user-select: none;
        transition: background var(--transition-fast);
        width: 100%;
        text-align: start;
      }

      .sidebar__toggle:hover {
        background: var(--surface-hover);
        box-shadow: var(--interactive-hover);
      }

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

      .sidebar__toggle-label {
        background: var(--gradient-accent-text);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }

      .sidebar__toggle-count {
        font-family: var(--font-mono);
        font-size: var(--_text-xs);
        font-weight: var(--font-mono-weight, 400);
        letter-spacing: 0;
        color: var(--text-ghost);
        -webkit-text-fill-color: var(--text-ghost);
        margin-inline-start: auto;
      }

      .sidebar__chevron {
        color: var(--text-ghost);
        flex-shrink: 0;
        transition: transform var(--transition-fast);
        -webkit-text-fill-color: unset;
      }

      .sidebar__chevron--closed {
        transform: rotate(-90deg);
      }

      /* ── Links container ── */
      /* The links sit a step inside their heading, and the rail marks the group
         they belong to. Structural and neutral by rule: one flat --divider that
         never takes a color, a weight or a state from whichever link is
         active. A left edge that tracks the current item is banned outright —
         the active row says "here" with tint and accent text, as everywhere
         else in the system. */
      .sidebar__links {
        display: flex;
        flex-direction: column;
        gap: 1px;
        margin-inline-start: var(--space-sm);
        padding-inline-start: var(--space-sm);
        border-inline-start: 1px solid var(--divider);
      }

      .sidebar__links--hidden {
        display: none;
      }

      /* ── Link ── */
      .sidebar__link {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-family: var(--font-body);
        font-size: var(--_text-sm);
        font-weight: 400;
        color: var(--text-muted);
        text-decoration: none;
        /* Logical, now that the container carries the indent. The four-value
           shorthand this replaces ended in a physical padding-left, which put
           the inset on the wrong edge in RTL. */
        padding-block: var(--touch-pad);
        padding-inline: var(--nav-row-inset) var(--space-md);
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition:
          color var(--transition-fast),
          background var(--transition-fast),
          box-shadow var(--transition-fast);
        border: none;
        background: none;
        text-align: start;
      }

      .sidebar__link-body {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        min-width: 0;
      }

      /* Heading and link glyphs match in size; what separates the two ranks is
         the heading's uppercase gradient text and the ghosted heading icon
         against the link icon's willingness to take the accent when active. */
      .sidebar__heading-icon,
      .sidebar__link-icon {
        flex-shrink: 0;
      }

      /* Ghosted by default so the label stays the thing being read; the icon is
         a landmark you find on the second pass, not competition for the first. */
      .sidebar__link-icon {
        color: var(--text-ghost);
        flex-shrink: 0;
        transition: color var(--transition-fast);
      }

      .sidebar__link:hover .sidebar__link-icon {
        color: var(--text-secondary);
      }

      .sidebar__link[aria-current="page"] .sidebar__link-icon {
        color: var(--interactive);
      }

      .sidebar__link-arrow {
        opacity: 0;
        color: var(--text-ghost);
        font-size: var(--_text-sm);
        flex-shrink: 0;
        transition: opacity var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
        transform: translateX(-2px);
      }

      /* The external marker is the one arrow that does not wait for a hover.
         Its job is to warn you where the link goes *before* you commit to it,
         and a glyph that only appears once the pointer is already there has
         missed the moment. Ghosted rather than hidden, so it reads as a
         property of the destination and not as an active state. */
      .sidebar__link-arrow--external {
        opacity: 0.55;
        transform: none;
      }

      .sidebar__link:hover .sidebar__link-arrow {
        opacity: 1;
        transform: translateX(0);
        color: var(--text-secondary);
      }

      .sidebar__link[aria-current="page"] .sidebar__link-arrow {
        opacity: 1;
        transform: translateX(0);
        color: var(--interactive);
      }

      /* Before the active rule: equal specificity, so the later selector wins,
         and a nested link that was the current page rendered ghost-grey. */
      .sidebar__link--nested {
        font-size: var(--_text-xs);
        color: var(--text-ghost);
      }


      .sidebar__link:hover {
        color: var(--text-primary);
        background: var(--surface-hover);
        box-shadow: inset 2px 0 6px rgba(var(--interactive-rgb), 0.08);
      }

      /* Active link */
      .sidebar__link[aria-current="page"] {
        color: var(--interactive);
        background: var(--accent-primary-subtle);
        font-weight: 500;
      }

      :host([glow]) .sidebar__link[aria-current="page"] {
        box-shadow: inset 6px 0 12px -6px rgba(var(--interactive-rgb), 0.15);
      }

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

      .sidebar__slot-host { display: none; }
    