/* ============================================================================
   THE BASE — FROZEN 2026-10-04 (owner: "up to here it was the base; from here on we change it for our project").
   Alaric's app.css, generated by its configurator (Alaric commit 4c6a0f9) with ELECT's identity, density Compact.
   NEVER regenerated, NEVER edited. ELECT's changes to Alaric's pieces go in site/alaric-changes.css (loaded after
   this file); a real Alaric bug goes to Alaric's own backlog. DECISIONS D38.
   ============================================================================ */
/* app.css: generated by the Design System Configurator (.claude/scripts/design-system-configurator.html).
   Do not edit by hand: change the choices in the configurator and save again.
   Choices: primary #34302c, secondary #ebe5da, background #f7f3ec, headings Switzer, body Switzer,
   radius 10px, shadow soft, density compact, icons outline,
   button text contrast WCAG 2 AA (4.5:1).
   Usage: put class="ds-root" on <body>; element typography is scoped to it. */
@import url('https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700&display=swap');

:root {
  --accent: #34302c;
  --accent-hover: #181715;
  --accent-ui: #34302c;
  --accent-text: #34302c;
  --accent-text-hover: #1e1c19;
  --accent-bg: rgba(52, 48, 44, 0.12);
  --accent-bg-subtle: rgba(52, 48, 44, 0.06);
  --on-accent: #ffffff;
  --focus-ring: #34302c;
  --accent-rgb: 52, 48, 44;
  --secondary: #ebe5da;
  --secondary-hover: #f0ece4;
  --secondary-ui: #8f895a;
  --secondary-text: #6b6542;
  --duo-tint: 22%;
  --secondary-bg: rgba(235, 229, 218, 0.12);
  --secondary-bg-subtle: rgba(235, 229, 218, 0.06);
  --secondary-rgb: 235, 229, 218;
  --on-secondary: #282115;
  --success: #2f8f5b;
  --success-strong: #1d5939;
  --success-text: #28734c;
  --success-bg: #e6f2eb;
  --success-border: #b6d8c6;
  --error: #c8382d;
  --error-strong: #8e2820;
  --error-text: #bc352a;
  --error-bg: #f8e7e6;
  --error-border: #ecb9b6;
  --warning: #b7791f;
  --warning-strong: #7a5115;
  --warning-text: #8f5b15;
  --warning-bg: #f6efe4;
  --warning-border: #e6d0b1;
  --info: #2f6fa8;
  --info-strong: #1f4a70;
  --info-text: #2d69a0;
  --info-bg: #e6eef5;
  --info-border: #b6cde1;
  --on-error: #ffffff;
  --font-display: 'Switzer', -apple-system, sans-serif;
  --font: 'Switzer', -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius-control: 10px;
  --radius-field: min(10px, 0.375rem);
  --radius-chip: min(10px, 0.5rem);
  --radius-surface: min(10px, 1rem);
  --radius-overlay: min(15px, 1.75rem);
  --radius-pill: 999px;
  --shadow-color: 38 25% 16%;
  --shadow-sm: 0 1px 3px 0 hsl(var(--shadow-color) / 0.1), 0 1px 2px -1px hsl(var(--shadow-color) / 0.1);
  --shadow-md: 0 4px 6px -1px hsl(var(--shadow-color) / 0.1), 0 2px 4px -2px hsl(var(--shadow-color) / 0.1);
  --shadow-hover: 0 10px 15px -3px hsl(var(--shadow-color) / 0.1), 0 4px 6px -4px hsl(var(--shadow-color) / 0.1);
  --shadow-glow: 0 0 0 3px rgba(52, 48, 44, 0.25);
  --bg-primary: #f7f3ec;
  --bg-card: #fcfbf8;
  --bg-surface: #f2ece1;
  --bg-hover: #efe8da;
  --text-primary: #464035;
  --text-secondary: #6a6358;
  --text-label: #6f685d;
  --border: #e8dcc8;
  --border-subtle: #efe8da;
  --border-control: #8d866e;
  --disabled-bg: #efe8da;
  --disabled-text: #a6a096;
  --overlay: rgba(38, 34, 29, 0.5);
  --text-display: 2.563rem;
  --text-h1: 1.688rem;
  --text-h2: 1.375rem;
  --text-h3: 1.125rem;
  --text-body: 0.875rem;
  --text-ui: 0.813rem;
  --text-small: 0.75rem;
  --text-xs: 0.688rem;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-caps: 0.08em;
  --tracking-wordmark: 0.24em;
  --leading-tight: 1.2;
  --leading-loose: 1.5;
  --z-dropdown: 10;
  --z-overlay: 50;
  --z-modal: 100;
  --z-toast: 1000;
  --control-height-sm: 1.75rem;
  --control-height: 2.25rem;
  --control-height-lg: 2.75rem;
  --row-height: 2rem;
  --icon-sm: 0.875rem;
  --icon-md: 1.125rem;
  --icon-lg: 1.375rem;
  --field-label-top: 0.313rem;
  --field-pad-top: 1.313rem;
  --field-pad-top-multiline: 1.625rem;
  --field-pad-bottom: 0.375rem;
  --field-height: 3.188rem;
  --space-0: 0;
  --space-1: 0.188rem;
  --space-2: 0.375rem;
  --space-3: 0.75rem;
  --space-4: 1.125rem;
  --space-5: 1.5rem;
  --space-6: 1.875rem;
  --space-7: 2.25rem;
  --space-8: 3rem;
  --space-9: 3.75rem;
  --space-10: 4.5rem;
  --space-11: 6rem;
  --space-12: 7.5rem;
}

/* Component styles. Token-driven: no colour, spacing or radius literals.
   Control sizes come from --control-height*, --row-height and --field-* tokens (defined with the other tokens).
   Forced-state classes (.is-hover, .is-focus, .is-active, .is-disabled) mirror the
   pseudo-classes so every state can be shown statically on the demo page.
   Element-level typography is scoped to .ds-root; put class="ds-root" on <body>. */

@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .ds-root *, .ds-root *::before, .ds-root *::after { animation: none !important; transition: none !important; }
}

/* ---------- Base + typography ---------- */
.ds-root {
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: var(--leading-loose);
  color: var(--text-primary);
  background: var(--bg-primary);
}
.ds-root :where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin: 0;
}
.ds-root h1 { font-size: var(--text-h1); font-weight: var(--weight-bold); }
.ds-root h2 { font-size: var(--text-h2); font-weight: var(--weight-semibold); }
.ds-root h3 { font-size: var(--text-h3); font-weight: var(--weight-semibold); }
.ds-root :where(h4, h5, h6) { font-size: var(--text-body); font-weight: var(--weight-semibold); }
.ds-root p { margin: 0; }
.ds-root small, .text-small { font-size: var(--text-small); }
.text-muted { color: var(--text-secondary); }
/* Overline / eyebrow: small, uppercase, tracked, medium gray. For section labels and group
   headings, and above a title. The sidebar group heading is one. */
.text-overline, .sidebar-heading {
  font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-tight);
  text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-label);
}
/* Zero specificity on purpose: a link inside any component (sidebar, navbar, button) sets its own colour. */
:where(.ds-root) a { color: var(--accent-text); }
.ds-root code, .ds-root kbd {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  background: var(--bg-surface);
  border-radius: var(--radius-chip);
  padding: 0 var(--space-1);
}
/* A code block: monospaced, on the surface tint, scrolls sideways instead of wrapping (code keeps its lines). */
.ds-root pre, .code-block {
  margin: 0; padding: var(--space-3) var(--space-4); overflow: auto; white-space: pre; tab-size: 2;
  font-family: var(--font-mono); font-size: var(--text-small); line-height: var(--leading-loose); color: var(--text-primary);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-surface);
}
.ds-root pre code { padding: 0; background: none; border-radius: 0; font-size: inherit; }
.ds-root blockquote {
  margin: 0;
  padding-left: var(--space-4);
  border-left: 3px solid var(--accent-ui);
  color: var(--text-secondary);
}
/* Vertical rhythm: space above a heading grows with its rank; space below is the paragraph gap. */
.prose > * + * { margin-top: var(--space-3); }
.prose > * + h1 { margin-top: var(--space-8); }
.prose > * + h2 { margin-top: var(--space-6); }
.prose > * + h3 { margin-top: var(--space-4); }
.prose > :where(h1, h2, h3) + * { margin-top: var(--space-2); }
/* An overline starts a new block and belongs to the heading right under it. */
.prose > * + .text-overline { margin-top: var(--space-6); }
.prose > .text-overline + :where(h1, h2, h3) { margin-top: var(--space-1); }
.prose :where(ul, ol) { padding-left: var(--space-5); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: var(--space-4); box-sizing: border-box; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 16rem)), 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-sm { gap: var(--space-2); }
.stack-lg { gap: var(--space-5); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* ---------- Actions ---------- */
.btn {
  --btn-fg: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font); font-size: var(--text-ui); font-weight: var(--weight-medium); /* controls read --text-ui, not the body size */
  line-height: var(--leading-tight);
  min-height: var(--control-height); padding: var(--space-2) var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-control);
  color: var(--btn-fg); cursor: pointer; text-decoration: none; box-sizing: border-box; white-space: nowrap;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}
.btn-primary { background: var(--accent); --btn-fg: var(--on-accent); }
.btn-primary:is(:hover, .is-hover) { background: var(--accent-hover); }
.btn-secondary { background: var(--secondary); --btn-fg: var(--on-secondary); --ring: var(--secondary-ui); }
.btn-secondary:is(:hover, .is-hover) { background: var(--secondary-hover); }
.btn-tertiary { background: var(--accent-bg-subtle); --btn-fg: var(--accent-text); }
.btn-tertiary:is(:hover, .is-hover) { background: var(--accent-bg); }
.btn-destructive { background: var(--error); --btn-fg: var(--on-error); --ring: var(--error-strong); }
.btn-destructive:is(:hover, .is-hover) { background: var(--error-strong); }
/* Ghost: no fill until hover. For icon buttons in table rows and toolbars, where a tinted
   button in every row would read as a column of colored patches. */
.btn-ghost { background: transparent; --btn-fg: var(--text-secondary); }
.btn-ghost:is(:hover, .is-hover) { background: var(--bg-hover); --btn-fg: var(--text-primary); }
.btn-ghost.is-danger:is(:hover, .is-hover) { background: var(--error-bg); --btn-fg: var(--error-strong); --ring: var(--error-strong); }
.btn:is(:active, .is-active) { transform: translateY(1px); }
.btn:is(:focus-visible, .is-focus) { outline: 2px solid var(--ring, var(--focus-ring)); outline-offset: 2px; }
.btn-sm { min-height: var(--control-height-sm); padding: var(--space-1) var(--space-3); font-size: var(--text-small); }
.btn-lg { min-height: var(--control-height-lg); padding: var(--space-2) var(--space-6); font-size: var(--text-body); }
.btn-icon { padding: 0; width: var(--control-height); }
.btn-icon.btn-sm { width: var(--control-height-sm); }
.btn.is-loading { position: relative; color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 1.1em; height: 1.1em; box-sizing: border-box;
  border: 2px solid var(--btn-fg); border-right-color: transparent; border-radius: 50%;
  animation: ds-spin 0.7s linear infinite;
}
.btn:is(:disabled, .is-disabled) {
  background: var(--disabled-bg); color: var(--disabled-text); border-color: transparent;
  cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-ghost:is(:disabled, .is-disabled) { background: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-color: var(--bg-card); }
.btn-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ---------- Icons (Phosphor, three styles; size tokens follow density) ---------- */
.icon { display: inline-block; flex-shrink: 0; width: var(--icon-md); height: var(--icon-md); fill: currentColor; }
.icon-sm, .btn-sm .icon, .badge .icon, .tag .icon { width: var(--icon-sm); height: var(--icon-sm); }
.icon-lg, .btn-lg .icon { width: var(--icon-lg); height: var(--icon-lg); }
.menu-item-label { display: flex; align-items: center; gap: var(--space-2); }
.menu-item .icon { color: var(--text-label); }
.menu-item.is-destructive .icon { color: inherit; }

.link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.link:is(:hover, .is-hover) { color: var(--accent-text-hover); }
.link:has(> .icon) { display: inline-flex; align-items: center; gap: var(--space-1); }
.link:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-chip); }
/* A link-styled button that can't act now ("Reset" with nothing to reset): grey, no underline, not clickable. */
.link:is(:disabled, .is-disabled, [aria-disabled="true"]) { color: var(--disabled-text); text-decoration: none; cursor: not-allowed; }

.toggle {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-height);
  padding: var(--space-2) var(--space-4); font: inherit; font-size: var(--text-ui); font-weight: var(--weight-medium);
  color: var(--text-secondary); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-control); cursor: pointer;
}
.toggle:is(:hover, .is-hover) { background: var(--bg-hover); }
.toggle[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent-ui); }
.toggle:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.toggle:is(:disabled, .is-disabled) { background: var(--disabled-bg); color: var(--disabled-text); border-color: transparent; cursor: not-allowed; }

/* Segmented control: ONE choice among 2-6 short options (a view, a mode, a density) — the chosen one sits on a
   raised indicator that SLIDES to it. Not for navigation (tabs) and not for actions (a button group). Options
   are equal width (the indicator's geometry needs it) and never wrap; past 6 options, or long labels, use a select.
   Markup: <div class="segmented" role="group" aria-label="..."><button aria-pressed="true">…</button>…</div>.
   CSS only: the option count and the chosen index come from :has(), up to 6. An option that is off shows no
   choice; when the chosen one is off, the indicator goes (a disabled control shows no value). */
.segmented {
  --seg-pad: calc(var(--space-1) / 2); --seg-n: 1; --seg-i: 0;
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; box-sizing: border-box;
  padding: var(--seg-pad); background: var(--bg-hover); border-radius: var(--radius-control); /* one step darker than the surface: the track must read (owner) */
}
.segmented.is-block { display: grid; width: 100%; }
.segmented::before {
  content: ''; position: absolute; top: var(--seg-pad); bottom: var(--seg-pad); left: var(--seg-pad);
  width: calc((100% - 2 * var(--seg-pad)) / var(--seg-n)); transform: translateX(calc(100% * var(--seg-i)));
  background: var(--bg-card); border-radius: max(0px, calc(var(--radius-control) - var(--seg-pad))); box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.segmented:not(:has(> [aria-pressed="true"]:not(:disabled)))::before { visibility: hidden; }
.segmented:has(> :nth-child(2):last-child) { --seg-n: 2; }
.segmented:has(> :nth-child(3):last-child) { --seg-n: 3; }
.segmented:has(> :nth-child(4):last-child) { --seg-n: 4; }
.segmented:has(> :nth-child(5):last-child) { --seg-n: 5; }
.segmented:has(> :nth-child(6):last-child) { --seg-n: 6; }
.segmented:has(> :nth-child(2)[aria-pressed="true"]) { --seg-i: 1; }
.segmented:has(> :nth-child(3)[aria-pressed="true"]) { --seg-i: 2; }
.segmented:has(> :nth-child(4)[aria-pressed="true"]) { --seg-i: 3; }
.segmented:has(> :nth-child(5)[aria-pressed="true"]) { --seg-i: 4; }
.segmented:has(> :nth-child(6)[aria-pressed="true"]) { --seg-i: 5; }
.segmented > button {
  position: relative; z-index: 1; min-height: var(--control-height-sm); padding: 0 var(--space-3); box-sizing: border-box;
  font: inherit; font-size: var(--text-ui); font-weight: var(--weight-regular); line-height: var(--leading-tight); white-space: nowrap;
  color: var(--text-secondary); background: none; border: 0; border-radius: max(0px, calc(var(--radius-control) - var(--seg-pad))); cursor: pointer;
  transition: color 0.2s ease;
}
.segmented > button:is(:hover, .is-hover) { color: var(--text-primary); }
/* only the chosen option is medium: weight is part of what tells it apart (all-medium read flat — ELECT, 2026-10-04) */
.segmented > button[aria-pressed="true"] { color: var(--text-primary); font-weight: var(--weight-medium); }
.segmented > button:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.segmented > button:is(:disabled, .is-disabled) { color: var(--disabled-text); cursor: not-allowed; }

/* ---------- Forms ---------- */
.field-group { display: flex; flex-direction: column; gap: var(--space-1); }
.field { position: relative; display: block; }
.field :is(input, textarea, select) {
  width: 100%; box-sizing: border-box; min-height: var(--field-height);
  font-family: var(--font); font-size: var(--text-body); color: var(--text-primary);
  padding: var(--field-pad-top) var(--space-3) var(--field-pad-bottom);
  background: var(--accent-bg-subtle); border: 0; border-bottom: 2px solid var(--border-control);
  border-radius: var(--radius-field) var(--radius-field) 0 0; outline: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { min-height: calc(var(--field-height) * 1.75); padding-top: var(--field-pad-top-multiline); resize: vertical; }
.field :is(input, textarea, select):is(:hover, .is-hover) { background: var(--accent-bg); }
.field :is(input, textarea, select):is(:focus, .is-focus) {
  background: var(--bg-card); border-bottom-color: var(--accent-ui); box-shadow: inset 0 -1px 0 var(--accent-ui);
}
.field label {
  position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%);
  font-size: var(--text-body); line-height: var(--leading-tight); color: var(--text-label); pointer-events: none;
  transition: all 0.2s ease;
}
.field:has(textarea) label { top: var(--space-3); transform: none; }
.field :is(input, textarea):is(:focus, .is-focus, :not(:placeholder-shown)) + label,
.field select + label {
  top: var(--field-label-top); transform: none; font-size: var(--text-xs); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--accent-text);
}
.field-select::after {
  content: ''; position: absolute; right: var(--space-4); top: 50%; width: 0.4rem; height: 0.4rem;
  border: solid var(--text-label); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.field select { appearance: none; padding-right: var(--space-7); }
/* A field with no label of its own — inside a .form-row, whose head names it, like every other control there: a plain
   control at control height and UI text (a floated label would be the only one in the row written differently). */
.field:not(:has(label)) :is(input, select) { min-height: var(--control-height); padding: 0 var(--space-3); font-size: var(--text-ui); }
.field-select:not(:has(label)) select { padding-right: var(--space-7); }
.field:not(:has(label)) textarea { padding: var(--space-2) var(--space-3); font-size: var(--text-ui); }
:is(.field.has-error, .field-group.has-error .field) :is(input, textarea, select) { border-bottom-color: var(--error); }
:is(.field.has-error, .field-group.has-error .field) label { color: var(--error-strong); }
:is(.field.has-success, .field-group.has-success .field) :is(input, textarea, select) { border-bottom-color: var(--success); }
:is(.field.has-success, .field-group.has-success .field) label { color: var(--success-strong); }
:is(.field.has-success, .field-group.has-success .field) :is(input, textarea, select):is(:focus, .is-focus) { box-shadow: inset 0 -1px 0 var(--success); }
:is(.field.has-error, .field-group.has-error .field) :is(input, textarea, select):is(:focus, .is-focus) { box-shadow: inset 0 -1px 0 var(--error); }
.field :is(input, textarea, select):is(:disabled, .is-disabled) {
  background: var(--disabled-bg); color: var(--disabled-text); border-bottom-color: var(--border); box-shadow: none; cursor: not-allowed;
}
.field :is(input, textarea, select):is(:disabled, .is-disabled) + label { color: var(--disabled-text); }
.field-msg { display: flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-3); font-size: var(--text-small); color: var(--text-secondary); }
.field-group.has-error .field-msg { color: var(--error-strong); }
.field-group.has-success .field-msg { color: var(--success-strong); }
/* labels recede: regular weight, smaller and secondary — a medium label competed with the control under it (ELECT, 2026-10-04) */
.label { font-size: var(--text-small); font-weight: var(--weight-regular); color: var(--text-secondary); }

.input-group { display: flex; align-items: stretch; }
.input-group .field { flex: 1; }
.input-addon:first-child + .field :is(input) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.field:has(+ .input-addon) :is(input) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon {
  display: flex; align-items: center; padding: 0 var(--space-3);
  background: var(--bg-surface); color: var(--text-secondary); font-size: var(--text-small);
  border-bottom: 2px solid var(--border-control);
}
.input-addon:first-child { border-top-left-radius: var(--radius-field); }
.input-addon:last-child { border-top-right-radius: var(--radius-field); }

.check, .radio, .switch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-height-sm); font-size: var(--text-ui); cursor: pointer; }
.check input, .radio input, .switch input {
  appearance: none; margin: 0; flex-shrink: 0; cursor: inherit; position: relative;
  background: var(--bg-card); border: 2px solid var(--text-label);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.check input { width: 1.25rem; height: 1.25rem; border-radius: min(var(--radius-chip), 0.3rem); }
.radio input { width: 1.25rem; height: 1.25rem; border-radius: 50%; }
.check input:is(:hover, .is-hover), .radio input:is(:hover, .is-hover) { border-color: var(--accent-ui); }
.check input:checked, .radio input:checked { background: var(--accent); border-color: var(--accent-ui); }
.check input:checked::after {
  content: ''; position: absolute; left: 0.3rem; top: 0.05rem; width: 0.3rem; height: 0.6rem;
  border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.radio input:checked { box-shadow: inset 0 0 0 3px var(--bg-card); }
/* Switch (amended 2026-10-04, from ELECT): its size follows density (the icon size: 18 / 20 / 24px tall), and OFF is an
   outlined track (--border-control, 3:1 — WCAG 1.4.11) with a grey thumb: the old light fill + white thumb sat at
   1.3:1 and the off state didn't read. ON: the accent's UI shade with a card-coloured thumb. */
.switch input { --sw-h: var(--icon-md); box-sizing: border-box; width: calc(var(--sw-h) * 1.8); height: var(--sw-h);
  border-radius: var(--radius-pill); background: var(--bg-card); border-color: var(--border-control); }
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: calc(var(--sw-h) - 8px); height: calc(var(--sw-h) - 8px);
  border-radius: 50%; background: var(--text-label); transition: transform 0.2s ease, background-color 0.2s ease;
}
.switch input:checked { background: var(--accent-ui); border-color: var(--accent-ui); }
.switch input:checked::after { background: var(--bg-card); transform: translateX(calc(var(--sw-h) * 0.8)); }
:is(.check, .radio, .switch) input:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
:is(.check, .radio, .switch) input:disabled { background: var(--disabled-bg); border-color: var(--disabled-text); cursor: not-allowed; }
:is(.check, .radio, .switch):has(input:disabled) { color: var(--disabled-text); cursor: not-allowed; }
.check input:checked:disabled, .radio input:checked:disabled { background: var(--disabled-text); }
.choice-group { display: flex; flex-direction: column; gap: var(--space-1); }

/* Form row (from ELECT): the label ABOVE a control that isn't a text field (a segmented control, a slider, a colour,
   a group of switches), with an optional value or "i" at the right of the label. The floated-label .field is for
   text inputs only. */
.form-row { display: flex; flex-direction: column; gap: var(--space-1); }
.form-row-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  font-size: var(--text-small); font-weight: var(--weight-regular); color: var(--text-secondary); }
.form-row-head > :last-child:not(:first-child) { display: inline-flex; align-items: center; gap: var(--space-2); }
.form-row-value { font-weight: var(--weight-regular); color: var(--text-primary); font-variant-numeric: tabular-nums; }
/* A control that doesn't apply NOW is OFF, with its reason — not hidden (it shows the option exists and how to get
   it; nothing below jumps). The reason stays readable (4.5:1) even when its control is greyed. */
.reason { font-size: var(--text-small); font-weight: var(--weight-regular); color: var(--text-label); }

/* Slider (range): a track in the control-border grey (3:1, WCAG 1.4.11), a thumb in the accent's UI shade with a
   card-coloured ring. The part before the thumb is filled in the accent, so the chosen amount reads at a glance: Firefox
   draws it (::-moz-range-progress); Chrome / Safari have no such part, so the track is a gradient up to --range-pct
   (0–1), which the page sets on input (style.setProperty('--range-pct', …)). Unset → a plain track, never a wrong fill.
   The thumb's half-width keeps the fill's end under the thumb's centre. The value is shown beside it (.form-row-value). */
.range { display: block; width: 100%; height: var(--control-height-sm); margin: 0; background: transparent; cursor: pointer; appearance: none; -webkit-appearance: none; }
.range::-webkit-slider-runnable-track { height: 0.25rem; border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--accent-ui) calc(0.5625rem + (100% - 1.125rem) * var(--range-pct, -1)), var(--border-control) 0); }
.range:disabled::-webkit-slider-runnable-track { background: var(--border-control); }
.range:disabled::-moz-range-progress { background: var(--border-control); }
.range::-moz-range-track { height: 0.25rem; border-radius: var(--radius-pill); background: var(--border-control); }
.range::-moz-range-progress { height: 0.25rem; border-radius: var(--radius-pill); background: var(--accent-ui); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 1.125rem; height: 1.125rem; margin-top: -0.4375rem; border-radius: 50%;
  background: var(--accent-ui); border: 2px solid var(--bg-card); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 1.125rem; height: 1.125rem; box-sizing: border-box; border-radius: 50%; background: var(--accent-ui); border: 2px solid var(--bg-card); box-shadow: var(--shadow-sm); }
.range:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-chip); }
.range:disabled { cursor: not-allowed; }
.range:disabled::-webkit-slider-thumb { background: var(--disabled-text); }
.range:disabled::-moz-range-thumb { background: var(--disabled-text); }

/* Colour picker: the native colour input as a swatch (a 3:1 border), with the hex beside it. */
.color-pick { display: inline-flex; align-items: center; gap: var(--space-2); }
.color-pick input[type="color"] { width: var(--control-height-sm); height: var(--control-height-sm); padding: 0; flex-shrink: 0; cursor: pointer;
  border: 1px solid var(--border-control); border-radius: var(--radius-chip); background: none; appearance: none; -webkit-appearance: none; }
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-pick input[type="color"]::-webkit-color-swatch { border: 0; border-radius: max(0px, calc(var(--radius-chip) - 2px)); }
.color-pick input[type="color"]::-moz-color-swatch { border: 0; border-radius: max(0px, calc(var(--radius-chip) - 2px)); }
.color-pick input[type="color"]:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.color-pick code { font-family: var(--font-mono); font-size: var(--text-small); color: var(--text-secondary); text-transform: uppercase; }

/* The "i": a small round button that opens its explanation on hover AND on focus — a tap on a phone, Tab on a keyboard (.info-tip > .tooltip).
   The app adds Esc to dismiss it (WCAG 1.4.13); the bubble never covers the "i" itself. */
.info-tip { position: relative; display: inline-grid; place-items: center; width: var(--icon-md); height: var(--icon-md); padding: 0; flex-shrink: 0;
  color: var(--text-label); background: none; border: 0; border-radius: 50%; cursor: help; }
.info-tip > .icon { width: var(--icon-sm); height: var(--icon-sm); }
.info-tip:is(:hover, .is-hover) { color: var(--text-primary); }
.info-tip:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.info-tip > .tooltip { position: absolute; bottom: calc(100% + var(--space-1)); right: 0; z-index: var(--z-dropdown); width: max-content; max-width: 16rem;
  white-space: normal; text-align: left; font-style: normal; font-weight: var(--weight-regular); line-height: var(--leading-loose);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.15s ease, visibility 0.15s ease; }
.info-tip:is(:hover, :focus, .is-hover, .is-open) > .tooltip { opacity: 1; visibility: visible; }

/* ---------- Navigation ---------- */
/* Wraps at any width, not only under 480px: a longer menu (more links, a CTA) overflowed at
   700-1100px. On a wide screen it still fits on one row, so nothing changes there. */
.navbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-5); background: var(--bg-card);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
/* Wordmark: quiet, uppercase and widely spaced, so the brand reads as a mark and not as a link. */
.navbar-brand { font-family: var(--font-display); font-size: var(--text-body); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wordmark); color: var(--text-secondary); }
.navbar-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.navbar-links a { color: var(--text-secondary); text-decoration: none; font-size: var(--text-ui); font-weight: var(--weight-regular); }
.navbar-links a:is(:hover, .is-hover) { color: var(--text-primary); }
.navbar-links a:is(.is-active, [aria-current="page"]) { color: var(--accent-text); font-weight: var(--weight-medium); }
.navbar-links a:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-chip); }
/* On a phone the links FOLD into a menu button (.navbar-toggle, aria-expanded); open (.is-open, set by the app), they
   take the full width under the bar, one per row. Wrapping alone (above) is fine for 3 links, not for a real menu.
   .is-folded forces the phone layout (the demo shows it at any width). */
.navbar-toggle { display: none; }
@media (max-width: 480px) {
  .navbar-toggle { display: inline-flex; }
  .navbar:has(.navbar-toggle):not(.is-open) .navbar-links { display: none; }
  .navbar.is-open .navbar-links { flex-direction: column; align-items: stretch; width: 100%; }
}
.navbar.is-folded .navbar-toggle { display: inline-flex; }
.navbar.is-folded:not(.is-open) .navbar-links { display: none; }
.navbar.is-folded.is-open .navbar-links { flex-direction: column; align-items: stretch; width: 100%; }

/* Footer: the page's last row — quiet links and a line of small print, wrapping at any width. */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-5);
  padding: var(--space-5); border-top: 1px solid var(--border); font-size: var(--text-small); color: var(--text-secondary); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.footer-links a { color: inherit; text-decoration: none; }
.footer-links a:is(:hover, .is-hover) { color: var(--text-primary); text-decoration: underline; text-underline-offset: 0.2em; }
.footer-links a:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-chip); }

/* Sidebar: neutral text and icons, a subtle hover, and the accent used once. The active
   item gets a faint tint, an accent icon and a short accent bar. */
.sidebar {
  display: flex; flex-direction: column; gap: var(--space-1); width: 15rem; min-width: max-content; box-sizing: border-box; /* grows with larger text instead of letting a badge poke out */
  padding: var(--space-2); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface);
}
.sidebar-heading { padding: var(--space-2) var(--space-3); }
.sidebar-heading:not(:first-child) { padding-top: var(--space-4); }
.sidebar-item {
  position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: var(--row-height); box-sizing: border-box;
  padding: var(--space-1) var(--space-3); border-radius: max(0px, calc(var(--radius-surface) - var(--space-2)));
  color: var(--text-secondary); text-decoration: none; font-size: var(--text-ui); font-weight: var(--weight-medium);
}
.sidebar-item .icon { color: var(--text-label); }
.sidebar-item .badge { margin-left: auto; }
.sidebar-item:is(:hover, .is-hover) { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item:is(:hover, .is-hover) .icon { color: var(--text-primary); }
.sidebar-item.is-active { background: var(--accent-bg-subtle); color: var(--text-primary); font-weight: var(--weight-semibold); }
.sidebar-item.is-active .icon { color: var(--accent-text); }
.sidebar-item.is-active::before {
  content: ''; position: absolute; left: 0; inset-block: 25%; width: 3px;
  border-radius: var(--radius-pill); background: var(--accent-ui);
}
.sidebar-item:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.tabs { display: flex; gap: var(--space-4); border-bottom: 1px solid var(--border); }
.tab {
  min-height: var(--control-height); padding: var(--space-2) 0; background: none; border: 0; border-bottom: 2px solid transparent;
  margin-bottom: -1px; font: inherit; font-size: var(--text-ui); font-weight: var(--weight-medium); color: var(--text-secondary); cursor: pointer;
}
.tab:is(:hover, .is-hover) { color: var(--text-primary); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent-ui); }
.tab:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-chip); }
.tab:disabled { color: var(--disabled-text); cursor: not-allowed; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0; font-size: var(--text-small); color: var(--text-secondary); }
.breadcrumb li + li::before { content: '/'; margin-right: var(--space-2); color: var(--text-label); }
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:is(:hover, .is-hover) { color: var(--accent-text); text-decoration: underline; }
.breadcrumb li:last-child { color: var(--text-primary); font-weight: var(--weight-medium); }

.pagination { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.page {
  min-width: var(--row-height); min-height: var(--row-height); padding: 0 var(--space-2); box-sizing: border-box; font: inherit;
  background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: var(--radius-control); cursor: pointer;
}
.page:is(:hover, .is-hover) { background: var(--bg-hover); }
.page.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.page:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.page:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }

.menu {
  display: flex; flex-direction: column; min-width: 12rem; box-sizing: border-box; padding: var(--space-1);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); box-shadow: var(--shadow-md);
}
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--row-height); box-sizing: border-box;
  padding: var(--space-1) var(--space-3); border: 0; background: none; font: inherit; font-size: var(--text-ui); text-align: left;
  color: var(--text-primary); border-radius: max(0px, calc(var(--radius-surface) - var(--space-1))); cursor: pointer;
}
.menu-item:is(:hover, .is-hover, :focus-visible, .is-focus) { background: var(--bg-hover); }
.menu-item:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.menu-item.is-destructive { color: var(--error-strong); }
.menu-item:disabled { color: var(--disabled-text); cursor: not-allowed; background: none; }
.menu-separator { height: 1px; background: var(--border); margin: var(--space-1) 0; }

/* ---------- Feedback ---------- */
/* The status icon is an <svg class="icon"> in the markup, not drawn with CSS, so it follows the
   chosen icon style (outline, filled, duotone) and the icon size tokens. */
.alert, .toast {
  --alert-bg: var(--info-bg); --alert-border: var(--info-border); --alert-fg: var(--info-strong);
  display: flex; align-items: flex-start; gap: var(--space-3); box-sizing: border-box;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-surface);
  background: var(--alert-bg); border: 1px solid var(--alert-border); color: var(--alert-fg);
}
.alert > .icon, .toast > .icon { color: var(--alert-fg); margin-top: calc((var(--text-body) * var(--leading-loose) - var(--icon-md)) / 2); }
.alert-success { --alert-bg: var(--success-bg); --alert-border: var(--success-border); --alert-fg: var(--success-strong); }
.alert-warning { --alert-bg: var(--warning-bg); --alert-border: var(--warning-border); --alert-fg: var(--warning-strong); }
.alert-error { --alert-bg: var(--error-bg); --alert-border: var(--error-border); --alert-fg: var(--error-strong); }
.alert-title { font-weight: var(--weight-semibold); }
.alert-body { flex: 1; display: flex; flex-direction: column; gap: var(--space-1); }
.toast { background: var(--bg-card); border-color: var(--border); border-left: 4px solid var(--alert-fg); box-shadow: var(--shadow-md); color: var(--text-primary); width: 22rem; max-width: 100%; }
.toast-success { --alert-fg: var(--success-strong); }
.toast-warning { --alert-fg: var(--warning-strong); }
.toast-error { --alert-fg: var(--error-strong); }
.toast-close { margin-left: auto; background: none; border: 0; font: inherit; font-size: var(--text-h3); line-height: 1; color: var(--text-label); cursor: pointer; }

.progress { height: 0.5rem; background: var(--bg-surface); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--value, 0%); background: var(--accent-ui); border-radius: inherit; transition: width 0.3s ease; }
.progress-success > span { background: var(--success); }
.progress-error > span { background: var(--error); }
.spinner { width: 1.5rem; height: 1.5rem; box-sizing: border-box; border: 3px solid var(--accent-bg); border-top-color: var(--accent-ui); border-radius: 50%; animation: ds-spin 0.8s linear infinite; }
.skeleton {
  min-height: 1rem; border-radius: var(--radius-chip); background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-hover) 50%, var(--bg-surface) 75%);
  animation: ds-shimmer 1.6s linear infinite;
}
.skeleton-circle { border-radius: 50%; width: 2.5rem; height: 2.5rem; }
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3);
  padding: var(--space-8) var(--space-5); border: 1px dashed var(--border); border-radius: var(--radius-surface); color: var(--text-secondary);
}
.empty-icon { display: flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); font-size: var(--text-h3); }

.badge, .tag {
  --chip-bg: var(--accent-bg); --chip-fg: var(--accent-text);
  display: inline-flex; align-items: center; gap: var(--space-1); box-sizing: border-box;
  font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: var(--leading-tight); white-space: nowrap;
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--chip-bg); color: var(--chip-fg);
}
/* A badge is as wide as its content, floored at its own height (1em line box + the vertical
   padding it already has) so a label that's naturally narrower than it is tall (a single
   letter) still reads as a circle instead of a sliver; badge-lg's bigger font raises that floor
   too, since 1em tracks the cascaded font-size. Text badges (Success, Neutral, ...) are already
   wider than this floor, so it has no visible effect on them. */
.badge { min-width: calc(1em * var(--leading-tight) + 2 * var(--space-1)); justify-content: center; }
.badge-lg { font-size: var(--text-small); padding: var(--space-1) var(--space-4); }
/* Count badges (sidebar unread count, notification indicators): var(--space-3) is sized for
   prose ("Success", "Neutral"), so a lone digit ends up padded into a wide oval. --space-1 on
   both axes matches the min-width floor above exactly, so 1-2 digits form a true circle and only
   3+ digits grow past it into a pill (Material's rule for numeric badges). */
.badge-count { padding-inline: var(--space-1); }
.badge-success { --chip-bg: var(--success-bg); --chip-fg: var(--success-strong); }
.badge-warning { --chip-bg: var(--warning-bg); --chip-fg: var(--warning-strong); }
.badge-error { --chip-bg: var(--error-bg); --chip-fg: var(--error-strong); }
.badge-info { --chip-bg: var(--info-bg); --chip-fg: var(--info-strong); }
.badge-neutral { --chip-bg: var(--bg-surface); --chip-fg: var(--text-secondary); }
.tag { border-radius: var(--radius-chip); --chip-bg: var(--bg-surface); --chip-fg: var(--text-primary); border: 1px solid var(--border); }
.tag-remove { background: none; border: 0; padding: 0; margin-left: var(--space-1); font: inherit; line-height: 1; color: var(--text-label); cursor: pointer; }
.tag-remove:is(:hover, .is-hover) { color: var(--error-strong); }

/* ---------- Overlays (static in the demo; the app adds position: fixed) ---------- */
.overlay { display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: var(--overlay); border-radius: var(--radius-surface); }
.overlay.is-fixed { position: fixed; inset: 0; z-index: var(--z-modal); border-radius: 0; }
.overlay-end { justify-content: flex-end; align-items: stretch; padding: 0; }
.dialog {
  display: flex; flex-direction: column; width: min(28rem, 100%); box-sizing: border-box;
  background: var(--bg-card); border-radius: var(--radius-overlay); box-shadow: var(--shadow-hover);
}
.dialog-header { padding: var(--space-4) var(--space-5) 0; }
.dialog-body { padding: var(--space-3) var(--space-5); color: var(--text-secondary); }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-4); }
/* .dialog as a REAL <dialog> (showModal: focus trap, Esc, the backdrop): the browser's own box styles are reset, a
   closed one stays hidden (.dialog's display would otherwise show it), and it enters with the overlay curve. */
dialog.dialog { padding: 0; border: 0; color: inherit; max-width: calc(100% - 2 * var(--space-5)); max-height: calc(100% - 2 * var(--space-5)); }
dialog.dialog:not([open]) { display: none; }
dialog.dialog::backdrop { background: var(--overlay); }
dialog.dialog[open] { animation: ds-dialog-in 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes ds-dialog-in { from { opacity: 0; transform: translateY(var(--space-2)) scale(0.98); } }
.drawer {
  display: flex; flex-direction: column; width: min(22rem, 100%); box-sizing: border-box;
  background: var(--bg-card); box-shadow: var(--shadow-hover);
}
.popover {
  width: 16rem; max-width: 100%; box-sizing: border-box; padding: var(--space-3);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); box-shadow: var(--shadow-md);
}
.tooltip {
  display: inline-block; padding: var(--space-1) var(--space-2); font-size: var(--text-xs);
  background: var(--text-primary); color: var(--bg-primary); border-radius: var(--radius-chip);
}

/* ---------- Data display ---------- */
/* Proximity: card children are groups. Between groups the gap is --space-3; inside a group it is --space-2,
   half as much, so related things (title + who/when, text + action) read as one unit. */
.card {
  display: flex; flex-direction: column; gap: var(--space-3); box-sizing: border-box; padding: var(--space-4);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); box-shadow: var(--shadow-sm);
}
.card-group { display: flex; flex-direction: column; gap: var(--space-2); }
.card-interactive { cursor: pointer; transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card-interactive:is(:hover, .is-hover) { box-shadow: var(--shadow-hover); }
.card-label { font-size: var(--text-small); color: var(--text-label); }
/* Metadata (who / when): smaller and quieter than the description above it, led by an icon. */
.card-meta { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-label); }

.table-wrap { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: var(--space-2) var(--space-3); text-align: left; font-size: var(--text-small); font-weight: var(--weight-semibold); color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: var(--space-3); border-bottom: 1px solid var(--border-subtle); font-size: var(--text-small); } /* tables read smaller than body copy (USWDS, ServiceNow) */
.table tbody tr:last-child td { border-bottom: 0; }
/* Actions column: shrinks to its buttons, right-aligned. The cell's vertical padding is small
   so a 40px icon button does not make its row taller than the rows around it. */
.table :is(th, td).table-actions { width: 1%; white-space: nowrap; text-align: right; }
.table td.table-actions { padding-block: var(--space-1); }
.row-actions { display: inline-flex; gap: var(--space-1); }
.table tbody tr:is(:hover, .is-hover) { background: var(--bg-hover); }

.list { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.list-item:last-child { border-bottom: 0; }
.list-item:is(:hover, .is-hover) { background: var(--bg-hover); }
.list-item-main { flex: 1; display: flex; flex-direction: column; }
.list-item-title { font-weight: var(--weight-medium); }
.list-item-meta { font-size: var(--text-small); color: var(--text-secondary); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text);
  font-size: var(--text-small); font-weight: var(--weight-semibold);
}
.avatar-sm { width: 2rem; height: 2rem; font-size: var(--text-xs); }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: var(--text-body); }
.avatar-group { display: flex; }
.avatar-group .avatar { border: 2px solid var(--bg-card); }
.avatar-group .avatar + .avatar { margin-left: calc(var(--space-2) * -1); }

.accordion { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-surface); overflow: hidden; }
.accordion details + details { border-top: 1px solid var(--border); }
/* Rows at the container's edge take its radius minus the 1px border (concentric), so the
   hover background and the focus ring follow the curve instead of poking past it. */
.accordion details:first-child > summary { border-top-left-radius: calc(var(--radius-surface) - 1px); border-top-right-radius: calc(var(--radius-surface) - 1px); }
.accordion details:last-child:not([open]) > summary { border-bottom-left-radius: calc(var(--radius-surface) - 1px); border-bottom-right-radius: calc(var(--radius-surface) - 1px); }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-height); box-sizing: border-box;
  padding: var(--space-2) var(--space-4); font-weight: var(--weight-medium); cursor: pointer; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: '+'; color: var(--text-label); font-size: var(--text-h3); line-height: 1; }
.accordion details[open] summary::after { content: '\2212'; }
.accordion summary:is(:hover, .is-hover) { background: var(--bg-hover); }
.accordion summary:is(:focus-visible, .is-focus) { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.accordion-body { padding: 0 var(--space-4) var(--space-4); color: var(--text-secondary); }

.separator { height: 1px; border: 0; margin: 0; background: var(--border); }
.separator-vertical { width: 1px; height: auto; align-self: stretch; }

/* Icon-style controls (opt-in: class "controls-outline" or "controls-duotone" on the root, set by the
   configurator's "Affect buttons and pills"). Filled = the solid default above. Outline: transparent
   with a 2px border in the button's own colour. Duotone: the same border plus a tint of that colour
   (--duo-tint). Hover: outline gets a light tint, duotone fills solid. Tertiary and ghost keep their look so
   primary and tertiary stay distinguishable. Text is the -text / -strong shade of the hue, checked against
   the tint, so mid-tone brand colours need no white/black call. */
:is(.controls-outline, .controls-duotone) .btn-primary { --btn-fg: var(--accent-text); --ring-color: var(--accent-ui); }
:is(.controls-outline, .controls-duotone) .btn-secondary { --btn-fg: var(--secondary-text); --ring-color: var(--secondary-ui); }
:is(.controls-outline, .controls-duotone) .btn-destructive { --btn-fg: var(--error-strong); --ring-color: var(--error); }
:is(.controls-outline, .controls-duotone) :is(.btn-primary, .btn-secondary, .btn-destructive) { border: 2px solid var(--ring-color); }
/* Outline: text and border are one colour, the text-safe shade of the hue. */
.controls-outline .btn-primary { --btn-fg: var(--accent-text); --ring-color: var(--accent-text); }
.controls-outline .btn-secondary { --btn-fg: var(--secondary-text); --ring-color: var(--secondary-text); }
.controls-outline .btn-destructive { --btn-fg: var(--error-text); --ring-color: var(--error-text); }
.controls-outline :is(.btn-primary, .btn-secondary, .btn-destructive) { background: transparent; }
.controls-duotone :is(.btn-primary, .btn-secondary, .btn-destructive) { background: color-mix(in srgb, var(--ring-color) var(--duo-tint), transparent); }
.controls-outline :is(.btn-primary, .btn-secondary, .btn-destructive):is(:hover, .is-hover) { background: color-mix(in srgb, var(--ring-color) calc(var(--duo-tint) / 4), transparent); }
.controls-duotone .btn-primary:is(:hover, .is-hover) { background: var(--accent); --btn-fg: var(--on-accent); border-color: var(--accent); }
.controls-duotone .btn-secondary:is(:hover, .is-hover) { background: var(--secondary); --btn-fg: var(--on-secondary); border-color: var(--secondary); }
.controls-duotone .btn-destructive:is(:hover, .is-hover) { background: var(--error); --btn-fg: var(--on-error); border-color: var(--error); }
:is(.controls-outline, .controls-duotone) .btn:is(:disabled, .is-disabled) { border: 2px solid var(--border); }
.controls-outline .btn:is(:disabled, .is-disabled) { background: transparent; }
.controls-duotone .btn:is(:disabled, .is-disabled) { background: var(--disabled-bg); }
:is(.controls-outline, .controls-duotone) .badge { --chip-ring: var(--accent-ui); border: 2px solid var(--chip-ring); }
:is(.controls-outline, .controls-duotone) .badge-success { --chip-ring: var(--success); }
:is(.controls-outline, .controls-duotone) .badge-warning { --chip-ring: var(--warning); }
:is(.controls-outline, .controls-duotone) .badge-error { --chip-ring: var(--error); }
:is(.controls-outline, .controls-duotone) .badge-info { --chip-ring: var(--info); }
:is(.controls-outline, .controls-duotone) .badge-neutral { --chip-ring: var(--border-control); }
.controls-outline .badge { --chip-fg: var(--accent-text); --chip-ring: var(--accent-text); background: transparent; }
.controls-outline .badge-success { --chip-fg: var(--success-text); --chip-ring: var(--success-text); }
.controls-outline .badge-warning { --chip-fg: var(--warning-text); --chip-ring: var(--warning-text); }
.controls-outline .badge-error { --chip-fg: var(--error-text); --chip-ring: var(--error-text); }
.controls-outline .badge-info { --chip-fg: var(--info-text); --chip-ring: var(--info-text); }
.controls-outline .badge-neutral { --chip-fg: var(--text-secondary); --chip-ring: var(--text-secondary); }
.controls-duotone .badge { background: color-mix(in srgb, var(--chip-ring) var(--duo-tint), transparent); }

/* ---------- Mobile (~480px and under) ---------- */
/* Pieces that assume desktop width wrap onto a second line instead of pushing the page
   wider than the viewport. Nothing here changes tokens, colours or structure. */
@media (max-width: 480px) {
  .tabs { flex-wrap: wrap; row-gap: var(--space-1); }
  /* Headings step down (GOV.UK does the same, 48px -> 32px on phone). calc() off the existing
     token, not a new size: it still moves with density and the chosen type scale. */
  .ds-root h1 { font-size: calc(var(--text-h1) * 0.75); }
  .ds-root h2 { font-size: calc(var(--text-h2) * 0.75); }
  .ds-root h3 { font-size: calc(var(--text-h3) * 0.75); }
}
