/* WCAG 2.2 AAA palette: every text pair below measures 7:1 or higher (computed 2026-11-08);
   UI borders 3:1. Re-check docs/accessibility.md before changing a token. */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1d1f24;
  --muted: #474b55;
  --line: #8a8f99;
  --line-soft: #dcdad3;
  --brand: #174a6e;
  --brand-ink: #ffffff;
  --accent: #85300f;
  --accent-ink: #ffffff;
  --ok: #14532d;
  --ok-bg: #e3f3e9;
  --warn-bg: #fff1d6;
  --err: #8a1c13;
  --err-bg: #fbe9e7;
  --focus: #0b57d0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --surface: #1d2026; --ink: #eceef2; --muted: #c3c8d2; --line: #6b7280; --line-soft: #2e323b;
    --brand: #9ccbf0; --brand-ink: #0c1116; --accent: #ffb08a; --accent-ink: #1d1f24;
    --ok: #8fe0b0; --ok-bg: #173226; --warn-bg: #33291a; --err: #ffb4ab; --err-bg: #3a1d1b; --focus: #ffd166;
    color-scheme: dark;
  }
}
/* Focus appearance (2.4.13): 3px solid outline with offset on every focusable element. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
/* Target size (2.5.5): interactive controls at least 44x44 CSS px. */
.btn, button, input[type="submit"], .tabs button, select, .site-header nav a { min-height: 44px; }
.site-header nav a { display: inline-flex; align-items: center; padding: 0 6px; }
button.link { min-height: 44px; min-width: 44px; }
input[type="radio"], input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); }
/* Visual presentation (1.4.8): readable measure, generous spacing, no justified text. */
p, li, label, legend { max-width: 75ch; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.25rem; margin: 0 0 .6em; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.site-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--accent); }
.site-header nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.who { color: var(--muted); }
.main { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; }
.main-wide { max-width: none; padding: 12px 16px; }
.narrow { max-width: 640px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { color: var(--muted); font-size: .9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--accent); font-weight: 700; margin: 0; }
.hero { padding: 24px 0 8px; }

.btn { display: inline-block; border: 0; border-radius: 999px; background: var(--brand); color: var(--brand-ink);
  padding: .65em 1.25em; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.small { padding: .4em .9em; font-size: .9rem; }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.secondary[aria-pressed="true"] { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok); }
.btn.danger { background: var(--err); color: var(--surface); }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; margin: 16px 0; box-shadow: var(--shadow); }
.panel.highlight { border-color: var(--brand); }
.flash { padding: 12px 16px; border-radius: 10px; margin: 0 0 12px; background: var(--warn-bg); }
.flash-success { background: var(--ok-bg); }
.flash-error { background: var(--err-bg); color: var(--err); }
.error { color: var(--err); min-height: 1em; margin: 4px 0 0; }

.stack { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-weight: 600; }
input, textarea, select { font: inherit; padding: .6em .7em; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%; }
input[type="radio"], input[type="checkbox"] { width: auto; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 700; margin-bottom: 6px; }
.choice { display: flex; gap: 10px; align-items: center; font-weight: 400; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.credit[hidden] { display: none; }

.cards { list-style: none; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: .2em 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15em .6em; border-radius: 999px; background: var(--line); color: var(--ink); vertical-align: middle; }
.badge.live { background: var(--accent); color: var(--accent-ink); }
.notice { border: 2px solid var(--brand); background: var(--surface); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.notice[hidden] { display: none; }
.badge.yes { background: var(--ok-bg); color: var(--ok); }
.badge.no { background: var(--err-bg); color: var(--err); }
.badge.ended, .badge.generated { background: var(--ok-bg); color: var(--ok); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; display: grid; }
.stat .num { font-size: 1.8rem; font-weight: 800; }
.copy { cursor: pointer; padding: 4px 8px; background: var(--bg); border-radius: 6px; word-break: break-all; }
.copy.copied { outline: 2px solid var(--ok); }

/* ---------------- room */
.room { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: calc(100vh - 80px); min-height: 520px; }
.stage-wrap { display: flex; flex-direction: column; min-width: 0; gap: 10px; }
.room-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-bar h1 { font-size: 1.2rem; margin: 0; }
.stage { flex: 1; background: #0e1014; border-radius: var(--radius); display: grid; gap: 8px; padding: 8px; position: relative;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-content: center; overflow: hidden; }
.stage.has-screen { grid-template-columns: 1fr 220px; }
.stage.has-screen .tile[data-source="screen_share"] { grid-row: 1 / span 3; }
.stage-empty { color: #c7ccd6; text-align: center; margin: auto; grid-column: 1 / -1; }
.tile { margin: 0; position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile figcaption { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 6px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.audio-unlock { align-self: center; }
.side { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.consent-chip { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.chip-panel { flex-basis: 100%; display: grid; gap: 6px; padding-top: 8px; }
.chip-panel label { font-weight: 400; display: flex; gap: 6px; align-items: center; }
.chip-panel .c-credit { display: grid; }
.tabs { display: flex; border-bottom: 1px solid var(--line-soft); }
.tabs button { flex: 1; background: none; border: 0; padding: 10px; font: inherit; cursor: pointer; color: var(--muted); }
.tabs button[aria-pressed="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--brand); }
.chat { list-style: none; margin: 0; padding: 10px 12px; overflow-y: auto; flex: 1; display: grid; gap: 10px; align-content: start; }
.msg { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.msg.mine { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.msg.host { border-left: 3px solid var(--accent); }
.msg.question { box-shadow: inset 0 0 0 1px var(--brand); }
.msg .meta { font-size: .8rem; color: var(--muted); }
.msg p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { border-top: 1px solid var(--line-soft); padding: 10px 12px; }
.chat-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.chat-actions label { display: flex; gap: 6px; align-items: center; font-weight: 400; }

@media (max-width: 860px) {
  .room { grid-template-columns: 1fr; height: auto; }
  .stage { min-height: 240px; }
  .side { height: 60vh; }
  .stage.has-screen { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}

/* ---------------- account + admin */
.subnav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0 0 8px; border-bottom: 1px solid var(--line-soft); }
.subnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0 0 16px; }
.inline-form label { flex: 1 1 220px; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.small-form { margin-top: 8px; gap: 8px; }
.small-form select { padding: .4em .5em; }
.table form { margin: 0 0 6px; }
.codes { columns: 2; list-style: none; padding: 0; font-size: 1.1rem; }
.codes li { margin: 4px 0; }
.qr { width: 220px; max-width: 100%; background: #ffffff; padding: 8px; border-radius: 8px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: auto; display: block; }
.steps { padding-left: 1.2em; }
fieldset.panel legend { font-size: 1.15rem; padding: 0 4px; }
