/*
 * The platform's one hand-written stylesheet (ADR-005: no CSS framework, no build step), in the
 * look of the approved design prototype (PD-077; docs/03-architecture/design/).
 *
 * Mobile-first: the unqualified rules are the phone layout, held at the till; one min-width query
 * widens it on larger screens. Black and white with a grey scale. Colour appears only where it
 * means something: green for passed, red for not passed, amber for in progress or due. A colour is
 * never the only carrier of meaning: every badge and result carries its word as well.
 *
 * NFR-05 (WCAG 2.1 AA). Every text and background pair below meets 4.5:1 or more, and every
 * control border 3:1 or more; the pull request states the ratios. Focus is always visible.
 *
 * Class names, after the prototype. Administration pages (lane 52) write their markup against
 * these names; the shell's helpers in ui/Layout.kt write the app bar, trail and back link.
 *
 *   Shell     appbar, wordmark (.dot), lang, who (summary .avatar .t), menu (.id), skip, vh
 *   Way about crumbs (.sep), backrow, back
 *   Headings  h1, h2, lead, eyebrow
 *   Buttons   btn | btn ghost | btn quiet | btn danger, plus block and sm; links and buttons alike
 *   Surfaces  card, hero (.ring), cert (.seal), result (.big ok|bad), callout, notice-*
 *   Status    badge | badge ok | badge bad | badge warn | badge dark
 *   Progress  bar (<i style="width:..">), dots
 *   Lists     list, li (.tick, .tick.done, .grow), mods, mod (.n .tt .row), tiles, tile (.v .l)
 *   Forms     field, label.f, input, help, hint, choice, opt, radio, actions, search
 *   Tables    table.data (or any table in a card)
 *   Actions   sticky (.hint): the bottom action bar on phones
 *   Dialogs   modal (a <dialog>), acts
 *   Test      qhead, step (one question per screen, ui/test.js)
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  /* Served by the platform itself (ADR-005, coordinator's note of 2026-10-12); licence in fonts/OFL.txt. */
  src: url("/web/fonts/InterVariable.woff2") format("woff2");
}

:root {
  --ink: #0b0b0c;
  --ink-2: #2a2a2e;
  --muted: #5f5f67;
  --line: #e2e2e7;
  --line-strong: #8c8c94;
  --soft: #f4f4f6;
  --paper: #ffffff;
  --ok: #0f7a3d;
  --ok-bg: #e7f5ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --on-ink-muted: #cfcfd4;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --r-lg: 1.25rem;
  --r-md: 0.875rem;
  --r-sm: 0.625rem;
  --r-pill: 999px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Long words, such as Swedish compounds, break rather than push the page wider (WCAG 1.4.10). */
  overflow-wrap: break-word;
}

a {
  color: inherit;
}

p {
  margin: 0 0 var(--space-3);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* Text for assistive technology only. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link: off-screen until focused, then pinned to the top-left. */
.skip {
  position: absolute;
  left: -100vw;
  top: 0;
  z-index: 50;
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 var(--r-sm) 0;
}

.skip:focus {
  left: 0;
}

/* ── App bar ─────────────────────────────────────────────────────────────── */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.appbar .grow {
  flex: 1;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark .dot {
  display: inline-block;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 0.375rem;
  background: var(--ink);
}

/* "Training" beside the wordmark shows from 24rem up, so the bar fits a 320 px screen (WCAG 1.4.10). */
.wordmark small {
  display: none;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0;
  color: var(--muted);
}

.lang {
  display: inline-flex;
  gap: var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
}

.lang a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  justify-content: center;
  padding: 0 var(--space-2);
  border-radius: var(--r-pill);
  color: var(--muted);
  text-decoration: none;
}

.lang a[aria-current="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Who is signed in (PD-076): a compact button that opens a small menu. A <details>, so it opens without scripting. */
.who {
  position: relative;
}

.who > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  cursor: pointer;
  list-style: none;
}

.who > summary::-webkit-details-marker {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
}

/* The name beside the avatar shows from tablet width up; the menu always names the person. */
.who .t {
  display: none;
  line-height: 1.15;
  padding-right: var(--space-2);
}

.who .t b {
  display: block;
  font-size: 0.8125rem;
}

.who .t span {
  font-size: 0.75rem;
  color: var(--muted);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: 30;
  width: min(18rem, calc(100vw - 2rem));
  padding: var(--space-2);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}

.menu .id {
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.menu .id p {
  margin: 0 0 var(--space-1);
  overflow-wrap: anywhere;
}

.menu .id .muted {
  color: var(--muted);
}

.menu > a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 500;
}

.menu > a:hover {
  background: var(--soft);
}

.menu form {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3) var(--space-1);
  border-top: 1px solid var(--line);
}

/* ── Page frame ──────────────────────────────────────────────────────────── */

main {
  display: block;
  max-width: 56rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-6);
}

main.narrow {
  max-width: 30rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  align-items: center;
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  color: var(--muted);
}

.crumbs ol {
  display: contents;
  list-style: none;
}

.crumbs li {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  /* A module title made of one very long word wraps in the trail rather than widening the page (WCAG 1.4.10). */
  min-width: 0;
  overflow-wrap: anywhere;
}

.crumbs li + li::before {
  content: "\203A";
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.crumbs [aria-current="page"] {
  color: var(--ink-2);
}

.backrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  align-items: center;
  margin: 0 0 var(--space-2);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-1) 0;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: var(--space-1) 0 var(--space-2);
}

h2 {
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: var(--space-5) 0 var(--space-3);
}

h3 {
  font-size: 1rem;
  margin: 0 0 var(--space-1);
}

.card > h2:first-child,
.cert h2,
.hero h2 {
  margin-top: 0;
}

.lead {
  color: var(--muted);
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
/* .btn on links and buttons alike; plain submit inputs and buttons get the same look, for pages not yet redesigned. */

.btn,
input[type="submit"],
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0.75rem 1.375rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* A long label wraps inside the button rather than pushing the page wider (WCAG 1.4.10). */
  max-width: 100%;
  white-space: normal;
}

.btn.ghost,
button.secondary,
input[type="submit"].secondary {
  background: var(--paper);
  color: var(--ink);
}

.btn.quiet,
input[type="submit"].quiet {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: var(--paper);
}

.btn.block {
  display: flex;
  width: 100%;
}

.btn.sm {
  min-height: 2.25rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

button:disabled,
input[type="submit"]:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}

/* The older call-to-action link, kept for pages not yet redesigned. */
.cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.75rem 1.375rem;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}

/* ── Surfaces ────────────────────────────────────────────────────────────── */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-4);
  margin: 0 0 var(--space-3);
  box-shadow: var(--shadow);
}

.card.narrow {
  max-width: 32rem;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-5);
  margin: 0 0 var(--space-4);
  border-radius: var(--r-lg);
  background: var(--ink);
  color: var(--paper);
}

.hero p {
  color: var(--on-ink-muted);
  margin: var(--space-1) 0 0;
}

.hero h2 {
  color: var(--paper);
  margin: var(--space-2) 0 0;
}

.hero .badge {
  background: var(--paper);
  color: var(--ink);
  white-space: normal;
}

/* Course progress: the ring is drawn by a conic gradient; --p is the share passed, in per cent. */
.ring {
  --p: 0;
  display: grid;
  place-items: center;
  flex: none;
  width: 5.25rem;
  height: 5.25rem;
  border-radius: 50%;
  background: conic-gradient(var(--paper) calc(var(--p) * 1%), #3a3a40 0);
}

.ring span {
  display: grid;
  place-items: center;
  width: 4.125rem;
  height: 4.125rem;
  border-radius: 50%;
  background: var(--ink);
  font-weight: 800;
  font-size: 1.125rem;
}

.cert {
  padding: var(--space-5);
  margin: 0 0 var(--space-4);
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--paper) 0%, var(--soft) 100%);
}

.cert .head {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.cert .seal {
  display: grid;
  place-items: center;
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
}

.cert p {
  margin: var(--space-3) 0 0;
  line-height: 1.6;
}

.result {
  text-align: center;
  padding: var(--space-5) var(--space-2) var(--space-4);
}

.result .big {
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
}

.result .big.ok {
  background: var(--ok);
}

.result .big.bad {
  background: var(--bad);
}

.callout {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--soft);
}

.notice {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--ink-2);
}

.notice-error {
  border-left-color: var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
}

.notice-ok {
  border-left-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}

.notice-warn {
  border-left-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
}

/* ── Status ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.dark {
  background: var(--ink);
  color: var(--paper);
}

/* ── Progress ────────────────────────────────────────────────────────────── */

.bar {
  height: 0.375rem;
  margin: var(--space-2) 0;
  border-radius: var(--r-pill);
  background: var(--soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--ink);
}

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.dots button {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8125rem;
}

.dots button.answered {
  border-color: var(--ink);
}

.dots button[aria-current="step"] {
  background: var(--ink);
  color: var(--paper);
}

/* ── Lists ───────────────────────────────────────────────────────────────── */

.list {
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  overflow: hidden;
}

.li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 3.5rem;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
  color: inherit;
  text-align: left;
  text-decoration: none;
}

.list > .li:first-child,
.list > li:first-child > .li {
  border-top: 0;
}

/* A list row that is a button (the test's review step) reads as a row, not as a pill button. */
button.li {
  justify-content: flex-start;
  min-height: 3.5rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.45;
}

a.li:hover,
button.li:hover {
  background: var(--soft);
}

.li .tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
}

.li .tick.done {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.li .grow {
  flex: 1;
  min-width: 0;
}

.li small {
  display: block;
  color: var(--muted);
}

.li .go {
  color: var(--muted);
}

.mods {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mod {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-decoration: none;
}

a.mod:hover {
  border-color: var(--ink);
}

.mod .n {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.mod .tt {
  font-weight: 700;
  line-height: 1.3;
  /* A single very long word wraps inside the card rather than widening it (WCAG 1.4.10). */
  overflow-wrap: anywhere;
}

.mod .row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: 0.8125rem;
  color: var(--muted);
}

.tiles {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 0 0 var(--space-4);
}

.tile {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.tile .v {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tile .l {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

/* ── Reading ─────────────────────────────────────────────────────────────── */

.reader {
  max-width: 40rem;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.reader p {
  margin: 0 0 var(--space-4);
  white-space: pre-line;
  overflow-wrap: anywhere;
  hyphens: auto;
}

h1,
legend {
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.field {
  margin: 0 0 var(--space-4);
}

.field label,
label.f {
  display: block;
  margin: 0 0 var(--space-1);
  font-weight: 600;
  font-size: 0.875rem;
}

.hint,
.help {
  margin: 0 0 var(--space-2);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
input:not([type]),
select,
textarea,
.input {
  width: 100%;
  min-height: 2.875rem;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 0.75rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

input[autocomplete="one-time-code"] {
  letter-spacing: 0.25em;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--ink);
}

fieldset {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin: 0 0 var(--space-2);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.4;
}

/* One option of a scenario or a test question: the whole row is the tap target (the prototype's .opt). */
.choice,
.opt,
.radio {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  line-height: 1.45;
}

.choice input[type="radio"],
.choice input[type="checkbox"],
.radio input[type="radio"] {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.0625rem 0 0;
  accent-color: var(--ink);
}

.choice label {
  flex: 1;
  min-width: 0;
  min-height: 1.5rem;
  cursor: pointer;
  /* A single very long word wraps inside the option rather than widening it (WCAG 1.4.10). */
  overflow-wrap: anywhere;
}

/* The label covers the whole option, so a tap anywhere on it chooses it. */
.choice label::after {
  content: "";
  position: absolute;
  inset: 0;
}

.choice:has(input:checked),
.radio:has(input:checked) {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink) inset;
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* "or" between the passkey and the one-time code (PD-081 (a)). */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.search {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.search .input,
.search input {
  flex: 1 1 12rem;
  width: auto;
}

form.inline {
  display: inline;
  margin: 0 0 0 var(--space-2);
}

.secret-value {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--r-sm);
  background: var(--soft);
  font-family: var(--mono);
  word-break: break-all;
}

/* Scenario feedback: the verdict is a word, the tint only repeats it. */
.feedback {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--soft);
}

.feedback .verdict {
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.feedback-right {
  border-left-color: var(--ok);
  background: var(--ok-bg);
}

.feedback-right .verdict {
  color: var(--ok);
}

.feedback-wrong {
  border-left-color: var(--bad);
  background: var(--bad-bg);
}

.feedback-wrong .verdict {
  color: var(--bad);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

table.data,
.card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: var(--space-4) 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}

table.data caption {
  padding: var(--space-3);
  text-align: left;
  font-weight: 600;
}

table.data th,
table.data td,
.card th,
.card td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

table.data th,
.card th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}

nav.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

nav.tabs a[aria-current="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ── The bottom action bar ───────────────────────────────────────────────── */
/* In the page's flow, so it never covers content; it sticks to the bottom edge while the page scrolls. */

.sticky {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: var(--space-2);
  margin: var(--space-5) calc(-1 * var(--space-4)) calc(-1 * var(--space-6));
  padding: var(--space-3) var(--space-4);
  background: var(--paper);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
  border-top: 1px solid var(--line);
}

.sticky .hint {
  margin: 0;
  text-align: center;
}

.sticky .btn {
  width: 100%;
}

/* ── Dialogs (opened by ui.js; without scripting the page states the same consequence beside the action) ── */

dialog.modal {
  width: min(26rem, calc(100vw - 2rem));
  padding: var(--space-5);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  color: var(--ink);
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog.modal h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
}

dialog.modal p {
  color: var(--ink-2);
}

.acts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ── The test: one question per screen (ui/test.js) ──────────────────────── */

.qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.stepped fieldset.step {
  display: none;
}

.stepped fieldset.step.on {
  display: block;
}

.stepped fieldset.step legend {
  font-size: 1.25rem;
  line-height: 1.35;
}

.stepped .no-script-only {
  display: none;
}

/* ── Larger screens ──────────────────────────────────────────────────────── */

@media (min-width: 24rem) {
  .wordmark small {
    display: inline;
  }

  .appbar {
    gap: var(--space-3);
  }
}

@media (min-width: 48rem) {
  .appbar {
    padding: var(--space-3) var(--space-5);
  }

  .who .t {
    display: block;
  }

  main {
    padding: var(--space-5) var(--space-6) var(--space-6);
  }

  h1 {
    font-size: 1.875rem;
  }

  .hero {
    flex-direction: row;
    align-items: center;
  }

  .mods {
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  }

  .actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sticky {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    margin-left: 0;
    margin-right: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  .sticky .hint {
    flex: 1;
    text-align: left;
  }

  .sticky .btn {
    width: auto;
  }

  .acts {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
}

/* ── Administration pages (lane 52; D-021) ──────────────────────────────────
 * Every rule below starts at main.admin, the class the administration pages put on <main>
 * (ui/admin/AdminWebRoutes.kt), so no learner page's look can change.
 *
 *   li person     a person's row: name and address, then the badge, then the actions,
 *                 wrapping below on a narrow screen so the name is never squeezed out
 *   row-actions   the row's buttons, which wrap
 *   consequence   what pressing the action beside it will do (PD-077)
 *   cancel        the link that leaves a form and saves nothing
 *   tile          a tile that is a link: no underline; .v.warn is the amber refresher-due number
 *   compare       the test versions comparison: row headers (.row-label) and differing rows
 *                 (.differs, <mark>), shaded in the grey scale with the word "Differs" beside them;
 *                 long words in its cells wrap, and below tablet width .scroll-hint says that the
 *                 table scrolls sideways (F-084)
 *   tabs          the start page's tabs stay on one row and scroll sideways when they do not fit (F-085);
 *                 their focus ring is drawn inside each tab, so the scroll box does not clip it
 */

main.admin .li.person {
  flex-wrap: wrap;
  align-items: flex-start;
}

main.admin .li.person .grow {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

main.admin .li.person .badge {
  flex: none;
}

main.admin .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-basis: 100%;
}

main.admin .row-actions form.inline {
  margin: 0;
}

main.admin .consequence {
  margin: var(--space-2) 0 var(--space-3);
}

main.admin .cancel {
  text-decoration: none;
}

main.admin a.tile {
  display: block;
  color: inherit;
  text-decoration: none;
}

main.admin a.tile:hover {
  border-color: var(--ink);
}

main.admin .tile .v.warn {
  color: var(--warn);
}

main.admin th.row-label {
  min-width: 9rem;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

main.admin tr.differs td,
main.admin tr.differs th {
  background: var(--soft);
}

main.admin .compare mark {
  padding: 0 0.125rem;
  border-radius: 0.25rem;
  background: var(--line);
  color: var(--ink);
}

main.admin .choice label,
main.admin .crumbs li {
  min-width: 0;
  overflow-wrap: anywhere;
}

main.admin table.compare th,
main.admin table.compare td {
  min-width: 9rem;
  overflow-wrap: anywhere;
}

/* Each version's column stays wide enough to read on a phone; the table scrolls sideways instead. */
main.admin table.compare td {
  min-width: 12rem;
}

/* A long status ("Replaced by a newer approved version") wraps in its cell rather than widening the table. */
main.admin table.compare .badge {
  white-space: normal;
}

main.admin .scroll-hint {
  margin: var(--space-3) 0 0;
}

main.admin nav.tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
}

main.admin nav.tabs a {
  flex: none;
  white-space: nowrap;
}

/* The tabs' row is a scroll box, which clips anything drawn outside it: the focus ring is drawn
   inside each tab instead, so keyboard focus stays visible (WCAG 2.4.7; NFR-05). */
main.admin nav.tabs a:focus-visible {
  outline-offset: -3px;
}

@media (min-width: 48rem) {
  main.admin .row-actions {
    flex-basis: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  main.admin .scroll-hint {
    display: none;
  }
}
