/* =============================================================
   Chalkline Teacher Assist

   Theme tokens are declared twice — once per resolved theme. The
   "system" preference is resolved to light/dark in JS (app.js: applyTheme)
   and re-resolved when the OS setting changes, so there is no third
   token block to keep in sync.
   ============================================================= */

:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --rail: 224px;
  --topbar: 56px;

  --speed: 140ms;
}

:root[data-theme="light"] {
  --bg: #F5F4EF;
  --surface: #FFFFFF;
  --surface-2: #EDEBE3;
  --sunken: #E3E0D5;
  --text: #17202C;
  --muted: #55606D;
  --faint: #8A94A0;
  --border: rgba(23, 32, 44, 0.12);
  --border-strong: rgba(23, 32, 44, 0.24);

  --brand: #152C4A;
  --primary-bg: #152C4A;
  --primary-fg: #FFFFFF;
  --primary-hover: #0E2038;
  --secondary-bg: #2F6B4F;
  --secondary-fg: #FFFFFF;
  --secondary-hover: #245641;
  --danger: #A8322C;
  --danger-bg: #A8322C;
  --danger-fg: #FFFFFF;
  --danger-soft: rgba(168, 50, 44, 0.10);
  --warn: #A85A1F;
  --warn-soft: rgba(168, 90, 31, 0.12);
  --ok: #2F6B4F;
  --ok-soft: rgba(47, 107, 79, 0.13);
  --info: #152C4A;
  --info-soft: rgba(21, 44, 74, 0.09);

  --shadow-1: 0 1px 2px rgba(23, 32, 44, 0.06);
  --shadow-2: 0 10px 34px rgba(23, 32, 44, 0.16);
  --canvas-bg: #FFFFFF;
  --canvas-ink: #17202C;
}

:root[data-theme="dark"] {
  --bg: #0E1319;
  --surface: #161D26;
  --surface-2: #1E2733;
  --sunken: #0A0E13;
  --text: #E4E9F0;
  --muted: #98A4B3;
  --faint: #6C7A8A;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);

  --brand: #8FB6E6;
  --primary-bg: #3F72AC;
  --primary-fg: #FFFFFF;
  --primary-hover: #4B82C0;
  --secondary-bg: #2F6B4F;
  --secondary-fg: #FFFFFF;
  --secondary-hover: #3A7F5F;
  --danger: #EF7A72;
  --danger-bg: #A8322C;
  --danger-fg: #FFFFFF;
  --danger-soft: rgba(239, 122, 114, 0.14);
  --warn: #E5A163;
  --warn-soft: rgba(229, 161, 99, 0.15);
  --ok: #63C295;
  --ok-soft: rgba(99, 194, 149, 0.14);
  --info: #8FB6E6;
  --info-soft: rgba(143, 182, 230, 0.13);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 38px rgba(0, 0, 0, 0.55);
  --canvas-bg: #0A0E13;
  --canvas-ink: #E4E9F0;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
p { margin: 0; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 12px; }
kbd {
  background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

.muted { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--faint); font-size: 13px; padding: 22px 0; text-align: center; }

/* ---------- controls ---------- */

button, input, select, textarea { font: inherit; color: inherit; }

input:not([type]), input[type="text"], input[type="number"], input[type="password"], input[type="email"],
input[type="search"], input[type="datetime-local"], input[type="date"], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 13.5px;
}
textarea { resize: vertical; min-height: 34px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
input[type="color"] {
  width: 34px; height: 30px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background var(--speed) ease, border-color var(--speed) ease, opacity var(--speed) ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-bg); color: var(--secondary-fg); }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); }
.btn-quiet { background: var(--surface); border-color: var(--border-strong); color: var(--muted); }
.btn-quiet:hover:not(:disabled) { color: var(--text); border-color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger-fg); }
.btn-block { width: 100%; justify-content: center; }
.btn.sm { padding: 5px 9px; font-size: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--muted);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--info-soft); color: var(--info);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-quiet { background: var(--surface-2); color: var(--faint); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  background: var(--surface); border: none; color: var(--muted);
  padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--primary-bg); color: var(--primary-fg); }

/* ---------- login ---------- */

.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, var(--info-soft) 0%, transparent 55%),
              radial-gradient(circle at 85% 90%, var(--ok-soft) 0%, transparent 50%);
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 28px;
  box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 13px;
}
.auth-mark { align-self: flex-start; }
.auth-card h1 { font-size: 25px; letter-spacing: -0.01em; }
.auth-sub { margin-top: -10px; color: var(--faint); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.auth-error { color: var(--danger); font-size: 12.5px; min-height: 1.1em; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- shell ---------- */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--brand); }
.brand-text i {
  font-style: normal; font-size: 9.5px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
.topbar-field {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em;
}
.topbar-field select { width: auto; min-width: 150px; max-width: 220px; padding: 5px 8px; font-size: 13px; }

.theme-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.theme-switch button {
  width: 30px; height: 28px; background: var(--surface); border: none;
  color: var(--faint); font-size: 13px; cursor: pointer; line-height: 1;
}
.theme-switch button + button { border-left: 1px solid var(--border-strong); }
.theme-switch button.on { background: var(--surface-2); color: var(--text); }
.nav-toggle { display: none; }

.body { flex: 1; display: grid; grid-template-columns: var(--rail) 1fr; align-items: start; }

/* ---------- nav ---------- */

.nav {
  position: sticky; top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 12px 10px 20px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.nav-group { border-radius: var(--radius-sm); }
.nav-group > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--faint);
  display: flex; align-items: center; gap: 7px;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::before {
  content: "›"; display: inline-block; font-size: 14px; line-height: 1;
  transition: transform var(--speed) ease; transform-origin: 45% 50%;
}
.nav-group[open] > summary::before { transform: rotate(90deg); }
.nav-group > summary:hover { color: var(--text); background: var(--surface-2); }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  background: transparent; border: none; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 7px 10px 7px 25px; margin-bottom: 1px; cursor: pointer;
}
.nav-item::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; opacity: 0.5; flex: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.on { background: var(--info-soft); color: var(--brand); font-weight: 600; }
.nav-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-foot .nav-item { padding-left: 10px; }

/* ---------- stage & panels ---------- */

.stage { padding: 22px 28px 72px; max-width: 1120px; width: 100%; }
.panel { display: none; }
.panel.on { display: block; animation: rise 160ms ease; }
@keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.panel-note { color: var(--faint); font-size: 12.5px; }

.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .col-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.card h2 { margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.collapsible { padding: 0; }
.collapsible > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 13px 16px; font-family: var(--font-display);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 9px;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after {
  content: "⌄"; margin-left: auto; color: var(--faint);
  font-size: 15px; transition: transform var(--speed) ease;
}
.collapsible[open] > summary::after { transform: rotate(180deg); }
.collapsible[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.collapsible > summary:hover { color: var(--brand); }
.collapsible > *:not(summary) { margin-left: 16px; margin-right: 16px; }
.collapsible > *:last-child { margin-bottom: 16px; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid > label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.form-actions.end { justify-content: flex-end; }
.field-mic { position: relative; }
.field-mic .mic { position: absolute; right: 6px; bottom: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.attach { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-end { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  color: var(--faint); font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.07em; text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: none; }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: var(--surface-2); }
td.num { font-family: var(--font-mono); font-size: 12px; }
td.actions { text-align: right; white-space: nowrap; }
.keys td { border: none; padding: 4px 8px; color: var(--muted); }

/* ---------- dashboard ---------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px;
}
.stat b { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }

.evt { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.evt:last-child { border-bottom: none; }
.evt-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.evt-body { color: var(--muted); margin-top: 2px; }
.evt-list { max-height: 260px; overflow-y: auto; }

/* ---------- chat ---------- */

.chat {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  height: min(52vh, 460px); overflow-y: auto;
}
.msg { max-width: 82%; padding: 9px 12px; border-radius: var(--radius); white-space: pre-wrap; font-size: 13.5px; }
.msg-user { align-self: flex-end; background: var(--surface-2); }
.msg-bot { align-self: flex-start; background: var(--info-soft); border: 1px solid var(--border); }
.msg-pending { color: var(--faint); font-style: italic; }
.msg-tag {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px;
}
.chat-empty { margin: auto; color: var(--faint); font-size: 13px; text-align: center; max-width: 34ch; }
.chat-compose { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-tools { display: flex; gap: 8px; align-items: center; }
.chat-tools .btn-primary { margin-left: auto; }

/* ---------- outputs ---------- */

.output pre {
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  color: var(--text); margin: 0;
  max-height: 60vh; overflow-y: auto;
}
.prompt { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65; color: var(--brand); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--info-soft); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--info);
  cursor: pointer; max-width: 100%;
}
.chip:hover { border-color: var(--brand); }

/* ---------- session ---------- */

.video-frame {
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 16 / 9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px; padding: 16px;
  overflow: hidden;
}
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-note { font-size: 12.5px; color: var(--muted); max-width: 46ch; text-align: center; }

.whiteboard {
  width: 100%; height: 300px; display: block;
  background: var(--canvas-bg); border: 1px solid var(--border);
  border-radius: var(--radius); touch-action: none; cursor: crosshair;
}
.autosave-hint { font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); margin-top: 6px; }
.jump-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6, 10, 16, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  position: relative; width: 100%; max-width: 620px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-2);
}
.modal-sm { max-width: 400px; }
.modal-x { position: absolute; top: 10px; right: 10px; }

.p-section { margin-top: 18px; }
.p-section > h3 {
  font-family: var(--font-body); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint);
  margin-bottom: 6px;
}
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 4px; }
.p-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px; }
.p-stat b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.p-stat span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.p-detail { display: grid; grid-template-columns: 1fr; gap: 7px; }
.p-detail input, .p-detail select, .p-detail textarea {
  grid-column: 1 / -1;
}
.p-row { display: grid; grid-template-columns: 110px 1fr; gap: 9px; align-items: center; }
.p-row > label { font-size: 12px; color: var(--muted); }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; right: 14px; bottom: 14px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); padding: 9px 13px;
  font-size: 13px; box-shadow: var(--shadow-2);
  max-width: 340px; animation: rise 160ms ease;
}
.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--danger); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed; top: var(--topbar); left: 0; z-index: 25;
    width: var(--rail); background: var(--surface);
    transform: translateX(-100%); transition: transform var(--speed) ease;
  }
  .nav.open { transform: none; box-shadow: var(--shadow-2); }
  .stage { padding: 16px 14px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .topbar-field > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- additions: groups, speaking, grading, nav ---------- */

.nav-top { padding-bottom: 6px; margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { width: auto; }
.form-grid > label.check { flex-direction: row; align-items: center; }
.attach select, .attach input:not([type]) { width: auto; min-width: 150px; }
.chip-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip b { font-weight: 700; opacity: 0.6; }
.chip b:hover { opacity: 1; color: var(--danger); }
.form-grid.single { grid-template-columns: 1fr; }
.modal .form-grid > label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }

.group-list { display: grid; gap: 10px; margin-top: 12px; }
.group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.group-head b { font-family: var(--font-display); font-size: 15px; }
.group-head button { margin-left: auto; }
.group-members { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.whiteboard-tall { height: 62vh; min-height: 360px; }

.speak-prompt { display: grid; gap: 14px; grid-template-columns: minmax(0, 340px) 1fr; align-items: start; }
.speak-prompt:has(img[hidden]) { grid-template-columns: 1fr; }
.speak-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 760px) { .speak-prompt { grid-template-columns: 1fr; } }

.crit-list { display: grid; gap: 12px; margin: 14px 0 4px; }
.crit-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.bar { height: 6px; border-radius: 4px; background: var(--sunken); margin: 5px 0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--secondary-bg); border-radius: 4px; }
.rep-h { font-family: var(--font-body); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 16px 0 4px; }
#speakingReport ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
#speakingReport p { font-size: 13.5px; line-height: 1.6; margin: 0; }
.parent-box { background: var(--info-soft); border-radius: var(--radius-sm); padding: 10px 12px; }

.grade-badge { display: inline-flex; align-items: baseline; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 8px 16px; margin-bottom: 12px; }
.grade-badge b { font-family: var(--font-display); font-size: 34px; line-height: 1; }
.grade-badge span { font-family: var(--font-mono); font-size: 13px; }

.whiteboard-shared { width: min(100%, calc(70vh * 1.6)); height: auto; aspect-ratio: 16 / 10; margin: 0 auto; }
.share-row { margin: 10px 0; }
.share-row input { flex: 1; min-width: 220px; font-family: var(--font-mono); font-size: 12px; }
.check input:not([type="checkbox"]) { width: 260px; }
.student-wrap { max-width: 1100px; margin: 0 auto; padding: 14px 16px 24px; }
.student-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.student-bar .brand-logo { height: 28px; width: auto; }
.student-page { background: var(--bg); color: var(--text); font-family: var(--font-body); margin: 0; }

.playback { width: 100%; margin: 8px 0; }
.deliv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; line-height: 1.55; }
.deliv dt { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px; }
.deliv dd { margin: 0; }
.metric-table td { vertical-align: top; font-size: 13px; }
.raw-metrics { margin-top: 14px; font-size: 12px; }
.raw-metrics summary { cursor: pointer; color: var(--muted); }
.raw-metrics pre { max-height: 260px; overflow: auto; font-size: 11px; background: var(--surface-2); padding: 10px; border-radius: var(--radius-sm); }
@media (max-width: 600px) { .deliv { grid-template-columns: 1fr; } }

/* ---------- metric lists & graphs ---------- */

.mlist { list-style: none; margin: 0; padding: 0; }
.mlist li {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--border); font-size: 13.5px;
}
.mlist li:last-child { border-bottom: 0; }
.mlist li > span { color: var(--muted); flex: 1; min-width: 0; }
.mlist li > b { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-align: right; }
.mgroups { columns: 2 280px; column-gap: 34px; }
.mgroup { break-inside: avoid; margin-bottom: 14px; }
.mgroup h4 { margin: 0 0 2px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-family: var(--font-body); }
.profile-stats { max-width: 420px; }
.contour { width: 100%; height: auto; display: block; background: var(--surface-2); border-radius: var(--radius-sm); }

.prog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.prog-pick { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.prog-pick select { width: auto; }
.prog-chart { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.prog-list { margin-top: 12px; }
.prog-list li { cursor: pointer; align-items: center; padding: 6px 8px; border-radius: var(--radius-sm); }
.prog-list li:hover { background: var(--surface-2); }
.prog-list li.on { background: var(--info-soft); }
.spark { width: 110px; height: 26px; flex: none; }
.chg { font-style: normal; font-size: 11.5px; font-family: var(--font-mono); min-width: 74px; text-align: right; color: var(--faint); }
.chg.good { color: var(--ok); }
.chg.bad { color: var(--danger); }
@media (max-width: 560px) { .spark { display: none; } }

/* ---------- timer, alarm, pause ---------- */

.top-btn { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
.top-btn.on { background: var(--info-soft); border-color: var(--brand); }
.top-btn.urgent { background: var(--danger-soft); color: var(--danger); }
#timerLabel { font-family: var(--font-mono); }

.timer-pop {
  position: fixed; top: calc(var(--topbar) + 6px); right: 12px; z-index: 70; width: 290px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); padding: 16px; display: grid; gap: 12px;
}
.timer-display { font-family: var(--font-mono); font-size: 46px; font-weight: 600; text-align: center; letter-spacing: 0.02em; }
.timer-pop input[type="number"] { width: 70px; }
.timer-presets { width: 100%; }
.timer-presets button { flex: 1; }

.alarm-banner {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 18px; padding: 14px 20px;
  background: var(--danger-bg); color: var(--danger-fg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); font-size: 20px; font-weight: 600;
  animation: alarm-flash 0.7s steps(2, jump-none) infinite;
}
.alarm-banner .btn-primary { background: #fff; color: var(--danger); }
@keyframes alarm-flash { 50% { filter: brightness(1.35); } }

.pause-overlay {
  position: fixed; inset: 0; z-index: 200; outline: none;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  text-align: center; padding: 24px; cursor: pointer;
}
.pause-overlay[hidden] { display: none !important; }
.pause-word { font-family: var(--font-display); font-weight: 700; font-size: clamp(64px, 20vw, 240px); letter-spacing: 0.08em; line-height: 1; color: var(--brand); }
.pause-overlay p { font-size: clamp(16px, 2.4vw, 24px); color: var(--muted); margin: 0; }
.pause-overlay kbd { font-family: var(--font-mono); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 10px; background: var(--surface); }
body.is-paused { overflow: hidden; }
@media (max-width: 760px) {
  .topbar { gap: 6px; }
  .top-btn { padding: 4px 7px; font-size: 12px; }
  .topbar-field { font-size: 0; }
  .topbar-field select { font-size: 12.5px; min-width: 100px; max-width: 130px; }
  .brand-text { display: none; }
}
.auth-info { color: var(--ok); font-size: 13px; min-height: 1em; margin: 6px 0; text-align: center; }

/* trial / licence banner (desktop edition) */
.lic-banner { padding: 8px 16px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line, rgba(0,0,0,.1)); }
.lic-banner.lic-locked { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
#licBackdrop textarea { width: 100%; font-family: monospace; font-size: 12px; }

/* Print: only the speaking report, on A4, black on white. */
@media print {
  @page { size: A4; margin: 14mm; }
  body * { visibility: hidden !important; }
  #speakingOutput, #speakingOutput * { visibility: visible !important; }
  #speakingOutput { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; background: #fff; color: #000; }
  #speakingOutput .row-actions, #speakingOutput .raw-metrics { display: none !important; }
}

.next-step { background: var(--accent-soft, #eef4ff); font-size: 14px; line-height: 1.5; }
.next-step[hidden] { display: none; }
.group-members .btn.sm, .next-step .btn.sm { margin: 2px 4px; }
