/* ==========================================================================
   Barrett Ahern Design System: components.css
   Requires tokens.css. All values come from tokens. No hex codes in this file.
   Naming: .ds-<component>, .ds-<component>--<variant>, .ds-<component>__<part>
   Sections: 1 Base · 2 Layout · 3 Type · 4 Actions · 5 Forms · 6 Feedback · 7 Containers
             8 Navigation · 9 Data display · 10 Audit/report · 11 Editorial · 12 Overlays
   ========================================================================== */

/* 1. Base ------------------------------------------------------------------ */
.ds-root, .ds-root *, .ds-root *::before, .ds-root *::after { box-sizing: border-box; }
.ds-root {
  font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--lh-body);
  color: var(--text-primary); background: var(--bg-base); -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}
.ds-root :where(h1,h2,h3,h4,p,ul,ol,figure,blockquote) { margin: 0; }
.ds-root :where(ul,ol) { padding: 0; list-style: none; }
.ds-root :where(a) { color: inherit; }
.ds-root :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.ds-root ::selection { background: var(--accent); color: var(--accent-ink); }
.ds-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ds-root * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* 2. Layout ---------------------------------------------------------------- */
.ds-wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)); }
.ds-wrap--narrow { max-width: var(--wrap-narrow); }
.ds-band { padding-block: var(--space-1200); border-bottom: 1px solid var(--border-faint); }
@media (min-width: 768px) { .ds-band { padding-block: var(--space-1600); } }
.ds-stack { display: flex; flex-direction: column; gap: var(--gap, var(--space-400)); }
.ds-stack--sm { --gap: var(--space-200); } .ds-stack--lg { --gap: var(--space-800); }
.ds-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-200)); }
.ds-inline--between { justify-content: space-between; }
.ds-grid { display: grid; gap: var(--space-300); grid-template-columns: repeat(auto-fit, minmax(var(--min, 260px), 1fr)); }
.ds-g2 { --min: 320px; } .ds-g3 { --min: 260px; } .ds-g4 { --min: 210px; }
/* Polaris-style two-column page layout: main + secondary */
.ds-layout { display: grid; gap: var(--space-400); grid-template-columns: 1fr; }
@media (min-width: 900px) { .ds-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
/* Annotated section: description left, card right */
.ds-annotated { display: grid; gap: var(--space-400); padding-block: var(--space-600); border-top: 1px solid var(--border-faint); }
@media (min-width: 900px) { .ds-annotated { grid-template-columns: 1fr 2fr; } }
.ds-divider { border: 0; border-top: 1px solid var(--border-subtle); margin: 0; }

/* 3. Type ------------------------------------------------------------------ */
.ds-eyebrow { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; }
.ds-h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 4vw, var(--text-4xl)); line-height: var(--lh-tight); letter-spacing: -.02em; }
.ds-h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 2.6vw, var(--text-3xl)); line-height: var(--lh-tight); letter-spacing: -.015em; max-width: 30ch; }
.ds-h3 { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-lg); line-height: var(--lh-snug); letter-spacing: -.01em; }
.ds-h4 { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-md); line-height: 1.3; }
.ds-standfirst { font-size: var(--text-lg); line-height: 1.5; color: var(--text-secondary); max-width: 68ch; }
.ds-body { font-size: var(--text-md); }
.ds-note { font-size: var(--text-xs); line-height: 1.35; color: var(--text-secondary); }
.ds-mono { font-family: var(--font-mono); }
.ds-num { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
.ds-muted { color: var(--text-secondary); }
.ds-link { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-subtle); text-underline-offset: 3px; transition: text-decoration-color var(--dur-fast); }
.ds-link:hover { text-decoration-color: var(--text-primary); }
.ds-code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-sunken); border: 1px solid var(--border-faint); border-radius: var(--radius-sm); padding: 1px 5px; }

/* 4. Actions --------------------------------------------------------------- */
.ds-btn {
  --h: var(--control-md);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-150);
  min-height: var(--h); padding: 0 var(--space-400); font: 600 var(--text-md)/1 var(--font-sans);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--bg-raised); color: var(--text-primary); text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.ds-btn:hover { background: var(--hover); border-color: var(--border-strong); }
.ds-btn:active { transform: translateY(1px); }
.ds-btn--primary { background: var(--action-bg); color: var(--action-ink); border-color: var(--action-bg); }
.ds-btn--primary:hover { background: var(--action-bg); filter: brightness(1.12); border-color: var(--action-bg); }
.ds-btn--accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ds-btn--accent:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.ds-btn--plain { background: transparent; border-color: transparent; padding-inline: var(--space-200); }
.ds-btn--plain:hover { background: var(--hover); border-color: transparent; }
.ds-btn--critical { background: var(--status-danger); color: #fff; border-color: var(--status-danger); }
.ds-btn--critical:hover { background: var(--status-danger); filter: brightness(1.1); border-color: var(--status-danger); }
.ds-btn--sm { --h: var(--control-sm); padding-inline: var(--space-300); font-size: var(--text-sm); }
.ds-btn--lg { --h: var(--control-lg); padding-inline: var(--space-600); font-size: var(--text-lg); }
.ds-btn--icon { width: var(--h); padding: 0; }
.ds-btn[disabled], .ds-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.ds-btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.ds-btn[aria-busy="true"]::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--action-ink); border-right-color: transparent; border-radius: 50%; animation: ds-spin .7s linear infinite; }
.ds-btn--primary[aria-busy="true"]::after { border-color: var(--action-ink); border-right-color: transparent; }
.ds-btn:not(.ds-btn--primary):not(.ds-btn--accent)[aria-busy="true"]::after { border-color: var(--text-primary); border-right-color: transparent; }
.ds-btn-group { display: inline-flex; }
.ds-btn-group .ds-btn { border-radius: 0; margin-left: -1px; }
.ds-btn-group .ds-btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; }
.ds-btn-group .ds-btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.ds-btn-group .ds-btn[aria-pressed="true"] { background: var(--selected); border-color: var(--border-strong); position: relative; z-index: 1; }
.ds-cta { display: inline-flex; gap: var(--space-200); align-items: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-primary); padding-bottom: 3px; border-bottom: 1px solid var(--border-subtle); text-decoration: none; transition: border-color var(--dur-fast); }
.ds-cta:hover { border-color: var(--text-primary); }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* 5. Forms ----------------------------------------------------------------- */
.ds-field { display: flex; flex-direction: column; gap: var(--space-100); }
.ds-label { font-size: var(--text-sm); font-weight: 600; }
.ds-help { font-size: var(--text-xs); color: var(--text-secondary); }
.ds-error-text { font-size: var(--text-xs); color: var(--status-danger-text); display: flex; gap: var(--space-100); align-items: center; font-weight: 600; }
.ds-input, .ds-select, .ds-textarea {
  width: 100%; min-height: var(--control-md); padding: 0 var(--space-300); font: 400 var(--text-md)/1.4 var(--font-sans);
  color: var(--text-primary); background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.ds-textarea { padding-block: var(--space-200); min-height: 88px; resize: vertical; }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--text-muted); }
.ds-input:hover, .ds-select:hover, .ds-textarea:hover { border-color: var(--border-strong); }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.ds-input[aria-invalid="true"], .ds-select[aria-invalid="true"], .ds-textarea[aria-invalid="true"] { border-color: var(--status-danger); box-shadow: 0 0 0 1px var(--status-danger); }
.ds-input:disabled, .ds-select:disabled, .ds-textarea:disabled { background: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed; }
.ds-select { appearance: none; padding-right: var(--space-800); background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ds-check { display: inline-flex; gap: var(--space-200); align-items: flex-start; font-size: var(--text-md); cursor: pointer; }
.ds-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--action-bg); cursor: pointer; }
.ds-switch { display: inline-flex; gap: var(--space-200); align-items: center; cursor: pointer; font-size: var(--text-md); }
.ds-switch input { appearance: none; width: 36px; height: 20px; border-radius: var(--radius-pill); background: var(--border-subtle); position: relative; transition: background var(--dur-fast); cursor: pointer; margin: 0; }
.ds-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg-raised); box-shadow: 0 0 0 1px var(--border-subtle); transition: transform var(--dur) var(--ease); }
.ds-switch input:checked { background: var(--action-bg); }
.ds-switch input:checked::after { transform: translateX(16px); }
.ds-range { width: 100%; accent-color: var(--action-bg); }
.ds-search { position: relative; }
.ds-search .ds-input { padding-left: var(--space-800); }
.ds-search::before { content: ""; position: absolute; left: 11px; top: 50%; width: 10px; height: 10px; border: 1.5px solid var(--text-secondary); border-radius: 50%; transform: translateY(-65%); pointer-events: none; }
.ds-search::after { content: ""; position: absolute; left: 22px; top: calc(50% + 3px); width: 5px; height: 1.5px; background: var(--text-secondary); transform: rotate(45deg); pointer-events: none; }

/* 6. Feedback -------------------------------------------------------------- */
/* Badge: tone + word + square marker, so colour never carries meaning alone. */
.ds-badge { --c: var(--text-secondary); --bg: var(--bg-sunken); --fg: var(--text-primary);
  display: inline-flex; align-items: center; gap: var(--space-150); padding: 2px var(--space-200); border-radius: var(--radius-pill);
  font-size: var(--text-xs); line-height: 16px; font-weight: 600; background: var(--bg); color: var(--fg); border: 1px solid var(--border-faint); white-space: nowrap; }
.ds-badge::before { content: ""; width: 7px; height: 7px; background: var(--c); border-radius: 1px; flex: none; }
.ds-badge--success   { --c: var(--status-success);   --bg: color-mix(in srgb, var(--status-success) 18%, var(--bg-raised));   --fg: var(--status-success-text); border-color: transparent; }
.ds-badge--warning   { --c: var(--status-warning);   --bg: color-mix(in srgb, var(--status-warning) 20%, var(--bg-raised));   --fg: var(--status-warning-text); border-color: transparent; }
.ds-badge--critical  { --c: var(--status-danger);    --bg: color-mix(in srgb, var(--status-danger) 16%, var(--bg-raised));    --fg: var(--status-danger-text); border-color: transparent; }
.ds-badge--attention { --c: var(--status-attention); --bg: color-mix(in srgb, var(--status-attention) 24%, var(--bg-raised)); --fg: var(--status-attention-text); border-color: transparent; }
.ds-badge--info      { --c: var(--status-info);      --bg: color-mix(in srgb, var(--status-info) 20%, var(--bg-raised));      --fg: var(--status-info-text); border-color: transparent; }
.ds-badge--plain::before { display: none; }
.ds-tier { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font: 500 11px/1 var(--font-mono); }
.ds-tier--f { background: var(--text-primary); color: var(--bg-base); }
.ds-tier--a { background: var(--selected); }
.ds-tier--c { border-style: dashed; border-color: var(--border-subtle); color: var(--text-secondary); }
.ds-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-danger); display: inline-block; animation: ds-pulse 1.8s ease-out infinite; }
@keyframes ds-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-danger) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.ds-banner { --c: var(--status-info); --fg: var(--status-info-text);
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-300); align-items: start; padding: var(--space-400);
  border: 1px solid var(--border-subtle); border-left: 4px solid var(--c); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--c) 10%, var(--bg-raised)); }
.ds-banner--success { --c: var(--status-success); --fg: var(--status-success-text); }
.ds-banner--warning { --c: var(--status-warning); --fg: var(--status-warning-text); }
.ds-banner--critical { --c: var(--status-danger); --fg: var(--status-danger-text); }
.ds-banner--attention { --c: var(--status-attention); --fg: var(--status-attention-text); }
.ds-banner__icon { width: 20px; height: 20px; display: grid; place-items: center; background: var(--c); color: var(--bg-raised); border-radius: 3px; font: 700 12px/1 var(--font-sans); }
.ds-banner__title { font-weight: 600; color: var(--fg); }
.ds-banner__body { font-size: var(--text-sm); color: var(--text-primary); margin-top: 2px; }
.ds-toast { position: fixed; left: 50%; bottom: var(--space-600); transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  display: flex; gap: var(--space-300); align-items: center; padding: var(--space-300) var(--space-400); background: var(--bg-invert); color: var(--text-on-invert);
  border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-pop); z-index: var(--z-toast);
  transition: transform var(--dur) var(--ease), opacity var(--dur); }
.ds-toast[data-open="true"] { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.ds-spinner { width: 20px; height: 20px; border: 2px solid var(--border-subtle); border-top-color: var(--text-primary); border-radius: 50%; animation: ds-spin .7s linear infinite; display: inline-block; }
.ds-skeleton { background: linear-gradient(90deg, var(--bg-sunken), var(--bg-overlay), var(--bg-sunken)); background-size: 200% 100%; border-radius: var(--radius-sm); min-height: 14px; animation: ds-shimmer 1.4s linear infinite; }
@keyframes ds-shimmer { to { background-position: -200% 0; } }
.ds-progress { height: 6px; background: var(--bg-overlay); border-radius: var(--radius-pill); overflow: hidden; }
.ds-progress > span { display: block; height: 100%; width: var(--v, 0%); background: var(--action-bg); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }

/* 7. Containers ------------------------------------------------------------ */
.ds-card { background: var(--bg-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-400); display: flex; flex-direction: column; gap: var(--space-300); transition: border-color var(--dur-fast), transform var(--dur) var(--ease), box-shadow var(--dur); }
@media (min-width: 768px) { .ds-card { padding: var(--space-400) var(--space-600); } }
.ds-card--flat { background: transparent; }
.ds-card--sunken { background: var(--bg-sunken); }
.ds-card--interactive { text-decoration: none; color: inherit; }
.ds-card--interactive:hover { border-color: var(--border-strong); transform: translateY(var(--lift)); box-shadow: var(--shadow-hover); }
.ds-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-300); }
.ds-card__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-300); padding-top: var(--space-300); border-top: 1px solid var(--border-faint); }
.ds-card__media { margin: calc(var(--space-400) * -1) calc(var(--space-400) * -1) 0; aspect-ratio: 16/9; background: var(--bg-overlay); border-radius: var(--radius-md) var(--radius-md) 0 0; overflow: hidden; }
.ds-card__media img { width: 100%; height: 100%; object-fit: cover; }
.ds-callout { border-left: 3px solid var(--accent); background: var(--bg-sunken); padding: var(--space-300) var(--space-400); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: var(--text-md); }
.ds-callout strong { font-weight: 700; }
.ds-empty { text-align: center; padding: var(--space-1200) var(--space-400); display: flex; flex-direction: column; align-items: center; gap: var(--space-300); border: 1px dashed var(--border-subtle); border-radius: var(--radius-md); }
.ds-empty p { max-width: 44ch; color: var(--text-secondary); }
.ds-page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-400); padding-block: var(--space-600); }
.ds-page-header__title { font-family: var(--font-display); font-size: var(--text-3xl); line-height: var(--lh-tight); font-weight: 400; letter-spacing: -.015em; }

/* 8. Navigation ------------------------------------------------------------ */
.ds-nav { position: sticky; top: 0; z-index: var(--z-nav); height: var(--nav-height); display: flex; align-items: center; background: color-mix(in srgb, var(--bg-base) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-subtle); }
.ds-nav__inner { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.ds-nav__logo { font-family: var(--font-display); font-size: 15px; text-decoration: none; }
.ds-nav__links { display: flex; gap: var(--space-800); }
@media (max-width: 600px) { .ds-nav__links { gap: var(--space-300); flex-wrap: wrap; justify-content: flex-end; } .ds-nav { height: auto; min-height: var(--nav-height); padding-block: var(--space-200); } .ds-nav__inner { gap: var(--space-300); } }
.ds-nav__links a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--text-secondary); padding-block: var(--space-100); border-bottom: 1px solid transparent; }
.ds-nav__links a:hover, .ds-nav__links a[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.ds-tabs { display: flex; gap: var(--space-100); border-bottom: 1px solid var(--border-subtle); overflow-x: auto; }
.ds-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: var(--space-200) var(--space-300); font: 600 var(--text-md)/1.2 var(--font-sans); color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.ds-tab:hover { color: var(--text-primary); background: var(--hover); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ds-tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.ds-breadcrumbs { display: flex; gap: var(--space-200); font-size: var(--text-sm); color: var(--text-secondary); }
.ds-breadcrumbs li + li::before { content: "/"; margin-right: var(--space-200); color: var(--text-muted); }
.ds-breadcrumbs a { text-decoration: none; } .ds-breadcrumbs a:hover { text-decoration: underline; }
.ds-pagination { display: inline-flex; gap: var(--space-100); }
.ds-pagination .ds-btn[aria-current="page"] { background: var(--action-bg); color: var(--action-ink); border-color: var(--action-bg); }
.ds-disclosure { border-bottom: 1px solid var(--border-subtle); }
.ds-disclosure > summary { cursor: pointer; list-style: none; padding: var(--space-300) 0; font-weight: 600; display: flex; justify-content: space-between; gap: var(--space-300); }
.ds-disclosure > summary::-webkit-details-marker { display: none; }
.ds-disclosure > summary::after { content: "+"; font-family: var(--font-mono); color: var(--text-secondary); }
.ds-disclosure[open] > summary::after { content: "−"; }
.ds-disclosure > div { padding: 0 0 var(--space-400); color: var(--text-secondary); max-width: 68ch; }

/* 9. Data display ---------------------------------------------------------- */
/* Table: Polaris IndexTable pattern. Sticky header, sticky first column, hairline rows, tabular numbers.
   Add .ds-table-wrap--scroll for a fixed-height body. Add .has-select when the first column is a checkbox:
   then the checkbox and the name column are both sticky. */
.ds-table-wrap { --sel-w: 44px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-raised); scroll-timeline: --ds-tw inline; position: relative; }
.ds-table-wrap--scroll { max-height: 360px; }
.ds-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: var(--text-md); }
.ds-table th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); padding: var(--space-200) var(--space-300); background: var(--bg-sunken); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.ds-table td { padding: var(--space-200) var(--space-300); height: 44px; border-bottom: 1px solid var(--border-faint); vertical-align: middle; background: var(--bg-raised); white-space: nowrap; }
.ds-table td.is-wrap { white-space: normal; min-width: 220px; }
.ds-table tbody tr:last-child td { border-bottom: 0; }
/* sticky first column (opaque so scrolled content never shows through) */
.ds-table th:first-child, .ds-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 180px; box-shadow: inset -1px 0 0 var(--border-faint); }
.ds-table th:first-child { z-index: 3; background: var(--bg-sunken); }
.ds-table td:first-child { font-weight: 600; }
/* with a checkbox column: checkbox sticks at 0, name column sticks beside it */
.has-select th:first-child, .has-select td:first-child { min-width: var(--sel-w); width: var(--sel-w); max-width: var(--sel-w); padding-inline: var(--space-300); box-shadow: none; }
.has-select th:nth-child(2), .has-select td:nth-child(2) { position: sticky; left: var(--sel-w); z-index: 1; min-width: 180px; box-shadow: inset -1px 0 0 var(--border-faint); }
.has-select th:nth-child(2) { z-index: 3; background: var(--bg-sunken); }
.has-select td:nth-child(2) { font-weight: 600; }
.has-select td:first-child { font-weight: 400; }
/* row states: hover and selected must stay opaque on sticky cells */
.ds-table tbody tr:hover td { background: color-mix(in srgb, var(--text-primary) 4%, var(--bg-raised)); }
.ds-table tbody tr[aria-selected="true"] td { background: color-mix(in srgb, var(--accent) 9%, var(--bg-raised)); }
.ds-table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent), inset -1px 0 0 var(--border-faint); }
.has-select tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.ds-table .is-num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ds-table th.is-num { text-align: right; }
.ds-table th[aria-sort] { cursor: pointer; user-select: none; }
.ds-table th[aria-sort]:hover { color: var(--text-primary); }
.ds-table th[aria-sort="ascending"]::after { content: " ↑"; } .ds-table th[aria-sort="descending"]::after { content: " ↓"; }
.ds-table td:has(> input[type="checkbox"]), .ds-table th:has(> input[type="checkbox"]) { text-align: center; }
.ds-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--action-bg); cursor: pointer; vertical-align: middle; margin: 0; }
/* soft shadow on the sticky edge appears once the table scrolls sideways (progressive enhancement) */
@supports (animation-timeline: scroll()) {
  .ds-table th:first-child::after, .ds-table td:first-child::after, .has-select th:nth-child(2)::after, .has-select td:nth-child(2)::after { content: ""; position: absolute; top: 0; bottom: 0; right: -9px; width: 9px; background: linear-gradient(to right, color-mix(in srgb, var(--text-primary) 10%, transparent), transparent); opacity: 0; pointer-events: none; animation: ds-edge linear both; animation-timeline: --ds-tw; animation-range: 0 40px; }
  .has-select th:first-child::after, .has-select td:first-child::after { display: none; }
}
@keyframes ds-edge { to { opacity: 1; } }
.ds-table-bar { display: flex; flex-wrap: wrap; gap: var(--space-300); align-items: center; justify-content: space-between; padding: var(--space-200) var(--space-300); border: 1px solid var(--border-subtle); border-bottom: 0; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--bg-raised); min-height: 52px; }
.ds-table-bar + .ds-table-wrap { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.ds-table-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-300); padding: var(--space-200) var(--space-300); font-size: var(--text-sm); color: var(--text-secondary); }
.ds-list > li { display: flex; gap: var(--space-300); align-items: center; padding: var(--space-300) 0; border-bottom: 1px solid var(--border-faint); }
.ds-list > li:first-child { border-top: 1px solid var(--border-faint); }
.ds-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-overlay); display: grid; place-items: center; font: 600 var(--text-xs)/1 var(--font-sans); flex: none; overflow: hidden; }
.ds-tags { display: flex; flex-wrap: wrap; gap: var(--space-200); }
.ds-tag { font-size: var(--text-sm); padding: var(--space-100) var(--space-300); background: var(--bg-sunken); border-left: 2px solid var(--border-subtle); color: var(--text-secondary); }

/* 10. Audit / report components (from the Vervaunt Audit Specimen) ----------- */
.ds-verdict { background: var(--bg-invert); color: var(--text-on-invert); border-radius: var(--radius-lg); padding: var(--space-600); display: grid; gap: var(--space-400); }
@media (min-width: 768px) { .ds-verdict { grid-template-columns: 1fr auto; align-items: end; padding: var(--space-800); } }
.ds-verdict__claim { font-family: var(--font-display); font-size: clamp(20px, 2.6vw, 28px); line-height: 1.25; letter-spacing: -.02em; font-weight: 600; max-width: 28ch; }
.ds-verdict .ds-eyebrow { color: var(--text-on-invert); opacity: .7; margin-bottom: var(--space-200); display: block; }
.ds-chip { display: inline-flex; flex-direction: column; gap: 2px; background: var(--accent-on-invert); color: var(--accent-on-invert-ink); padding: var(--space-300) var(--space-400); border-radius: var(--radius-md); }
.ds-chip__val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.ds-chip__cap { font-size: var(--text-xs); max-width: 24ch; line-height: 1.3; }
.ds-kpi { background: var(--bg-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-400); display: flex; flex-direction: column; gap: var(--space-100); }
.ds-kpi__lbl { font-size: var(--text-sm); color: var(--text-secondary); display: flex; justify-content: space-between; gap: var(--space-200); align-items: center; }
.ds-kpi__val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.025em; }
.ds-kpi__val small { font-size: var(--text-lg); font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.ds-kpi__sub { font-size: var(--text-xs); color: var(--text-secondary); }
.ds-delta { font: 600 var(--text-xs)/16px var(--font-num); font-variant-numeric: tabular-nums; padding: 0 var(--space-150); border-radius: var(--radius-sm); background: var(--bg-sunken); border: 1px solid var(--border-faint); }
.ds-delta--up::before { content: "▲ "; font-size: .8em; } .ds-delta--down::before { content: "▼ "; font-size: .8em; } .ds-delta--flat::before { content: "■ "; font-size: .7em; }
.ds-spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; margin-top: var(--space-200); }
.ds-spark i { flex: 1; height: var(--h); background: var(--chart-quiet); border-radius: 1px; }
.ds-spark i:last-child { background: var(--chart-accent); }
.ds-dial { --v: 50; --band: var(--status-warning); display: flex; gap: var(--space-400); align-items: center; }
.ds-dial__ring { width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--band) calc(var(--v) * 1%), var(--bg-overlay) 0); display: grid; place-items: center; flex: none; }
.ds-dial__ring span { width: 66px; height: 66px; border-radius: 50%; background: var(--bg-raised); display: grid; place-items: center; font: 600 24px/1 var(--font-num); font-variant-numeric: tabular-nums; }
.ds-dial--good { --band: var(--status-success); } .ds-dial--mid { --band: var(--status-warning); } .ds-dial--poor { --band: var(--status-danger); }
.ds-hbars { display: grid; gap: var(--space-300); }
.ds-hbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 3fr auto; gap: var(--space-300); align-items: center; font-size: var(--text-sm); }
.ds-hbar__track { height: 10px; background: var(--bg-overlay); border-radius: 2px; overflow: hidden; }
.ds-hbar__track i { display: block; width: var(--v); height: 100%; background: var(--chart-quiet); } .ds-hbar--hot .ds-hbar__track i { background: var(--chart-accent); }
.ds-mix { display: flex; height: 28px; border-radius: var(--radius-sm); overflow: hidden; gap: 2px; }
.ds-mix i { flex: var(--v) 1 0; background: var(--chart-quiet); } .ds-mix i.is-hot { background: var(--chart-accent); }
.ds-legend { display: flex; flex-wrap: wrap; gap: var(--space-400); font-size: var(--text-sm); margin-top: var(--space-200); }
.ds-legend b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ds-dumb { display: grid; gap: var(--space-300); }
.ds-dumb__row { display: grid; grid-template-columns: 110px 1fr 48px; gap: var(--space-300); align-items: center; font-size: var(--text-sm); }
.ds-dumb__plot { position: relative; height: 16px; border-bottom: 1px dashed var(--border-subtle); }
.ds-dumb__plot::before { content: ""; position: absolute; left: var(--a); width: calc(var(--b) - var(--a)); top: 7px; height: 2px; background: var(--chart-ink); }
.ds-dumb__plot i { position: absolute; top: 3px; width: 10px; height: 10px; border-radius: 50%; transform: translateX(-50%); }
.ds-dumb__plot .lo { left: var(--a); background: var(--chart-quiet); border: 1px solid var(--chart-ink); } .ds-dumb__plot .hi { left: var(--b); background: var(--chart-accent); border: 1px solid var(--chart-ink); }
.ds-statline { display: flex; gap: var(--space-400); align-items: center; }
.ds-bignum { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: clamp(40px, 6vw, 64px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ds-bignum--accent { background: var(--accent); color: var(--accent-ink); padding: var(--space-100) var(--space-300); border-radius: var(--radius-md); }
.ds-quote { border-left: 2px solid var(--border-strong); padding-left: var(--space-400); }
.ds-quote p { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.35; }
.ds-quote cite { display: block; margin-top: var(--space-200); font: normal 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.ds-deadline { display: grid; grid-template-columns: auto 1fr; gap: var(--space-600); align-items: center; }
.ds-deadline__days { font: 700 56px/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.ds-findings summary { display: grid; grid-template-columns: 24px 56px 96px 1fr; gap: var(--space-300); align-items: start; padding: var(--space-300); cursor: pointer; list-style: none; border-bottom: 1px solid var(--border-faint); }
.ds-findings summary::-webkit-details-marker { display: none; }
.ds-findings summary::before { content: "›"; font-family: var(--font-mono); color: var(--text-secondary); transition: transform var(--dur-fast); }
.ds-findings details[open] > summary::before { transform: rotate(90deg); }
.ds-findings summary:hover { background: var(--hover); }
.ds-findings__body { display: grid; gap: var(--space-400); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); padding: var(--space-400) var(--space-400) var(--space-400) calc(24px + var(--space-300)); background: var(--bg-sunken); border-bottom: 1px solid var(--border-faint); font-size: var(--text-sm); }
.ds-diff { grid-column: 1 / -1; font: 12px/1.5 var(--font-mono); background: var(--bg-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: var(--space-200) var(--space-300); overflow-x: auto; white-space: pre; }
.ds-diff .del { color: var(--status-danger-text); } .ds-diff .add { color: var(--status-success-text); }
.ds-option--recommended { border-color: var(--border-strong); box-shadow: 0 0 0 1px var(--border-strong); }
.ds-steps { counter-reset: s; display: grid; gap: var(--space-400); }
.ds-steps > li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: var(--space-300); }
.ds-steps > li::before { content: counter(s, decimal-leading-zero); font: 500 var(--text-xs)/32px var(--font-mono); color: var(--text-secondary); }

/* 11. Editorial (barrettahern.com patterns) --------------------------------- */
.ds-hero { display: grid; gap: var(--space-800); padding-block: var(--space-1200); border-bottom: 1px solid var(--border-subtle); }
@media (min-width: 900px) { .ds-hero { grid-template-columns: 1.4fr 1fr; align-items: center; padding-block: var(--space-2000); } }
.ds-hero__title em { font-style: italic; color: var(--text-secondary); }
.ds-hero__body { border-left: 2px solid var(--border-subtle); padding-left: var(--space-400); color: var(--text-secondary); max-width: 52ch; }
.ds-stat { border-top: 1px solid var(--border-subtle); padding-top: var(--space-400); display: grid; gap: var(--space-100); }
.ds-stat__fig { font-family: var(--font-display); font-size: clamp(36px, 5vw, 52px); line-height: 1; letter-spacing: -.02em; color: var(--accent-text); }
.ds-stat__kw { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: .12em; text-transform: uppercase; }
.ds-service { padding: var(--space-600); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); display: grid; gap: var(--space-300); }
.ds-service__icon { width: 32px; height: 32px; color: var(--accent-text); }
.ds-pub { display: grid; gap: var(--space-400); grid-template-columns: 1fr; padding-block: var(--space-600); border-bottom: 1px solid var(--border-subtle); }
@media (min-width: 700px) { .ds-pub { grid-template-columns: 1fr 160px; } }
.ds-pub__title { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1.2; }
.ds-pub__title a { text-decoration: none; } .ds-pub__title a:hover { text-decoration: underline; }
.ds-event { display: grid; gap: var(--space-100); padding-block: var(--space-600); border-bottom: 1px solid var(--border-subtle); }
.ds-testimonial { background: var(--bg-sunken); border: 1px solid var(--border-subtle); padding: var(--space-800); border-radius: var(--radius-md); }
.ds-footer { padding-block: var(--space-1200); border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); color: var(--text-secondary); }

/* 12. Overlays ------------------------------------------------------------- */
.ds-modal { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--bg-raised); color: var(--text-primary); box-shadow: var(--shadow-pop); }
.ds-modal::backdrop { background: rgb(0 0 0 / .45); }
.ds-modal__head, .ds-modal__body, .ds-modal__foot { padding: var(--space-400) var(--space-600); }
.ds-modal__head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-faint); }
.ds-modal__foot { display: flex; justify-content: flex-end; gap: var(--space-200); border-top: 1px solid var(--border-faint); background: var(--bg-sunken); }
.ds-tooltip { position: relative; }
.ds-tooltip[data-tip]:hover::after, .ds-tooltip[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--bg-invert); color: var(--text-on-invert); font-size: var(--text-xs); padding: var(--space-100) var(--space-200); border-radius: var(--radius-sm); white-space: nowrap; z-index: var(--z-popover); }
