/* ==========================================================================
   frontier-ds / components.css  (v1, 2026-10-06, Iris)
   Requires tokens.css. Pure CSS: no JS, no inline styles, no data: URIs
   (the apps' CSP is default-src 'self'). Icons are inline SVG in markup or
   drawn with CSS borders. Mobile-first. Class reference: README.md.
   Selector discipline: one class per rule wherever possible; element rules
   only inside .prose. Specificity never exceeds (0,2,0).
   ========================================================================== */

/* ---------- 0. Reset / base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--ds-font-body);
  font-size: var(--ds-fs-base);
  line-height: var(--ds-lh-body);
  color: var(--ds-fg);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "calt";
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, fieldset { margin: 0; }
ul, ol { padding: 0; }
fieldset { padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--ds-accent); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { color: var(--ds-accent-hover); }
:focus-visible {
  outline: var(--ds-ring-width) solid var(--ds-ring-color);
  outline-offset: var(--ds-ring-offset);
  border-radius: var(--ds-r-sm);
}
::selection { background: var(--ds-accent-soft); color: var(--ds-fg); }
:target { scroll-margin-top: var(--ds-sp-16); }
code, kbd, samp { font-family: var(--ds-font-mono); font-size: 0.92em; font-variant-ligatures: none; }

/* Typography primitives */
.display, .h1, .h2 {
  font-family: var(--ds-font-display);
  font-weight: var(--ds-display-weight);
  font-stretch: var(--ds-display-stretch);
  letter-spacing: var(--ds-display-tracking);
  line-height: var(--ds-display-leading);
  font-optical-sizing: auto;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.display { font-size: var(--ds-fs-display); }
.h1 { font-size: var(--ds-fs-2xl); }
.h2 { font-size: var(--ds-fs-xl); line-height: 1.15; }
.h3 { font-family: var(--ds-font-body); font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
.h4 { font-family: var(--ds-font-body); font-size: var(--ds-fs-base); font-weight: 650; line-height: 1.3; }
.lead { font-size: var(--ds-fs-md); color: var(--ds-fg-2); max-width: var(--ds-measure-lead); text-wrap: pretty; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--ds-sp-2);
  font-size: var(--ds-fs-xs); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ds-accent-soft-fg);
}
.eyebrow::before { content: ""; width: 1.25rem; height: 2px; background: var(--ds-accent); border-radius: 1px; }
.small { font-size: var(--ds-fs-sm); }
.caption { font-size: var(--ds-fs-xs); color: var(--ds-muted); }
.muted { color: var(--ds-muted); }
.mono { font-family: var(--ds-font-mono); font-variant-ligatures: none; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noprint { }

/* Reading column: element rules live ONLY here */
.prose { max-width: var(--ds-measure); text-wrap: pretty; }
.prose > * + * { margin-top: var(--ds-sp-4); }
.prose h2 { font-family: var(--ds-font-display); font-weight: var(--ds-display-weight); font-stretch: var(--ds-display-stretch); letter-spacing: var(--ds-display-tracking); font-size: var(--ds-fs-xl); line-height: 1.15; margin-top: var(--ds-sp-10); }
.prose h3 { font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; margin-top: var(--ds-sp-8); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: var(--ds-sp-2); }
.prose li::marker { color: var(--ds-muted); }

/* ---------- 1. Layout ------------------------------------------------------- */
.container { width: 100%; max-width: var(--ds-container); margin-inline: auto; padding-inline: var(--ds-gutter); }
.container--content { max-width: var(--ds-content); }
.page { padding-block: var(--ds-sp-8) var(--ds-sp-16); }
@media (min-width: 720px) { .page { padding-block: var(--ds-sp-12) var(--ds-sp-24); } }
.section { padding-block: var(--ds-sp-8); }
.section + .section { border-top: 1px solid var(--ds-border); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--ds-sp-2) var(--ds-sp-4); margin-bottom: var(--ds-sp-5); }
.stack > * + * { margin-top: var(--ds-sp-4); }
.stack--sm > * + * { margin-top: var(--ds-sp-2); }
.stack--lg > * + * { margin-top: var(--ds-sp-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2) var(--ds-sp-3); }
.grid { display: grid; gap: var(--ds-sp-4); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--hero { grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: var(--ds-sp-10); align-items: start; }
  .grid--sidebar { grid-template-columns: minmax(0, 1fr) 18rem; gap: var(--ds-sp-10); align-items: start; }
}
.divider { border: 0; border-top: 1px solid var(--ds-border); margin-block: var(--ds-sp-8); }

/* Skip link */
.skip-link { position: absolute; left: var(--ds-sp-2); top: -100px; z-index: 100; padding: var(--ds-sp-2) var(--ds-sp-4); background: var(--ds-fg); color: #fff; border-radius: var(--ds-r-md); font-weight: 600; }
.skip-link:focus { top: var(--ds-sp-2); }

/* ---------- 2. App shell: header, wordmark, nav, language switch ------------- */
.shell { background: var(--ds-surface); border-bottom: 1px solid var(--ds-border); }
.shell__inner {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand lang" "nav nav";
  align-items: center; column-gap: var(--ds-sp-4); min-height: 3.25rem;
}
.shell__brand { grid-area: brand; }
.shell__lang { grid-area: lang; }
.shell__nav { grid-area: nav; display: flex; gap: var(--ds-sp-1); margin-inline: calc(var(--ds-sp-3) * -1); overflow-x: auto; scrollbar-width: none; }
.shell__nav::-webkit-scrollbar { display: none; }
.shell__nav a {
  display: inline-flex; align-items: center; min-height: var(--ds-tap); padding: 0 var(--ds-sp-3);
  color: var(--ds-fg-2); text-decoration: none; font-weight: 500; font-size: var(--ds-fs-sm); white-space: nowrap;
  border-bottom: 2px solid transparent; border-radius: 0;
  transition: color var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease);
}
.shell__nav a:hover { color: var(--ds-fg); }
.shell__nav a[aria-current] { color: var(--ds-fg); border-bottom-color: var(--ds-accent); font-weight: 600; }
@media (min-width: 720px) {
  .shell__inner { grid-template-columns: auto 1fr auto; grid-template-areas: "brand nav lang"; min-height: 4rem; column-gap: var(--ds-sp-8); }
  .shell__nav { margin-inline: 0; }
  .shell__nav a { font-size: var(--ds-fs-base); min-height: 4rem; }
}
/* Opt-in one-row mobile header (no JS): add .shell--menu and a <details class="shell__menu"> holding a
   second copy of the nav + language switch. Below 720px the direct nav/lang hide and the menu shows;
   from 720px up the menu hides. The critic penalised the two-row mobile header (2026-10-07). */
.shell__menu { display: none; }
.shell__menu summary {
  display: inline-flex; align-items: center; gap: var(--ds-sp-2); min-height: var(--ds-tap); padding: 0 var(--ds-sp-4);
  list-style: none; cursor: pointer; border: 1px solid var(--ds-border-strong); border-radius: var(--ds-r-pill);
  font-size: var(--ds-fs-sm); font-weight: 600; color: var(--ds-fg); background: var(--ds-surface);
}
.shell__menu summary::-webkit-details-marker { display: none; }
.shell__menu-code { font-size: var(--ds-fs-xs); letter-spacing: 0.04em; color: var(--ds-fg-2); padding-right: var(--ds-sp-2); border-right: 1px solid var(--ds-border); }
.shell__menu-icon { width: 1rem; height: 1rem; flex: none; }
.shell__menu[open] summary { border-color: var(--ds-accent); color: var(--ds-accent); }
.shell__menu-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 50; display: grid; gap: var(--ds-sp-4);
  padding: var(--ds-sp-2) var(--ds-sp-4) var(--ds-sp-5); background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border); box-shadow: var(--ds-shadow-md);
}
.shell__menu-panel .shell__nav { display: grid; gap: 0; margin-inline: 0; overflow: visible; }
.shell__menu-panel .shell__nav a { min-height: var(--ds-tap); font-size: var(--ds-fs-base); border-bottom: 1px solid var(--ds-border); border-left: 3px solid transparent; padding-left: var(--ds-sp-3); }
.shell__menu-panel .shell__nav a[aria-current] { border-bottom-color: var(--ds-border); border-left-color: var(--ds-accent); }
.shell__menu-panel .seg { justify-self: start; }
@media (max-width: 719px) {
  .shell--menu { position: relative; }
  .shell--menu .shell__inner { grid-template-columns: 1fr auto; grid-template-areas: "brand menu"; }
  .shell--menu .shell__inner > .shell__nav, .shell--menu .shell__inner > .shell__lang { display: none; }
  .shell--menu .shell__menu { display: block; grid-area: menu; }
}

.wordmark {
  display: inline-flex; align-items: center; gap: var(--ds-sp-2); min-height: var(--ds-tap);
  color: var(--ds-fg); text-decoration: none;
  font-family: var(--ds-font-display); font-weight: var(--ds-display-weight); font-stretch: var(--ds-display-stretch);
  letter-spacing: var(--ds-display-tracking); font-size: 1.25rem; line-height: 1;
}
.wordmark:hover { color: var(--ds-fg); }
.mark { width: 1.75rem; height: 1.75rem; flex: none; color: var(--ds-accent); }
.mark--lg { width: 3rem; height: 3rem; }

/* Segmented language switcher */
.seg { display: inline-flex; padding: 2px; background: var(--ds-surface-2); border-radius: var(--ds-r-pill); }
.seg a, .seg button {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; min-height: 2.5rem; padding: 0 var(--ds-sp-3);
  color: var(--ds-fg-2); text-decoration: none; font-size: var(--ds-fs-xs); font-weight: 600; letter-spacing: 0.02em;
  border: 0; background: transparent; border-radius: var(--ds-r-pill); cursor: pointer;
  transition: background var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease);
}
.seg a:hover, .seg button:hover { color: var(--ds-fg); }
.seg a[aria-current], .seg button[aria-current] { background: var(--ds-surface); color: var(--ds-fg); box-shadow: var(--ds-shadow-sm); }
.seg a:focus-visible, .seg button:focus-visible { outline-offset: -2px; border-radius: var(--ds-r-pill); }

/* ---------- 3. Honesty notice (designed disclaimer) -------------------------- */
/* Prominent, compact, never removed. Short bold sentence always visible; the
   long text sits in <details>. Full text also lives in the footer (print). */
.honesty { background: var(--ds-surface); border-bottom: 1px solid var(--ds-border); }
.honesty__inner { padding-block: var(--ds-sp-2); }
.honesty details { border-left: 3px solid var(--ds-accent); padding-left: var(--ds-sp-3); }
.honesty summary {
  display: flex; align-items: center; gap: var(--ds-sp-3); min-height: 2.25rem; cursor: pointer; list-style: none;
  font-size: var(--ds-fs-sm); color: var(--ds-fg);
}
.honesty summary::-webkit-details-marker { display: none; }
.honesty__icon { flex: none; width: 1.25rem; height: 1.25rem; color: var(--ds-accent); }
.honesty__label { font-weight: 700; }
.honesty__more { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: var(--ds-sp-1); color: var(--ds-accent); font-weight: 600; font-size: var(--ds-fs-xs); white-space: nowrap; }
.honesty__more::after { content: ""; width: 0.45em; height: 0.45em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform var(--ds-dur-fast) var(--ds-ease); }
.honesty details[open] .honesty__more::after { transform: rotate(-135deg) translateY(-2px); }
.honesty__body { padding: var(--ds-sp-1) 0 var(--ds-sp-2) calc(1.25rem + var(--ds-sp-3)); font-size: var(--ds-fs-sm); color: var(--ds-fg-2); max-width: var(--ds-measure); }

/* Secondary notice for synthetic / demo / shared data */
.flag { display: inline-flex; align-items: center; gap: var(--ds-sp-2); padding: var(--ds-sp-1) var(--ds-sp-3); border-radius: var(--ds-r-pill); font-size: var(--ds-fs-xs); font-weight: 650; background: var(--ds-warning-soft); color: var(--ds-warning-fg); border: 1px solid #F0D9A6; }
.flag--neutral { background: var(--ds-surface-2); color: var(--ds-fg-2); border-color: var(--ds-border); }

/* ---------- 4. Hero ----------------------------------------------------------- */
.hero { display: grid; gap: var(--ds-sp-4); align-content: start; }
.hero .display { margin-top: var(--ds-sp-2); }
.hero__lede { font-size: var(--ds-fs-md); color: var(--ds-fg-2); max-width: var(--ds-measure-lead); text-wrap: pretty; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--ds-sp-3); margin-top: var(--ds-sp-2); }
.hero__note { font-size: var(--ds-fs-sm); color: var(--ds-muted); }
@media (min-width: 720px) { .hero { gap: var(--ds-sp-5); } }

/* ---------- 5. Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-sp-2);
  min-height: var(--ds-control-h); padding: var(--ds-sp-2) var(--ds-sp-5);
  border: 1.5px solid var(--ds-accent); border-radius: var(--ds-r-md);
  background: var(--ds-accent); color: var(--ds-accent-fg);
  font-weight: 650; font-size: var(--ds-fs-base); line-height: 1.2; text-align: center; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease), transform var(--ds-dur-fast) var(--ds-ease);
}
.btn:hover { background: var(--ds-accent-hover); border-color: var(--ds-accent-hover); color: var(--ds-accent-fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 1.125em; height: 1.125em; flex: none; }

.btn--secondary, .btn.secondary { background: var(--ds-surface); color: var(--ds-fg); border-color: var(--ds-border-strong); }
.btn--secondary:hover, .btn.secondary:hover { background: var(--ds-surface-2); color: var(--ds-fg); border-color: var(--ds-fg-2); }
.btn--ghost { background: transparent; color: var(--ds-accent-soft-fg); border-color: transparent; }
.btn--ghost:hover { background: var(--ds-accent-soft); color: var(--ds-accent-soft-fg); border-color: transparent; }
.btn--danger, .btn.danger { background: var(--ds-surface); color: var(--ds-danger); border-color: var(--ds-danger); }
.btn--danger:hover, .btn.danger:hover { background: var(--ds-danger); color: #fff; border-color: var(--ds-danger); }
.btn--sm, .btn.small { min-height: 2.25rem; padding: var(--ds-sp-1) var(--ds-sp-3); font-size: var(--ds-fs-sm); font-weight: 600; }
.btn--lg { min-height: 3.25rem; padding: var(--ds-sp-3) var(--ds-sp-6); font-size: var(--ds-fs-md); }
.btn--block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--ds-accent-soft); color: var(--ds-accent-soft-fg); border-color: var(--ds-accent); }
@media (pointer: coarse) { .btn--sm, .btn.small { min-height: var(--ds-tap); } }

.actions { display: flex; flex-wrap: wrap; gap: var(--ds-sp-3); align-items: center; }
.actions--end { justify-content: flex-end; }
@media (max-width: 599px) { .actions--stack-sm { flex-direction: column; align-items: stretch; } .actions--stack-sm .btn { width: 100%; } }

/* Busy state without JS: the form marks the button once submitted via the
   `.btn--busy` class rendered by the server on the pending page, or by
   :active while the request is in flight. */
.btn--busy { position: relative; color: transparent; pointer-events: none; }
.btn--busy::after {
  content: ""; position: absolute; width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid var(--ds-accent-fg); border-right-color: transparent;
  animation: ds-spin 0.8s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn--busy::after { animation: none; border-right-color: var(--ds-accent-fg); opacity: 0.5; } }

/* Link that looks like a text action, same tap target */
.link-action { display: inline-flex; align-items: center; gap: var(--ds-sp-1); min-height: var(--ds-tap); font-weight: 600; text-decoration: none; }
.link-action:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: var(--ds-sp-1); min-height: var(--ds-tap); color: var(--ds-fg-2); text-decoration: none; font-size: var(--ds-fs-sm); font-weight: 500; }
.back-link::before { content: ""; width: 0.5em; height: 0.5em; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(45deg); }
.back-link:hover { color: var(--ds-fg); text-decoration: underline; }

/* ---------- 6. Cards ---------------------------------------------------------- */
.card { background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-r-lg); padding: var(--ds-sp-5); box-shadow: var(--ds-shadow-sm); }
.card--flat { box-shadow: none; }
.card--tint { background: var(--ds-accent-soft); border-color: transparent; box-shadow: none; }
.card--inset { background: var(--ds-surface-2); border-color: transparent; box-shadow: none; }
.card > * + * { margin-top: var(--ds-sp-4); }
.card__title { font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.card__foot { margin-top: auto; padding-top: var(--ds-sp-4); }
.card--action { display: flex; flex-direction: column; }
@media (min-width: 720px) { .card { padding: var(--ds-sp-6); } }

/* ---------- 7. Forms ---------------------------------------------------------- */
.form { display: grid; gap: var(--ds-sp-6); }
.form__section { display: grid; gap: var(--ds-sp-4); }
.form__section > legend { float: left; width: 100%; margin-bottom: var(--ds-sp-1); }
.form__section > legend + * { clear: both; }
.legend { font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.legend__hint, .field__hint { display: block; font-size: var(--ds-fs-sm); color: var(--ds-muted); font-weight: 400; max-width: var(--ds-measure); }
.field { display: grid; gap: var(--ds-sp-1); align-content: start; }
.field--invalid { border-left: 4px solid var(--ds-danger); padding-left: var(--ds-sp-3); }
.field__label { font-weight: 600; line-height: 1.3; }
.field__label-opt { font-weight: 400; color: var(--ds-muted); }
.field__error { display: flex; gap: var(--ds-sp-2); align-items: flex-start; color: var(--ds-danger-fg); font-weight: 650; font-size: var(--ds-fs-sm); }
.field__error::before { content: "!"; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; margin-top: 0.05em; border-radius: 50%; background: var(--ds-danger); color: #fff; font-size: 0.8rem; font-weight: 800; }
.field__privacy { display: flex; gap: var(--ds-sp-2); align-items: flex-start; font-size: var(--ds-fs-sm); color: var(--ds-fg-2); margin-top: var(--ds-sp-2); }
.field__privacy svg { flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.15em; color: var(--ds-success); }
.fields { display: grid; gap: var(--ds-sp-4); }
@media (min-width: 600px) { .fields--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fields--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .fields--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.input, .select select, .textarea {
  width: 100%; min-height: var(--ds-control-h); padding: var(--ds-sp-2) var(--ds-sp-3);
  background: var(--ds-surface); color: var(--ds-fg);
  border: 1.5px solid var(--ds-border-strong); border-radius: var(--ds-r-md);
  transition: border-color var(--ds-dur-fast) var(--ds-ease), box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.input:hover, .select select:hover, .textarea:hover { border-color: var(--ds-fg-2); }
.input:focus-visible, .select select:focus-visible, .textarea:focus-visible { border-color: var(--ds-accent); outline-offset: 0; }
.input[aria-invalid="true"], .select select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--ds-danger); border-width: 2px; }
.input::placeholder, .textarea::placeholder { color: var(--ds-muted); opacity: 1; }
.input[readonly] { background: var(--ds-surface-2); border-color: var(--ds-border); font-family: var(--ds-font-mono); font-size: var(--ds-fs-sm); }
.input--sm { max-width: 10rem; }
.input--xs { max-width: 6rem; }
.input--num { font-variant-numeric: tabular-nums; text-align: right; }
.input-group { display: flex; }
.input-group > .input { border-radius: var(--ds-r-md) 0 0 var(--ds-r-md); }
.input-group > .select { width: auto; }
.input-group > .select select { border-left: 0; border-radius: 0 var(--ds-r-md) var(--ds-r-md) 0; min-width: 6rem; }

/* Select: native control inside a wrapper that draws the chevron with CSS (no images, CSP-safe) */
.select { position: relative; width: 100%; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 2.75rem; cursor: pointer; }
.select::after { content: ""; position: absolute; right: 1rem; top: 50%; width: 0.55rem; height: 0.55rem; margin-top: -0.45rem; border: solid var(--ds-fg-2); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }

.textarea { min-height: 8rem; line-height: 1.5; resize: vertical; }
.textarea--mono {
  font-family: var(--ds-font-mono); font-size: var(--ds-fs-sm); line-height: 1.75; font-variant-ligatures: none; tab-size: 4; white-space: pre; overflow: auto;
  background-color: var(--ds-surface);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.75 * var(--ds-fs-sm) - 1px), var(--ds-border) calc(1.75 * var(--ds-fs-sm) - 1px), var(--ds-border) calc(1.75 * var(--ds-fs-sm)));
  background-attachment: local; background-origin: content-box; background-clip: content-box;
}
.textarea--draft { font-family: var(--ds-font-mono); font-size: var(--ds-fs-sm); line-height: 1.65; min-height: 20rem; background: #FFFDF7; }

/* CSV helpers: column legend (ordered because position matters) + example row */
.csv-legend { display: flex; flex-wrap: wrap; gap: var(--ds-sp-1); counter-reset: col; list-style: none; }
.csv-legend li { counter-increment: col; display: inline-flex; align-items: center; gap: var(--ds-sp-1); padding: 2px var(--ds-sp-2) 2px 4px; border: 1px solid var(--ds-border); border-radius: var(--ds-r-sm); background: var(--ds-surface-2); font-family: var(--ds-font-mono); font-size: var(--ds-fs-xs); color: var(--ds-fg-2); }
.csv-legend li::before { content: counter(col); display: inline-flex; align-items: center; justify-content: center; min-width: 1.1rem; height: 1.1rem; padding-inline: 3px; border-radius: 3px; background: var(--ds-fg-2); color: #fff; font-size: 0.68rem; font-weight: 700; font-family: var(--ds-font-body); }
.csv-legend li.is-optional { border-style: dashed; color: var(--ds-muted); }
.csv-legend li.is-optional::before { background: var(--ds-muted); }
.csv-example { display: grid; grid-template-columns: auto 1fr; gap: var(--ds-sp-2) var(--ds-sp-3); align-items: center; font-size: var(--ds-fs-xs); color: var(--ds-muted); }
.csv-example code { padding: var(--ds-sp-1) var(--ds-sp-2); border-radius: var(--ds-r-sm); background: var(--ds-highlight); color: var(--ds-fg); font-size: var(--ds-fs-xs); overflow-wrap: anywhere; }

/* Checkbox / radio: custom-drawn, 24 px, 44 px row */
.choice { display: flex; align-items: flex-start; gap: var(--ds-sp-3); min-height: var(--ds-tap); padding-block: var(--ds-sp-2); cursor: pointer; font-weight: 400; }
.choice input { appearance: none; -webkit-appearance: none; flex: none; width: 1.5rem; height: 1.5rem; margin: 0.05rem 0 0; border: 2px solid var(--ds-border-strong); border-radius: var(--ds-r-sm); background: var(--ds-surface); display: grid; place-content: center; cursor: pointer; transition: border-color var(--ds-dur-fast) var(--ds-ease), background var(--ds-dur-fast) var(--ds-ease); }
.choice input[type="radio"] { border-radius: 50%; }
.choice input:hover { border-color: var(--ds-fg-2); }
.choice input:checked { border-color: var(--ds-accent); background: var(--ds-accent); }
.choice input[type="checkbox"]:checked::before { content: ""; width: 0.45rem; height: 0.8rem; margin-top: -0.15rem; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.choice input[type="radio"]:checked { background: var(--ds-surface); }
.choice input[type="radio"]:checked::before { content: ""; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--ds-accent); }
.choice input[aria-invalid="true"] { border-color: var(--ds-danger); }
.choice__text { line-height: 1.4; padding-top: 0.15rem; }
.choice__hint { display: block; font-size: var(--ds-fs-sm); color: var(--ds-muted); }
.choice-list { display: grid; gap: var(--ds-sp-1); }

/* Radio cards: the same control inside a bordered card, highlighted via :has */
.choice-cards { display: grid; gap: var(--ds-sp-2); }
@media (min-width: 600px) { .choice-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice-cards .choice { padding: var(--ds-sp-3) var(--ds-sp-4); border: 1.5px solid var(--ds-border); border-radius: var(--ds-r-md); background: var(--ds-surface); transition: border-color var(--ds-dur-fast) var(--ds-ease), background var(--ds-dur-fast) var(--ds-ease); }
.choice-cards .choice:hover { border-color: var(--ds-border-strong); }
.choice-cards .choice:has(input:checked) { border-color: var(--ds-accent); background: var(--ds-accent-soft); }
.choice-cards .choice:has(input:focus-visible) { outline: var(--ds-ring-width) solid var(--ds-ring-color); outline-offset: var(--ds-ring-offset); }
.choice-cards .choice:has(input:focus-visible) input { outline: none; }

/* File dropzone: a <label> wrapping the native input. No JS. The input itself is the
   drop target (native), the whole label opens the picker on click. */
.dropzone {
  display: grid; justify-items: center; text-align: center; gap: var(--ds-sp-2);
  padding: var(--ds-sp-6) var(--ds-sp-4);
  border: 2px dashed var(--ds-border-strong); border-radius: var(--ds-r-xl);
  background: var(--ds-surface); cursor: pointer;
  transition: border-color var(--ds-dur-fast) var(--ds-ease), background var(--ds-dur-fast) var(--ds-ease);
}
.dropzone:hover { border-color: var(--ds-accent); background: var(--ds-accent-soft); }
.dropzone:focus-within { border-color: var(--ds-accent); border-style: solid; outline: var(--ds-ring-width) solid var(--ds-ring-color); outline-offset: var(--ds-ring-offset); }
.dropzone--invalid { border-color: var(--ds-danger); border-style: solid; }
.dropzone__icon { width: 2.5rem; height: 2.5rem; color: var(--ds-accent); }
.dropzone__title { font-weight: 650; font-size: var(--ds-fs-md); line-height: 1.3; }
.dropzone__hint { font-size: var(--ds-fs-sm); color: var(--ds-muted); max-width: 40ch; }
.dropzone__input { width: 100%; max-width: 26rem; margin-top: var(--ds-sp-2); font-size: var(--ds-fs-sm); color: var(--ds-fg-2); cursor: pointer; }
.dropzone__input:focus-visible { outline: none; }
.dropzone__input::file-selector-button {
  margin-right: var(--ds-sp-3); min-height: var(--ds-control-h); padding: var(--ds-sp-2) var(--ds-sp-5);
  font: inherit; font-weight: 650; font-size: var(--ds-fs-base); color: var(--ds-accent-fg);
  background: var(--ds-accent); border: 1.5px solid var(--ds-accent); border-radius: var(--ds-r-md); cursor: pointer;
  transition: background var(--ds-dur-fast) var(--ds-ease);
}
.dropzone__input::file-selector-button:hover { background: var(--ds-accent-hover); border-color: var(--ds-accent-hover); }
@media (min-width: 720px) { .dropzone { padding: var(--ds-sp-8) var(--ds-sp-6); } }

/* ---------- 8. Callouts & inline alerts ------------------------------------- */
.callout { display: grid; grid-template-columns: auto 1fr; gap: var(--ds-sp-3); padding: var(--ds-sp-4); border-radius: var(--ds-r-md); border: 1px solid transparent; border-left-width: 4px; background: var(--ds-info-soft); color: var(--ds-fg); border-color: var(--ds-info); }
.callout__icon { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; color: var(--ds-info); }
.callout__title { font-weight: 700; }
.callout__body { font-size: var(--ds-fs-sm); color: var(--ds-fg-2); }
.callout__body > * + * { margin-top: var(--ds-sp-2); }
.callout--warn { background: var(--ds-warning-soft); border-color: var(--ds-warning); }
.callout--warn .callout__icon { color: var(--ds-warning); }
.callout--danger { background: var(--ds-danger-soft); border-color: var(--ds-danger); }
.callout--danger .callout__icon { color: var(--ds-danger); }
.callout--success { background: var(--ds-success-soft); border-color: var(--ds-success); }
.callout--success .callout__icon { color: var(--ds-success); }
.callout--plain { background: var(--ds-surface-2); border-color: var(--ds-border-strong); }
.callout--plain .callout__icon { color: var(--ds-fg-2); }

/* Error summary at the top of a form (GOV.UK pattern), links jump to the fields */
.error-summary { padding: var(--ds-sp-4) var(--ds-sp-5); border: 3px solid var(--ds-danger); border-radius: var(--ds-r-md); background: var(--ds-surface); }
.error-summary__title { font-weight: 700; font-size: var(--ds-fs-lg); color: var(--ds-danger-fg); }
.error-summary ul { margin-top: var(--ds-sp-2); padding-left: 1.2em; }
.error-summary a { color: var(--ds-danger-fg); font-weight: 600; }

/* ---------- 9. Badges / pills ------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.15em 0.65em; border-radius: var(--ds-r-pill); font-size: var(--ds-fs-xs); font-weight: 650; line-height: 1.5; white-space: nowrap; background: var(--ds-surface-2); color: var(--ds-fg-2); border: 1px solid transparent; }
.badge::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.badge--high, .badge--danger { background: var(--ds-sev-high-soft); color: var(--ds-sev-high-fg); }
.badge--medium, .badge--warn { background: var(--ds-sev-medium-soft); color: var(--ds-sev-medium-fg); }
.badge--low { background: var(--ds-sev-low-soft); color: var(--ds-sev-low-fg); }
.badge--success { background: var(--ds-success-soft); color: var(--ds-success-fg); }
.badge--info { background: var(--ds-info-soft); color: var(--ds-info-fg); }
.badge--accent { background: var(--ds-accent-soft); color: var(--ds-accent-soft-fg); }
.badge--outline { background: transparent; border-color: var(--ds-border-strong); color: var(--ds-fg-2); }
.badge--nodot::before { display: none; }

/* ---------- 10. Findings / results ------------------------------------------ */
.finding { position: relative; background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-r-lg); padding: var(--ds-sp-5) var(--ds-sp-5) var(--ds-sp-5) calc(var(--ds-sp-5) + 6px); box-shadow: var(--ds-shadow-sm); overflow: hidden; }
.finding::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--ds-sev-low); }
.finding--high::before { background: var(--ds-sev-high); }
.finding--medium::before { background: var(--ds-sev-medium); }
.finding--low::before { background: var(--ds-sev-low); }
.finding--success::before { background: var(--ds-success); }
.finding--accent::before { background: var(--ds-accent); }
.finding > * + * { margin-top: var(--ds-sp-3); }
.finding__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2) var(--ds-sp-3); font-size: var(--ds-fs-xs); color: var(--ds-muted); }
.finding__title { font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
.finding__body { color: var(--ds-fg); max-width: var(--ds-measure); }
.finding__fix { display: grid; grid-template-columns: auto 1fr; gap: var(--ds-sp-2); font-size: var(--ds-fs-sm); }
.finding__fix dt { font-weight: 700; color: var(--ds-fg); }
.finding__fix dd { margin: 0; color: var(--ds-fg-2); }
@media (max-width: 599px) { .finding__fix { grid-template-columns: 1fr; gap: 2px; } }
.finding__source { font-size: var(--ds-fs-xs); color: var(--ds-muted); overflow-wrap: anywhere; }
.finding__source a { color: inherit; }
.finding__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2); padding-top: var(--ds-sp-3); border-top: 1px solid var(--ds-border); }
.finding__actions-label { font-size: var(--ds-fs-sm); color: var(--ds-fg-2); margin-right: var(--ds-sp-1); }
.finding__actions .link-action { margin-left: auto; }
@media (max-width: 599px) { .finding__actions .link-action { margin-left: 0; width: 100%; } }
@media (min-width: 720px) { .finding { padding: var(--ds-sp-6) var(--ds-sp-6) var(--ds-sp-6) calc(var(--ds-sp-6) + 6px); } }

/* Evidence / quote block: "this is the line we are talking about" */
.evidence { display: grid; grid-template-columns: auto 1fr; border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); background: var(--ds-surface-2); overflow: hidden; }
.evidence__ref { display: flex; flex-direction: column; gap: 2px; padding: var(--ds-sp-3); min-width: 4.5rem; max-width: 9rem; overflow-wrap: anywhere; background: var(--ds-highlight); border-right: 1px solid var(--ds-border); font-family: var(--ds-font-mono); font-size: var(--ds-fs-xs); color: var(--ds-fg); font-variant-ligatures: none; }
.evidence__ref a { color: inherit; font-weight: 700; text-decoration: none; }
.evidence__ref a:hover { text-decoration: underline; }
.evidence__ref small { color: var(--ds-muted); font-size: 0.75rem; }
.evidence__quote { margin: 0; padding: var(--ds-sp-3) var(--ds-sp-4); font-family: var(--ds-font-mono); font-size: var(--ds-fs-sm); line-height: 1.6; color: var(--ds-fg); white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; font-variant-ligatures: none; }
.evidence__quote::before { content: "\201C"; color: var(--ds-muted); }
.evidence__quote::after { content: "\201D"; color: var(--ds-muted); }
.evidence__where { padding: var(--ds-sp-1) var(--ds-sp-4) var(--ds-sp-3); grid-column: 2; font-size: var(--ds-fs-xs); color: var(--ds-muted); }
.evidence--plain .evidence__quote { font-family: var(--ds-font-body); font-style: italic; }
.evidence + .evidence { margin-top: var(--ds-sp-2); }
.evidence > * { min-width: 0; }
@media (max-width: 599px) {
  .evidence { grid-template-columns: 1fr; }
  .evidence__ref { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: var(--ds-sp-2); max-width: none; padding: var(--ds-sp-2) var(--ds-sp-3); border-right: 0; border-bottom: 1px solid var(--ds-border); }
  .evidence__where { grid-column: 1; }
}

/* Record view: line-numbered rows that findings link to */
.record { width: 100%; border-collapse: collapse; font-family: var(--ds-font-mono); font-size: var(--ds-fs-sm); font-variant-ligatures: none; }
.record td { padding: var(--ds-sp-1) var(--ds-sp-3); border-bottom: 1px solid var(--ds-border); vertical-align: top; }
.record__n { width: 4rem; text-align: right; color: var(--ds-muted); user-select: none; }
.record__where { width: 10rem; font-family: var(--ds-font-body); font-size: var(--ds-fs-xs); color: var(--ds-muted); }
.record__text { overflow-wrap: anywhere; white-space: pre-wrap; }
.record tr:target td { background: var(--ds-highlight); }
.record tr:target .record__n { color: var(--ds-fg); font-weight: 700; }

/* Big result number */
.stat { display: grid; gap: var(--ds-sp-1); }
.stat__label { font-size: var(--ds-fs-sm); font-weight: 600; color: var(--ds-fg-2); }
.stat__value { font-family: var(--ds-font-display); font-weight: var(--ds-display-weight); font-stretch: var(--ds-display-stretch); letter-spacing: var(--ds-display-tracking); font-size: var(--ds-fs-stat); line-height: 1; font-variant-numeric: tabular-nums; color: var(--ds-fg); }
.stat__value--accent { color: var(--ds-accent); }
.stat__note { font-size: var(--ds-fs-sm); color: var(--ds-muted); max-width: 48ch; }

/* Math receipt: label / expression / amount rows, double-ruled total */
.receipt { width: 100%; border-collapse: collapse; font-size: var(--ds-fs-sm); }
.receipt th, .receipt td { padding: var(--ds-sp-2) var(--ds-sp-2); border-bottom: 1px dashed var(--ds-border); vertical-align: baseline; text-align: left; }
.receipt th { font-weight: 500; color: var(--ds-fg-2); width: 40%; }
.receipt .receipt__expr { font-family: var(--ds-font-mono); color: var(--ds-muted); font-size: var(--ds-fs-xs); overflow-wrap: anywhere; }
.receipt .receipt__amt { font-family: var(--ds-font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; color: var(--ds-fg); }
.receipt tr.receipt__total th, .receipt tr.receipt__total td { border-bottom: 0; border-top: 3px double var(--ds-fg); font-weight: 700; color: var(--ds-fg); padding-top: var(--ds-sp-3); }
.receipt tr.receipt__total .receipt__amt { font-size: var(--ds-fs-md); }
@media (max-width: 599px) { .receipt th { width: auto; } .receipt .receipt__expr { display: block; } }

/* Readings strip: instrument-cluster style key figures */
.readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ds-border); border: 1px solid var(--ds-border); border-radius: var(--ds-r-lg); overflow: hidden; }
.readings__item { display: grid; gap: 2px; padding: var(--ds-sp-3) var(--ds-sp-4); background: var(--ds-surface); }
.readings__label { font-size: var(--ds-fs-xs); color: var(--ds-muted); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.readings__value { font-family: var(--ds-font-mono); font-size: var(--ds-fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ds-fg); overflow-wrap: anywhere; }
.readings__value small { font-family: var(--ds-font-body); font-size: var(--ds-fs-xs); font-weight: 500; color: var(--ds-muted); margin-left: 0.25em; }
.readings__source { font-family: var(--ds-font-mono); font-size: 0.75rem; color: var(--ds-muted); overflow-wrap: anywhere; }
.readings--dark { background: #2C3440; border-color: #2C3440; }
.readings--dark .readings__item { background: #1F2933; }
.readings--dark .readings__label, .readings--dark .readings__source { color: #AEB7C4; }
.readings--dark .readings__value { color: #fff; }
.readings--dark .readings__value small { color: #AEB7C4; }
@media (min-width: 600px) { .readings { grid-template-columns: repeat(4, minmax(0, 1fr)); } .readings--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- 11. Steps / timeline -------------------------------------------- */
.timeline { list-style: none; counter-reset: step; display: grid; gap: 0; }
.timeline__item { counter-increment: step; position: relative; display: grid; grid-template-columns: 2.5rem 1fr; gap: 0 var(--ds-sp-3); padding-bottom: var(--ds-sp-6); }
.timeline__item::before { content: counter(step); grid-row: 1 / span 9; justify-self: center; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ds-surface); border: 2px solid var(--ds-border-strong); color: var(--ds-fg-2); font-weight: 700; font-size: var(--ds-fs-sm); z-index: 1; }
.timeline__item::after { content: ""; position: absolute; left: 1.25rem; top: 2rem; bottom: 0; width: 2px; margin-left: -1px; background: var(--ds-border); }
.timeline__item:last-child::after { display: none; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item--today::before { background: var(--ds-accent); border-color: var(--ds-accent); color: var(--ds-accent-fg); }
.timeline__item--overdue::before { background: var(--ds-danger); border-color: var(--ds-danger); color: #fff; }
.timeline__item--done::before { content: ""; background: var(--ds-success); border-color: var(--ds-success); }
.timeline__item--done::after { background: var(--ds-success); }
.timeline__item--waiting::before { border-color: var(--ds-warning); color: var(--ds-warning-fg); border-style: dashed; }
.timeline__item--locked { opacity: 0.6; }
.timeline__item--locked::before { border-style: dashed; }
.timeline__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2) var(--ds-sp-3); min-height: 2rem; }
.timeline__title { font-size: var(--ds-fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.timeline__date { font-family: var(--ds-font-mono); font-size: var(--ds-fs-xs); font-weight: 600; padding: 2px var(--ds-sp-2); border-radius: var(--ds-r-sm); background: var(--ds-surface-2); color: var(--ds-fg-2); font-variant-numeric: tabular-nums; }
.timeline__item--today .timeline__date { background: var(--ds-accent-soft); color: var(--ds-accent-soft-fg); }
.timeline__item--overdue .timeline__date { background: var(--ds-danger-soft); color: var(--ds-danger-fg); }
.timeline__body { grid-column: 2; margin-top: var(--ds-sp-2); }
.timeline__body > * + * { margin-top: var(--ds-sp-3); }
.timeline__body ol { padding-left: 1.25em; }
.timeline__body li + li { margin-top: var(--ds-sp-1); }

/* Simple step list for "how it works" (not a timeline) */
.steps { list-style: none; counter-reset: s; display: grid; gap: var(--ds-sp-4); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2rem 1fr; gap: var(--ds-sp-3); align-content: start; }
.steps li::before { content: counter(s); display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: var(--ds-r-md); background: var(--ds-accent-soft); color: var(--ds-accent-soft-fg); font-weight: 700; font-size: var(--ds-fs-sm); }
.steps strong { display: block; }
@media (min-width: 720px) { .steps--row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .steps--row li { grid-template-columns: 1fr; gap: var(--ds-sp-2); } }

/* ---------- 12. Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); background: var(--ds-surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--ds-fs-sm); }
.table th, .table td { padding: var(--ds-sp-3) var(--ds-sp-4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--ds-border); }
.table thead th { background: var(--ds-surface-2); font-size: var(--ds-fs-xs); font-weight: 700; color: var(--ds-fg-2); letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody th[scope="row"] { font-weight: 600; color: var(--ds-fg-2); width: 30%; }
.table .num { font-family: var(--ds-font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table .mono { font-size: var(--ds-fs-xs); overflow-wrap: anywhere; }
.table caption { text-align: left; padding: var(--ds-sp-3) var(--ds-sp-4); font-weight: 650; }
.table--compact th, .table--compact td { padding: var(--ds-sp-2) var(--ds-sp-3); }
/* Stacks into cards under 600 px. Each td needs data-label="Column name". */
@media (max-width: 599px) {
  .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--stack tr { display: block; padding: var(--ds-sp-3) var(--ds-sp-4); border-bottom: 1px solid var(--ds-border); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td, .table--stack tbody th { display: block; padding: var(--ds-sp-1) 0; border: 0; width: auto; }
  .table--stack td::before, .table--stack tbody th::before { content: attr(data-label); display: block; font-size: var(--ds-fs-xs); font-weight: 700; color: var(--ds-muted); text-transform: uppercase; letter-spacing: 0.02em; }
  .table--stack td:empty { display: none; }
  .table--stack .num { text-align: left; }
}

/* Key / value list (vehicle, case meta) */
.kv { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: var(--ds-sp-2) var(--ds-sp-4); font-size: var(--ds-fs-sm); }
.kv dt { color: var(--ds-muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--ds-fg); overflow-wrap: anywhere; }

/* ---------- 13. Output preview ("what you get") ------------------------------ */
.doc-preview { position: relative; display: grid; gap: var(--ds-sp-3); }
.doc-preview__sheet {
  position: relative; padding: var(--ds-sp-6) var(--ds-sp-6) var(--ds-sp-8); background: #FFFFFF;
  border: 1px solid var(--ds-border); border-radius: 2px; box-shadow: var(--ds-shadow-lg);
  font-size: var(--ds-fs-xs); line-height: 1.5; color: var(--ds-fg-2); max-height: 22rem; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}
.doc-preview__sheet > * + * { margin-top: var(--ds-sp-3); }
.doc-preview__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--ds-sp-3); padding-bottom: var(--ds-sp-3); border-bottom: 2px solid var(--ds-fg); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-muted); }
.doc-preview__head strong { color: var(--ds-fg); }
.doc-preview__title { font-family: var(--ds-font-display); font-weight: var(--ds-display-weight); font-stretch: var(--ds-display-stretch); letter-spacing: var(--ds-display-tracking); font-size: var(--ds-fs-lg); line-height: 1.2; color: var(--ds-fg); }
.doc-preview__h { font-weight: 700; color: var(--ds-fg); font-size: var(--ds-fs-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.doc-preview__sheet ol, .doc-preview__sheet ul { padding-left: 1.2em; }
.doc-preview__sheet li + li { margin-top: var(--ds-sp-1); }
.doc-preview__badge { position: absolute; top: var(--ds-sp-4); right: var(--ds-sp-4); padding: 2px var(--ds-sp-2); border-radius: var(--ds-r-sm); background: var(--ds-fg); color: #fff; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; }
.doc-preview__caption { font-size: var(--ds-fs-sm); color: var(--ds-fg-2); }
.doc-preview__caption strong { color: var(--ds-fg); }
.doc-preview--stack .doc-preview__sheet::before { content: ""; position: absolute; inset: 6px -6px -6px 6px; border: 1px solid var(--ds-border); border-radius: 2px; background: var(--ds-surface); z-index: -1; }

/* ---------- 14. Empty state, error page, 404 --------------------------------- */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--ds-sp-3); padding: var(--ds-sp-10) var(--ds-sp-5); border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-r-lg); background: var(--ds-surface); }
.empty__icon { width: 2.5rem; height: 2.5rem; color: var(--ds-muted); }
.empty__title { font-weight: 650; font-size: var(--ds-fs-lg); }
.empty__body { color: var(--ds-fg-2); max-width: 44ch; }

.error-page { display: grid; gap: var(--ds-sp-4); max-width: 40rem; padding-block: var(--ds-sp-10); }
.error-page__code { font-family: var(--ds-font-mono); font-size: var(--ds-fs-xs); font-weight: 600; letter-spacing: 0.1em; color: var(--ds-muted); }
.error-page__title { font-family: var(--ds-font-display); font-weight: var(--ds-display-weight); font-stretch: var(--ds-display-stretch); letter-spacing: var(--ds-display-tracking); font-size: var(--ds-fs-2xl); line-height: var(--ds-display-leading); text-wrap: balance; }
.error-page__body { font-size: var(--ds-fs-md); color: var(--ds-fg-2); max-width: var(--ds-measure-lead); }
.error-page .actions { margin-top: var(--ds-sp-2); }

/* Inline status messages (role=status / role=alert) */
.status { display: flex; gap: var(--ds-sp-2); align-items: flex-start; padding: var(--ds-sp-3) var(--ds-sp-4); border-radius: var(--ds-r-md); font-size: var(--ds-fs-sm); background: var(--ds-success-soft); color: var(--ds-success-fg); border: 1px solid #BFE0CB; }
.status--error { background: var(--ds-danger-soft); color: var(--ds-danger-fg); border-color: #F2C4BF; }
.status--info { background: var(--ds-info-soft); color: var(--ds-info-fg); border-color: #C5D3EA; }
.status strong { font-weight: 700; }

/* Disclosure (details) used for "show the rule", "what this means" */
.disclosure { border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); background: var(--ds-surface); }
.disclosure summary { display: flex; align-items: center; gap: var(--ds-sp-2); min-height: var(--ds-tap); padding: var(--ds-sp-2) var(--ds-sp-4); cursor: pointer; list-style: none; font-weight: 600; font-size: var(--ds-fs-sm); color: var(--ds-fg); }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: ""; flex: none; width: 0.45em; height: 0.45em; border: solid var(--ds-fg-2); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform var(--ds-dur-fast) var(--ds-ease); }
.disclosure[open] summary::before { transform: rotate(45deg); }
.disclosure[open] summary { border-bottom: 1px solid var(--ds-border); }
.disclosure__body { padding: var(--ds-sp-3) var(--ds-sp-4) var(--ds-sp-4); font-size: var(--ds-fs-sm); color: var(--ds-fg-2); }
.disclosure__body > * + * { margin-top: var(--ds-sp-3); }

/* ---------- 15. Footer -------------------------------------------------------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--ds-border); background: var(--ds-surface); color: var(--ds-muted); font-size: var(--ds-fs-sm); }
.site-footer__inner { display: grid; gap: var(--ds-sp-4); padding-block: var(--ds-sp-8); }
.site-footer__brand { display: flex; align-items: center; gap: var(--ds-sp-2); color: var(--ds-fg); font-weight: 650; }
.site-footer__brand .mark { width: 1.25rem; height: 1.25rem; }
.site-footer__honesty { max-width: var(--ds-measure); color: var(--ds-fg-2); }
.site-footer__honesty strong { color: var(--ds-fg); }
.site-footer__meta { display: flex; flex-wrap: wrap; gap: var(--ds-sp-2) var(--ds-sp-5); }
.site-footer a { color: var(--ds-fg-2); }
.site-footer a:hover { color: var(--ds-fg); }
@media (min-width: 720px) { .site-footer__inner { grid-template-columns: 1fr auto; align-items: start; } .site-footer__honesty { grid-column: 1; } .site-footer__meta { grid-column: 1 / -1; } }

/* ---------- 16. Print --------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .shell__nav, .shell__lang, .skip-link, .noprint, .btn, .actions, .finding__actions, .dropzone, .site-footer__meta { display: none !important; }
  .honesty, .site-footer { border: 0; }
  .honesty details { border-left-color: #000; }
  .honesty__more { display: none; }
  .site-footer__honesty { display: block; color: #000; }
  .card, .finding, .evidence, .table-wrap, .doc-preview__sheet { box-shadow: none; break-inside: avoid; }
  .doc-preview__sheet { max-height: none; -webkit-mask-image: none; mask-image: none; }
  a { color: #000; text-decoration: underline; }
  .finding::before { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .evidence__ref, .badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
