@font-face {
  font-family: InterVariable;
  src: url('/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  font-family: InterVariable, system-ui, sans-serif;
  font-synthesis: none;
  font-optical-sizing: auto;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;

  /* Surfaces */
  --canvas: #f4f6f3;
  --surface: #ffffff;
  --surface-sunken: #eef2ed;
  --soft: #eef3ee;
  --line: #173c321f;
  --line-strong: #173c3240;
  --field-line: #173c325c;

  /* Text */
  --text: #1b3029;
  --ink: #173c32;
  --muted: #586960;

  /* Brand: forest green with a shuttlecock-lime accent */
  --brand: #173c32;
  --brand-hover: #245445;
  --brand-pressed: #0f2c24;
  --on-brand: #ffffff;
  --accent: #c9ec9a;
  --accent-ink: #173c32;
  --focus: #bd6624;

  /* Status tones (text always accompanies colour) */
  --success-bg: #e3f4e6;
  --success-fg: #1f5a33;
  --success-line: #1f5a3340;
  --warning-bg: #fff4dc;
  --warning-fg: #6b4a12;
  --warning-line: #b4793766;
  --danger-bg: #fdeceb;
  --danger-fg: #8a2a20;
  --danger-line: #9d393066;
  --info-bg: #e7f0f6;
  --info-fg: #1f4a66;
  --info-line: #1f4a6640;
  --neutral-bg: #edf1ee;
  --neutral-fg: #405a4d;
  --live: #d9480f;
  /* Competing sides: always paired with names, never colour alone. */
  --side-a: #1d5fa8;
  --side-b: #b3261e;

  /* Shape and depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px #0f2c2414;
  --shadow: 0 1px 2px #0f2c2412, 0 4px 16px #0f2c240d;
  --shadow-lg: 0 12px 40px #0f2c241f;

  /* The court board is always a dark scoreboard surface. */
  --board-bg: #173c32;
  --board-fg: #ffffff;
  --board-muted: #cfe0d6;
  --board-line: #ffffff2e;

  /* Layout */
  --page-width: 1120px;
  --gutter: 40px;

  color: var(--text);
  background: var(--canvas);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #0e1512;
    --surface: #151e1a;
    --surface-sunken: #111916;
    --soft: #1c2823;
    --line: #e1ece51f;
    --line-strong: #e1ece53d;
    --field-line: #e1ece554;
    --text: #e3ebe6;
    --ink: #f0f6f2;
    --muted: #a3b5ab;
    --brand: #9fdcb4;
    --brand-hover: #b6e7c6;
    --brand-pressed: #86cfa0;
    --on-brand: #0d2419;
    --accent: #c9ec9a;
    --accent-ink: #10281d;
    --focus: #f3a766;
    --success-bg: #173524;
    --success-fg: #a9e5bb;
    --success-line: #a9e5bb33;
    --warning-bg: #3a2c12;
    --warning-fg: #f6d89a;
    --warning-line: #f6d89a3d;
    --danger-bg: #3d1a17;
    --danger-fg: #f6b3aa;
    --danger-line: #f6b3aa3d;
    --info-bg: #15283a;
    --info-fg: #a9cdea;
    --info-line: #a9cdea33;
    --neutral-bg: #202d27;
    --neutral-fg: #c4d3ca;
    --live: #ff8a5b;
    --side-a: #8cc0f5;
    --side-b: #f5a19a;
    --shadow-sm: 0 1px 2px #0006;
    --shadow: 0 1px 2px #0006, 0 4px 16px #0004;
    --shadow-lg: 0 12px 40px #0008;
  }
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: inherit;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
a:hover {
  text-decoration-color: currentColor;
}
img {
  max-width: 100%;
  height: auto;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Type ---------- */
h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 620;
  text-wrap: balance;
  margin: 0;
}
h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
p {
  line-height: 1.6;
  text-wrap: pretty;
  margin: 0;
  max-width: 68ch;
}
small {
  font-size: 0.875rem;
}
.muted {
  color: var(--muted);
}
.lead {
  font-size: 1.15rem;
  color: var(--text);
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.date,
.num {
  font-variant-numeric: tabular-nums;
}
.content-version,
.wrap-text {
  overflow-wrap: anywhere;
}

/* ---------- Buttons ---------- */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 120ms ease-out,
    border-color 120ms ease-out,
    color 120ms ease-out;
}
button:hover,
.button:hover {
  background: var(--brand-hover);
}
button:active:not(:disabled),
.button:active {
  background: var(--brand-pressed);
}
button.secondary,
.button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
button.secondary:hover,
.button.secondary:hover {
  background: var(--soft);
}
button.danger,
.button.danger {
  background: var(--surface);
  color: var(--danger-fg);
  border-color: var(--danger-line);
}
button.danger:hover,
.button.danger:hover {
  background: var(--danger-bg);
}
button.ghost,
.button.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
button.ghost:hover,
.button.ghost:hover {
  background: var(--soft);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button[aria-busy='true'] {
  cursor: progress;
}

/* ---------- Forms ---------- */
input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  transition: border-color 120ms ease-out;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
  border-color: color-mix(in srgb, var(--ink) 55%, transparent);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent);
  outline-offset: 0;
  border-color: var(--focus);
}
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--brand);
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}
textarea {
  resize: vertical;
}
label {
  display: grid;
  gap: 6px;
  font-weight: 560;
}
label small {
  font-weight: 400;
  color: var(--muted);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
  min-width: 0;
}
legend {
  padding: 0 6px;
  font-weight: 600;
  color: var(--ink);
}
.check-field {
  grid-template-columns: 1.25rem 1fr;
  align-items: center;
  min-height: 44px;
}
.check-field input {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  padding: 0;
  margin: 0;
}

/* ---------- Layout ---------- */
.stack {
  display: grid;
  gap: 24px;
}
.compact {
  gap: 10px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.page {
  width: min(var(--page-width), 100%);
  padding: 40px var(--gutter) 80px;
  margin: 0 auto;
  isolation: isolate;
}
.page-heading {
  display: grid;
  gap: 10px;
  padding-bottom: 28px;
}
.form {
  display: grid;
  gap: 20px;
  max-width: 640px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Sections are the primary content surface: a quiet card on the canvas. */
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-top: 20px;
}
.section .section {
  box-shadow: none;
  background: var(--surface-sunken);
  padding: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------- Feedback ---------- */
.notice,
.error,
.callout-info,
.callout-success {
  position: relative;
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning-fg);
  max-width: 75ch;
}
.error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-fg);
}
.callout-info {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info-fg);
}
.callout-success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success-fg);
}
.notice::before,
.error::before,
.callout-info::before,
.callout-success::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 16px;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}
.error::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}
.callout-success::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.notice p,
.error p {
  color: inherit;
}
[role='status']:not(:empty):not(.status):not(.badge) {
  color: var(--success-fg);
  font-weight: 560;
}

/* Text for screen readers only, e.g. which match a repeated button acts on. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Live-update chip; its state is set by the connected-view script at runtime. */
#live-status[data-state='live'] {
  background: var(--success-bg);
  color: var(--success-fg);
}
#live-status[data-state='offline'],
#live-status[data-state='stopped'],
#live-status[data-state='waiting'] {
  background: var(--warning-bg);
  color: var(--warning-fg);
}

/* Status badges: tone is set with data-tone; text always carries meaning. */
.status,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.status::before,
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
[data-tone='success'] {
  background: var(--success-bg);
  color: var(--success-fg);
}
[data-tone='warning'] {
  background: var(--warning-bg);
  color: var(--warning-fg);
}
[data-tone='danger'] {
  background: var(--danger-bg);
  color: var(--danger-fg);
}
[data-tone='info'] {
  background: var(--info-bg);
  color: var(--info-fg);
}
[data-tone='live'] {
  background: var(--danger-bg);
  color: var(--live);
}

/* ---------- Design system v2: stats, hub cards, avatars ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
  margin: 0 0 20px;
}
.stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.stat-value {
  font-size: 2rem;
  line-height: 1.1;
}
.hub-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.hub-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}
.hub-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.hub-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.hub-card .icon-badge {
  grid-row: span 2;
}
.hub-card .muted {
  font-size: 0.9rem;
}
/* A card whose title link covers the whole card; its name stays the link's name. */
.card-with-link {
  position: relative;
  grid-template-columns: auto 1fr auto;
}
.card-with-link .card-link {
  color: var(--ink);
  text-decoration: none;
}
.card-with-link .card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.card-with-link .card-link:focus-visible::after {
  outline: 3px solid var(--focus);
}
.card-with-link .badge {
  grid-column: 3;
  grid-row: 1 / span 2;
}
.card-with-link .muted {
  grid-column: 2;
}
.icon-badge {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}
.icon {
  flex: none;
}
.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}
.button .icon {
  margin-inline-start: -2px;
}

/* ---------- Lists, tables, empty states ---------- */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.list > li {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.list > li:first-child {
  padding-top: 0;
}
.list > li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.empty {
  padding: 40px 28px;
  display: grid;
  gap: 14px;
  justify-items: start;
}
.section.empty {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
}

/* ---------- Disclosures ---------- */
summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
summary::-webkit-details-marker {
  display: none;
}
summary::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-inline: 4px 2px;
  transition: transform 120ms ease-out;
}
details[open] > summary::before {
  transform: rotate(45deg);
}
summary:hover {
  color: var(--brand-hover);
}
.guidance {
  padding: 6px 18px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 75ch;
}
.guidance[open] {
  padding-bottom: 18px;
}
.guidance p,
.guidance ol {
  margin-block: 12px;
  line-height: 1.65;
}
.guidance li {
  margin-block: 6px;
}
.guidance a {
  display: inline-block;
  padding-block: 8px;
  font-weight: 600;
}

/* ---------- Court tiles ---------- */
.court-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.court-grid > li {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.court-grid > li[data-state='active'] {
  border-color: var(--success-line);
  background: var(--success-bg);
}
.court-grid > li[data-state='called'] {
  border-color: var(--warning-line);
  background: var(--warning-bg);
}

/* ---------- Page-specific containers ---------- */
.court-desk .stack,
.court-desk .form {
  grid-template-columns: minmax(0, 1fr);
}
.court-desk label,
.court-desk select {
  min-width: 0;
}
.platform-admin,
.platform-admin .stack {
  grid-template-columns: minmax(0, 1fr);
  overflow-wrap: anywhere;
}
.platform-admin label,
.platform-admin select {
  min-width: 0;
}
.platform-admin label:has(> input[type='checkbox']) {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.platform-admin input[type='checkbox'] {
  width: 24px;
  min-height: 24px;
  flex-shrink: 0;
}
.platform-admin pre {
  white-space: pre-wrap;
}

/* ---------- Authenticated navigation ---------- */
.skip {
  position: absolute;
  top: -100px;
  left: 20px;
  z-index: 20;
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  border-radius: var(--radius-sm);
}
.skip:focus {
  top: 10px;
}
.app-navigation {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.nav-top,
.nav-context,
.breadcrumbs {
  max-width: var(--page-width);
  margin: auto;
  padding-inline: var(--gutter);
}
.nav-top {
  display: flex;
  align-items: center;
  gap: 8px 24px;
  min-height: 64px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.wordmark::before {
  content: '';
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: url('/favicon.svg') center / cover no-repeat;
}
.nav-primary,
.nav-context {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-primary {
  flex: 1;
}
.app-navigation nav a,
.nav-account summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 120ms ease-out,
    color 120ms ease-out;
}
.app-navigation nav a:hover,
.nav-account summary:hover {
  background: var(--soft);
  color: var(--ink);
}
.app-navigation nav a[aria-current] {
  color: var(--ink);
  background: var(--soft);
}
.nav-context {
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--line);
  padding-block: 4px;
}
.nav-context a[aria-current] {
  box-shadow: inset 0 -2px 0 var(--brand);
  border-radius: 0;
}
.nav-account {
  position: relative;
}
.nav-account summary::before {
  display: none;
}
.nav-account summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 240px;
  display: grid;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.nav-menu a {
  justify-content: flex-start;
}
.nav-menu form {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 6px;
}
.nav-menu button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-weight: 560;
}
.nav-menu button:hover {
  background: var(--danger-bg);
  color: var(--danger-fg);
}
.nav-menu .nav-mobile-only,
.nav-label-narrow {
  display: none;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  padding-block: 10px;
  font-size: 0.875rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.breadcrumbs a {
  text-decoration: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.breadcrumbs a:hover {
  text-decoration: underline;
}
.breadcrumbs a[aria-current] {
  color: var(--ink);
  font-weight: 600;
}
/* The breadcrumbs (desktop) or header back link (phones) replace in-page back links. */
body:has(.app-navigation .breadcrumbs) .page-back {
  display: none;
}
/* Phone-only navigation: short title, one way back, and a bottom tab bar. */
.nav-title,
.nav-back,
.nav-tabs {
  display: none;
}
.nav-tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-tabs a[aria-current] {
  color: var(--ink);
  box-shadow: inset 0 3px 0 var(--brand);
}
.help-footer {
  padding-top: 0;
  padding-bottom: 32px;
}
.help-footer nav {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 0.9rem;
}
.help-footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--muted);
}

/* ---------- Motion ---------- */
@keyframes acknowledge {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}
details[open] > :not(summary),
[role='status'] {
  animation: acknowledge 140ms ease-out;
}

/* ---------- Small screens ---------- */
@media (max-width: 650px) {
  :root {
    --gutter: 16px;
  }
  .page {
    padding-top: 24px;
    padding-bottom: 64px;
  }
  .page-heading {
    padding-bottom: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .section {
    padding: 20px 16px;
    border-radius: var(--radius);
  }
  .nav-primary,
  .nav-context,
  .breadcrumbs {
    display: none;
  }
  .nav-top {
    justify-content: space-between;
    min-height: 56px;
  }
  .nav-top:has(.nav-title) .wordmark {
    font-size: 0;
    gap: 0;
  }
  .nav-title {
    display: block;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-weight: 650;
  }
  .nav-back {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding-inline: var(--gutter);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
    text-decoration: none;
  }
  .nav-tabs {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -4px 16px #0f2c2414;
  }
  .stats.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .stats.three .stat {
    padding: 10px;
  }
  .stats.three .stat dd {
    font-size: 0.95rem;
  }
  .stats.three .stat .stat-value {
    font-size: 1.6rem;
  }
  body:has(.nav-tabs) {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .nav-menu .nav-mobile-only {
    display: inline-flex;
  }
  .nav-label-narrow {
    display: inline;
  }
  .nav-label-wide {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
