/* design-kit v1.9.0. GENERATED by build/build.mjs from tokens/tokens.json. Do not edit. */
/* design-kit components. Built only on tokens.css variables: no colour, px, rem or duration literals
   (build/build.mjs lints this). Class names follow Basecoat (btn, input, card, badge, alert, ...);
   native elements and ARIA attributes are the state hooks. Layers match Tailwind v4, so utilities win. */

@layer base, components, utilities;

/* ============================================================ base */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--text-base--line-height);
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: var(--font-weight-bold);
    color: inherit;
    text-wrap: balance;
    overflow-wrap: break-word;
  }
  h4, h5, h6 { overflow-wrap: break-word; }
  h1 { font-size: var(--text-3xl); line-height: var(--text-3xl--line-height); letter-spacing: var(--tracking-tighter); }
  h2 { font-size: var(--text-2xl); line-height: var(--text-2xl--line-height); letter-spacing: var(--tracking-tight); }
  h3 { font-size: var(--text-xl); line-height: var(--text-xl--line-height); }
  h4, h5, h6 { margin: 0; font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); }
  p { margin: 0; }
  figure { margin: 0; }

  a { color: var(--brand); text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
  a:hover { text-decoration-thickness: 0.14em; }

  code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
  :not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    background: var(--muted);
    color: var(--foreground);
  }
  pre {
    margin: 0;
    padding: var(--space-lg);
    overflow: auto;
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-md);
    background: var(--muted);
    color: var(--foreground);
    line-height: var(--text-sm--line-height);
  }

  hr { height: 0; margin: var(--space-xl) 0; border: 0; border-top: var(--size-border) solid var(--border); }
  img, svg, video, canvas { max-width: 100%; }
  [hidden] { display: none !important; }

  :focus-visible { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  ::selection { background: color-mix(in oklab, var(--brand) 35%, transparent); }
  /* scrollbars in the kit's colours (inherited by every scroller), instead of the platform's grey with arrows */
  :root { scrollbar-color: var(--input) transparent; }
  /* matched words (search hits in a quote): a brand tint; the text is foreground, even in muted copy (AA) */
  mark { padding: 0 var(--space-xs); border-radius: var(--radius-xs); background: color-mix(in oklab, var(--brand) 22%, transparent); color: var(--foreground); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
}

/* ============================================================ components */
@layer components {

  /* ---------- typography roles (the doc's typography tokens) */
  .display-xl { font-family: var(--font-display); font-size: var(--text-3xl); line-height: var(--text-3xl--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tighter); }
  .display-md { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--text-2xl--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); }
  .display-md-heavy { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--text-2xl--line-height); font-weight: var(--font-weight-extrabold); letter-spacing: var(--tracking-tight); }
  .heading-md { font-family: var(--font-display); font-size: var(--text-xl); line-height: var(--text-xl--line-height); font-weight: var(--font-weight-bold); }
  /* a compact page title (a day title between ‹ › arrows) that can be a real h1: display font, between heading-sm and heading-md */
  .heading-page { font-family: var(--font-display); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); overflow-wrap: break-word; }
  .heading-sm { font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); }
  .body-md { font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-regular); }
  .body-sm { font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-regular); }
  .label-md { font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-semibold); }
  .mono-sm, .eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    line-height: var(--text-2xs--line-height);
    font-weight: var(--font-weight-regular);
    letter-spacing: var(--tracking-normal);
    text-transform: uppercase;
  }
  .lead { font-size: var(--text-base); line-height: var(--text-base--line-height); color: var(--muted-foreground); }
  :is(.display-xl, .display-md, .display-md-heavy, .heading-md, .heading-sm, .card-title, .section-title) { overflow-wrap: break-word; }

  /* ---------- button */
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link) {
    --btn-bg: var(--primary);
    --btn-fg: var(--primary-foreground);
    --btn-border: transparent;
    --btn-bg-hover: var(--primary-hover);
    --btn-fg-hover: var(--btn-fg);
    --btn-h: var(--size-control-md);
    --btn-px: var(--space-lg);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-base);
    height: var(--btn-h);
    padding: 0 var(--btn-px);
    border: var(--size-border) solid var(--btn-border);
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--duration-normal) var(--ease-standard), color var(--duration-normal) var(--ease-standard), border-color var(--duration-normal) var(--ease-standard);
  }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link):hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link) svg { width: var(--size-icon); height: var(--size-icon); flex-shrink: 0; }

  :is(.btn, .btn-primary) { --btn-border: var(--primary-border); }
  .btn-secondary { --btn-bg: var(--secondary); --btn-fg: var(--secondary-foreground); --btn-bg-hover: var(--accent); --btn-fg-hover: var(--accent-foreground); }
  .btn-outline { --btn-bg: transparent; --btn-fg: var(--foreground); --btn-border: var(--input); --btn-bg-hover: var(--accent); --btn-fg-hover: var(--accent-foreground); }
  .btn-ghost { --btn-bg: transparent; --btn-fg: var(--foreground); --btn-bg-hover: var(--accent); --btn-fg-hover: var(--accent-foreground); }
  /* quiet destructive: red text on transparent, for row-level Remove / Move to trash */
  .btn-ghost-destructive { --btn-bg: transparent; --btn-fg: var(--destructive); --btn-bg-hover: color-mix(in oklab, var(--destructive) 10%, transparent); --btn-fg-hover: var(--destructive); }
  .btn-destructive { --btn-bg: var(--destructive); --btn-fg: var(--destructive-foreground); --btn-bg-hover: color-mix(in oklab, var(--destructive) 85%, var(--foreground)); }
  .btn-link {
    --btn-bg: transparent; --btn-fg: var(--brand); --btn-bg-hover: transparent;
    --btn-px: 0;
    height: auto;
    border-radius: var(--radius-xs);
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.2em;
  }
  .btn-link:hover { text-decoration-thickness: 0.14em; }

  .btn-sm { --btn-h: var(--size-control-sm); --btn-px: var(--space-md); gap: var(--space-sm); }
  .btn-lg { --btn-h: var(--size-control-lg); --btn-px: var(--space-xl); font-size: var(--text-base); line-height: var(--text-base--line-height); }
  .btn-icon { width: var(--btn-h); --btn-px: 0; }
  .btn-block { width: 100%; }

  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link):is(:disabled, [aria-disabled="true"]) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link)[aria-busy="true"] { cursor: progress; pointer-events: none; }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive, .btn-link)[aria-busy="true"]::before,
  .spinner {
    content: "";
    display: inline-block;
    width: var(--size-icon-sm);
    height: var(--size-icon-sm);
    flex-shrink: 0;
    border: calc(var(--size-border) * 2) solid currentColor;
    border-right-color: transparent;
    border-radius: var(--radius-full);
    animation: kit-spin calc(var(--duration-slow) * 2) linear infinite;
  }
  /* toggle buttons: any variant with aria-pressed="true" is on (accent fill, 2px brand edge). Components with their own
     pressed look (chip, poster-actions, episode-actions) override it later in the file. */
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive)[aria-pressed="true"] {
    --btn-bg: var(--accent); --btn-fg: var(--accent-foreground); --btn-border: var(--brand); --btn-bg-hover: var(--accent); --btn-fg-hover: var(--accent-foreground);
    box-shadow: inset 0 0 0 var(--size-border) var(--brand);
  }
  .btn-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-base); }

  /* ---------- form controls */
  :is(.input, .textarea, .select, select.input, textarea.input),
  .form :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"], [type="reset"]), select, textarea) {
    display: block;
    width: var(--control-w, 100%);
    min-width: 0;
    height: var(--size-control-md);
    margin: 0;
    padding: 0 var(--space-md);
    border: var(--size-border) solid var(--input);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--duration-normal) var(--ease-standard);
  }
  :is(.input, .textarea, .select)::placeholder, .form :where(input, textarea)::placeholder { color: var(--muted-foreground); opacity: 1; }
  :is(.input, .textarea, .select):focus-visible,
  .form :where(input, select, textarea):focus-visible { border-color: var(--ring); outline: var(--size-ring) solid var(--ring); outline-offset: 0; }
  :is(.input, .textarea, .select, .checkbox, .radio, .switch)[aria-invalid="true"],
  .form :where(input, select, textarea)[aria-invalid="true"] { border-color: var(--destructive); }
  :is(.input, .textarea, .select)[aria-invalid="true"]:focus-visible,
  .form :where(input, select, textarea)[aria-invalid="true"]:focus-visible { outline-color: var(--destructive); }
  :is(.input, .textarea, .select):disabled,
  .form :where(input, select, textarea):disabled { opacity: 0.5; cursor: not-allowed; background: var(--muted); }
  :is(.input, .textarea, .select)[readonly] { background: var(--muted); }

  :is(.textarea, textarea.input), .form :where(textarea) {
    height: auto;
    min-height: calc(var(--size-control-md) * 2.5);
    padding: var(--space-base) var(--space-md);
    resize: vertical;
    field-sizing: content;
  }
  :is(.select, select.input), .form :where(select:not([multiple])) {
    appearance: none;
    padding-right: calc(var(--space-md) * 2 + var(--size-icon-sm));
    background-image:
      linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%),
      linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
    background-position: calc(100% - var(--space-md) - var(--space-sm)) 50%, calc(100% - var(--space-md)) 50%;
    background-size: var(--space-sm) var(--space-sm);
    background-repeat: no-repeat;
    cursor: pointer;
  }
  :is(.select, select.input)[multiple], .form :where(select[multiple]) { height: auto; padding: var(--space-sm); background-image: none; }
  /* The open option list. Selects are transparent with --foreground text, and Chromium on Windows paints the list
     on its own white, so options were near-white on white. Give options the popover pair in both modes. */
  :is(.select, select.input, .form select) :is(option, optgroup) { background-color: var(--popover); color: var(--popover-foreground); }
  :is(.select, select.input, .form select) option:checked { background-color: var(--accent); color: var(--accent-foreground); }
  :is(.select, select.input, .form select) option:disabled { color: var(--muted-foreground); }
  :is(.input, .form input)[type="file"] { padding: var(--space-xs) var(--space-sm); height: auto; }

  /* checkbox */
  :is(.checkbox, input[type="checkbox"].input:not([role="switch"])), .form :where(input[type="checkbox"]:not([role="switch"])) {
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex-shrink: 0;
    width: var(--size-icon);
    height: var(--size-icon);
    margin: 0;
    padding: 0;
    border: var(--size-border) solid var(--input);
    border-radius: var(--radius-sm);
    background: transparent;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  }
  :is(.checkbox, input[type="checkbox"].input:not([role="switch"]))::before, .form :where(input[type="checkbox"]:not([role="switch"]))::before {
    content: "";
    width: var(--size-icon-sm);
    height: var(--size-icon-sm);
    background: var(--brand-foreground);
    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='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: scale(0);
    transition: transform var(--duration-fast) var(--ease-out);
  }
  :is(.checkbox, input[type="checkbox"].input:not([role="switch"])):is(:checked, :indeterminate), .form :where(input[type="checkbox"]:not([role="switch"])):is(:checked, :indeterminate) { background: var(--brand); border-color: var(--brand); }
  :is(.checkbox, input[type="checkbox"].input:not([role="switch"])):is(:checked, :indeterminate)::before, .form :where(input[type="checkbox"]:not([role="switch"])):is(:checked, :indeterminate)::before { transform: scale(1); }
  :is(.checkbox, input[type="checkbox"].input:not([role="switch"])):indeterminate::before, .form :where(input[type="checkbox"]:not([role="switch"])):indeterminate::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
  :is(.checkbox, .radio, .switch, input.input[type="checkbox"], input.input[type="radio"]):disabled, .form :where(input[type="checkbox"], input[type="radio"]):disabled { opacity: 0.5; cursor: not-allowed; }

  /* radio */
  :is(.radio, input[type="radio"].input), .form :where(input[type="radio"]) {
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex-shrink: 0;
    width: var(--size-icon);
    height: var(--size-icon);
    margin: 0;
    border: var(--size-border) solid var(--input);
    border-radius: var(--radius-full);
    background: transparent;
    vertical-align: middle;
    cursor: pointer;
  }
  :is(.radio, input[type="radio"].input)::before, .form :where(input[type="radio"])::before {
    content: "";
    width: calc(var(--size-icon) / 2);
    height: calc(var(--size-icon) / 2);
    border-radius: var(--radius-full);
    background: var(--brand);
    transform: scale(0);
    transition: transform var(--duration-fast) var(--ease-out);
  }
  :is(.radio, input[type="radio"].input):checked, .form :where(input[type="radio"]):checked { border-color: var(--brand); }
  :is(.radio, input[type="radio"].input):checked::before, .form :where(input[type="radio"]):checked::before { transform: scale(1); }

  /* switch: <input type="checkbox" role="switch" class="switch"> */
  :is(.switch, input[type="checkbox"][role="switch"].input), .form :where(input[type="checkbox"][role="switch"]) {
    --switch-w: calc(var(--size-icon) * 2 + var(--space-xs) * 2);
    appearance: none;
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: var(--switch-w);
    height: calc(var(--size-icon) + var(--space-xs) * 2);
    margin: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--input);
    vertical-align: middle;
    cursor: pointer;
    transition: background-color var(--duration-normal) var(--ease-standard);
  }
  :is(.switch, input[type="checkbox"][role="switch"].input)::before, .form :where(input[type="checkbox"][role="switch"])::before {
    content: "";
    position: absolute;
    top: var(--space-xs);
    left: var(--space-xs);
    width: var(--size-icon);
    height: var(--size-icon);
    border-radius: var(--radius-full);
    background: var(--background);
    transition: translate var(--duration-normal) var(--ease-standard);
  }
  :is(.switch, input[type="checkbox"][role="switch"].input):checked, .form :where(input[type="checkbox"][role="switch"]):checked { background: var(--brand); }
  :is(.switch, input[type="checkbox"][role="switch"].input):checked::before, .form :where(input[type="checkbox"][role="switch"]):checked::before { translate: var(--size-icon) 0; }

  /* label, field, fieldset, form */
  .label, .form :where(label) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-base);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
    user-select: none;
  }
  .label:has(:disabled), .label[data-disabled] { opacity: 0.5; cursor: not-allowed; }
  .field { display: grid; align-content: start; gap: var(--space-base); min-width: 0; }
  .field > .label { justify-self: start; }
  .field-description, .field-help {
    margin: 0;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    color: var(--muted-foreground);
  }
  .field-error {
    margin: 0;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium);
    color: var(--destructive);
  }
  .field-error:empty { display: none; }
  .field:has([aria-invalid="true"]) > .label { color: var(--destructive); }
  .field-row { display: flex; align-items: center; gap: var(--space-base); }
  .fieldset { display: grid; gap: var(--space-lg); min-width: 0; margin: 0; padding: 0; border: 0; }
  .fieldset > legend { margin-bottom: var(--space-base); padding: 0; font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-semibold); }
  .form { display: grid; gap: var(--space-xl); }
  /* A row of compact fields that wraps (filter bars, search options): form.form-row > .field (+ .field-sm for short
     values such as numbers) and buttons, bottom-aligned so a button lines up with the controls. */
  .form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-md); }
  .form-row > .field { flex: 1 1 calc(var(--space-4xl) * 1.6); }
  .form-row > .field-sm { flex: 0 1 var(--space-4xl); }
  .form-row > .field-full { flex-basis: 100%; }

  /* ---------- card */
  .card {
    --table-header-bg: var(--card);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    min-width: 0;
    padding: var(--space-2xl) var(--space-xl);
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: var(--shadow-sm);
  }
  .card-resource { padding: var(--space-xl); background: var(--accent); color: var(--accent-foreground); border-color: transparent; }
  @media (max-width: 40rem) { .card { padding: var(--space-xl) var(--space-lg); } .card-resource { padding: var(--space-lg); } }
  .card > header, .card-header { display: grid; gap: var(--space-sm); }
  .card > header :is(h1, h2, h3, h4), .card-title {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    line-height: var(--text-lg--line-height);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--tracking-normal);
  }
  .card > header p, .card-description { margin: 0; font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }
  .card-resource :is(.card-description, header p) { color: var(--muted-foreground); }
  .card > section, .card-content { min-width: 0; font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  .card > footer, .card-footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-base); }

  /* ---------- badge / chip */
  :is(.badge, .badge-secondary, .badge-outline, .badge-destructive, .badge-success, .badge-warning, .badge-info, .badge-brand, .badge-foam, .badge-cerulean, .badge-soft) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    height: var(--size-chip);
    padding: 0 var(--space-base);
    border: var(--size-border) solid transparent;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--primary-foreground);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    line-height: var(--text-xs--line-height);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    vertical-align: middle;
    text-decoration: none;
  }
  :is(.badge, .badge-secondary, .badge-outline, .badge-destructive, .badge-success, .badge-warning, .badge-info, .badge-brand, .badge-foam, .badge-cerulean, .badge-soft) svg { width: var(--size-icon-sm); height: var(--size-icon-sm); }
  .badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
  .badge-outline { background: transparent; color: var(--foreground); border-color: var(--input); }
  .badge-destructive { background: var(--destructive); color: var(--destructive-foreground); }
  .badge-success { background: var(--success); color: var(--success-foreground); }
  .badge-warning { background: var(--warning); color: var(--warning-foreground); }
  .badge-info { background: var(--info); color: var(--info-foreground); }
  .badge-brand { background: var(--brand); color: var(--brand-foreground); }
  .badge-foam { background: var(--foam); color: var(--foam-foreground); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-regular); }
  .badge-cerulean { background: var(--cerulean); color: var(--cerulean-foreground); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-regular); }
  /* soft badge: badge-success badge-soft = a 15% tint of the variant; the text is the variant deepened toward foreground
     (1.7.3, like status), AA on every surface incl. sidebars and hovered rows; plain badge-soft, or on badge / secondary /
     outline, is the muted pair */
  .badge-soft { background: var(--muted); color: var(--muted-foreground); border-color: transparent; }
  :is(.badge-success, .badge-warning, .badge-destructive, .badge-info, .badge-brand).badge-soft { background: color-mix(in oklab, var(--badge-soft) 15%, transparent); color: color-mix(in oklab, var(--badge-soft) 75%, var(--foreground)); }
  .badge-success.badge-soft { --badge-soft: var(--success); }
  .badge-warning.badge-soft { --badge-soft: var(--warning); }
  .badge-destructive.badge-soft { --badge-soft: var(--destructive); }
  .badge-info.badge-soft { --badge-soft: var(--info); }
  .badge-brand.badge-soft { --badge-soft: var(--brand); }
  /* a badge that links somewhere (a tag): underline on hover, the global focus ring on focus */
  a:is(.badge, .badge-secondary, .badge-outline, .badge-destructive, .badge-success, .badge-warning, .badge-info, .badge-brand, .badge-foam, .badge-cerulean, .badge-soft):hover { text-decoration: underline; text-underline-offset: 0.2em; }

  /* ---------- toggle chip: .chips > button.chip[aria-pressed] (filters) or a.chip (links); .count, .chip-logo
     pill-nav's look for buttons: on/off filters (aria-pressed), the current choice in a set (aria-current) */
  .chips { display: flex; flex-wrap: wrap; gap: var(--space-base); align-items: center; }
  .chip {
    display: inline-flex; align-items: center; gap: var(--space-base);
    height: var(--size-control-sm); padding: 0 var(--space-md);
    border: var(--size-border) solid var(--input); border-radius: var(--radius-pill);
    background: transparent; color: var(--foreground); cursor: pointer;
    font: inherit; font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium); text-decoration: none; white-space: nowrap;
    transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  }
  .chip svg { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }
  .chip:hover { background: var(--accent); color: var(--accent-foreground); }
  .chip:focus-visible { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  .chip:is([aria-pressed="true"], [aria-current]:not([aria-current="false"])) { border-color: var(--primary-border); background: var(--primary); color: var(--primary-foreground); }
  .chip:is([aria-pressed="true"], [aria-current]:not([aria-current="false"])):hover { background: var(--primary-hover); }
  .chip .count { color: var(--muted-foreground); font-variant-numeric: tabular-nums; font-size: var(--text-xs); line-height: var(--text-xs--line-height); }
  .chip:is([aria-pressed="true"], [aria-current]:not([aria-current="false"])) .count { color: var(--primary-foreground); }
  .chip:disabled { opacity: 0.5; cursor: not-allowed; }
  /* a service or brand logo in front of the label */
  .chip-logo { padding-left: var(--space-xs); }
  .chip-logo img { width: calc(var(--size-control-sm) - var(--space-sm) * 2); height: calc(var(--size-control-sm) - var(--space-sm) * 2); border-radius: var(--radius-full); object-fit: cover; flex: none; }
  @media (prefers-reduced-motion: reduce) { .chip { transition: none; } }

  /* ---------- alert */
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info) {
    --alert-accent: var(--foreground);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-xs) var(--space-md);
    padding: var(--space-lg);
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--card-foreground);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
  /* the icon slot holds an svg, or a .spinner while something is busy */
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info):has(> :is(svg, .spinner)) { grid-template-columns: var(--size-icon) minmax(0, 1fr); }
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info) > :is(svg, .spinner) { grid-row: span 2; width: var(--size-icon); height: var(--size-icon); margin-top: var(--space-xs); color: var(--alert-accent); }
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info):has(> :is(svg, .spinner)) > :not(svg, .spinner) { grid-column: 2; }
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info) > :is(h2, h3, h4, h5, .alert-title) { margin: 0; font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-normal); }
  :is(.alert, .alert-destructive, .alert-success, .alert-warning, .alert-info) > :is(section, p, .alert-description) { margin: 0; color: var(--muted-foreground); }
  :is(.alert-destructive, .alert-success, .alert-warning, .alert-info) {
    background: color-mix(in oklab, var(--alert-accent) 10%, var(--background));
    border-color: color-mix(in oklab, var(--alert-accent) 45%, var(--background));
    color: var(--foreground);
  }
  :is(.alert-destructive, .alert-success, .alert-warning, .alert-info) > :is(section, p, .alert-description) { color: var(--foreground); }
  .alert-destructive { --alert-accent: var(--destructive); }
  .alert-success { --alert-accent: var(--success); }
  .alert-warning { --alert-accent: var(--warning); }
  .alert-info { --alert-accent: var(--info); }

  /* ---------- table */
  .table-container {
    position: relative;
    width: 100%;
    overflow: auto;
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-lg);
  }
  .table-container-flush { border: 0; border-radius: 0; }
  .table-container.table-scroll { max-height: calc(var(--size-control-lg) * 10); }
  .table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    caption-side: bottom;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    color: inherit;
  }
  .table caption { padding: var(--space-md); color: var(--muted-foreground); text-align: start; }
  .table :is(th, td) { padding: var(--space-base) var(--space-md); border-bottom: var(--size-border) solid var(--border); text-align: start; vertical-align: middle; }
  .table th {
    height: var(--size-control-lg);
    font-weight: var(--font-weight-medium);
    color: var(--muted-foreground);
    white-space: nowrap;
  }
  .table tbody tr { transition: background-color var(--duration-fast) var(--ease-standard); }
  .table tbody tr:hover { background: color-mix(in oklab, var(--foreground) 5%, transparent); }
  .table tbody tr[aria-selected="true"] { background: var(--accent); color: var(--accent-foreground); }
  /* row states: data-tone tints an error or warning row (event logs); data-state="muted" dims a dismissed or finished row */
  .table tbody tr[data-tone="destructive"] { background: color-mix(in oklab, var(--destructive) 10%, transparent); }
  .table tbody tr[data-tone="warning"] { background: color-mix(in oklab, var(--warning) 10%, transparent); }
  .table tbody tr[data-tone]:hover { background-image: linear-gradient(color-mix(in oklab, var(--foreground) 5%, transparent), color-mix(in oklab, var(--foreground) 5%, transparent)); }
  .table tbody tr[data-state="muted"] > :is(td, th) { opacity: 0.55; }
  .table-container .table tbody tr:last-child > :is(td, th) { border-bottom: 0; }
  .table tfoot :is(td, th) { border-top: var(--size-border) solid var(--border); border-bottom: 0; font-weight: var(--font-weight-medium); color: var(--foreground); }
  .table :is(th, td):is(.num, [data-numeric], .text-right) { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .table-striped tbody tr:nth-child(even) { background: var(--muted); }
  .table-compact :is(th, td) { padding-block: var(--space-xs); }
  .table-compact th { height: var(--size-control-md); }
  .table-sticky thead :is(th, td) {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--table-header-bg, var(--background));
  }
  /* Sortable column: <th aria-sort="ascending|descending|none"><button class="th-sort" aria-pressed>Name <svg
     class="sort-arrow"></button></th>. Also usable in any grid header. The app sorts; the kit only styles. The
     arrow shows on hover/focus while a column isn't sorted (always faintly on touch screens). */
  .th-sort {
    display: inline-flex; align-items: center; gap: var(--space-xs); min-width: 0; max-width: 100%;
    padding: 0; margin: 0; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; cursor: pointer;
    font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: inherit; white-space: nowrap;
  }
  .th-sort:hover, .th-sort[aria-pressed="true"] { color: var(--foreground); }
  .th-sort:focus-visible { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  .th-sort .sort-arrow { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }
  .th-sort .sort-arrow.idle { opacity: 0; transition: opacity var(--duration-fast) var(--ease-standard); }
  .th-sort:is(:hover, :focus-visible) .sort-arrow.idle { opacity: 0.6; }
  @media (hover: none) { .th-sort .sort-arrow.idle { opacity: 0.4; } }
  .table th[aria-sort] { padding-block: 0; }
  .table th:is(.num, [data-numeric], .text-right) .th-sort { flex-direction: row-reverse; }

  /* ---------- tabs: .tabs > [role=tablist] > [role=tab] + [role=tabpanel] */
  .tabs { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; }
  .tabs [role="tablist"] {
    position: relative;
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: var(--space-xs);
    max-width: 100%;
    padding: var(--space-xs);
    overflow-x: auto; scrollbar-width: thin;
    border-radius: var(--radius-md);
    background: var(--muted);
    color: var(--muted-foreground);
  }
  .tabs [role="tab"] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    height: calc(var(--size-control-md) - var(--space-sm));
    padding: 0 var(--space-md);
    border: var(--size-border) solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
  }
  .tabs [role="tab"]:hover { color: var(--foreground); }
  .tabs [role="tab"][aria-selected="true"] { background: var(--card); color: var(--card-foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
  .tabs [role="tab"]:disabled { opacity: 0.5; cursor: not-allowed; }
  .tabs [role="tab"]:focus-visible { outline-offset: 0; }
  .tabs-line [role="tablist"] { gap: var(--space-lg); padding: 0; border-radius: 0; background: transparent; box-shadow: inset 0 calc(var(--size-border) * -1) 0 var(--border); align-self: stretch; }
  .tabs-line [role="tab"] { height: var(--size-control-lg); padding: 0; border: 0; border-radius: 0; }
  .tabs-line [role="tab"][aria-selected="true"] { background: transparent; border: 0; box-shadow: inset 0 calc(var(--size-ring) * -1) 0 var(--brand); }
  .tabs [role="tabpanel"] { min-width: 0; border-radius: var(--radius-md); }

  /* ---------- accordion: .accordion > details > summary */
  .accordion { display: grid; min-width: 0; }
  .accordion details { border-bottom: var(--size-border) solid var(--border); }
  .accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-lg) 0;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-semibold);
    list-style: none;
    cursor: pointer;
  }
  .accordion summary::-webkit-details-marker { display: none; }
  .accordion summary:hover { text-decoration: underline; text-underline-offset: 0.2em; }
  .accordion summary::after {
    content: "";
    flex-shrink: 0;
    width: var(--size-icon);
    height: var(--size-icon);
    background: var(--muted-foreground);
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: rotate var(--duration-normal) var(--ease-standard);
  }
  .accordion details[open] > summary::after { rotate: 180deg; }
  .accordion details > :not(summary) { padding-bottom: var(--space-lg); font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }

  /* ---------- dialog: <dialog class="dialog"> header / section / footer */
  .dialog {
    position: fixed;
    width: calc(100% - var(--space-xl) * 2);
    max-width: calc(var(--size-sidebar) * 2);
    max-height: calc(100% - var(--space-3xl) * 2);
    margin: auto;
    padding: var(--space-xl);
    overflow: auto;
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-lg);
  }
  .dialog-lg { max-width: var(--size-container-narrow); }
  .dialog[open] { display: flex; flex-direction: column; gap: var(--space-lg); animation: kit-rise var(--duration-moderate) var(--ease-out); }
  .dialog::backdrop { background: var(--overlay); animation: kit-fade var(--duration-moderate) var(--ease-out); }
  :is(.dialog, .sheet) > header { display: grid; gap: var(--space-sm); padding-right: var(--space-xl); }
  :is(.dialog, .sheet) > header :is(h1, h2, h3) { font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--text-lg--line-height); letter-spacing: var(--tracking-normal); }
  :is(.dialog, .sheet) > header p { font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }
  :is(.dialog, .sheet) > section { font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  :is(.dialog, .sheet) > footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-base); }
  .dialog-close { position: absolute; top: var(--space-md); right: var(--space-md); }

  /* ---------- dropdown menu: .dropdown-menu > [aria-haspopup=menu] + [role=menu] > [role=menuitem] */
  .dropdown-menu { position: relative; display: inline-block; }
  .dropdown-menu [role="menu"] { position: absolute; top: calc(100% + var(--space-sm)); left: 0; }
  /* .menu[role=menu] is the same surface outside a .dropdown-menu, for an app that positions it itself (position: fixed) */
  :is(.dropdown-menu [role="menu"], .menu) {
    z-index: var(--z-dropdown);
    display: grid;
    min-width: calc(var(--size-sidebar) * 0.75);
    padding: var(--space-sm);
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-md);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
    animation: kit-fade var(--duration-fast) var(--ease-out);
  }
  .dropdown-menu[data-align="end"] [role="menu"] { left: auto; right: 0; }
  .dropdown-menu[data-side="top"] [role="menu"] { top: auto; bottom: calc(100% + var(--space-sm)); }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) {
    display: flex;
    align-items: center;
    gap: var(--space-base);
    width: 100%;
    min-height: var(--size-control-sm);
    padding: 0 var(--space-base);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    text-align: start;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
  }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]):is(:hover, :focus-visible) { background: var(--accent); color: var(--accent-foreground); }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]):focus-visible { outline-offset: calc(var(--size-ring) * -1); }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"])[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) svg { width: var(--size-icon); height: var(--size-icon); flex-shrink: 0; }
  /* a leading check for checked items; items that draw their own icon keep it instead */
  :is([role="menuitemcheckbox"], [role="menuitemradio"]):not(:has(svg))::before { content: ""; flex: none; width: var(--size-icon); height: var(--size-icon); }
  :is([role="menuitemcheckbox"], [role="menuitemradio"])[aria-checked="true"]:not(:has(svg))::before {
    background: currentColor;
    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='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  /* headless libraries (Radix, React Aria) mark the pointer/keyboard item with data-highlighted and a disabled one with data-disabled */
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"])[data-highlighted] { outline: none; background: var(--accent); color: var(--accent-foreground); }
  :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"])[data-disabled] { opacity: 0.5; pointer-events: none; }
  [role="menuitem"].menu-item-destructive, [role="menuitem"].menu-item-destructive[data-highlighted] { color: var(--destructive); }
  [role="menu"] :is(hr, [role="separator"]) { margin: var(--space-sm) calc(var(--space-sm) * -1); border: 0; border-top: var(--size-border) solid var(--border); }
  .menu-label { padding: var(--space-sm) var(--space-base); font-size: var(--text-xs); line-height: var(--text-xs--line-height); font-weight: var(--font-weight-semibold); color: var(--muted-foreground); }
  .menu-shortcut { margin-left: auto; padding-left: var(--space-lg); font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--muted-foreground); }
  [role^="menuitem"]:is(:hover, :focus-visible) .menu-shortcut { color: inherit; }

  /* ---------- tooltip: data-tooltip="Text" [data-side=top|bottom|left|right] */
  [data-tooltip] { position: relative; }
  [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + var(--space-base));
    left: 50%;
    z-index: var(--z-tooltip);
    width: max-content;
    max-width: var(--size-sidebar);
    padding: var(--space-sm) var(--space-base);
    border-radius: var(--radius-sm);
    background: var(--foreground);
    color: var(--background);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    line-height: var(--text-xs--line-height);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--tracking-normal);
    text-align: center;
    text-transform: none;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    translate: -50% var(--space-xs);
    transition: opacity var(--duration-fast) var(--ease-out), translate var(--duration-fast) var(--ease-out);
  }
  [data-tooltip]:is(:hover, :focus-visible)::after { opacity: 1; translate: -50% 0; }
  [data-tooltip][data-side="bottom"]::after { top: calc(100% + var(--space-base)); bottom: auto; translate: -50% calc(var(--space-xs) * -1); }
  [data-tooltip][data-side="bottom"]:is(:hover, :focus-visible)::after { translate: -50% 0; }
  [data-tooltip][data-side="left"]::after { top: 50%; right: calc(100% + var(--space-base)); bottom: auto; left: auto; translate: var(--space-xs) -50%; }
  [data-tooltip][data-side="right"]::after { top: 50%; left: calc(100% + var(--space-base)); bottom: auto; translate: calc(var(--space-xs) * -1) -50%; }
  [data-tooltip]:is([data-side="left"], [data-side="right"]):is(:hover, :focus-visible)::after { translate: 0 -50%; }
  /* .tooltip: the same bubble as an element, for a library that positions it (Radix Tooltip.Content) + svg.tooltip-arrow */
  .tooltip {
    z-index: var(--z-tooltip); width: max-content; max-width: var(--size-sidebar); padding: var(--space-sm) var(--space-base);
    border-radius: var(--radius-sm); background: var(--foreground); color: var(--background);
    font-family: var(--font-sans); font-size: var(--text-xs); line-height: var(--text-xs--line-height); font-weight: var(--font-weight-medium);
    letter-spacing: var(--tracking-normal); text-align: center; text-transform: none; white-space: normal; overflow-wrap: anywhere;
    animation: kit-fade var(--duration-fast) var(--ease-out);
  }
  .tooltip[data-state="closed"] { animation: kit-fade-out var(--duration-fast) var(--ease-in) forwards; }
  .tooltip-arrow { display: block; fill: var(--foreground); }

  /* ---------- toast: Kit.toast({ title, description, variant }), or a library's ol.toaster > li.toast[data-state=open|closed].
     The toaster sits above --action-bar-h, which an app with a bottom action bar sets on <html> from JS. */
  .toaster {
    position: fixed;
    right: var(--space-lg);
    bottom: calc(var(--action-bar-h, 0px) + var(--space-lg));
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-base);
    width: calc(100% - var(--space-lg) * 2);
    max-width: calc(var(--size-sidebar) * 1.4);
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
  }
  .toast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-xs) var(--space-md);
    padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    pointer-events: auto;
    animation: kit-rise var(--duration-moderate) var(--ease-out);
  }
  .toast[data-variant] { border-left: calc(var(--size-border) * 4) solid var(--toast-accent); }
  .toast[data-variant="success"] { --toast-accent: var(--success); }
  .toast[data-variant="destructive"] { --toast-accent: var(--destructive); }
  .toast[data-variant="warning"] { --toast-accent: var(--warning); }
  .toast[data-variant="info"] { --toast-accent: var(--info); }
  .toast-title { grid-column: 1; align-self: center; font-weight: var(--font-weight-semibold); }
  .toast-description { grid-column: 1; color: var(--muted-foreground); }
  .toast-close { grid-column: 2; grid-row: 1 / span 2; }
  .toast:is([data-state="closing"], [data-state="closed"]) { animation: kit-sink var(--duration-normal) var(--ease-in) forwards; }
  /* swipe to dismiss (Radix Toast sets data-swipe and its --radix-toast-swipe-* offsets) */
  .toast[data-swipe="move"] { translate: var(--radix-toast-swipe-move-x, 0) 0; }
  .toast[data-swipe="cancel"] { translate: 0 0; transition: translate var(--duration-fast) var(--ease-out); }
  .toast[data-swipe="end"] { animation: kit-swipe-out var(--duration-normal) var(--ease-in) forwards; }

  /* ---------- avatar */
  .avatar {
    --avatar-size: var(--size-avatar);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--avatar-size);
    height: var(--avatar-size);
    overflow: hidden;
    border-radius: var(--radius-full);
    background: var(--muted);
    color: var(--muted-foreground);
    font-family: var(--font-sans);
    font-size: calc(var(--avatar-size) * 0.4);
    line-height: 1;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    user-select: none;
  }
  .avatar img { width: 100%; height: 100%; object-fit: cover; }
  .avatar-sm { --avatar-size: var(--size-avatar-sm); }
  .avatar-lg { --avatar-size: var(--size-avatar-lg); }
  .avatar-group { display: inline-flex; }
  .avatar-group > .avatar { box-shadow: 0 0 0 var(--size-ring) var(--background); }
  .avatar-group > .avatar + .avatar { margin-left: calc(var(--space-base) * -1); }

  /* ---------- skeleton */
  .skeleton {
    display: block;
    min-height: var(--text-sm--line-height);
    border-radius: var(--radius-md);
    background: color-mix(in oklab, var(--foreground) 10%, transparent);
    animation: kit-pulse calc(var(--duration-slow) * 5) var(--ease-standard) infinite;
  }

  /* ---------- progress: <progress class="progress" value="40" max="100"> */
  .progress {
    appearance: none;
    display: block;
    width: 100%;
    height: var(--space-base);
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-full);
    background: color-mix(in oklab, var(--foreground) 12%, var(--background));
    color: var(--brand);
  }
  .progress::-webkit-progress-bar { background: transparent; }
  .progress::-webkit-progress-value { background: var(--brand); border-radius: var(--radius-full); transition: inline-size var(--duration-moderate) var(--ease-standard); }
  .progress::-moz-progress-bar { background: var(--brand); border-radius: var(--radius-full); }
  .progress:indeterminate {
    background-image: linear-gradient(90deg, transparent, var(--brand), transparent);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: kit-indeterminate calc(var(--duration-slow) * 4) var(--ease-standard) infinite;
  }
  .progress:indeterminate::-moz-progress-bar { background: transparent; }

  /* ---------- separator */
  .separator { flex-shrink: 0; width: 100%; height: var(--size-border); margin: 0; border: 0; background: var(--border); }
  .separator:is([aria-orientation="vertical"], .separator-vertical) { width: var(--size-border); height: auto; align-self: stretch; }

  /* ---------- breadcrumb: nav.breadcrumb > ol > li */
  .breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-base);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    color: var(--muted-foreground);
  }
  .breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-base); }
  .breadcrumb li + li::before { content: "/"; content: "/" / ""; color: var(--muted-foreground); }
  .breadcrumb a { color: inherit; text-decoration: none; border-radius: var(--radius-xs); }
  .breadcrumb a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 0.2em; }
  .breadcrumb [aria-current="page"] { color: var(--foreground); font-weight: var(--font-weight-medium); }

  /* ---------- pagination: nav.pagination > ul > li > a|button */
  .pagination ul { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
  .pagination :is(a, button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-width: var(--size-control-md);
    height: var(--size-control-md);
    padding: 0 var(--space-base);
    border: var(--size-border) solid transparent;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    cursor: pointer;
  }
  .pagination :is(a, button):hover { background: var(--accent); color: var(--accent-foreground); }
  .pagination [aria-current="page"] { border-color: var(--input); }
  .pagination [aria-disabled="true"], .pagination :disabled { opacity: 0.5; pointer-events: none; }
  .pagination .pagination-ellipsis { display: inline-flex; justify-content: center; min-width: var(--size-control-md); color: var(--muted-foreground); }

  /* ---------- navbar (top-nav) */
  .navbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-xl);
    min-width: 0;
    min-height: var(--size-navbar);
    padding: var(--space-md) var(--space-xl);
    border-bottom: var(--size-border) solid var(--border);
    background: var(--background);
    color: var(--foreground);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
  .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-base);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    line-height: var(--text-lg--line-height);
    font-weight: var(--font-weight-extrabold);
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
  }
  /* Never a scroll strip (hidden links go unnoticed): the links keep one row while it fits beside the brand, and the
     actions wrap below; on a row of its own the link row wraps. nav.js (1.8) adds a More menu instead. */
  .navbar-nav { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); min-width: min(100%, max-content); }
  .navbar-nav a {
    padding: var(--space-base) var(--space-md);
    border-radius: var(--radius-full);
    color: var(--foreground);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--duration-fast) var(--ease-standard);
  }
  .navbar-nav a:hover { background: var(--accent); color: var(--accent-foreground); }
  .navbar-nav a[aria-current="page"] { background: var(--secondary); color: var(--secondary-foreground); }
  .navbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--space-base); min-width: 0; max-width: 100%; margin-left: auto; }
  @media (max-width: 48rem) {
    .navbar { gap: var(--space-sm) var(--space-md); padding-inline: var(--space-lg); }
    /* brand and actions share the first row; the link row wraps below instead of shrinking into a scroll strip */
    .navbar-nav { order: 1; flex-basis: 100%; }
    /* tighter pills so five links fit a 375px phone; beyond that they wrap instead of hiding in a scroll strip */
    .navbar-nav a { padding-inline: var(--space-base); }
  }

  /* ---------- navbar overflow (nav.js): nav.js marks the bar data-nav-ready, keeps the links on one row and moves the
     ones that don't fit into .navbar-more, the kit's dropdown menu. Without nav.js the bar wraps (above). */
  .navbar[data-nav-ready] { flex-wrap: nowrap; }
  .navbar[data-nav-ready] > .navbar-nav[data-nav-overflow] { flex: 1 1 0; flex-wrap: nowrap; min-width: 0; }
  .navbar-more { flex: none; }
  .navbar-nav[data-nav-overflow] > [data-nav-moved] { display: none !important; }  /* in More (nav.js); the page's own hidden is separate */
  .navbar-more-toggle {
    display: inline-flex; align-items: center; gap: var(--space-sm); margin: 0; padding: var(--space-base) var(--space-md);
    border: 0; border-radius: var(--radius-full); background: transparent; color: var(--foreground);
    font: inherit; font-weight: var(--font-weight-medium); white-space: nowrap; cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard);
  }
  .navbar-more-toggle:is(:hover, [aria-expanded="true"]) { background: var(--accent); color: var(--accent-foreground); }
  .navbar-more[data-current] .navbar-more-toggle { background: var(--secondary); color: var(--secondary-foreground); }
  .navbar-more-toggle::after {
    content: ""; width: var(--size-icon-sm); height: var(--size-icon-sm); background: currentColor;
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .navbar-more-icon { display: none; }
  .navbar-more [role="menu"] { min-width: calc(var(--size-sidebar) * 0.75); }
  /* the bar is its own stacking context (sticky + z-index): lift it while its More menu is open, so the menu clears a
     sticky action bar (z-action-bar) */
  .navbar:has(.navbar-more-toggle[aria-expanded="true"]) { z-index: var(--z-portal); }
  /* tab-bar links carry an icon for the phone bar; above 48rem the top bar shows the label only (the More menu keeps it) */
  .navbar-tabbar > a > svg { display: none; }

  /* ---------- navbar search: .navbar-search > button.navbar-search-toggle + form.navbar-search-form[role=search] > input.
     Full width while there is room; nav.js collapses it to the toggle when the links need the space and on phones
     (data-search-collapsed on the bar), and the toggle opens it as a panel. data-hotkey="/" opens it from the keyboard. */
  .navbar-search { position: relative; display: flex; flex: 0 1 auto; align-items: center; width: calc(var(--space-4xl) * 2.6); min-width: calc(var(--space-4xl) * 1.6); }
  .navbar-search-form { display: flex; flex: 1 1 auto; min-width: 0; margin: 0; }
  .navbar-search-form .input { width: 100%; }
  .navbar-search-toggle { display: none; }
  /* collapsed, the search is positioned against the bar (not the toggle), so its panel always fits the screen */
  .navbar[data-search-collapsed] .navbar-search { position: static; flex: none; width: auto; min-width: 0; }
  .navbar[data-search-collapsed] .navbar-search-toggle { display: inline-flex; }
  .navbar[data-search-collapsed] .navbar-search:not([data-open]) .navbar-search-form { display: none; }
  .navbar[data-search-collapsed] .navbar-search[data-open] .navbar-search-form {
    position: absolute; top: calc(100% + var(--space-sm)); right: var(--space-lg); z-index: var(--z-dropdown);
    width: min(calc(var(--size-sidebar) * 1.5), calc(100% - var(--space-lg) * 2)); padding: var(--space-sm);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--popover); box-shadow: var(--shadow-md);
    animation: kit-fade var(--duration-fast) var(--ease-out);
  }

  /* ---------- navbar tab bar: .navbar-nav.navbar-tabbar (links <a><svg><span>Label</span></a>). Under 48rem the nav leaves the
     top bar and becomes a bar fixed to the bottom of the screen: equal tabs, icon over label, at most five with nav.js
     (More holds the rest). It sets --tabbar-offset so sticky bottom bars and toasts clear it, and pads the page. */
  @media (max-width: 48rem) {
    .navbar[data-nav-ready] { flex-wrap: wrap; }
    .navbar[data-nav-ready] > .navbar-nav[data-nav-overflow]:not(.navbar-tabbar) { flex: 1 0 100%; }
    body:has(.navbar-tabbar) { --tabbar-offset: calc(var(--size-tabbar) + env(safe-area-inset-bottom)); padding-bottom: var(--tabbar-offset); }
    body:has(.navbar-tabbar) .toaster { bottom: calc(var(--tabbar-offset) + var(--action-bar-h, 0px) + var(--space-lg)); }
    .navbar > .navbar-nav.navbar-tabbar {
      position: fixed; inset: auto 0 0; z-index: var(--z-sticky); order: 0; flex: none; flex-wrap: nowrap; gap: 0; min-width: 0;
      padding: 0 0 env(safe-area-inset-bottom); border-top: var(--size-border) solid var(--border); background: var(--background);
    }
    .navbar-tabbar > :is(a, .navbar-more) { flex: 1 1 0; min-width: 0; }
    .navbar-tabbar > a, .navbar-tabbar .navbar-more-toggle {
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs);
      width: 100%; min-height: var(--size-tabbar); padding: var(--space-sm) var(--space-xs); border-radius: 0;
      background: transparent; color: var(--muted-foreground); font-size: var(--text-xs); line-height: var(--text-xs--line-height);
      text-align: center; white-space: nowrap;
    }
    .navbar-tabbar > a:hover, .navbar-tabbar .navbar-more-toggle:is(:hover, [aria-expanded="true"]) { background: transparent; color: var(--foreground); }
    .navbar-tabbar > a[aria-current="page"], .navbar-tabbar .navbar-more[data-current] .navbar-more-toggle { background: transparent; color: var(--foreground); font-weight: var(--font-weight-semibold); }
    .navbar-tabbar > a > span, .navbar-tabbar .navbar-more-toggle > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .navbar-tabbar > a > svg, .navbar-tabbar .navbar-more-icon {
      display: block; flex: none; box-sizing: content-box; width: var(--size-icon); height: var(--size-icon);
      padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-pill); transition: background-color var(--duration-fast) var(--ease-standard);
    }
    .navbar-tabbar > a[aria-current="page"] > svg, .navbar-tabbar .navbar-more[data-current] .navbar-more-icon { background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); }
    .navbar-tabbar .navbar-more-toggle::after { display: none; }
    .navbar-tabbar :is(a, button):focus-visible { outline-offset: calc(var(--size-ring) * -1); }
    .navbar-tabbar .navbar-more [role="menu"] { bottom: calc(100% + var(--space-sm)); }
  }

  .footer {
    padding: var(--space-3xl) var(--space-xl);
    border-top: var(--size-border) solid var(--border);
    background: var(--background);
    color: var(--muted-foreground);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }

  /* ---------- sidebar + app shell */
  .app-shell { display: grid; grid-template-columns: var(--size-sidebar) minmax(0, 1fr); min-height: 100vh; }
  .app-main { min-width: 0; padding: var(--space-xl); }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    height: 100vh;
    overflow-y: auto;
    padding: var(--space-lg) var(--space-md);
    border-right: var(--size-border) solid var(--sidebar-border);
    background: var(--sidebar);
    color: var(--sidebar-foreground);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
  .navbar ~ .app-shell .sidebar, .navbar + .app-shell .sidebar { top: var(--size-navbar); height: calc(100vh - var(--size-navbar)); }
  .sidebar-header, .sidebar-footer { padding: 0 var(--space-base); }
  .sidebar-footer { margin-top: auto; }
  .sidebar nav, .sidebar-group { display: grid; gap: var(--space-xs); }
  .sidebar-group-label { padding: var(--space-sm) var(--space-base); font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-transform: uppercase; color: var(--muted-foreground); }
  .sidebar :is(a, button):not(.btn, [class*="btn-"]) {
    display: flex;
    align-items: center;
    gap: var(--space-base);
    width: 100%;
    min-height: var(--size-control-md);
    padding: 0 var(--space-base);
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    text-align: start;
    text-decoration: none;
    cursor: pointer;
  }
  .sidebar :is(a, button):not(.btn, [class*="btn-"]):hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
  .sidebar :is(a, button)[aria-current="page"] { background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); }
  .sidebar :focus-visible { outline-color: var(--sidebar-ring); }
  .sidebar svg { width: var(--size-icon); height: var(--size-icon); flex-shrink: 0; }

  @media (max-width: 48rem) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar, .navbar ~ .app-shell .sidebar, .navbar + .app-shell .sidebar { position: static; height: auto; border-right: 0; border-bottom: var(--size-border) solid var(--sidebar-border); }
    .sidebar nav, .sidebar-group { grid-auto-flow: column; justify-content: start; overflow-x: auto; scrollbar-width: thin; }
    .sidebar :is(a, button):not(.btn, [class*="btn-"]) { white-space: nowrap; }
    .sidebar-group-label { display: none; }
    .app-main { padding: var(--space-lg); }
  }

  /* ---------- stat / KPI card */
  .stat {
    display: grid;
    align-content: start;
    gap: var(--space-sm);
    min-width: 0;
    padding: var(--space-xl);
    border: var(--size-border) solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: var(--shadow-sm);
  }
  .stat-label { font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-transform: uppercase; color: var(--card-foreground); }
  .stat-value { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--text-2xl--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .stat-delta { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-semibold); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
  .stat-delta[data-trend="up"] { color: var(--success); }
  .stat-delta[data-trend="up"]::before { content: "\25B2"; content: "\25B2" / ""; font-size: 0.75em; }
  .stat-delta[data-trend="down"] { color: var(--destructive); }
  .stat-delta[data-trend="down"]::before { content: "\25BC"; content: "\25BC" / ""; font-size: 0.75em; }
  .stat-description { font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }
  /* the number is the call to action: data-tone colours the value only */
  .stat[data-tone="destructive"] .stat-value { color: var(--destructive); }
  .stat[data-tone="warning"] .stat-value { color: var(--warning); }
  .stat[data-tone="success"] .stat-value { color: var(--success); }
  .stat[data-tone="info"] .stat-value { color: var(--info); }
  .stat[data-tone="muted"] .stat-value { color: var(--muted-foreground); }

  /* ---------- reading patterns: layouts that read top to bottom (digests, reports, docs, dashboards) */
  .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--stat-min, var(--size-stat-min))), 1fr)); gap: var(--space-md); }
  .stat-grid:has(> .stat-compact) { --stat-min: calc(var(--size-stat-min) * 0.72); }
  .stat-compact { padding: var(--space-lg) var(--space-xl); }
  .stat-compact .stat-value { font-size: var(--text-xl); line-height: var(--text-xl--line-height); letter-spacing: var(--tracking-normal); }
  .stat-compact .stat-description { font-size: var(--text-xs); line-height: var(--text-xs--line-height); }

  .navbar-contained { padding-inline: max(var(--space-xl), (100% - var(--size-container)) / 2); }
  .navbar-contained-reading { padding-inline: max(var(--space-xl), (100% - var(--size-container-reading)) / 2); }
  :is(.navbar-contained, .navbar-contained-reading) .navbar-brand { margin-inline-end: auto; }

  .section-title {
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    margin: var(--space-3xl) 0 var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: var(--size-ring) solid var(--border);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    line-height: var(--text-xl--line-height);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--tracking-normal);
    scroll-margin-top: calc(var(--size-navbar) + var(--space-lg));
  }
  .section-title-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    line-height: var(--text-2xs--line-height);
    font-weight: var(--font-weight-regular);
    text-transform: uppercase;
    color: var(--muted-foreground);
  }

  .meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    line-height: var(--text-2xs--line-height);
    text-transform: uppercase;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
  }
  .meta-strip a { color: var(--brand); }

  .pill-nav { display: flex; flex-wrap: wrap; gap: var(--space-base); }
  .pill-nav a {
    display: inline-flex;
    align-items: center;
    height: var(--size-control-sm);
    padding: 0 var(--space-md);
    border: var(--size-border) solid var(--input);
    border-radius: var(--radius-pill);
    color: var(--foreground);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  }
  .pill-nav a:hover { background: var(--accent); color: var(--accent-foreground); }
  .pill-nav a[aria-current] { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
  .pill-nav a[aria-current]:hover { background: var(--primary-hover); }

  .list-numbered { display: grid; gap: var(--space-md); margin: 0; padding: 0; list-style: none; counter-reset: kit-n; }
  .list-numbered > li {
    display: grid;
    grid-template-columns: var(--space-xl) minmax(0, 1fr);
    gap: var(--space-md);
    counter-increment: kit-n;
  }
  .list-numbered > li::before {
    content: counter(kit-n, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: inherit;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
  }

  .callout {
    display: grid;
    gap: var(--space-xs);
    padding-left: var(--space-md);
    border-left: var(--size-ring) solid var(--brand);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
  .callout-label {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    line-height: var(--text-2xs--line-height);
    text-transform: uppercase;
    color: var(--brand);
  }

  .disclosure { font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  .disclosure > summary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    width: fit-content;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    list-style: none;
    cursor: pointer;
  }
  .disclosure > summary::-webkit-details-marker { display: none; }
  .disclosure > summary::after {
    content: "";
    width: var(--size-icon-sm);
    height: var(--size-icon-sm);
    background: currentColor;
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: rotate var(--duration-normal) var(--ease-standard);
  }
  .disclosure[open] > summary::after { rotate: 180deg; }
  .disclosure > :not(summary) { margin-top: var(--space-sm); color: var(--muted-foreground); }
  /* disclosure-plain: the body keeps the normal text colour (forms, notes) */
  .disclosure-plain > :not(summary) { color: inherit; }
  .disclosure > ul { display: grid; gap: var(--space-xs); padding-left: var(--space-lg); }
  .disclosure-warning > summary { color: var(--warning); }
  .disclosure-warning > summary::before {
    content: "";
    width: var(--size-icon-sm);
    height: var(--size-icon-sm);
    background: currentColor;
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 21h20z'/%3E%3Cpath d='M12 10v5M12 18h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .meter {
    display: inline-block;
    width: calc(var(--value, 0) * var(--size-meter));
    height: var(--size-meter-height);
    margin-left: var(--space-base);
    border-radius: var(--radius-full);
    background: var(--chart-1);
    vertical-align: middle;
  }

  /* ---------- poster cards (films, books, albums, products): a.poster-card > .poster > img (+ badges) and .poster-title,
     .poster-meta below. Lay them out in a .rail (one scrolling row) or a .poster-grid (wrapping, fills the width). */
  .poster-card { display: grid; gap: var(--space-base); align-content: start; min-width: 0; color: inherit; text-decoration: none; scroll-snap-align: start; }
  .poster-card .poster {
    position: relative; aspect-ratio: var(--poster-aspect, 2 / 3); overflow: hidden;
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card);
    transition: border-color var(--duration-normal) var(--ease-standard), translate var(--duration-normal) var(--ease-standard);
  }
  .poster-card .poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .poster-card .poster > :is([class^="badge"], [class*=" badge"]) { position: absolute; top: var(--space-base); left: var(--space-base); }
  .poster-card .poster > :is([class^="badge"], [class*=" badge"]) + :is([class^="badge"], [class*=" badge"]) { left: auto; right: var(--space-base); }
  :is(a, button, [role="button"]).poster-card { cursor: pointer; }
  button.poster-card { margin: 0; padding: 0; border: 0; background: none; font: inherit; text-align: start; }
  :is(a, button, [role="button"]).poster-card:is(:hover, :focus-visible) .poster { border-color: var(--brand); translate: 0 calc(var(--space-sm) * -1); }
  :is(a, button, [role="button"]).poster-card:focus-visible { outline: none; }
  :is(a, button, [role="button"]).poster-card:focus-visible .poster { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  .poster-card .poster-title {
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-semibold);
  }
  .poster-card .poster-meta { font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .poster-fallback { display: grid; place-items: center; height: 100%; padding: var(--space-md); text-align: center; color: var(--muted-foreground); font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  .rail {
    position: relative;
    display: grid; grid-auto-flow: column; grid-auto-columns: var(--poster-width, calc(var(--space-4xl) * 1.6)); gap: var(--space-lg);
    overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: var(--space-md);
  }
  .poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--poster-width, calc(var(--space-4xl) * 1.45)), 1fr)); gap: var(--space-xl) var(--space-lg); }
  .poster-grid > .empty { grid-column: 1 / -1; }
  @media (max-width: 40rem) {
    .rail { grid-auto-columns: var(--poster-width-sm, calc(var(--space-4xl) * 1.25)); gap: var(--space-md); }
    .poster-grid { grid-template-columns: repeat(auto-fill, minmax(var(--poster-width-sm, calc(var(--space-4xl) * 1.05)), 1fr)); gap: var(--space-lg) var(--space-md); }
  }
  @media (prefers-reduced-motion: reduce) { .poster-card .poster { transition: none; } :is(a, button, [role="button"]).poster-card:hover .poster { translate: none; } }
  /* poster with quick actions: .poster-item > a.poster-card + .poster-actions > button.btn-icon[aria-pressed] (say,
     "add to watchlist"). The actions sit over the poster's bottom-right corner, outside the link. */
  .poster-item { position: relative; min-width: 0; scroll-snap-align: start; }
  .poster-actions {
    position: absolute; top: 0; left: 0; right: 0; aspect-ratio: var(--poster-aspect, 2 / 3); display: flex; align-items: flex-end; justify-content: flex-end;
    gap: var(--space-xs); padding: var(--space-base); pointer-events: none; transition: translate var(--duration-normal) var(--ease-standard);
  }
  .poster-actions > * { pointer-events: auto; }
  .poster-item:has(> :is(a, button, [role="button"]).poster-card:is(:hover, :focus-visible)) .poster-actions { translate: 0 calc(var(--space-sm) * -1); }
  .poster-actions [aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary-border); }
  .poster-actions [aria-pressed="true"] svg { fill: currentColor; }
  @media (prefers-reduced-motion: reduce) {
    .poster-actions { transition: none; }
    .poster-item:has(> :is(a, button, [role="button"]).poster-card:hover) .poster-actions { translate: none; }
  }
  /* how much of it was watched: <progress class="progress poster-progress" max="1" value="0.4"> inside .poster */
  .poster-progress, .media-progress { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: var(--space-xs); border-radius: 0; }

  /* ---------- media cards (an episode, something to resume): a.media-card > .media-thumb > img (+ .media-play,
     .media-badge, progress.media-progress) and .media-body > .media-title, .media-meta. 16:9, in a .media-rail. */
  .media-rail {
    position: relative;
    display: grid; grid-auto-flow: column; grid-auto-columns: var(--media-width, calc(var(--space-4xl) * 3.4)); gap: var(--space-lg);
    overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: var(--space-sm);
  }
  @media (max-width: 40rem) { .media-rail { grid-auto-columns: var(--media-width-sm, 78%); gap: var(--space-md); } }
  .media-card { display: grid; gap: var(--space-base); align-content: start; min-width: 0; color: inherit; text-decoration: none; scroll-snap-align: start; }
  .media-thumb {
    position: relative; aspect-ratio: 16 / 9; overflow: hidden;
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card);
    transition: border-color var(--duration-fast) var(--ease-standard);
  }
  .media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
  a.media-card:is(:hover, :focus-visible) .media-thumb { border-color: var(--brand); }
  a.media-card:focus-visible { outline: none; }
  a.media-card:focus-visible .media-thumb { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  .media-play {
    position: absolute; inset: 0; display: grid; place-items: center; color: var(--foreground); opacity: 0;
    background: color-mix(in oklab, var(--background) 45%, transparent); transition: opacity var(--duration-fast) var(--ease-standard);
  }
  .media-play svg { width: var(--space-2xl); height: var(--space-2xl); }
  a:is(:hover, :focus-visible) .media-play { opacity: 1; }
  @media (hover: none) {
    .media-play { opacity: 1; background: transparent; }
    .media-play svg { width: var(--space-xl); height: var(--space-xl); filter: drop-shadow(0 0 var(--space-sm) var(--background)); }
  }
  .media-badge { position: absolute; top: var(--space-base); right: var(--space-base); }
  .media-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--font-weight-semibold); }
  .media-meta { font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }

  /* ---------- episode list: .episode-list > article.episode[data-watched] > .episode-thumb (img, .media-play,
     progress.media-progress) + .episode-body (.episode-title, meta, .episode-overview) + .episode-actions */
  .episode-list { display: grid; gap: var(--space-base); }
  .episode {
    display: grid; grid-template-columns: calc(var(--space-4xl) * 2.2) minmax(0, 1fr) auto; gap: var(--space-lg); align-items: center;
    padding: var(--space-md); border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card);
  }
  .episode-thumb {
    position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
    border: var(--size-border) solid transparent; border-radius: var(--radius-md); background: var(--muted);
  }
  .episode-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
  a.episode-thumb:is(:hover, :focus-visible) { border-color: var(--brand); }
  .episode-title { font-weight: var(--font-weight-semibold); }
  .episode-overview { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted-foreground); }
  .episode-actions { display: flex; align-items: center; gap: var(--space-sm); }
  .episode-actions [aria-pressed="true"] { color: var(--success); }
  .episode[data-watched="true"] .episode-thumb img { opacity: 0.55; }
  .episode[data-watched="true"] .episode-title { color: var(--muted-foreground); }
  @media (max-width: 40rem) {
    .episode { grid-template-columns: calc(var(--space-4xl) * 1.3) minmax(0, 1fr); gap: var(--space-md); }
    .episode-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .episode-overview { display: none; }
  }

  /* ---------- video player chrome: .player[data-theme=dark][data-idle][data-paused][aria-busy] > video.player-video,
     .player-subs (cues as spans), .player-busy, .player-top, .player-center, .player-end > .player-card, .player-resume,
     .player-bottom > .player-scrub > input.player-range (--played, --buffered) + .player-hover, and .player-bar of
     btn-ghost btn-icon buttons and dropdown-menu[data-side=top]. Stage is --sidebar, the kit's one pure black. */
  .player { position: fixed; inset: 0; z-index: var(--z-overlay); overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; background: var(--sidebar); color: var(--foreground); }
  .player-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--sidebar); }
  .player-top, .player-bottom {
    position: absolute; left: 0; right: 0; z-index: 2; padding: var(--space-lg) var(--space-xl);
    transition: opacity var(--duration-normal) var(--ease-standard), translate var(--duration-normal) var(--ease-standard);
  }
  .player-top { top: 0; display: flex; align-items: center; gap: var(--space-md); padding-bottom: var(--space-3xl); background: linear-gradient(180deg, color-mix(in oklab, var(--sidebar) 85%, transparent), transparent); }
  .player-bottom { bottom: 0; display: grid; gap: var(--space-sm); padding-top: var(--space-3xl); background: linear-gradient(0deg, color-mix(in oklab, var(--sidebar) 90%, transparent), transparent); }
  .player[data-idle="true"] { cursor: none; }
  .player[data-idle="true"] :is(.player-top, .player-bottom, .player-center) { opacity: 0; pointer-events: none; }
  .player[data-idle="true"] .player-top { translate: 0 calc(var(--space-md) * -1); }
  .player[data-idle="true"] .player-bottom { translate: 0 var(--space-md); }
  .player-heading { flex: 1 1 auto; min-width: 0; }
  .player-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); }
  .player-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
  .player-center {
    position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 2; display: grid; place-items: center;
    width: calc(var(--space-4xl) * 1.2); aspect-ratio: 1; border: 0; border-radius: var(--radius-full); cursor: pointer;
    background: color-mix(in oklab, var(--sidebar) 55%, transparent); color: var(--foreground); transition: opacity var(--duration-normal) var(--ease-standard);
  }
  .player-center svg { width: var(--space-2xl); height: var(--space-2xl); }
  .player:is([data-paused="false"], [aria-busy="true"]) .player-center { opacity: 0; pointer-events: none; }
  .player-busy { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 3; display: grid; justify-items: center; gap: var(--space-md); color: var(--muted-foreground); pointer-events: none; }
  .player-busy .spinner { width: var(--space-2xl); height: var(--space-2xl); }
  .player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
  .player-bar .btn-ghost { color: var(--foreground); }
  .player-time { padding-inline: var(--space-sm); white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
  .player-time > :first-child { color: var(--foreground); }
  .player-vol { display: inline-flex; align-items: center; }
  .player-volume { width: calc(var(--space-4xl) * 0.9); accent-color: var(--brand); }
  .player-scrub { position: relative; }
  .player-range {
    -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--space-lg); margin: 0; background: transparent; cursor: pointer;
    --played: 0%; --buffered: 0%;
    --track: linear-gradient(90deg, var(--brand) var(--played), color-mix(in oklab, var(--foreground) 35%, transparent) var(--played),
      color-mix(in oklab, var(--foreground) 35%, transparent) var(--buffered), color-mix(in oklab, var(--foreground) 15%, transparent) var(--buffered));
  }
  .player-range::-webkit-slider-runnable-track { height: var(--space-xs); border-radius: var(--radius-full); background: var(--track); }
  .player-range::-moz-range-track { height: var(--space-xs); border-radius: var(--radius-full); background: var(--track); }
  .player-range::-webkit-slider-thumb { -webkit-appearance: none; width: var(--space-md); height: var(--space-md); margin-top: calc((var(--space-xs) - var(--space-md)) / 2); border: 0; border-radius: var(--radius-full); background: var(--brand); }
  .player-range::-moz-range-thumb { width: var(--space-md); height: var(--space-md); border: 0; border-radius: var(--radius-full); background: var(--brand); }
  .player-hover {
    position: absolute; bottom: calc(100% + var(--space-xs)); left: var(--x, 0%); translate: -50% 0; padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm); background: var(--popover); color: var(--popover-foreground); pointer-events: none; font-variant-numeric: tabular-nums;
  }
  .player [role="menu"] { max-height: min(70vh, calc(var(--space-4xl) * 7)); overflow-y: auto; min-width: calc(var(--space-4xl) * 2.6); }
  .player [role="menuitemradio"] { text-align: start; }
  .menu-note { display: block; font-size: var(--text-xs); line-height: var(--text-xs--line-height); font-weight: var(--font-weight-regular); color: var(--muted-foreground); }
  .menu-info { max-width: calc(var(--space-4xl) * 3.2); padding: var(--space-sm) var(--space-base); overflow-wrap: anywhere; color: var(--muted-foreground); }
  .player-subs {
    position: absolute; left: 5%; right: 5%; bottom: 7%; z-index: 1; display: grid; justify-items: center; gap: var(--space-xs);
    text-align: center; pointer-events: none; transition: bottom var(--duration-normal) var(--ease-standard);
    --sub-size: clamp(var(--text-base), 2.6vw, var(--text-2xl)); font-size: var(--sub-size); line-height: 1.3; font-weight: var(--font-weight-semibold);
  }
  .player[data-idle="false"] .player-subs { bottom: calc(var(--space-4xl) * 1.5); }
  .player-subs span { padding: var(--space-xs) var(--space-base); border-radius: var(--radius-sm); background: color-mix(in oklab, var(--sidebar) 72%, transparent); color: var(--foreground); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  .player[data-subsize="s"] .player-subs { --sub-size: clamp(var(--text-sm), 2vw, var(--text-xl)); }
  .player[data-subsize="l"] .player-subs { --sub-size: clamp(var(--text-lg), 3.3vw, var(--text-3xl)); }
  .player[data-subsize="xl"] .player-subs { --sub-size: clamp(var(--text-xl), 4.2vw, calc(var(--text-3xl) * 1.3)); }
  .player-end { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: var(--space-xl); background: color-mix(in oklab, var(--sidebar) 60%, transparent); }
  .player-end:has(.player-next) { place-items: end; padding-bottom: calc(var(--space-4xl) * 1.6); background: transparent; pointer-events: none; }
  .player-end:has(.player-next) .player-card { pointer-events: auto; }
  .player-card { max-width: var(--size-container-narrow); padding: var(--space-xl); border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground); }
  .player-next { display: flex; align-items: center; gap: var(--space-lg); max-width: calc(var(--space-4xl) * 6); }
  .player-next img { width: calc(var(--space-4xl) * 1.8); aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); }
  .player-resume {
    position: absolute; left: var(--space-xl); bottom: calc(var(--space-4xl) * 1.6); z-index: 3; display: flex; align-items: center; gap: var(--space-md);
    padding: var(--space-base) var(--space-md); border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card);
  }
  .player :is(.player-busy, .player-end, .player-resume, .player-hover, [role="menu"])[hidden] { display: none; }
  @media (max-width: 40rem) {
    .player-top, .player-bottom { padding-inline: var(--space-md); }
    .player-volume, .player-bar .player-optional { display: none; }
    .player-next img { display: none; }
  }
  @media (prefers-reduced-motion: reduce) { .player-top, .player-bottom, .player-subs, .player-center { transition: none; } }

  /* ---------- thumbnails: .thumb > img, a fixed-width cropped frame (4:5 by default, the shape of a feed post);
     -sm / -lg sizes, -square / -wide (16:9) / -tall (9:16) shapes. Works alone, in a table cell or in an .item row. */
  .thumb {
    position: relative; display: block; flex: none; width: var(--thumb-width, var(--space-4xl)); aspect-ratio: 4 / 5;
    overflow: hidden; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); text-decoration: none;
  }
  .thumb :is(img, video) { display: block; width: 100%; height: 100%; object-fit: cover; }
  .thumb-sm { --thumb-width: var(--space-3xl); border-radius: var(--radius-sm); }
  .thumb-lg { --thumb-width: calc(var(--space-4xl) * 1.6); }
  .thumb-square { aspect-ratio: 1; }
  .thumb-wide { aspect-ratio: 16 / 9; }
  .thumb-tall { aspect-ratio: 9 / 16; }
  a.thumb:is(:hover, :focus-visible) { outline: var(--size-ring) solid var(--brand); outline-offset: var(--size-ring-offset); }
  @media (max-width: 40rem) {
    .thumb { --thumb-width: calc(var(--space-3xl) * 1.5); }
    .thumb-sm { --thumb-width: var(--space-3xl); }
    .thumb-lg { --thumb-width: var(--space-4xl); }
  }

  /* ---------- list rows: .item-list > .item > .thumb + .item-body (.item-title, .item-meta, anything) + .item-actions.
     Divided rows by default; .item-list-cards makes each row a card. data-unread="true" marks a row not seen yet with a
     brand edge (say so in text too, e.g. in the meta line). */
  .item-list { display: grid; margin: 0; padding: 0; list-style: none; }
  .item-list > .item + .item { border-top: var(--size-border) solid var(--border); }
  .item { display: flex; align-items: flex-start; gap: var(--space-lg); min-width: 0; padding-block: var(--space-md); }
  .item-body { display: grid; align-content: start; gap: var(--space-xs); flex: 1 1 0%; min-width: 0; }
  /* rows often put the title in an h3: reset the heading face (Plus Jakarta ships 700–800 only) */
  .item-title { font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-normal); overflow-wrap: anywhere; }
  .item-title a { color: inherit; text-decoration: none; }
  .item-title a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
  .item-meta { font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }
  .item-actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
  .item-list-cards { gap: var(--space-md); }
  .item-list-cards > .item {
    padding: var(--space-md); border: var(--size-border) solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--card-foreground);
  }
  .item[data-unread="true"] { border-inline-start: calc(var(--size-ring) * 2) solid var(--brand); padding-inline-start: var(--space-md); }
  @media (max-width: 40rem) {
    .item { flex-wrap: wrap; gap: var(--space-md); }
    .item-actions { flex-basis: 100%; justify-content: flex-end; }
  }

  /* ---------- description list: dl.desc-list > div > dt + dd. Labelled facts in a grid that fills the width;
     .desc-list-rows puts each pair on its own divided row (label left) for longer values. */
  .desc-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--size-stat-min)), 1fr));
    gap: var(--space-md) var(--space-xl); margin: 0;
  }
  .desc-list > div { display: grid; align-content: start; gap: var(--space-xs); min-width: 0; }
  .desc-list dt { font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-transform: uppercase; color: var(--muted-foreground); }
  .desc-list dd { margin: 0; font-size: var(--text-sm); line-height: var(--text-sm--line-height); overflow-wrap: anywhere; }
  .desc-list-rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .desc-list-rows > div { grid-template-columns: calc(var(--space-4xl) * 1.25) minmax(0, 1fr); align-items: baseline; gap: var(--space-md); padding-block: var(--space-base); }
  .desc-list-rows > div + div { border-top: var(--size-border) solid var(--border); }
  @media (max-width: 40rem) { .desc-list-rows > div { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); } }

  /* ---------- media frame: video.media-frame / img.media-frame, shown whole (not cropped) at the column's width on
     the kit's black, e.g. a clip beside its notes. Full-screen viewing is the .player. */
  .media-frame { display: block; width: 100%; height: auto; border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--sidebar); }

  /* ---------- empty state */
  .empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-3xl) var(--space-xl);
    border: var(--size-border) dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
  }
  .empty-icon { display: grid; place-items: center; width: var(--space-3xl); height: var(--space-3xl); border-radius: var(--radius-md); background: var(--muted); color: var(--foreground); }
  .empty-icon svg { width: var(--size-control-sm); height: var(--size-control-sm); }
  .empty-title { margin: 0; font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-normal); }
  .empty-description { max-width: calc(var(--size-sidebar) * 1.5); margin: 0; font-size: var(--text-sm); line-height: var(--text-sm--line-height); color: var(--muted-foreground); }
  .empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-base); margin-top: var(--space-sm); }

  /* ---------- kbd */
  .kbd {
    display: inline-flex;
    align-items: center;
    height: calc(var(--size-chip) - var(--space-sm));
    padding: 0 var(--space-sm);
    border: var(--size-border) solid var(--border);
    border-bottom-width: calc(var(--size-border) * 2);
    border-radius: var(--radius-sm);
    background: var(--muted);
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    line-height: 1;
  }

  /* ============ 1.6 app patterns (promoted from the fasting-plan app). CSS only: state comes from attributes. */

  /* ---------- tab bar: .sidebar.sidebar-tabbar in an .app-shell. From 48rem a normal sidebar; below it a bar fixed to
     the bottom of the screen whose nav links become equal-width tabs, icon over a short label (<a><svg><span>Today</span></a>).
     The header, footer and group labels hide. --tabbar-offset (set on the app shell) lifts sticky bottom bars above it. */
  @media (max-width: 48rem) {
    .app-shell:has(> .sidebar-tabbar) { --tabbar-offset: calc(var(--size-tabbar) + env(safe-area-inset-bottom)); }
    .app-shell:has(> .sidebar-tabbar) > .app-main { padding-bottom: calc(var(--tabbar-offset) + var(--space-lg)); }
    .sidebar.sidebar-tabbar, .navbar ~ .app-shell .sidebar.sidebar-tabbar, .navbar + .app-shell .sidebar.sidebar-tabbar {
      position: fixed; inset: auto 0 0; z-index: var(--z-sticky); flex-direction: row; gap: 0; height: auto; overflow: visible;
      padding: 0 0 env(safe-area-inset-bottom); border-right: 0; border-bottom: 0; border-top: var(--size-border) solid var(--sidebar-border);
    }
    /* !important: a layout utility on these parts (sidebar-header cluster) sits in a later layer and would show them */
    .sidebar-tabbar :is(.sidebar-header, .sidebar-footer, .sidebar-group-label) { display: none !important; }
    .sidebar-tabbar :is(nav, .sidebar-group) { display: flex; flex: 1 1 auto; gap: 0; min-width: 0; overflow: visible; }
    .sidebar-tabbar nav :is(a, button):not(.btn, [class*="btn-"]) {
      flex: 1 1 0; flex-direction: column; justify-content: center; gap: var(--space-xs); min-width: 0; min-height: var(--size-tabbar);
      padding: var(--space-sm) var(--space-xs); border-radius: 0; color: var(--muted-foreground);
      font-size: var(--text-xs); line-height: var(--text-xs--line-height); text-align: center; white-space: nowrap;
    }
    .sidebar-tabbar nav :is(a, button):not(.btn, [class*="btn-"]):hover { background: transparent; color: var(--sidebar-foreground); }
    .sidebar-tabbar nav :is(a, button)[aria-current="page"] { background: transparent; color: var(--sidebar-foreground); font-weight: var(--font-weight-semibold); }
    .sidebar-tabbar nav :is(a, button) > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-tabbar nav :is(a, button) svg { box-sizing: content-box; padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-pill); transition: background-color var(--duration-fast) var(--ease-standard); }
    .sidebar-tabbar nav :is(a, button)[aria-current="page"] svg { background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); }
    .sidebar-tabbar nav :is(a, button):focus-visible { outline-offset: calc(var(--size-ring) * -1); }
    body:has(.sidebar-tabbar) .toaster { bottom: calc(var(--size-tabbar) + env(safe-area-inset-bottom) + var(--action-bar-h, 0px) + var(--space-lg)); }
  }

  /* ---------- div overlays (when the top layer of showModal() would make a floating bar inert):
     .dialog-backdrop > .dialog[role=dialog][aria-modal=true], .sheet-backdrop > .sheet. Hide with the hidden attribute. */
  :is(.dialog-backdrop, .sheet-backdrop) { position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; overflow: auto; background: var(--overlay); animation: kit-fade var(--duration-moderate) var(--ease-out); }
  .dialog-backdrop { align-items: center; justify-content: center; padding: var(--space-xl); }
  .dialog-backdrop > .dialog { position: relative; display: flex; flex-direction: column; gap: var(--space-lg); width: 100%; max-height: 100%; margin: auto; animation: kit-rise var(--duration-moderate) var(--ease-out); }
  .sheet-backdrop { justify-content: flex-end; }

  /* ---------- sheet: a right-hand drawer, <dialog class="sheet"> or .sheet-backdrop > .sheet, width --sheet-w (sheet-lg
     wider), with the dialog's header / section / footer. Below 48rem every sheet is a bottom sheet (full width, rounded top,
     slides up). <dialog class="dialog sheet"> stays a centred dialog from 48rem and is a bottom sheet only on phones. */
  .sheet:not(.dialog) {
    position: fixed; inset: 0 0 0 auto; width: min(100%, var(--sheet-w, calc(var(--size-sidebar) * 1.5))); max-width: 100%; height: 100%; max-height: 100%;
    margin: 0 0 0 auto; padding: var(--space-xl); overflow: auto; border: 0; border-left: var(--size-border) solid var(--border); border-radius: 0;
    background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-lg);
  }
  .sheet-lg { --sheet-w: calc(var(--size-sidebar) * 2.5); }
  .sheet:not(.dialog):is([open], .sheet-backdrop > *) { display: flex; flex-direction: column; gap: var(--space-lg); animation: kit-drawer var(--duration-moderate) var(--ease-out); }
  .sheet-backdrop > .sheet { position: relative; inset: auto; flex: none; }
  .sheet::backdrop { background: var(--overlay); animation: kit-fade var(--duration-moderate) var(--ease-out); }
  @media (max-width: 48rem) {
    :is(.sheet:not(.dialog), .dialog.sheet) {
      inset: auto 0 0; width: 100%; max-width: none; height: auto; max-height: calc(100% - var(--space-4xl)); margin: auto 0 0;
      padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
      border: var(--size-border) solid var(--border); border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    :is(.sheet:not(.dialog), .dialog.sheet):is([open], .sheet-backdrop > *) { animation: kit-sheet var(--duration-moderate) var(--ease-out); }
    :is(.sheet:not(.dialog), .dialog.sheet)::before { content: ""; flex: none; align-self: center; width: var(--space-2xl); height: var(--space-xs); margin-top: calc(var(--space-sm) * -1); border-radius: var(--radius-full); background: var(--border); }
    .sheet-backdrop { align-items: flex-end; }
  }

  /* ---------- docked aside (1.9): .app-shell.app-shell-aside[data-aside=open|closed] > .sidebar + .app-main + aside.app-aside
     (> .app-aside-header, .app-aside-body, .app-aside-footer) + button.app-aside-tab. Non-modal and CSS only: the app
     toggles data-aside and moves focus. From 70rem a third grid column, sticky at full viewport height (below a navbar),
     only its body scrolls; the toaster and a floating action bar move left of it. Under 70rem a full-height panel over
     the page from the right (no backdrop, no scroll lock); under 48rem a bottom sheet. Width: size-aside (app-aside-lg:
     size-aside-lg), or --aside-w set on <html>. data-aside=closed hides it and shows app-aside-tab on the right edge. */
  .app-aside {
    --chat-composer-bg: var(--background);
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    border-left: var(--size-border) solid var(--border); background: var(--background); color: var(--foreground);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height);
  }
  .app-shell-aside[data-aside="closed"] > .app-aside { display: none; }
  .app-aside-header {
    display: flex; flex: none; align-items: center; gap: var(--space-sm); min-height: var(--size-navbar);
    padding: var(--space-sm) var(--space-md) var(--space-sm) var(--space-lg); border-bottom: var(--size-border) solid var(--border);
  }
  .app-aside-header > :is(h1, h2, h3, h4) {
    flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-normal);
  }
  .app-aside-header > :is(.select, select) { flex: 0 1 auto; width: auto; min-width: 0; height: var(--size-control-sm); }
  .app-aside-body { flex: 1 1 auto; min-height: 0; padding: var(--space-lg); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .app-aside-body .chat-msg { max-width: 92%; }
  .app-aside-footer { flex: none; padding: var(--space-sm) var(--space-lg) var(--space-md); border-top: var(--size-border) solid var(--border); }
  .app-aside-footer > .chat-composer { position: static; padding-block: 0; }
  .app-aside-tab {
    position: fixed; top: 50%; right: 0; z-index: var(--z-sticky);
    display: none; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-sm);
    border: var(--size-border) solid var(--border); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: var(--card); color: var(--card-foreground); box-shadow: var(--shadow-md);
    font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-semibold);
    writing-mode: vertical-rl; translate: 0 -50%; cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard);
  }
  .app-aside-tab:hover { background: var(--accent); color: var(--accent-foreground); }
  .app-aside-tab svg { width: var(--size-icon); height: var(--size-icon); flex: none; }
  .app-shell-aside[data-aside="closed"] > .app-aside-tab { display: inline-flex; }
  /* keep page content clear of the closed tab (its width: one line of text-sm plus padding and border) */
  @media (min-width: 48rem) {
    .app-shell-aside[data-aside="closed"] > .app-main { padding-right: calc(var(--space-xl) + var(--text-sm--line-height) + var(--space-sm) * 2 + var(--size-border)); }
  }
  @media (min-width: 70rem) {
    :root:has(.app-shell-aside:not([data-aside="closed"]) > .app-aside) { --aside-offset: var(--aside-w, var(--size-aside)); }
    :root:has(.app-shell-aside:not([data-aside="closed"]) > .app-aside-lg) { --aside-offset: var(--aside-w, var(--size-aside-lg)); }
    .app-shell-aside:not([data-aside="closed"]) { grid-template-columns: var(--size-sidebar) minmax(0, 1fr) var(--aside-offset); }
    .app-shell-aside:not([data-aside="closed"]):not(:has(> .sidebar)) { grid-template-columns: minmax(0, 1fr) var(--aside-offset); }
    .app-shell-aside > .app-aside { position: sticky; top: 0; grid-row: 1; grid-column: -2 / -1; height: 100vh; }
    .navbar ~ .app-shell-aside > .app-aside { top: var(--size-navbar); height: calc(100vh - var(--size-navbar)); }
    .toaster { right: calc(var(--aside-offset, 0px) + var(--space-lg)); }
    .action-bar-floating { left: calc((100% - var(--aside-offset, 0px)) / 2); max-width: calc(100% - var(--aside-offset, 0px) - var(--space-lg) * 2); }
  }
  @media (width < 70rem) {
    .app-aside {
      position: fixed; inset: 0 0 0 auto; z-index: var(--z-overlay); width: min(100%, var(--aside-w, var(--size-aside))); height: 100%;
      box-shadow: var(--shadow-lg); animation: kit-drawer var(--duration-moderate) var(--ease-out);
    }
    .app-aside-lg { width: min(100%, var(--aside-w, var(--size-aside-lg))); }
  }
  @media (max-width: 48rem) {
    .app-aside, .app-aside-lg {
      inset: auto 0 0; width: 100%; height: calc(100% - var(--space-4xl)); overflow: hidden;
      border: var(--size-border) solid var(--border); border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      animation: kit-sheet var(--duration-moderate) var(--ease-out);
    }
    .app-aside::before { content: ""; flex: none; align-self: center; width: var(--space-2xl); height: var(--space-xs); margin-top: var(--space-sm); border-radius: var(--radius-full); background: var(--border); }
    .app-aside-footer { padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); }
    .app-aside-tab { top: auto; bottom: calc(var(--tabbar-offset, 0px) + var(--space-4xl)); translate: none; }
  }

  /* ---------- segmented control: .segmented[role=group] > button[aria-pressed], or [role=radiogroup] > [role=radio][aria-checked].
     A muted pill track at btn-sm height, the selected button on card + border; it wraps when narrow. segmented-sm is
     chip height; segmented-block fills the width with equal buttons. */
  .segmented {
    --seg-h: var(--size-control-sm);
    display: inline-flex; flex-wrap: wrap; align-items: center; align-self: flex-start; justify-self: start; gap: var(--space-xs); max-width: 100%; padding: var(--space-xs);
    border-radius: calc(var(--seg-h) / 2); background: var(--muted); color: var(--muted-foreground); vertical-align: middle;
  }
  .segmented-sm { --seg-h: var(--size-chip); }
  .segmented > :is(button, a, [role="radio"]) {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    height: calc(var(--seg-h) - var(--space-xs) * 2); padding: 0 var(--space-md);
    border: var(--size-border) solid transparent; border-radius: var(--radius-pill); background: transparent; color: inherit;
    font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
  }
  .segmented > :is(button, a, [role="radio"]):hover { color: var(--foreground); }
  .segmented > :is([aria-pressed="true"], [aria-checked="true"], [aria-current]:not([aria-current="false"])) { background: var(--card); color: var(--card-foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
  .segmented > :is(button, a, [role="radio"]):is(:disabled, [aria-disabled="true"]) { opacity: 0.5; cursor: not-allowed; }
  .segmented > :focus-visible { outline-offset: 0; }
  .segmented svg { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }
  .segmented-block { display: flex; align-self: stretch; justify-self: stretch; width: 100%; }
  .segmented-block > * { flex: 1 1 0; min-width: 0; }
  .segmented-sm > :is(button, a, [role="radio"]) { padding: 0 var(--space-base); font-size: var(--text-xs); line-height: var(--text-xs--line-height); }

  /* ---------- chat: .chat-log > .chat-msg[data-role=user|assistant] > .chat-bubble (+ .chat-meta); .chat-typing (one empty
     element, three dots); .chat-composer > textarea + send btn-icon (+ .chat-composer-hint); .chat-suggestions > .chip */
  .chat-log { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }
  .chat-msg { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xs); min-width: 0; max-width: min(88%, calc(var(--size-sidebar) * 2.5)); }
  .chat-msg[data-role="user"] { align-self: flex-end; align-items: flex-end; }
  .chat-msg[data-role="assistant"] { align-self: flex-start; }
  .chat-bubble {
    max-width: 100%; min-width: 0; padding: var(--space-base) var(--space-md);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height); overflow-wrap: anywhere;
  }
  .chat-bubble > * + * { margin-top: var(--space-sm); }
  .chat-bubble :is(ul, ol) { margin-block: 0; padding-left: var(--space-lg); }
  .chat-msg[data-role="assistant"] .chat-bubble { border-bottom-left-radius: var(--radius-xs); }
  .chat-msg[data-role="user"] .chat-bubble { border-color: var(--primary-border); border-bottom-right-radius: var(--radius-xs); background: var(--primary); color: var(--primary-foreground); white-space: pre-wrap; }
  .chat-msg[data-role="user"] .chat-bubble a { color: inherit; }
  .chat-msg[data-tone="destructive"] .chat-bubble { border-color: var(--destructive); background: color-mix(in oklab, var(--destructive) 10%, var(--card)); color: var(--foreground); }
  .chat-meta { padding-inline: var(--space-sm); font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
  .chat-typing {
    --dot: calc(var(--space-sm) * 1.5); --dot-step: calc(var(--dot) + var(--space-sm));
    --dot-on: var(--muted-foreground); --dot-off: color-mix(in oklab, var(--muted-foreground) 30%, transparent);
    display: inline-flex; align-items: center; align-self: flex-start; height: var(--size-control-md); padding: 0 var(--space-md);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); border-bottom-left-radius: var(--radius-xs); background: var(--card);
  }
  .chat-typing::before {
    content: ""; width: var(--dot); height: var(--dot); margin-inline-end: calc(var(--dot-step) * 2); border-radius: var(--radius-full);
    background-color: var(--dot-on); box-shadow: var(--dot-step) 0 var(--dot-on), calc(var(--dot-step) * 2) 0 var(--dot-on);
    animation: kit-typing calc(var(--duration-slow) * 4) var(--ease-standard) infinite;
  }
  .chat-composer {
    position: sticky; bottom: var(--tabbar-offset, 0px); z-index: var(--z-sticky);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-sm) var(--space-base);
    padding-block: var(--space-md); background: var(--chat-composer-bg, var(--background));
  }
  .chat-composer :is(.textarea, textarea) {
    min-height: var(--size-control-lg); max-height: calc(var(--size-control-lg) * 4); overflow-y: auto; resize: none;
    padding: calc((var(--size-control-lg) - var(--text-sm--line-height)) / 2 - var(--size-border)) var(--space-lg);
    border-radius: calc(var(--size-control-lg) / 2); field-sizing: content;
  }
  .chat-composer > :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost) { --btn-h: var(--size-control-lg); }
  .chat-composer-hint { grid-column: 1 / -1; padding-inline: var(--space-lg); font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .chat-suggestions { position: relative; display: flex; gap: var(--space-base); overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: var(--space-xs); }
  .chat-suggestions > .chip {
    flex: none; height: auto; min-height: var(--size-control-sm); max-width: calc(var(--size-sidebar) * 1.125);
    padding-block: var(--space-sm); white-space: normal; text-align: start; scroll-snap-align: start;
  }

  /* ---------- chat action card (1.9): a proposal inside a .chat-msg the owner confirms.
     .chat-card[data-state=open|done|dismissed|failed] > header (strong + badge) + p (reason) + optional .chat-compare
     (del over ins, whitespace kept) + footer (buttons) + .chat-card-status (the app's "Posted" / "Dismissed" / error line).
     Settled states (done, dismissed, failed) read muted: the footer hides and the status line shows. */
  .chat-card {
    --chat-card-bg: var(--card);
    display: grid; align-self: stretch; gap: var(--space-sm); min-width: 0; padding: var(--space-md);
    border: var(--size-border) solid var(--primary-border); border-radius: var(--radius-lg); background: var(--chat-card-bg); color: var(--card-foreground);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height);
  }
  .chat-card > header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); min-width: 0; }
  .chat-card > header > strong { font-weight: var(--font-weight-semibold); }
  .chat-card > p { margin: 0; color: var(--muted-foreground); }
  .chat-card > footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-base); padding-top: var(--space-xs); }
  .chat-card-status { display: none; margin: 0; }
  .chat-card:is([data-state="done"], [data-state="dismissed"], [data-state="failed"]) { --chat-card-bg: var(--muted); border-color: var(--border); color: var(--muted-foreground); }
  .chat-card:is([data-state="done"], [data-state="dismissed"], [data-state="failed"]) > footer { display: none; }
  .chat-card:is([data-state="done"], [data-state="dismissed"], [data-state="failed"]) > .chat-card-status {
    display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xs); line-height: var(--text-xs--line-height); font-weight: var(--font-weight-semibold);
  }
  .chat-card[data-state="done"] > .chat-card-status { color: var(--success); }
  .chat-card[data-state="done"] > .chat-card-status::before { content: "\2713"; content: "\2713" / ""; }
  .chat-card[data-state="failed"] { border-color: var(--destructive); }
  .chat-card[data-state="failed"] > .chat-card-status { color: var(--destructive); }
  .chat-card[data-state="failed"] > .chat-card-status::before { content: "\2715"; content: "\2715" / ""; }
  .chat-card[data-state="dismissed"] > .chat-card-status::before { content: "\2013"; content: "\2013" / ""; }
  .chat-compare { display: grid; gap: var(--space-xs); min-width: 0; }
  .chat-compare > :is(del, ins) {
    display: block; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); color: var(--foreground);
    white-space: pre-wrap; overflow-wrap: anywhere; text-decoration: none;
  }
  .chat-compare > del { background: color-mix(in oklab, var(--destructive) 10%, var(--chat-card-bg, var(--card))); text-decoration: line-through; text-decoration-color: var(--destructive); }
  .chat-compare > ins { background: color-mix(in oklab, var(--success) 10%, var(--chat-card-bg, var(--card))); }

  /* ---------- progress track (a div bar for what <progress> can't do): .progress-track[role=progressbar] >
     .progress-fill (--value: 40%) + i.progress-mark (--at: 60%, a target tick). data-variant on track or fill:
     success | warning | destructive | info | muted (default brand). progress-track-sm is thinner. */
  .progress-track {
    --track-h: var(--space-base); --fill: var(--brand);
    position: relative; display: block; width: 100%; height: var(--track-h);
    border-radius: var(--radius-full); background: color-mix(in oklab, var(--foreground) 12%, var(--background));
  }
  .progress-track-sm { --track-h: var(--space-sm); }
  .progress-fill {
    position: absolute; inset-block: 0; left: 0; width: var(--value, 0%); max-width: 100%;
    border-radius: inherit; background: var(--fill); transition: width var(--duration-moderate) var(--ease-standard);
  }
  .progress-fill[data-state="active"] { animation: kit-pulse calc(var(--duration-slow) * 5) var(--ease-standard) infinite; }
  .progress-mark {
    position: absolute; top: 50%; left: var(--at, 0%); width: var(--size-ring); height: calc(var(--track-h) + var(--space-sm) * 2);
    translate: -50% -50%; border-radius: var(--radius-full); background: var(--foreground);
  }
  .progress-mark[data-variant="warning"] { background: var(--warning); }
  :is(.progress-track, .progress-fill)[data-variant="success"] { --fill: var(--success); }
  :is(.progress-track, .progress-fill)[data-variant="warning"] { --fill: var(--warning); }
  :is(.progress-track, .progress-fill)[data-variant="destructive"] { --fill: var(--destructive); }
  :is(.progress-track, .progress-fill)[data-variant="info"] { --fill: var(--info); }
  :is(.progress-track, .progress-fill)[data-variant="muted"] { --fill: var(--muted-foreground); }

  /* ---------- progress ring (timers): svg.progress-ring[viewBox="0 0 100 100"] > circle.progress-ring-track +
     circle.progress-ring-value[pathLength=100] (--value: 0..100) + optional line.progress-ring-mark ticks.
     data-variant=warning|success|destructive|info on the svg; size with --progress-ring-size. */
  .progress-ring { --progress-ring-color: var(--brand); display: block; width: var(--progress-ring-size, calc(var(--space-4xl) * 1.5)); height: auto; aspect-ratio: 1; overflow: visible; }
  .progress-ring :is(.progress-ring-track, .progress-ring-value) { fill: none; stroke-width: var(--progress-ring-width, 8); }
  .progress-ring-track { stroke: color-mix(in oklab, var(--foreground) 12%, var(--background)); }
  .progress-ring-value {
    stroke: var(--progress-ring-color); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - clamp(0, var(--value, 0), 100));
    transform: rotate(-90deg); transform-origin: center; transform-box: fill-box;
    transition: stroke-dashoffset var(--duration-moderate) var(--ease-standard), stroke var(--duration-moderate) var(--ease-standard);
  }
  .progress-ring-mark { stroke: var(--muted-foreground); stroke-width: var(--progress-ring-mark-width, 2); stroke-linecap: round; }
  .progress-ring[data-variant="warning"] { --progress-ring-color: var(--warning); }
  .progress-ring[data-variant="success"] { --progress-ring-color: var(--success); }
  .progress-ring[data-variant="destructive"] { --progress-ring-color: var(--destructive); }
  .progress-ring[data-variant="info"] { --progress-ring-color: var(--info); }

  /* ---------- list rows (settings, navigation): .list-rows (+ .list-rows-label headings) > a|button|div.list-row >
     .list-row-icon + .list-row-body (.list-row-title, .list-row-description) + .list-row-trail. Links and buttons get
     a hover and a trailing chevron; aria-current="page" a primary edge. */
  .list-rows { display: grid; gap: var(--space-sm); min-width: 0; margin: 0; padding: 0; list-style: none; }
  .list-rows-label { padding: var(--space-md) var(--space-xs) var(--space-xs); font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-transform: uppercase; color: var(--muted-foreground); }
  .list-rows-label:first-child { padding-top: 0; }
  .list-row {
    display: flex; align-items: center; gap: var(--space-md); width: 100%; min-width: 0; min-height: var(--size-control-lg); margin: 0;
    padding: var(--space-md) var(--space-lg); border: var(--size-border) solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--card-foreground); font: inherit; font-size: var(--text-sm); line-height: var(--text-sm--line-height);
    text-align: start; text-decoration: none;
  }
  :is(a, button).list-row { cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); }
  :is(a, button).list-row:hover { background: color-mix(in oklab, var(--foreground) 5%, var(--card)); }
  :is(a, button).list-row::after {
    content: ""; flex: none; width: var(--size-icon); height: var(--size-icon); background: var(--muted-foreground);
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .list-row[aria-current]:not([aria-current="false"]) { border-color: var(--primary-border); box-shadow: inset 0 0 0 var(--size-border) var(--primary-border); }
  .list-row:is(:disabled, [aria-disabled="true"]) { opacity: 0.5; pointer-events: none; }
  .list-row-icon {
    display: grid; place-items: center; flex: none; width: var(--size-control-md); height: var(--size-control-md);
    border-radius: var(--radius-md); background: var(--accent); color: var(--accent-foreground); font-size: var(--text-base); line-height: 1;
  }
  .list-row-icon svg { width: var(--size-icon); height: var(--size-icon); }
  .list-row-body { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
  .list-row-title { font-weight: var(--font-weight-semibold); }
  .list-row-description { font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .list-row-trail { display: flex; flex: none; align-items: center; gap: var(--space-sm); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

  /* ---------- calendar (month grid): .calendar > 7 × .calendar-dow, then button|div.calendar-day > .calendar-day-num + app
     content. aria-current="date" = today (2px brand edge), aria-selected="true" = ring outline, data-outside = another
     month, data-tone=info|success|warning tints the cell. */
  .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-xs); min-width: 0; }
  .calendar-dow { padding: var(--space-xs) var(--space-sm); font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-align: center; text-transform: uppercase; color: var(--muted-foreground); }
  .calendar-day {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--space-xs); min-width: 0; min-height: calc(var(--space-4xl) * 0.75);
    margin: 0; padding: var(--space-sm); overflow: hidden; border: var(--size-border) solid var(--border); border-radius: var(--radius-md);
    background: var(--card); color: var(--card-foreground); font: inherit; font-size: var(--text-xs); line-height: var(--text-xs--line-height); text-align: start;
  }
  button.calendar-day { cursor: pointer; transition: border-color var(--duration-fast) var(--ease-standard); }
  button.calendar-day:hover { border-color: var(--input); }
  .calendar-day-num { font-weight: var(--font-weight-semibold); font-variant-numeric: tabular-nums; }
  .calendar-day[aria-current="date"] { border-color: var(--brand); box-shadow: inset 0 0 0 var(--size-border) var(--brand); }
  .calendar-day[aria-current="date"] .calendar-day-num { color: var(--brand); }
  .calendar-day:is([aria-selected="true"], [aria-pressed="true"]) { outline: var(--size-ring) solid var(--ring); outline-offset: 0; }
  .calendar-day[data-tone="info"] { --calendar-tone: var(--info); }
  .calendar-day[data-tone="success"] { --calendar-tone: var(--success); }
  .calendar-day[data-tone="warning"] { --calendar-tone: var(--warning); }
  .calendar-day[data-tone] { background: color-mix(in oklab, var(--calendar-tone) 12%, var(--card)); border-color: color-mix(in oklab, var(--calendar-tone) 40%, var(--card)); }
  .calendar-day[data-outside]:not([data-outside="false"]) { opacity: 0.5; }
  @media (max-width: 40rem) {
    .calendar-day { min-height: calc(var(--space-4xl) * 0.625); padding: var(--space-xs); }
  }

  /* ---------- heatmap (GitHub-style): .heatmap > optional 7 × .heatmap-dow, then .heatmap-cell[data-level=0..4] in columns
     of seven (Monday down to Sunday). data-future = dashed, no fill; aria-current="date" and aria-selected outline it.
     .heatmap-legend: Less + level cells + More. Cell size --cell. */
  .heatmap {
    --cell: var(--space-md);
    position: relative; display: grid; grid-template-rows: repeat(7, var(--cell)); grid-template-columns: auto; grid-auto-flow: column; grid-auto-columns: var(--cell);
    gap: var(--space-xs); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: thin; padding: var(--space-xs);
  }
  .heatmap-dow { padding-right: var(--space-sm); font-size: var(--text-2xs); line-height: var(--cell); color: var(--muted-foreground); white-space: nowrap; }
  .heatmap-cell {
    --heat: var(--muted);
    display: block; flex: none; width: var(--cell, var(--space-md)); height: var(--cell, var(--space-md)); margin: 0; padding: 0;
    border: 0; border-radius: var(--radius-xs); background: var(--heat); box-shadow: inset 0 0 0 var(--size-border) color-mix(in oklab, var(--foreground) 6%, transparent);
  }
  .heatmap-cell[data-level="1"] { --heat: color-mix(in oklab, var(--chart-1) 30%, var(--muted)); }
  .heatmap-cell[data-level="2"] { --heat: color-mix(in oklab, var(--chart-1) 55%, var(--muted)); }
  .heatmap-cell[data-level="3"] { --heat: color-mix(in oklab, var(--chart-1) 78%, var(--muted)); }
  .heatmap-cell[data-level="4"] { --heat: var(--chart-1); }
  .heatmap-cell[data-future]:not([data-future="false"]) { background: transparent; box-shadow: none; outline: var(--size-border) dashed var(--border); outline-offset: calc(var(--size-border) * -1); }
  button.heatmap-cell { cursor: pointer; }
  button.heatmap-cell:hover { outline: var(--size-border) solid var(--muted-foreground); outline-offset: var(--size-border); }
  .heatmap-cell[aria-current="date"] { outline: var(--size-border) solid var(--ring); outline-offset: var(--size-border); }
  .heatmap-cell:is([aria-selected="true"], [aria-pressed="true"]) { position: relative; z-index: 1; outline: var(--size-ring) solid var(--foreground); outline-offset: 0; }
  .heatmap-cell:focus-visible { position: relative; z-index: 1; outline: var(--size-ring) solid var(--ring); outline-offset: 0; }
  .heatmap-legend { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .heatmap-legend > :not(.heatmap-cell) { padding-inline: var(--space-sm); }

  /* ---------- steps (setup stepper): ol.steps > li[data-state=done|current|todo]. A numbered circle on the left; done = a
     success circle with a check, current = brand circle and a brand edge on the item, todo (the default) = muted. */
  .steps { display: grid; gap: var(--space-sm); margin: 0; padding: 0; list-style: none; counter-reset: kit-step; }
  .steps > li {
    position: relative; display: grid; grid-template-columns: var(--size-control-md) minmax(0, 1fr); align-items: center; gap: var(--space-xs) var(--space-md);
    padding: var(--space-md); border: var(--size-border) solid transparent; border-radius: var(--radius-lg);
    color: var(--muted-foreground); font-size: var(--text-sm); line-height: var(--text-sm--line-height); counter-increment: kit-step;
  }
  .steps > li > * { grid-column: 2; min-width: 0; }
  .steps > li::before {
    content: counter(kit-step); grid-column: 1; grid-row: 1; align-self: start; display: grid; place-items: center;
    width: var(--size-control-md); height: var(--size-control-md); border: var(--size-border) solid var(--border); border-radius: var(--radius-full);
    background: var(--muted); color: var(--muted-foreground); font-weight: var(--font-weight-semibold); font-variant-numeric: tabular-nums;
  }
  .steps > li:is([data-state="done"], [data-state="current"]) { color: var(--foreground); }
  .steps > li[data-state="current"] { border-color: var(--brand); background: var(--card); }
  .steps > li[data-state="current"]::before { border-color: var(--brand); background: var(--brand); color: var(--brand-foreground); }
  .steps > li[data-state="done"]::before { content: ""; border-color: var(--success); background: var(--success); }
  .steps > li[data-state="done"]::after {
    content: ""; position: absolute; top: calc(var(--space-md) + (var(--size-control-md) - var(--size-icon)) / 2); left: calc(var(--space-md) + (var(--size-control-md) - var(--size-icon)) / 2);
    width: var(--size-icon); height: var(--size-icon); background: var(--success-foreground);
    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='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* ---------- info tip (a tap-friendly popover; data-tooltip is hover-only): details.info-tip > summary[aria-label] +
     .info-tip-body. The body opens under the summary, inset inside the nearest positioned ancestor (cards and stats are). */
  .info-tip { display: inline-block; vertical-align: middle; }
  .info-tip > summary {
    display: inline-grid; place-items: center; width: var(--size-chip); height: var(--size-chip); border-radius: var(--radius-full);
    color: var(--muted-foreground); font-size: var(--text-sm); line-height: 1; list-style: none; cursor: pointer; user-select: none;
    transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
  }
  .info-tip > summary::-webkit-details-marker { display: none; }
  .info-tip > summary:hover, .info-tip[open] > summary { background: var(--accent); color: var(--accent-foreground); }
  .info-tip > summary svg { width: var(--size-icon); height: var(--size-icon); }
  .info-tip-body {
    position: absolute; left: var(--space-md); right: var(--space-md); z-index: var(--z-dropdown); max-width: calc(var(--size-sidebar) * 1.625);
    margin-top: var(--space-sm); padding: var(--space-md) var(--space-lg); border: var(--size-border) solid var(--border); border-radius: var(--radius-md);
    background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-md);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-regular); letter-spacing: var(--tracking-normal);
    text-align: start; text-transform: none; white-space: normal; animation: kit-fade var(--duration-fast) var(--ease-out);
  }
  :is(.card, .stat, .alert, .list-row):has(.info-tip) { position: relative; }

  /* ---------- action bar (unsaved changes, a running timer, a selection): .action-bar > .action-bar-message (or any first
     child, which pushes the rest to the end) + buttons. In flow and sticky at the bottom of its scroll area (action-bar-sticky
     says so explicitly); action-bar-floating is fixed to the viewport instead. Both sit above the phone tab bar and above
     div overlays. data-state="dirty" = primary edge, data-tone="warning" = warning edge and tint (unsaved work). */
  /* the fallback needs a unit: calc(0 + 12px) is invalid, which left bottom: auto (a fixed bar off-screen, a sticky one never sticking) */
  .action-bar {
    position: sticky; bottom: calc(var(--tabbar-offset, 0px) + var(--space-md)); z-index: var(--z-action-bar);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-base) var(--space-md); padding: var(--space-md) var(--space-lg);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground);
    box-shadow: var(--shadow-md); font-size: var(--text-sm); line-height: var(--text-sm--line-height);
  }
  .action-bar > :first-child { margin-inline-end: auto; }
  .action-bar-message { flex: 1 1 calc(var(--size-sidebar) * 0.75); min-width: 0; }
  .action-bar[data-state="dirty"] { border-color: var(--primary-border); }
  .action-bar[data-tone="warning"] { border-color: var(--warning); background: color-mix(in oklab, var(--warning) 10%, var(--card)); }
  .action-bar-sticky { position: sticky; }
  .action-bar-floating {
    position: fixed; left: 50%; bottom: calc(var(--tabbar-offset, 0px) + var(--space-lg)); translate: -50% 0;
    width: max-content; max-width: calc(100% - var(--space-lg) * 2); animation: kit-rise var(--duration-moderate) var(--ease-out);
  }

  /* ---------- key/value list: dl.kv > dt + dd (or div > dt + dd). Two columns; one under 30rem. */
  .kv { display: grid; grid-template-columns: fit-content(calc(var(--size-sidebar) * 0.75)) minmax(0, 1fr); gap: var(--space-sm) var(--space-lg); margin: 0; font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  .kv > div { display: contents; }
  .kv dt { min-width: 0; color: var(--muted-foreground); }
  .kv dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
  @media (max-width: 30rem) {
    .kv { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
    .kv dt:not(:first-child), .kv > div:not(:first-child) > dt { margin-top: var(--space-md); }
  }

  /* ---------- status dot: span.status-dot[data-status=ok|warning|error|unknown] (or data-tone=success|warning|destructive|muted)
     with a title or a visible word next to it. 1.7: the workflow tones too (data-status=neutral|info|working|attention|
     success|danger), data-dot=ring (hollow: waiting on you) or pulse (working); inside a .status pill it takes the pill's tone. */
  .status-dot {
    display: inline-block; flex: none; width: calc(var(--size-icon-sm) / 2); height: calc(var(--size-icon-sm) / 2); border-radius: var(--radius-full);
    color: var(--muted-foreground); background: currentColor; vertical-align: middle;
  }
  .status-dot:is([data-status="ok"], [data-status="success"], [data-tone="success"]) { color: var(--success); }
  .status-dot:is([data-status="warning"], [data-status="attention"], [data-tone="warning"]) { color: var(--warning); }
  .status-dot:is([data-status="error"], [data-status="danger"], [data-tone="destructive"]) { color: var(--destructive); }
  .status-dot:is([data-status="info"], [data-tone="info"]) { color: var(--info); }
  .status-dot[data-status="working"] { color: var(--brand); }
  .status-dot[data-dot="ring"] { background: transparent; box-shadow: inset 0 0 0 calc(var(--size-ring) * 0.75) currentColor; }
  .status-dot[data-dot="pulse"] { animation: kit-pulse calc(var(--duration-slow) * 4) var(--ease-standard) infinite; }

  /* ---------- chart legend: .legend > .legend-item > i.legend-swatch[data-shape=dot|line|dash|dotted|band|square]
     (--swatch: var(--chart-1)) + label. Square is the default. */
  .legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-lg); font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .legend-item { display: inline-flex; align-items: center; gap: var(--space-sm); }
  .legend-swatch { display: inline-block; flex: none; width: var(--space-md); height: var(--space-md); border-radius: var(--radius-xs); background: var(--swatch, var(--chart-1)); }
  /* a hairline edge, so a light series or category colour still shows on a light card (and a dark one on dark) */
  .legend-swatch:not([data-shape="line"], [data-shape="dash"], [data-shape="dotted"], [data-shape="empty"]) { box-shadow: inset 0 0 0 var(--size-border) color-mix(in oklab, var(--foreground) 20%, transparent); }
  .legend-swatch[data-shape="dot"] { width: var(--space-base); height: var(--space-base); border-radius: var(--radius-full); }
  .legend-swatch[data-shape="line"] { width: var(--space-lg); height: var(--size-ring); border-radius: var(--radius-full); }
  .legend-swatch:is([data-shape="dash"], [data-shape="dotted"]) { width: var(--space-lg); height: 0; border-top: var(--size-ring) dashed var(--swatch, var(--chart-1)); border-radius: 0; background: none; }
  .legend-swatch[data-shape="dotted"] { border-top-style: dotted; }
  .legend-swatch[data-shape="band"] { width: var(--space-lg); height: var(--space-base); background: color-mix(in oklab, var(--swatch, var(--chart-1)) 30%, transparent); }

  /* ---------- choice cards (pick one or several options): .choice-grid (min width --choice-min) > button.choice-card[aria-pressed]
     or label.choice-card > visually hidden input + .choice-card-media (img or background-image, aspect --choice-aspect) +
     .choice-card-title + .choice-card-description. Selected = a 2px ring edge. choice-card-add is the dashed "add new" card. */
  .choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--choice-min, calc(var(--size-sidebar) * 0.75))), 1fr)); gap: var(--space-md); }
  .choice-card {
    position: relative; display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; margin: 0; padding: var(--space-md);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground);
    font: inherit; font-size: var(--text-sm); line-height: var(--text-sm--line-height); text-align: start; cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
  }
  .choice-card:hover { border-color: var(--input); }
  .choice-card:is([aria-pressed="true"], [aria-checked="true"], :has(input:checked)) { border-color: var(--ring); box-shadow: inset 0 0 0 var(--size-border) var(--ring); }
  .choice-card > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .choice-card:has(> input:focus-visible) { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }
  .choice-card:is(:disabled, [aria-disabled="true"], :has(> input:disabled)) { opacity: 0.5; cursor: not-allowed; }
  .choice-card-media { display: block; width: 100%; height: auto; aspect-ratio: var(--choice-aspect, 4 / 3); object-fit: cover; border-radius: var(--radius-md); background: var(--muted) center / cover no-repeat; }
  .choice-card-title { font-weight: var(--font-weight-semibold); }
  .choice-card-description { font-size: var(--text-xs); line-height: var(--text-xs--line-height); color: var(--muted-foreground); }
  .choice-card-add { align-items: center; justify-content: center; border-style: dashed; background: transparent; color: var(--muted-foreground); text-align: center; }
  .choice-card-add:hover { color: var(--foreground); }

  /* ---------- thumbs (choose a version): .thumbs > button.thumb[aria-pressed] on the .thumb frame (sizes and shapes as
     above), with an img inside or style="background-image: url(…)". Selected = a 2px ring edge over the image; data-off
     dims it to grey; .thumb-label is a corner tag. */
  .thumbs { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
  .thumb { background-position: center; background-size: cover; background-repeat: no-repeat; }
  button.thumb { margin: 0; padding: 0; border: 0; font: inherit; cursor: pointer; }
  button.thumb:hover { outline: var(--size-ring) solid var(--brand); outline-offset: var(--size-ring-offset); }
  .thumb[aria-pressed="true"]::after { content: ""; position: absolute; inset: 0; border: var(--size-ring) solid var(--ring); border-radius: inherit; pointer-events: none; }
  .thumb[data-off]:not([data-off="false"]) { opacity: 0.5; filter: grayscale(1); }
  .thumb-label {
    position: absolute; right: var(--space-xs); bottom: var(--space-xs); z-index: 1; padding: 0 var(--space-xs); border-radius: var(--radius-xs);
    background: var(--popover); color: var(--popover-foreground); font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height);
  }

  /* ---------- colour swatches: .swatches > button.swatch[aria-pressed][aria-label] (style="--swatch: <the colour>", user content),
     label.swatch.swatch-custom > input[type=color] for a custom one. Selected = a ring with a gap. */
  .swatches { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
  .swatch {
    position: relative; display: inline-block; flex: none; width: var(--size-control-md); height: var(--size-control-md); margin: 0; padding: 0;
    border: var(--size-border) solid color-mix(in oklab, var(--foreground) 20%, transparent); border-radius: var(--radius-full);
    background: var(--swatch, var(--muted)); cursor: pointer;
  }
  .swatch[aria-pressed="true"], .swatch:has(> input:checked) { box-shadow: 0 0 0 var(--size-ring) var(--ring), inset 0 0 0 var(--size-ring) var(--background); }
  .swatch-custom { overflow: hidden; background: var(--swatch, conic-gradient(var(--chart-1), var(--chart-2), var(--chart-6), var(--chart-5), var(--chart-7), var(--chart-4), var(--chart-3), var(--chart-1))); }
  .swatch > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
  .swatch:has(> input:focus-visible) { outline: var(--size-ring) solid var(--ring); outline-offset: var(--size-ring-offset); }

  /* ---------- range: input[type=range].range, a brand thumb on a muted track. WebKit has no filled part of its own: set
     style="--range-fill: 40%" (the value as a percentage) to fill it; Firefox fills natively. */
  .range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--size-control-sm); margin: 0; background: transparent; cursor: pointer; }
  .range::-webkit-slider-runnable-track {
    height: var(--space-sm); border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--brand) var(--range-fill, 0%), color-mix(in oklab, var(--foreground) 12%, var(--background)) var(--range-fill, 0%));
  }
  .range::-moz-range-track { height: var(--space-sm); border-radius: var(--radius-full); background: color-mix(in oklab, var(--foreground) 12%, var(--background)); }
  .range::-moz-range-progress { height: var(--space-sm); border-radius: var(--radius-full); background: var(--brand); }
  .range::-webkit-slider-thumb {
    -webkit-appearance: none; width: var(--size-icon); height: var(--size-icon); margin-top: calc((var(--space-sm) - var(--size-icon)) / 2);
    border: var(--size-ring) solid var(--background); border-radius: var(--radius-full); background: var(--brand);
  }
  .range::-moz-range-thumb { width: var(--size-icon); height: var(--size-icon); box-sizing: border-box; border: var(--size-ring) solid var(--background); border-radius: var(--radius-full); background: var(--brand); }
  .range:disabled { opacity: 0.5; cursor: not-allowed; }

  /* ---------- stepper (a wizard's steps, horizontal): nav.stepper > ol > li > a|span[aria-current=step][data-state=complete].
     Numbered by a counter (or a .stepper-n inside); complete = success disc with a check, current = brand disc. Scrolls
     sideways when narrow. (ol.steps is the vertical checklist.) */
  .stepper ol { position: relative; display: flex; align-items: center; gap: var(--space-sm); margin: 0; padding: 0 0 var(--space-xs); overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; list-style: none; counter-reset: kit-stepper; }
  .stepper li { display: flex; flex: 0 0 auto; align-items: center; gap: var(--space-sm); counter-increment: kit-stepper; }
  .stepper li + li::before { content: ""; flex: none; width: var(--space-xl); height: var(--size-border); background: var(--border); }
  .stepper li > :is(a, span, button) {
    display: inline-flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-md) var(--space-xs) var(--space-xs);
    border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--muted-foreground);
    font: inherit; font-size: var(--text-sm); line-height: var(--text-sm--line-height); font-weight: var(--font-weight-medium); text-decoration: none; white-space: nowrap;
  }
  .stepper li > :is(a, button) { cursor: pointer; }
  .stepper li > :is(a, button):hover { background: var(--accent); color: var(--accent-foreground); }
  .stepper li > :is(a, span, button):not(:has(> .stepper-n))::before, .stepper-n {
    content: counter(kit-stepper); display: grid; place-items: center; flex: none; width: var(--size-control-sm); height: var(--size-control-sm);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground);
    font-size: var(--text-xs); line-height: 1; font-weight: var(--font-weight-semibold); font-variant-numeric: tabular-nums;
  }
  .stepper li > :is([data-state="complete"], [data-state="done"], [aria-current="step"]) { color: var(--foreground); }
  .stepper li > [aria-current="step"] { font-weight: var(--font-weight-semibold); }
  .stepper li > [aria-current="step"]:not(:has(> .stepper-n))::before, .stepper li > [aria-current="step"] > .stepper-n { border-color: var(--brand); background: var(--brand); color: var(--brand-foreground); }
  .stepper li > :is([data-state="complete"], [data-state="done"]):not(:has(> .stepper-n))::before, .stepper li > :is([data-state="complete"], [data-state="done"]) > .stepper-n {
    content: ""; border: 0; background: var(--success); color: transparent;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12'/%3E%3C/svg%3E") center / contain no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 12.5 3.5 3.5L17 9'/%3E%3C/svg%3E") center / contain no-repeat;
    mask-composite: exclude; -webkit-mask-composite: xor;
  }

  /* ---------- toolbar: a compact surface row of controls (wraps). toolbar-sticky sticks to the top (under a top navbar). */
  .toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-base); min-width: 0; padding: var(--space-md);
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height);
  }
  .toolbar-sticky { position: sticky; top: var(--space-sm); z-index: var(--z-sticky); }
  body:has(> .navbar) .toolbar-sticky { top: calc(var(--size-navbar) + var(--space-sm)); }

  /* ---------- banner: a full-width notice strip under the navbar, padded like container-fluid. banner-info, banner-warning,
     banner-success; .banner-label is its eyebrow, .banner-actions go to the end. */
  .banner {
    --banner-accent: var(--muted-foreground);
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); padding: var(--space-md) var(--space-xl);
    border-bottom: var(--size-border) solid var(--border); background: var(--muted); color: var(--foreground); font-size: var(--text-sm); line-height: var(--text-sm--line-height);
  }
  :is(.banner-info, .banner-warning, .banner-success) { background: color-mix(in oklab, var(--banner-accent) 10%, var(--background)); border-color: color-mix(in oklab, var(--banner-accent) 45%, var(--background)); }
  .banner-info { --banner-accent: var(--info); }
  .banner-warning { --banner-accent: var(--warning); }
  .banner-success { --banner-accent: var(--success); }
  .banner-label { font-family: var(--font-mono); font-size: var(--text-2xs); line-height: var(--text-2xs--line-height); text-transform: uppercase; color: var(--banner-accent); }
  .banner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-base); margin-inline-start: auto; }

  /* ---------- draft editing: .field[data-state=changed] marks its label with a warning dot (unsaved); data-suggested on a
     control highlights a value filled in for the user (say, by AI) that isn't saved yet. */
  .field[data-state="changed"] > .label::after { content: ""; flex: none; width: calc(var(--size-icon-sm) / 2); height: calc(var(--size-icon-sm) / 2); border-radius: var(--radius-full); background: var(--warning); }
  :is(.input, .textarea, .select)[data-suggested]:not([data-suggested="false"]), .form :where(input, select, textarea)[data-suggested]:not([data-suggested="false"]) {
    border-style: dashed; border-color: var(--brand); background-color: color-mix(in oklab, var(--brand) 8%, transparent);
  }

  /* ---------- badge remove: a small × button inside any badge (tag lists). Empty, it draws its own ×. */
  .badge-remove {
    display: inline-grid; place-items: center; flex: none; width: calc(var(--size-chip) - var(--space-sm) * 2); height: calc(var(--size-chip) - var(--space-sm) * 2);
    margin: 0 calc(var(--space-sm) * -1) 0 0; padding: 0; border: 0; border-radius: var(--radius-full); background: transparent; color: inherit;
    font: inherit; line-height: 1; opacity: 0.75; cursor: pointer;
  }
  .badge-remove:hover { opacity: 1; background: color-mix(in oklab, currentColor 20%, transparent); }
  .badge-remove:empty::before {
    content: ""; width: var(--size-icon-sm); height: var(--size-icon-sm); background: currentColor;
    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='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* ---------- collapsible card (folded "More settings" panels): details.card.card-collapsible > summary (a heading + muted
     meta) + the body. A chevron like disclosure, but the body keeps the normal foreground colour. */
  .card-collapsible { gap: 0; }
  .card-collapsible > summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); list-style: none; cursor: pointer; border-radius: var(--radius-sm); }
  .card-collapsible > summary::-webkit-details-marker { display: none; }
  .card-collapsible > summary :is(h2, h3, h4) { font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--text-lg--line-height); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-normal); }
  .card-collapsible > summary::after {
    content: ""; flex: none; width: var(--size-icon); height: var(--size-icon); margin-inline-start: auto; background: var(--muted-foreground);
    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='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: rotate var(--duration-normal) var(--ease-standard);
  }
  .card-collapsible[open] > summary { margin-bottom: var(--space-xl); }
  .card-collapsible[open] > summary::after { rotate: 180deg; }

  /* ============ 1.7 workflow, data and headless-library patterns (Reel dashboard, jam-trading, fasting-plan-app,
     Picture Book Studio, Insta Wiki). CSS only. */

  /* ---------- status label: span.status.status-{neutral|info|working|attention|success|danger} (+ a leading .status-dot,
     data-dot=ring|pulse). A soft-tinted pill; without a dot it is a count pill (next to a sidebar link or menu item it
     moves to the end). working = brand, so it reads apart from info (blue). The text is the tone deepened toward
     foreground, which keeps AA on the tint over menus, sidebars and hovered rows too. */
  .status {
    --status: var(--muted-foreground);
    display: inline-flex; flex: none; align-items: center; gap: var(--space-sm); height: var(--size-chip); padding: 0 var(--space-base);
    border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground);
    font-family: var(--font-sans); font-size: var(--text-xs); line-height: var(--text-xs--line-height); font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums; white-space: nowrap; vertical-align: middle;
  }
  .status-info { --status: var(--info); }
  .status-working { --status: var(--brand); }
  .status-attention { --status: var(--warning); }
  .status-success { --status: var(--success); }
  .status-danger { --status: var(--destructive); }
  .status:is(.status-info, .status-working, .status-attention, .status-success, .status-danger) { background: color-mix(in oklab, var(--status) 15%, transparent); color: color-mix(in oklab, var(--status) 75%, var(--foreground)); }
  .status > .status-dot { color: inherit; }
  :is(.sidebar :is(a, button), [role^="menuitem"]) > :is(.status, [class^="badge"], [class*=" badge"]):last-child { margin-inline-start: auto; }
  /* on the current sidebar link (a sidebar-primary fill) a status or soft/outline badge becomes an outline in the link's colour */
  .sidebar :is(a, button)[aria-current="page"] :is(.status, .badge-soft, .badge-outline) { border-color: transparent; background: transparent; box-shadow: inset 0 0 0 var(--size-border) currentColor; color: inherit; }

  /* ---------- stat strip: ol.stat-strip > li > a (or div) > .stat-value + .stat-label. One bordered strip of linked counts,
     6 across (3 a row under 48rem), hairline dividers, sentence-case labels. data-attention = needs you (brand value and underline bar),
     data-empty = zero (muted). stat-strip-compact is tighter. */
  .stat-strip {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; padding: 0; overflow: hidden; list-style: none;
    border: var(--size-border) solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground);
  }
  .stat-strip > li { display: flex; min-width: 0; box-shadow: calc(var(--size-border) * -1) 0 0 var(--border), 0 calc(var(--size-border) * -1) 0 var(--border); }
  .stat-strip > li > :is(a, div) {
    position: relative; display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--space-xs); min-width: 0; padding: var(--space-md) var(--space-lg);
    color: inherit; text-decoration: none; transition: background-color var(--duration-fast) var(--ease-standard);
  }
  .stat-strip a:hover { background: var(--accent); color: var(--accent-foreground); }
  .stat-strip a:focus-visible { outline-offset: calc(var(--size-ring) * -1); }
  .stat-strip .stat-value { font-size: var(--text-xl); line-height: var(--text-xl--line-height); letter-spacing: var(--tracking-normal); }
  .stat-strip .stat-label { font-family: var(--font-sans); font-size: var(--text-xs); line-height: var(--text-xs--line-height); text-transform: none; overflow-wrap: break-word; color: var(--muted-foreground); }
  .stat-strip [data-attention]:not([data-attention="false"]) .stat-value { color: var(--brand); }
  .stat-strip [data-attention]:not([data-attention="false"])::after {
    content: ""; position: absolute; right: var(--space-lg); bottom: 0; left: var(--space-lg); height: var(--size-ring); border-radius: var(--radius-full); background: var(--brand);
  }
  .stat-strip [data-empty]:not([data-empty="false"]) .stat-value { color: var(--muted-foreground); }
  .stat-strip-compact > li > :is(a, div) { gap: 0; padding: var(--space-base) var(--space-md); }
  .stat-strip-compact .stat-value { font-size: var(--text-lg); line-height: var(--text-lg--line-height); }
  .stat-strip-compact [data-attention]:not([data-attention="false"])::after { right: var(--space-md); left: var(--space-md); }
  @media (max-width: 48rem) { .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

  /* ---------- small swatches: span.swatch.swatch-xs (14px) or swatch-sm (20px), a square label for a data colour (a
     category's or a user's own) in lists, menus and sidebar links, set inline as style="--swatch: #hex". The hairline
     shows light colours on light and dark on dark; with no --swatch it is an empty outlined square. */
  :is(.swatch-xs, .swatch-sm) {
    width: var(--swatch-size, var(--size-icon-sm)); height: var(--swatch-size, var(--size-icon-sm)); border-radius: var(--radius-sm);
    background: var(--swatch, transparent); cursor: inherit; vertical-align: middle;
  }
  .swatch-sm { --swatch-size: calc(var(--size-icon) + var(--space-xs) * 2); }
  :is(button, label):is(.swatch-xs, .swatch-sm) { cursor: pointer; }

  /* ---------- standalone menu (a library positions it): data-state=closed fades out; p.menu-note is a wrapping muted
     paragraph inside the menu (the app sets the menu's max width). */
  .menu[role="menu"] { z-index: var(--z-portal); }
  .menu[data-state="closed"] { animation: kit-fade-out var(--duration-fast) var(--ease-in) forwards; }
  [role="menu"] > .menu-note { padding: var(--space-sm) var(--space-base); white-space: normal; overflow-wrap: anywhere; }

  /* ---------- dialog on a div beside its backdrop (Radix Dialog): .dialog-backdrop + div.dialog[role=dialog] with
     data-state=open|closed (or .dialog-modal). Fixed and centred above the backdrop; a long section scrolls while the
     header and footer stay put. data-state=closed plays the exit animation on both. */
  .dialog:not(dialog):is([data-state], .dialog-modal):not(.dialog-backdrop > *) {
    inset: 0; z-index: var(--z-portal); display: flex; flex-direction: column; gap: var(--space-lg); height: fit-content; overflow: hidden;
    animation: kit-rise var(--duration-moderate) var(--ease-out);
  }
  .dialog:not(dialog):is([data-state], .dialog-modal):not(.dialog-backdrop > *) > section {
    position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto;
    margin: calc((var(--size-ring) + var(--size-ring-offset)) * -1); padding: calc(var(--size-ring) + var(--size-ring-offset));
  }
  .dialog:not(dialog)[data-state="closed"] { animation: kit-sink var(--duration-normal) var(--ease-in) forwards; }
  :is(.dialog-backdrop, .sheet-backdrop)[data-state="closed"] { animation: kit-fade-out var(--duration-normal) var(--ease-in) forwards; }

  /* ---------- docked action bar: action-bar action-bar-docked sits flush on the bottom edge of its column (top border
     only, no radius) with a soft upward lift in light mode (none on dark). The app sets --action-bar-h on <html> so
     the toaster clears it. */
  .action-bar-docked { bottom: var(--tabbar-offset, 0px); border-width: var(--size-border) 0 0; border-radius: 0; box-shadow: var(--shadow-up); }

  /* ---------- choice: label.choice > input.radio|checkbox + span (.choice-title + .choice-description, or plain text).
     The control in column 1, the text in column 2. With choice-card it is a bordered card whose control stays visible. */
  .choice {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-base);
    font-size: var(--text-sm); line-height: var(--text-sm--line-height); cursor: pointer;
  }
  .choice > input { margin: calc((var(--text-sm--line-height) - var(--size-icon)) / 2) 0 0; }
  .choice > :not(input) { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
  .choice-title { font-weight: var(--font-weight-medium); }
  .choice-description { color: var(--muted-foreground); }
  .choice:has(> input:disabled) { opacity: 0.5; cursor: not-allowed; }
  .choice.choice-card { display: grid; padding: var(--space-md) var(--space-lg); }
  .choice.choice-card > input { position: static; width: var(--size-icon); height: var(--size-icon); opacity: 1; }
  .choice.choice-card > input:focus-visible { outline: none; }

  /* ---------- scrubber (chapters): .scrubber > .scrubber-segments[aria-hidden] > span (style="flex-grow: <length>",
     the current one aria-current="true") + input.range on top with a transparent track, so only its thumb shows. */
  .scrubber { position: relative; display: grid; align-items: center; min-width: 0; }
  .scrubber > * { grid-area: 1 / 1; }
  .scrubber-segments { display: flex; gap: var(--space-xs); height: var(--space-sm); pointer-events: none; }
  .scrubber-segments > * { flex: 1 1 0; min-width: var(--size-border); border-radius: var(--radius-full); background: var(--input); }
  .scrubber-segments > [aria-current="true"] { background: var(--brand); }
  .scrubber .range::-webkit-slider-runnable-track { background: transparent; }
  .scrubber .range::-moz-range-track, .scrubber .range::-moz-range-progress { background: transparent; }

  /* ---------- progress-thin: a 2px <progress class="progress progress-thin"> for inline job indicators (indeterminate too) */
  .progress-thin { height: var(--size-ring); }

  /* ---------- sparkline: svg.sparkline (viewBox, role="img", aria-label) > polyline|path. An inline trend line in table
     cells and stat cards, chart-1 via currentColor; data-tone=muted|success|destructive. sparkline-fluid fills the width
     (give the svg preserveAspectRatio="none"); its height is --sparkline-h. The Jinja macro ui.sparkline draws one. */
  .sparkline { display: inline-block; flex: none; width: var(--size-sparkline-w); height: var(--size-sparkline-h); overflow: visible; color: var(--chart-1); vertical-align: middle; }
  .sparkline :is(polyline, path, line) { fill: none; stroke: currentColor; stroke-width: var(--size-sparkline-stroke); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
  .sparkline-fluid { display: block; width: 100%; height: var(--sparkline-h, calc(var(--size-sparkline-h) * 4)); }
  .sparkline[data-tone="muted"] { color: var(--muted-foreground); }
  .sparkline[data-tone="success"] { color: var(--success); }
  .sparkline[data-tone="destructive"] { color: var(--destructive); }

  /* ---------- control widths: a short .input / .select (an age, a count) doesn't have to fill the row. input-xs / -sm /
     -md set --control-w (any control takes style="--control-w: …" too); inside a cluster, toolbar or field-row a control
     is as wide as its own content unless --control-w says otherwise. */
  :is(.input, .select, select.input, textarea.input).input-xs { --control-w: calc(var(--space-4xl) * 0.75); }
  :is(.input, .select, select.input, textarea.input).input-sm { --control-w: calc(var(--space-4xl) * 1.25); }
  :is(.input, .select, select.input, textarea.input).input-md { --control-w: calc(var(--space-4xl) * 2); }
  :is(.cluster, .toolbar, .field-row) > :is(.input, .select, select.input) { width: var(--control-w, auto); }

  /* ---------- extensions to earlier components (fasting-plan-app) */
  /* stat-delta data-good="down": down is the good direction (weight, cost), so down is success and up destructive */
  .stat-delta[data-good="down"][data-trend="down"] { color: var(--success); }
  .stat-delta[data-good="down"][data-trend="up"] { color: var(--destructive); }
  /* list-row selected besides aria-current: aria-selected, or a label row holding a checked radio/checkbox; data-state="next" = up next (brand tint) */
  .list-row:is([aria-selected="true"], :has(input:checked)) { border-color: var(--primary-border); box-shadow: inset 0 0 0 var(--size-border) var(--primary-border); }
  label.list-row { cursor: pointer; }
  .list-row[data-state="next"] { border-color: var(--brand); background: color-mix(in oklab, var(--brand) 8%, var(--card)); }
  /* a highlighted card ("this week"): aria-current on the card = a 2px brand edge */
  .card[aria-current]:not([aria-current="false"]) { border-color: var(--brand); box-shadow: inset 0 0 0 var(--size-border) var(--brand); }
  /* calendar-day data-range: inside a program or period (a brand tint; a data-tone tint wins over it) */
  .calendar-day[data-range]:not([data-range="false"], [data-tone]) { background: color-mix(in oklab, var(--brand) 8%, var(--card)); }
  /* legend-swatch data-shape="empty": a dashed empty square for "no data" */
  .legend-swatch[data-shape="empty"] { border: var(--size-border) dashed var(--muted-foreground); background: transparent; }
  /* status-dot data-status="changed" (unsaved: the warning dot of field[data-state=changed]) and data-tone="brand" */
  .status-dot[data-status="changed"] { color: var(--warning); }
  .status-dot[data-tone="brand"] { color: var(--brand); }
  /* progress-ring-mark data-state="done": a passed tick is a notch in the surface colour (draw marks after the value circle);
     upcoming ticks stay muted. On a card or stat the notch takes the card colour. */
  .progress-ring-mark[data-state="done"] { stroke: var(--progress-ring-surface, var(--background)); }
  :is(.card, .stat) .progress-ring { --progress-ring-surface: var(--card); }

  /* ---------- touch: on a coarse pointer controls grow to 44px targets (size-touch; btn-sm, chips and menu items 40px)
     and form fields use 16px text, so iOS Safari doesn't zoom on focus. Checkboxes and radios keep their drawn size: a
     pseudo-element widens the hit area, and a label wrapping one becomes a full-height row. Fine pointers are unchanged. */
  @media (pointer: coarse) {
    :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive) { min-height: var(--size-touch); }
    :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive).btn-icon { min-width: var(--size-touch); }
    :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive).btn-sm { min-height: var(--size-control-lg); }
    :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-ghost-destructive, .btn-destructive).btn-sm.btn-icon { min-width: var(--size-control-lg); }
    .chip, .chat-suggestions > .chip { min-height: var(--size-control-lg); }
    .segmented > :is(button, a, [role="radio"]) { min-height: calc(var(--size-touch) - var(--space-xs) * 2); }
    :is(.input, .select, select.input),
    .form :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"], [type="reset"]), select) { min-height: var(--size-touch); }
    :is(.input, .textarea, .select, select.input, textarea.input),
    .form :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"], [type="reset"]), select, textarea) { font-size: var(--text-base); line-height: var(--text-base--line-height); }
    .pagination :is(a, button) { min-width: var(--size-touch); min-height: var(--size-touch); }
    .tabs [role="tab"] { min-height: calc(var(--size-touch) - var(--space-xs) * 2); }
    .tabs-line [role="tab"] { min-height: var(--size-touch); }
    :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) { min-height: var(--size-control-lg); }
    .sidebar :is(a, button):not(.btn, [class*="btn-"]) { min-height: var(--size-touch); }
    :is(.checkbox, .radio, .switch, input.input[type="checkbox"], input.input[type="radio"]), .form :where(input[type="checkbox"], input[type="radio"]) { position: relative; }
    :is(.checkbox, .radio, .switch, input.input[type="checkbox"], input.input[type="radio"])::after, .form :where(input[type="checkbox"], input[type="radio"])::after {
      content: ""; position: absolute; inset: calc((var(--size-icon) - var(--size-touch)) / 2);
    }
    .label:has(> :is(.checkbox, .radio, .switch, input[type="checkbox"], input[type="radio"])), .form :where(label):has(> input[type="checkbox"], > input[type="radio"]) { min-height: var(--size-touch); }
    :is(.badge-remove, .info-tip > summary) { position: relative; }
    :is(.badge-remove, .info-tip > summary)::after { content: ""; position: absolute; inset: calc((var(--size-chip) - var(--size-touch)) / 2); }
    .swatch:not(.swatch-xs, .swatch-sm) { width: var(--size-touch); height: var(--size-touch); }
    .range { height: var(--size-touch); }
    .stepper li > :is(a, button) { min-height: var(--size-control-lg); }
    .chat-composer :is(.textarea, textarea) { min-height: var(--size-touch); padding-block: calc((var(--size-touch) - var(--text-base--line-height)) / 2 - var(--size-border)); }
  }

  /* ---------- scroll strips: a fade on the edge that has more to scroll to (scroll-driven; none where unsupported, under
     reduced motion, or when the strip fits). Tables keep a plain thin scrollbar: a fade would cut their border. */
  @supports (animation-timeline: scroll()) {
    :is(.rail, .media-rail, .chat-suggestions, .stepper ol, .tabs [role="tablist"]) {
      --fade: var(--space-2xl);
      mask-image: linear-gradient(to right, transparent, var(--background) var(--fade-l), var(--background) calc(100% - var(--fade-r)), transparent);
      animation: kit-scroll-fade linear both;
      animation-timeline: scroll(self inline);
    }
  }
}

/* ============================================================ utilities (layout) */
@layer utilities {
  /* :where() keeps these at zero specificity, so Tailwind (or app) utilities always win. */
  :where(.page) { min-height: 100vh; background: var(--background); color: var(--foreground); }
  /* Pages use the full width by default (container-fluid); the capped containers are opt-in, container-reading for prose. */
  :where(.container-fluid), :where(.container), :where(.container-wide), :where(.container-narrow), :where(.container-reading) { width: 100%; margin-inline: auto; padding-inline: var(--space-xl); }
  :where(.container-reading) { max-width: calc(var(--size-container-reading) + var(--space-xl) * 2); }
  :where(.container) { max-width: calc(var(--size-container) + var(--space-xl) * 2); }
  :where(.container-wide) { max-width: calc(var(--size-container-wide) + var(--space-xl) * 2); }
  :where(.container-narrow) { max-width: calc(var(--size-container-narrow) + var(--space-xl) * 2); }
  :where(.section) { padding-block: var(--space-3xl); }
  :where(.section-hero) { padding-block: var(--space-4xl); }

  :where(.stack) { display: flex; flex-direction: column; gap: var(--gap, var(--space-lg)); min-width: 0; }
  :where(.cluster) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-base)); }
  :where(.cluster-between) { justify-content: space-between; }
  :where(.cluster-end) { justify-content: flex-end; }
  :where(.divided) > * + * { border-top: var(--size-border) solid var(--border); }
  :where(.grid) { display: grid; gap: var(--gap, var(--space-xl)); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, var(--size-sidebar))), 1fr)); }
  :where(.grid-2) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where(.grid-3) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :where(.grid-4) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  :where(.span-2) { grid-column: span 2; }
  :where(.span-full) { grid-column: 1 / -1; }
  @media (max-width: 64rem) { :where(.grid-3), :where(.grid-4) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 40rem) { :where(.grid-2), :where(.grid-3), :where(.grid-4) { grid-template-columns: minmax(0, 1fr); } :where(.span-2) { grid-column: auto; } }

  /* Aside + main (filters beside results, a clip beside its notes): .split > aside + section; .split-wide for a wider
     aside. One column under 48rem, aside first. */
  :where(.split) { display: grid; grid-template-columns: minmax(0, var(--split-aside, var(--size-sidebar))) minmax(0, 1fr); gap: var(--gap, var(--space-xl)); align-items: start; }
  :where(.split-wide) { --split-aside: calc(var(--size-sidebar) * 1.5); }
  @media (max-width: 48rem) { :where(.split) { grid-template-columns: minmax(0, 1fr); } }

  :where(.gap-0) { --gap: 0; } :where(.gap-xs) { --gap: var(--space-xs); } :where(.gap-sm) { --gap: var(--space-sm); } :where(.gap-base) { --gap: var(--space-base); }
  :where(.gap-md) { --gap: var(--space-md); } :where(.gap-lg) { --gap: var(--space-lg); } :where(.gap-xl) { --gap: var(--space-xl); }
  :where(.gap-2xl) { --gap: var(--space-2xl); } :where(.gap-3xl) { --gap: var(--space-3xl); }

  :where(.text-muted) { color: var(--muted-foreground); }
  :where(.text-brand) { color: var(--brand); }
  :where(.text-destructive) { color: var(--destructive); }
  :where(.text-success) { color: var(--success); }
  :where(.text-warning) { color: var(--warning); }
  :where(.text-info) { color: var(--info); }
  :where(.text-sm) { font-size: var(--text-sm); line-height: var(--text-sm--line-height); }
  :where(.text-xs) { font-size: var(--text-xs); line-height: var(--text-xs--line-height); }
  :where(.font-display) { font-family: var(--font-display); }
  :where(.font-mono) { font-family: var(--font-mono); }
  :where(.tabular-nums) { font-variant-numeric: tabular-nums; }
  :where(.text-right) { text-align: end; }
  :where(.truncate) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :where(.text-nowrap) { white-space: nowrap; }
  :where(.text-center) { text-align: center; }
  :where(.list-plain) { margin: 0; padding: 0; list-style: none; }
  :where(.text-pre-wrap) { white-space: pre-wrap; overflow-wrap: anywhere; }
  :where(.w-full) { width: 100%; }
  :where(.grow) { flex: 1 1 0%; min-width: 0; }
  :where(.sr-only) { position: absolute; width: var(--size-border); height: var(--size-border); padding: 0; margin: calc(var(--size-border) * -1); overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
}

@keyframes kit-spin { to { rotate: 360deg; } }
/* scroll-strip fades: registered so they interpolate; 0% = no fade */
@property --fade-l { syntax: "<length-percentage>"; inherits: false; initial-value: 0%; }
@property --fade-r { syntax: "<length-percentage>"; inherits: false; initial-value: 0%; }
@keyframes kit-scroll-fade { 0% { --fade-l: 0%; --fade-r: var(--fade); } 8%, 92% { --fade-l: var(--fade); --fade-r: var(--fade); } 100% { --fade-l: var(--fade); --fade-r: 0%; } }
@keyframes kit-pulse { 50% { opacity: 0.5; } }
@keyframes kit-fade { from { opacity: 0; } }
@keyframes kit-fade-out { to { opacity: 0; } }
@keyframes kit-swipe-out { from { translate: var(--radix-toast-swipe-end-x, 0) 0; } to { opacity: 0; translate: 100% 0; } }
@keyframes kit-rise { from { opacity: 0; translate: 0 var(--space-base); } }
@keyframes kit-sink { to { opacity: 0; translate: 0 var(--space-base); } }
@keyframes kit-indeterminate { from { background-position: -70% 0; } to { background-position: 170% 0; } }
@keyframes kit-sheet { from { translate: 0 100%; } }
@keyframes kit-drawer { from { translate: 100% 0; } }
@keyframes kit-typing {
  0%, 100% { background-color: var(--dot-on); box-shadow: var(--dot-step) 0 var(--dot-off), calc(var(--dot-step) * 2) 0 var(--dot-off); }
  33% { background-color: var(--dot-off); box-shadow: var(--dot-step) 0 var(--dot-on), calc(var(--dot-step) * 2) 0 var(--dot-off); }
  66% { background-color: var(--dot-off); box-shadow: var(--dot-step) 0 var(--dot-off), calc(var(--dot-step) * 2) 0 var(--dot-on); }
}
