/* Candidate portal design system (candidate redesign spec §5).
   Control boundaries (inputs, choices, secondary buttons) use --text-muted, not --border-strong:
   --border-strong is 2.15:1 on white, under the 3:1 WCAG 1.4.11 asks of a control's edge.
   Colours, radii and shadows come ONLY from /theme.css tokens: no literal colours here.
   Mobile first: base styles are for a 360 px phone; 768 px and 1024 px add space and the sidebar.
   Manrope with a system fallback; the layout is tested with the web font blocked. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.cand {
  margin: 0;
  background: var(--background-primary);
  color: var(--text-primary);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}
/* A link that is styled as a button keeps its button colours: a bare ".cand a" rule is more specific than ".btn--primary" and would paint its label in its own background.
   :where() adds no specificity, so these rules stay exactly as specific as ".cand a" was and every other component's rule still ranks the way it did. */
.cand a:not(:where(.btn)) { color: var(--action-primary); text-underline-offset: 2px; }
.cand a:not(:where(.btn)):hover { color: var(--action-primary-hover); }
.cand a.btn { text-decoration: none; }
.cand :focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.cand h1, .cand h2, .cand h3 { line-height: 1.25; margin: 0 0 8px; overflow-wrap: anywhere; }
.cand h1 { font-size: 1.375rem; font-weight: 700; }
.cand h2 { font-size: 1.0625rem; font-weight: 700; }
.cand h3 { font-size: 1rem; font-weight: 700; }
.cand p { margin: 0 0 12px; }
.cand .muted { color: var(--text-muted); }
.cand .num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Skip link ---- */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--surface-elevated); color: var(--text-primary); border: 2px solid var(--focus-ring); border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }

/* ---- Shell ---- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 16px; background: var(--surface-ink); color: var(--text-on-ink); }
.topbar__brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-on-ink); text-decoration: none; font-weight: 700; }
.topbar__brand img { display: block; height: 26px; width: auto; }
.topbar__spacer { flex: 1; }
.topbar .btn--ghost { color: var(--text-on-ink); border-color: var(--border-on-ink); }
.topbar .btn--ghost:hover { background: var(--border-on-ink); color: var(--text-on-ink); }
.topbar :focus-visible { outline-color: var(--accent-on-ink); }
/* Phones: top-bar controls show only their icon; the label stays for assistive tech. */
@media (max-width: 419px) {
  .topbar__btn { padding-inline: 10px; }
  .topbar__btn .btn__label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}

.layout { display: block; }
.main { display: block; max-width: 760px; margin: 0 auto; padding: 20px 16px 104px; outline: none; }
.footer { max-width: 760px; margin: 0 auto; padding: 0 16px 120px; display: flex; flex-wrap: wrap; gap: 8px; }

.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--surface-elevated); border-top: 1px solid var(--border-default); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav__list { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0; padding: 0; list-style: none; }
.nav__link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px 2px; color: var(--text-muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; text-align: center; }
.nav__link .icon { width: 22px; height: 22px; }
.nav__link[aria-current="page"] { color: var(--action-primary); box-shadow: inset 0 3px 0 var(--action-primary); }
.nav__link:hover { color: var(--action-primary); }

@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; }
  .nav { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); border-top: 0; border-right: 1px solid var(--border-default); padding: 16px 8px; }
  .nav__list { display: flex; flex-direction: column; gap: 4px; }
  .nav__link { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 8px 12px; font-size: 0.9375rem; border-radius: var(--radius-sm); }
  .nav__link[aria-current="page"] { color: var(--text-primary); background: var(--action-soft); box-shadow: inset 3px 0 0 var(--action-primary); }
  .main { padding: 32px 32px 48px; max-width: 820px; margin: 0; }
  .footer { padding: 0 32px 48px; margin: 0; }
}

/* ---- Page header ---- */
.page-head { margin-bottom: 20px; }
.page-head h1:focus { outline: none; }
.page-head h1:focus-visible { outline: 3px solid var(--focus-ring); }
.crumbs { margin: 0 0 8px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.875rem; }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: var(--text-muted); }
/* A breadcrumb link is a control in a list, not a link inside a sentence, so it keeps the 24 px minimum target (WCAG 2.2 2.5.8). */
.crumbs a { display: inline-flex; align-items: center; min-height: 24px; padding: 0 2px; }
.page-head__intro { color: var(--text-secondary); max-width: 62ch; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- Cards and sections ---- */
.card { background: var(--surface-primary); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; }
.card > :last-child { margin-bottom: 0; }
@media (min-width: 768px) { .card { padding: 24px; } }
.stack > * + * { margin-top: 12px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font: inherit; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.btn .icon { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--action-primary); color: var(--action-primary-ink); }
.btn--primary:hover { background: var(--action-primary-hover); color: var(--action-primary-ink); }
.btn--secondary { background: var(--surface-primary); color: var(--action-primary); border-color: var(--text-muted); }
.btn--secondary:hover { border-color: var(--action-primary); color: var(--action-primary-hover); }
.btn--ghost { background: transparent; color: var(--action-primary); border-color: var(--text-muted); }
.btn--danger { background: var(--status-error); color: var(--action-primary-ink); }
.btn--link { background: none; border: 0; padding: 10px 4px; color: var(--action-primary); text-decoration: underline; font-weight: 600; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.btn--block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
/* A choice is its own component: ".field label" is more specific than ".choice" and used to turn every option into a bold block. */
.field label:not(.choice), .field legend { display: block; font-weight: 700; margin-bottom: 4px; }
.field__hint { display: block; color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 6px; }
.field__error { display: block; color: var(--status-error); font-weight: 700; margin: 4px 0 0; }
/* Controls are scoped under the body id: theme.css styles bare input/select/textarea with
   input:not(…):not(…):not(…) (specificity 0,3,1), which would otherwise win and render 15 px
   text, a 42 px height and a 1.4:1 edge. The walk checks the rendered values. */
#candidate-portal .input, #candidate-portal .select, #candidate-portal .textarea { display: block; width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; line-height: 1.4; color: var(--text-primary); background: var(--surface-primary); border: 1px solid var(--text-muted); border-radius: var(--radius-sm); }
#candidate-portal .textarea { min-height: 112px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-placeholder); }
#candidate-portal .input[aria-invalid="true"], #candidate-portal .select[aria-invalid="true"], #candidate-portal .textarea[aria-invalid="true"] { border: 2px solid var(--status-error); }
#candidate-portal .input:focus-visible, #candidate-portal .select:focus-visible, #candidate-portal .textarea:focus-visible { border-color: var(--border-focus); }
#candidate-portal .input:disabled, #candidate-portal .select:disabled, #candidate-portal .textarea:disabled { background: var(--surface-sunk); color: var(--text-muted); cursor: not-allowed; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.choice { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-primary); cursor: pointer; }
/* A long formula or reference has no spaces to wrap at: it breaks anywhere rather than widening the page (audit 2026-11-16, M-4). */
.choice > span { min-width: 0; overflow-wrap: anywhere; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--action-primary); }
.choice:has(input:checked) { border: 2px solid var(--action-primary); background: var(--action-soft); }
.check { display: flex; gap: 12px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--action-primary); }
.check label { min-height: 44px; display: inline-flex; align-items: center; }
.check--bad { border-left: 4px solid var(--status-error); padding-left: 8px; }

.error-summary { border: 2px solid var(--status-error); border-radius: var(--radius-md); padding: 16px; margin-bottom: 20px; background: var(--surface-primary); }
.error-summary h2 { color: var(--status-error); }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--status-error); font-weight: 700; }

/* ---- Stepper ---- */
.stepper { margin-bottom: 16px; }
.stepper__count { display: block; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.stepper__bar { display: grid; gap: 4px; margin-top: 8px; }
.stepper__seg { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunk); }
.stepper__seg--done, .stepper__seg--current { background: var(--action-primary); }

/* ---- Status tag ---- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.875rem; font-weight: 700; line-height: 1.4; border: 1px solid currentColor; background: var(--surface-primary); }
.tag .icon { width: 16px; height: 16px; }
/* Every chip is the same height, with or without an icon (a plain chip next to a status chip sat lower: audit 2026-11-16, section 7). */
.tag { min-height: 28px; box-sizing: border-box; vertical-align: middle; }
.tag .icon { flex: 0 0 auto; }
.result-readiness { font-weight: 600; margin-left: 4px; }
.catalogue-group { margin: 16px 0; }
.catalogue-group > summary { cursor: pointer; }
.catalogue-group__h { display: inline; margin: 0; font-size: 1.125rem; }
.tag--good { color: var(--status-success); background: var(--status-success-soft); }
.tag--warn { color: var(--status-warning); background: var(--status-warning-soft); }
.tag--bad { color: var(--status-error); background: var(--status-error-soft); }
.tag--info { color: var(--status-info); background: var(--status-info-soft); }
.tag--neutral { color: var(--text-secondary); background: var(--surface-interactive); }

/* ---- Task list (GOV.UK pattern) ---- */
.tasks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-default); }
.task { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 14px 0; border-bottom: 1px solid var(--border-default); }
.task__main { flex: 1 1 220px; min-width: 0; }
.task__name { font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.task__hint { display: block; color: var(--text-muted); font-size: 0.9375rem; margin-top: 2px; }

/* ---- Summary list (check answers) ---- */
.summary { margin: 0; }
.summary__row { display: grid; grid-template-columns: 1fr; gap: 2px 16px; padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.summary__key { font-weight: 700; }
.summary__value { margin: 0; overflow-wrap: anywhere; }
.summary__action { margin: 0; }
@media (min-width: 768px) { .summary__row { grid-template-columns: 32% 1fr auto; align-items: start; } }

/* ---- States ---- */
.state { padding: 20px 0; }
.state--error { border-left: 4px solid var(--status-error); padding-left: 16px; }
.skeleton { display: block; height: 16px; margin: 10px 0; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.skeleton--wide { height: 72px; }
.notice { border-left: 4px solid var(--status-info); background: var(--status-info-soft); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.notice--warn { border-left-color: var(--status-warning); background: var(--status-warning-soft); }
.notice--bad { border-left-color: var(--status-error); background: var(--status-error-soft); }
.notice--good { border-left-color: var(--status-success); background: var(--status-success-soft); }
.inline-msg { margin-top: 8px; font-weight: 600; }
.inline-msg--bad { color: var(--status-error); }
.inline-msg--good { color: var(--status-success); }

/* ---- Dialog ---- */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: var(--overlay); }
.dialog { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface-elevated); color: var(--text-primary); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-md); }
.dialog__actions { display: flex; flex-wrap: wrap-reverse; gap: 8px; justify-content: flex-end; margin-top: 16px; }
@media (min-width: 768px) { .overlay { align-items: center; padding: 16px; } .dialog { border-radius: var(--radius-lg); padding: 24px; } }

/* ---- Toasts ---- */
.toasts { position: fixed; z-index: 70; left: 16px; right: 16px; bottom: 76px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface-ink); color: var(--text-on-ink); box-shadow: var(--shadow-md); }
.toast .icon { width: 18px; height: 18px; flex: none; }
@media (min-width: 1024px) { .toasts { left: auto; right: 24px; bottom: 24px; max-width: 420px; } }

/* ---- Icons ---- */
.icon { display: inline-block; width: 20px; height: 20px; vertical-align: -0.2em; flex: none; }

/* ---- Auth screens ---- */
.auth { max-width: 480px; margin: 0 auto; padding: 24px 16px 64px; }
.auth__links { list-style: none; padding: 0; margin: 20px 0 0; }
.auth__links li { margin-bottom: 8px; }
.auth__links a { display: inline-block; padding: 10px 0; min-height: 44px; }

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

/* ---- Home (Plan 2) ---- */
/* The bar is drawn here, not by the browser: the default track is a solid mid-grey that reads as a FULL bar at 0% (audit 2026-11-16, L-8). */
.cand progress { display: block; width: 100%; height: 10px; border: 1px solid var(--border-default); border-radius: var(--radius-pill); background: var(--surface-sunk); accent-color: var(--status-success); -webkit-appearance: none; appearance: none; overflow: hidden; }
.cand progress::-webkit-progress-bar { background: var(--surface-sunk); border-radius: var(--radius-pill); }
.cand progress::-webkit-progress-value { background: var(--status-success); border-radius: var(--radius-pill); }
.cand progress::-moz-progress-bar { background: var(--status-success); border-radius: var(--radius-pill); }
.stand { display: grid; gap: 8px; }
.stand__score { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-weight: 700; }
.stand__score .num { font-size: 1.5rem; }
.reveal { margin-top: 12px; }
.reveal > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-primary); color: var(--action-primary); font-weight: 700; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal[open] > summary { margin-bottom: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.task__button { background: none; border: 0; padding: 0; min-height: 44px; text-align: left; font: inherit; font-weight: 700; color: var(--action-primary); text-decoration: underline; cursor: pointer; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.note:first-child { border-top: 1px solid var(--border-default); }
.note__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.note__title { font-weight: 700; }
.note__meta { color: var(--text-muted); font-size: 0.9375rem; }
.note__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--border-default); }
.timeline time { color: var(--text-muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.flash:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---- Chip picker (titles, skills, systems) ---- */
.picker { margin-bottom: 16px; }
.picker__count { font-weight: 700; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 12px; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 0 0 12px; min-height: 44px; border: 1px solid var(--text-muted); border-radius: var(--radius-pill); background: var(--surface-primary); overflow-wrap: anywhere; }
.chip-rows { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: none; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-height: 44px; padding: 4px 4px 4px 12px; margin-bottom: 8px; border: 1px solid var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-primary); }
.chip-row__name { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.chip-row__actions { display: inline-flex; gap: 4px; }
.chip__btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--action-primary); cursor: pointer; }
.chip__btn:hover { background: var(--action-soft); }
.chip__btn .icon { width: 20px; height: 20px; }
.picker-results { list-style: none; margin: 0 0 16px; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--border-default); border-radius: var(--radius-sm); }
.picker-result { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border-default); background: var(--surface-primary); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.picker-result span { color: var(--text-muted); font-size: 0.875rem; }
.picker-result:hover { background: var(--action-soft); }

/* ---- Profile (Plan 2) ---- */
ol.plain { margin: 0; padding-left: 20px; }
.field__label { margin: 0 0 4px; }
.cv-entry { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px; margin-bottom: 12px; background: var(--surface-primary); }
.cv-entry__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.repeater { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.notice h3 { margin-bottom: 4px; }

/* Evidence and CV */
.evidence-list { list-style: none; margin: 0; padding: 0; }
.evidence { padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.evidence:first-child { border-top: 1px solid var(--border-default); }
.evidence__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.evidence__title { font-weight: 700; overflow-wrap: anywhere; }
.evidence__meta { margin: 0 0 4px; color: var(--text-muted); font-size: 0.9375rem; }
.evidence p { margin: 4px 0; }

/* Build your profile */
.methods { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.method { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; min-height: 44px; padding: 16px; text-align: left; font: inherit; color: var(--text-primary); background: var(--surface-primary); border: 1px solid var(--border-default); border-radius: var(--radius-md); cursor: pointer; }
.method:hover { border-color: var(--action-primary); }
.method span { color: var(--text-muted); }
.li-steps { padding-left: 24px; margin: 0 0 16px; }
.li-steps li { margin-bottom: 8px; }
.input--file { padding: 16px; border-style: dashed; cursor: pointer; }
@media (min-width: 768px) { .methods { grid-template-columns: repeat(3, 1fr); } }

/* How employers see you */
.tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--border-default); }
.tabs__tab { flex: 1 1 0; min-height: 44px; padding: 8px 6px; text-align: center; font: inherit; line-height: 1.25; font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; }
.tabs__tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--action-primary); }
.tabs__tab:hover { color: var(--text-primary); }
[role="tabpanel"] { padding-top: 16px; }
.tree { margin: 0; }
.tree__row { display: grid; grid-template-columns: 1fr; gap: 2px 16px; padding: 8px 0; border-bottom: 1px solid var(--border-default); }
.tree__row:last-child { border-bottom: 0; }
.tree dt { font-weight: 700; overflow-wrap: anywhere; }
.tree dd { margin: 0; overflow-wrap: anywhere; }
.tree .tree { padding-left: 12px; border-left: 3px solid var(--surface-sunk); }
.tree-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tree-list > li { padding: 8px 12px; background: var(--surface-sunk); border-radius: var(--radius-md); }
.roles li { margin-bottom: 8px; }
@media (min-width: 768px) { .tree__row { grid-template-columns: 30% 1fr; align-items: start; } }

/* Proof */
.proof-list { list-style: none; margin: 0 0 16px; padding: 0; }
.proof-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.proof-item:first-child { border-top: 1px solid var(--border-default); }
.proof-item__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.proof-item__state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cards-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.card--inner { margin: 0; box-shadow: none; }
.card--inner h3, .card--inner h4 { margin-top: 0; }
@media (min-width: 768px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }

/* Assessment runner */
.run-bar { display: grid; gap: 8px; margin: 12px 0 16px; padding: 12px 16px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-primary); }
.run-timer { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.run-timer strong { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.run-warning { font-weight: 700; color: var(--status-error); }
.run-bar__actions { margin: 0; }
/* The typing bar keeps the clock and the figures in view just under the sticky top bar while the passage scrolls on a phone. */
.run-bar--sticky { position: sticky; top: 56px; z-index: 10; }
.qindex { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.qindex__btn { min-width: 44px; min-height: 44px; padding: 0 8px; border: 1px solid var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-primary); color: var(--text-primary); font: inherit; font-weight: 700; cursor: pointer; }
.qindex__btn--done { background: var(--action-soft); border-color: var(--action-primary); }
.qindex__btn[aria-current="step"] { border: 3px solid var(--action-primary); }
.qindex__legend { margin: 8px 0 16px; }
.run-q h2 { font-size: 1.125rem; line-height: 1.4; }
.run-nav { margin-top: 12px; }
.run-choices { border: 0; padding: 0; margin: 0; }
.choice__letter { font-weight: 700; margin-right: 4px; }
.linkish { background: none; border: 0; padding: 8px 0; min-height: 44px; font: inherit; color: var(--action-primary); text-decoration: underline; cursor: pointer; }
.input--formula { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

/* What assessments carry: the worked example, question grids, the live sheet (admin-authored HTML passes safe-html.js first) */
.assessment-context { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 16px; background: var(--surface-interactive); color: var(--text-secondary); margin: 12px 0; overflow-x: auto; }
.assessment-context { overflow-x: auto; position: relative; }
.assessment-context .eyebrow { color: var(--text-primary); font-weight: 700; margin: 0 0 8px; }
.assessment-context .note { margin: 8px 0 0; font-size: 0.875rem; }
.context-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 8px; }
.context-table th, .context-table td { border: 1px solid var(--text-muted); padding: 8px 10px; text-align: left; }
.context-table th { color: var(--text-primary); font-weight: 700; }
.cell-formula { color: var(--status-success); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; }
.cell-discrepancy { background: var(--status-error-soft); color: var(--status-error); font-weight: 700; }
.reconcile-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 10px; }
.reconcile-col-label { color: var(--text-primary); font-weight: 700; margin: 0 0 6px; }
.inbox-list { display: grid; gap: 6px; margin-top: 10px; }
.inbox-item { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 9px 12px; border: 1px solid var(--text-muted); border-radius: var(--radius-sm); }
.inbox-item--urgent { border-color: var(--status-error); }
.inbox-sender { font-weight: 700; color: var(--text-primary); }
.inbox-subject { overflow-wrap: anywhere; min-width: 0; }
/* position: relative keeps the target cell's screen-reader label (absolutely positioned) inside the scroll box: without it the label
   escaped the clip and widened the whole page on a phone (audit 2026-11-16, M-4). */
.sheet-wrap { overflow-x: auto; margin: 8px 0 12px; max-width: 100%; position: relative; }
.sheet-hint { margin: -4px 0 12px; font-size: 0.875rem; }
.sim-sheet { border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.sim-sheet caption { text-align: left; font-weight: 700; padding-bottom: 6px; color: var(--text-primary); }
.sheet-caption { text-align: left; font-weight: 700; margin: 8px 0 6px; color: var(--text-primary); }
.sim-sheet th, .sim-sheet td { border: 1px solid var(--text-muted); padding: 6px 12px; min-width: 68px; white-space: nowrap; text-align: left; color: var(--text-primary); background: var(--surface-primary); }
.sim-sheet thead th, .sim-sheet tbody th, .sim-sheet .sheet-corner { background: var(--surface-interactive); text-align: center; font-weight: 700; }
.sim-sheet .sheet-target { outline: 3px solid var(--action-primary); outline-offset: -3px; background: var(--action-soft); }
.sheet-target-mark { font-weight: 800; }
@media (min-width: 640px) { .reconcile-grid { grid-template-columns: 1fr 1fr; } }

/* Typing challenge */
.typing-passage { margin: 0 0 16px; padding: 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--surface-interactive); font-size: 1.125rem; line-height: 1.9; overflow-wrap: anywhere; }
.tch--pending { color: var(--text-secondary); }
.tch--correct { color: var(--text-primary); font-weight: 700; }
.tch--wrong { color: var(--status-error); text-decoration-line: underline; text-decoration-style: wavy; }
.tch--cursor { box-shadow: inset 0 -3px 0 var(--action-primary); }

/* Pages outside the shell (email landing pages and the referee form): one centred card on the same tokens, so they match the portal in both themes. */
.cand [hidden] { display: none !important; }
.outside { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.outside__brand { display: block; margin: 0 0 20px; }
.outside__brand img { display: block; height: 32px; width: auto; }
.outside .card { padding: 20px; }
.outside h1 { font-size: 1.5rem; margin-bottom: 12px; }
.outside h1:focus { outline: none; }
.outside h1:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.outside .switch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.outside .switch .btn[aria-pressed="true"] { background: var(--action-primary); color: var(--action-primary-ink); border-color: var(--action-primary); }
.outside .now { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px 16px; margin: 0 0 16px; }
.outside .now p { margin: 0 0 4px; }
.outside .outcome { margin: 0 0 12px; }
.outside .outcome:focus { outline: none; }
.outside .outcome:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.outside .btn--block { margin-top: 8px; }
.outside .contact { margin-top: 20px; color: var(--text-secondary); font-size: 0.875rem; }

/* A link that is the main way into a card or a page is a 44 px target, not a line of text (spec 5 and 10; Plan 4 review A-9, B-11). */
.cand .touch-link { display: inline-flex; align-items: center; min-height: 44px; }

/* battery-v2 assessment page (ui/battery-v2.js): every section on one page, the source documents beside the questions on a wide
   screen and just before the first practical section on a narrow one. The clock bar stays in view (run-bar--sticky). */
.run-bar--page { grid-template-columns: auto 1fr; align-items: center; column-gap: 16px; margin: 0 0 8px; padding: 8px 16px; box-shadow: var(--shadow-sm); }
.run-bar--page .run-timer strong { font-size: 1.5rem; }
.run-bar--page #run-save { margin: 0; text-align: right; }
.run-bar--page #run-save-alert { grid-column: 1 / -1; margin: 0; }
.run-bar__more { margin-bottom: 16px; }
.run-monitoring { margin: 0; }
/* An amount column never breaks "R2 181.00" over two lines (the house format has a space between thousands). */
.assessment-context .context-table td:last-child { white-space: nowrap; }
.capture-record { display: grid; gap: 4px; }
@media (min-width: 900px) { .capture-record { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; } .capture-record > legend, .capture-record > .field__hint { grid-column: 1 / -1; } }
.run-monitoring summary { font-size: 0.9375rem; }
@media (max-width: 599px) { .run-bar--page { padding: 6px 12px; column-gap: 8px; } .run-bar--page .run-timer strong { font-size: 1.25rem; } .run-bar--page .run-warning { flex-basis: 100%; } }
.run-bar__more .run-bar__actions { margin-bottom: 8px; }
.bv2 { display: block; }
.bv2__docs { display: none; }
.bv2-intro ul { margin: 0 0 12px; padding-left: 20px; }
.bv2-intro p, .bv2-intro li { color: var(--text-secondary); }
.bv2-section h2 { margin-bottom: 16px; }
.bv2-q { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
.bv2-q + .bv2-q { padding-top: 20px; border-top: 1px solid var(--border-default); }
.bv2-q:last-child { margin-bottom: 0; }
.bv2-q__prompt { display: block; float: none; width: 100%; padding: 0; font-weight: 700; line-height: 1.45; margin-bottom: 10px; }
.bv2-num { display: inline-block; min-width: 2.25em; color: var(--action-primary); font-variant-numeric: tabular-nums; }
.bv2-instr { color: var(--text-secondary); margin: -4px 0 10px; }
.bv2-ref { white-space: nowrap; }
.bv2-answer { display: flex; align-items: center; gap: 10px; max-width: 440px; }
.bv2-answer__prefix { font-weight: 700; color: var(--text-secondary); }
.bv2-answer__input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.bv2-readback { margin: 6px 0 0; min-height: 1.45em; color: var(--text-secondary); font-size: 0.9375rem; }
.bv2-readback--error { color: var(--status-error); font-weight: 700; }
.bv2-doc { margin-bottom: 16px; }
.bv2-doc:last-child { margin-bottom: 0; }
.bv2-doc h3 { font-size: 1rem; margin: 0 0 6px; }
.bv2-doc__scroll { overflow-x: auto; }
.bv2-doc__scroll:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.bv2-doc__table { margin-top: 0; }
.bv2-doc__table td, .bv2-doc__table th { white-space: nowrap; vertical-align: top; }
.bv2-doc__table .is-amount { text-align: right; font-variant-numeric: tabular-nums; }
.bv2-doc__table .is-wrap { white-space: normal; min-width: 14ch; }
.bv2-submit .btn-row { margin-top: 12px; }
.bv2-doc__table { font-size: 0.8125rem; }
.bv2-doc__table th, .bv2-doc__table td { padding: 6px 8px; }
.bv2-doc__table th { white-space: normal; }
/* Wide screens: questions and documents side by side; the documents pane stays in view under the clock strip. */
@media (min-width: 1200px) {
  .main:has(.bv2) { max-width: 1280px; }
  .bv2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .bv2-docs--inline { display: none; }
  .bv2__docs { display: block; position: sticky; top: 128px; max-height: calc(100vh - 144px); overflow: auto; background: var(--surface-primary); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 16px; }
  .bv2__docs h2 { margin-bottom: 12px; }
}
