/*
 * One stylesheet for both web consoles.
 *
 * There used to be three -- admin_portal.css, style.css and staff.css -- for
 * three pages that are the same product wearing different clothes. A shared
 * token set means a change to the button or the card shape lands everywhere,
 * and the staff console stops looking like a different company's software.
 */

:root {
  color-scheme: light dark;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-sunken: #eef1f5;
  --border: #d8dee6;
  --border-strong: #b9c3ce;

  --text: #16202b;
  --text-muted: #5b6875;
  --text-faint: #8a95a1;

  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --accent-soft: #e8eeff;

  --danger: #b42318;
  --danger-soft: #fdeceb;
  --warn: #92500a;
  --warn-soft: #fdf3e4;
  --ok: #16653c;
  --ok-soft: #e6f4ec;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 4px 12px rgba(16, 32, 48, 0.05);

  --sidebar-width: 244px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --surface: #1a2027;
    --surface-sunken: #141a20;
    --border: #2b343e;
    --border-strong: #3c4854;

    --text: #e8edf3;
    --text-muted: #a3b0bd;
    --text-faint: #75828f;

    --accent: #6f96ff;
    --accent-text: #0d1219;
    --accent-soft: #1c2740;

    --danger: #f0857a;
    --danger-soft: #2e1a19;
    --warn: #e5b370;
    --warn-soft: #2c2418;
    --ok: #6ed49f;
    --ok-soft: #14261d;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

/*
 * `hidden` has to win. Both the sign-in gate and the app shell set an explicit
 * `display`, which beats the user agent's `[hidden] { display: none }` -- so a
 * hidden gate stayed in the layout and pushed the whole console 100vh down the
 * page. Every panel toggle on both consoles depends on this rule.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
p { margin: 0; }

a { color: var(--accent); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- gate ------------------------------------------------------------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 14px;
  text-align: center;
}

.gate-mark {
  justify-self: center;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.local-auth {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.local-auth p { margin: 0; }

/* ---- shell ------------------------------------------------------------ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 13px;
}
.brand-name { font-weight: 600; }

.nav { display: grid; gap: 2px; }
.nav-label {
  padding: 6px 8px 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.nav button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
}
.nav button:hover { background: var(--surface-sunken); color: var(--text); }
.nav button[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 10px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.main { padding: 22px 26px 64px; min-width: 0; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head .titles { display: grid; gap: 3px; }
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

/* ---- cards ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card > header p { color: var(--text-muted); font-size: 12.5px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ---- forms ------------------------------------------------------------ */

.field { display: grid; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-faint); }

/* Inputs inside a compact row must share the row with their sibling. The
 * global width:100% rule is right for a standalone field, but made each
 * colour hex field 100% wide next to its 40px picker and pushed the branding
 * card a few pixels past the viewport on small laptops and tablets. */
.field .row > input[type="text"],
.field .row > input[type="email"] {
  width: auto;
  min-width: 0;
  flex: 1 1 110px;
}
.field .row { min-width: 0; }

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
input[type="file"] {
  font: inherit;
  color: var(--text-muted);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
input[type="color"] {
  width: 40px; height: 34px; padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; }
.check input { margin-top: 2px; width: auto; }
.check span { display: grid; gap: 2px; }
.check b { font-weight: 500; font-size: 13px; }
.check em { font-style: normal; font-size: 12px; color: var(--text-faint); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-end { justify-content: flex-end; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-form {
  display: grid;
  gap: 10px;
  text-align: left;
}
.auth-form .field { margin-bottom: 0; }

/* ---- buttons ---------------------------------------------------------- */

button {
  font: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}
button:hover:not(:disabled) { filter: brightness(1.06); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
button.ghost:hover:not(:disabled) { background: var(--surface-sunken); filter: none; }
button.danger { background: var(--danger); color: #fff; }
button.link {
  background: none; border: none; color: var(--accent);
  padding: 2px 4px; text-decoration: underline;
}
button.small { padding: 5px 9px; font-size: 12.5px; }

/* ---- tabs ------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tabs button {
  background: none;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 12px;
  white-space: nowrap;
}
.tabs button[aria-current="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tabs button:hover:not([aria-current="true"]) { color: var(--text); filter: none; }

/* ---- tables and lists -------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.selectable { cursor: pointer; }
tbody tr.selectable:hover { background: var(--surface-sunken); }
tbody tr.selectable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ---- status ------------------------------------------------------------ */

.status {
  display: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}
.status[data-tone] { display: block; }
.status[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); border-color: currentColor; }
.status[data-tone="bad"] { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.status[data-tone="info"] { background: var(--accent-soft); color: var(--accent); border-color: currentColor; }

.inline-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.inline-status[data-tone="ok"] { color: var(--ok); }
.inline-status[data-tone="bad"] { color: var(--danger); }

.selection-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 13px;
}

table tbody tr[data-selected="true"] { background: var(--accent-soft); }

/* Campus question authoring: keep the answer contract visible while an
 * instructor is composing it, so the portal never makes a faculty member
 * guess how a student will see a clicker question. */
.student-preview {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sunken);
}
.preview-eyebrow {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.preview-title { margin-top: 3px; font-weight: 600; }
.preview-muted, .preview-note { color: var(--text-muted); font-size: 12px; }
.preview-note { margin-top: 10px; }
.student-choice-preview { display: grid; gap: 6px; margin-top: 10px; }
.student-choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.choice-radio, .choice-box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.choice-radio { border-radius: 50%; }
.choice-box { border-radius: 4px; }
.student-input-preview {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--surface);
}
.question-choice-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.question-choice {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 12px;
}
.question-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.question-result {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

details.details { margin-top: 10px; }
details.details summary { cursor: pointer; font-size: 12px; color: var(--text-faint); }
details.details pre {
  margin: 8px 0 0;
  padding: 10px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  max-height: 320px;
}

.code-display {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.16em;
  font-weight: 700;
  padding: 14px 16px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  text-align: center;
  user-select: all;
}

/* ---- checklist --------------------------------------------------------- */

.checklist { display: grid; gap: 8px; }
.checklist-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.checklist-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px;
  background: var(--ok);
}
.checklist-item[data-state="attention"] .dot { background: var(--warn); }
.checklist-item b { font-weight: 600; font-size: 13px; }
.checklist-item span { font-size: 12.5px; color: var(--text-muted); }

/* ---- brand preview ----------------------------------------------------- */

.preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  background: var(--surface-sunken);
}
.preview img, .preview .preview-fallback {
  width: 56px; height: 56px;
  border-radius: 14px;
  object-fit: cover;
  display: grid; place-items: center;
  font-weight: 700;
}

/* ---- documents --------------------------------------------------------- */

.doc-list { display: grid; gap: 8px; }
.doc-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.doc-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-sunken);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.doc-item .doc-meta { display: grid; gap: 2px; min-width: 0; }
.doc-item .doc-meta b { font-weight: 600; }
.doc-item .doc-meta span { font-size: 12px; color: var(--text-faint); }
.doc-item[data-hidden="true"] { opacity: 0.6; }

/* ---- inbox ------------------------------------------------------------- */

.inbox {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  min-height: 520px;
}
.inbox-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.inbox-filters {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-content: flex-start;
  min-width: 0;
}
.inbox-filters button {
  background: var(--surface-sunken);
  color: var(--text-muted);
  border: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.inbox-filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.conversations { overflow-y: auto; flex: 1; max-height: 60vh; }
.conversation-item {
  all: unset;
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}
.conversation-item:hover { background: var(--surface-sunken); }
.conversation-item[aria-current="true"] { background: var(--accent-soft); }
.conversation-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.conversation-item .line1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conversation-item strong { font-size: 13.5px; }
.conversation-item time { font-size: 11.5px; color: var(--text-faint); }
.conversation-item .preview-text {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-item .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }

.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 46vh;
  background: var(--surface-sunken);
}
.bubble {
  max-width: 74%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.bubble[data-from="staff"] {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.bubble[data-pending="true"] { opacity: 0.6; }
.bubble .who { display: block; font-size: 11px; opacity: 0.75; margin-bottom: 2px; }

.composer { display: grid; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.composer .row { justify-content: space-between; }

/* ---- responsive --------------------------------------------------------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-foot { margin-top: 0; border-top: none; width: 100%; }
  .nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .nav-label { display: none; }
  .main { padding: 16px; }
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  .main { padding: 14px 12px 40px; }
  .card { padding: 14px; }
  .doc-item { grid-template-columns: 40px minmax(0, 1fr); }
  .doc-item > .row { grid-column: 1 / -1; justify-content: flex-end; }
  .thread-head { padding: 12px; }
  .messages { padding: 12px; max-height: 45vh; }
  .composer { padding: 10px 12px; }
}

/* ---- Campus: live class, schedule, legacy (v17) ------------------------- */

.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-muted); }
.steps-list b { color: var(--text); }

.day-picks { flex-wrap: wrap; gap: 6px; }
.day-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.day-pick input { margin: 0; }
.day-pick:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }

.live-panel {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px;
  padding: 16px; margin-bottom: 14px; border: 1px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--accent-soft);
}
.live-panel .code-display { font-size: 44px; letter-spacing: 0.22em; background: var(--surface); }
.live-panel-side { display: grid; gap: 10px; align-content: start; }
.live-panel-side .row { flex-wrap: wrap; }
.attendance-box { padding: 10px; background: var(--surface); border-radius: var(--radius-sm); }
.code-display.small-code { font-size: 30px; padding: 8px; }
@media (max-width: 720px) { .live-panel { grid-template-columns: 1fr; } }

details.legacy-section > summary { cursor: pointer; list-style: revert; }

/* ---- Campus: Today, course and class views (v18) ------------------------ */

.link-button {
  background: none; border: 0; padding: 0; color: var(--accent);
  font: inherit; font-size: 12.5px; cursor: pointer; width: auto; min-height: 0;
}
.link-button:hover { text-decoration: underline; background: none; }

details.how-it-works > summary,
details.card > summary { cursor: pointer; }

.class-list { display: grid; gap: 8px; }
.class-row {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.class-row[data-state="live"] { border-color: var(--ok); background: var(--ok-soft); }
.class-row[data-state="closed"] { opacity: 0.8; }
.class-when { display: grid; font-variant-numeric: tabular-nums; }
.class-when span { font-size: 12px; color: var(--text-faint); }
.class-main { display: grid; gap: 2px; min-width: 0; }
.class-main span { font-size: 12.5px; color: var(--text-muted); }
.class-side { justify-content: flex-end; }
@media (max-width: 720px) {
  .class-row { grid-template-columns: 64px minmax(0, 1fr); }
  .class-side { grid-column: 1 / -1; justify-content: flex-start; }
}

.class-head { display: grid; gap: 8px; }
.class-head-main { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.class-head h2 { font-size: 20px; }
.class-actions { justify-content: flex-end; }
.class-actions select { width: auto; }

.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; display: grid; gap: 2px; padding: 10px 12px; background: var(--surface);
  border-radius: var(--radius-sm); font-variant-numeric: tabular-nums;
}
.stat b { font-size: 26px; line-height: 1; }
.stat span { font-size: 12px; color: var(--text-muted); }

.class-grid {
  display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start;
}
.class-grid > .card { margin-bottom: 0; }

.question-live {
  display: grid; gap: 8px; margin-top: 4px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-sunken);
}
.question-prompt { margin: 0; font-weight: 500; }
.bars { display: grid; gap: 6px; margin-top: 6px; }
.bar-row {
  display: grid; grid-template-columns: minmax(28px, max-content) minmax(0, 1fr) 72px;
  gap: 8px; align-items: center; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.bar-label { font-weight: 600; max-width: 180px; overflow-wrap: anywhere; }
.bar-track { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 240ms ease; }
.bar-count { text-align: right; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
.text-answers { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; font-size: 13px; }
.history-item { align-items: start; }
.history-item .bars { max-width: 460px; }

.checks-list { display: grid; gap: 4px; margin-top: 10px; }

select.small-select { width: auto; padding: 3px 6px; font-size: 12.5px; min-height: 0; }
select.small-select[data-tone="ok"] { color: var(--ok); }
select.small-select[data-tone="bad"] { color: var(--danger); }
td[data-correct="true"] { color: var(--ok); }
td[data-correct="false"] { color: var(--danger); }

.quiz-editor { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.quiz-questions { display: grid; gap: 10px; margin-bottom: 12px; }
.quiz-question { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.quiz-question > .row:first-child { margin-bottom: 8px; }
.class-head > .link-button { justify-self: start; }

/* ---- Teach: one hand, facing a room (v19) -------------------------------- */

body.teach { background: var(--bg); }
body.teach .gate { padding: 24px 16px; }

.teach-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-top)) 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.teach-bar-title { display: grid; min-width: 0; margin-right: auto; }
.teach-bar-title b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.teach-main { padding: 14px 14px 96px; max-width: 640px; margin: 0 auto; }
.teach-main .card { margin-bottom: 14px; }
.teach-card h2 { font-size: 16px; margin-bottom: 10px; }
.teach-foot { margin-top: 16px; }

/* Every control an instructor taps mid-class is thumb-sized. */
.teach-main button:not(.ghost):not(.link-button),
.teach-main select,
.teach-main input,
.teach-main textarea { min-height: 48px; font-size: 16px; }
.teach-main button { width: 100%; }
.teach-main .row button { width: auto; flex: 1 1 auto; }
.teach-main .row select { flex: 0 0 auto; width: auto; }

.teach-row {
  width: 100%; text-align: left; background: var(--surface); cursor: pointer;
  font: inherit; color: inherit; min-height: 64px;
}
.teach-row:hover { background: var(--surface-sunken); }

.teach-live {
  padding: 16px; margin-bottom: 14px; text-align: center;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft);
}
.teach-live .code-display {
  font-size: clamp(40px, 15vw, 64px); letter-spacing: 0.2em; background: var(--surface); margin: 6px 0 10px;
}
.teach-live .stat-row { margin-bottom: 10px; }
.teach-live .row { justify-content: center; }

.teach-actions { margin-bottom: 14px; }
.teach-actions:empty { display: none; }

.teach-students { display: grid; gap: 8px; }
.teach-student {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}

.teach-foot-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) 14px;
  background: var(--surface); border-top: 1px solid var(--border);
}
body.teach .status { margin: 10px 14px 0; }
.teach-end { margin: 22px 0 8px; }
.teach-end button { width: 100%; }
button.danger-outline { color: var(--danger); border-color: var(--danger); }
button.danger-outline:hover { background: var(--danger-soft); }
.teach-link { margin: -4px 0 14px; }

/* ---- the class QR and the door sign -------------------------------------- */

.join-card .code-display { font-size: 40px; letter-spacing: 0.2em; margin: 4px 0 14px; }

.qr-sheet {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; gap: 14px;
  padding: 24px; background: #ffffff; color: #111111; text-align: center;
}
.qr-sheet svg { width: min(78vw, 78vh); height: auto; }
.qr-sheet .code-display { font-size: clamp(32px, 11vw, 64px); letter-spacing: 0.2em; background: none; color: #111111; }
.qr-sheet p { color: #444444; font-size: 14px; margin: 0; }
.qr-sheet button { position: absolute; top: 16px; right: 16px; width: auto; }
@media print {
  body * { visibility: hidden !important; }
  .qr-sheet, .qr-sheet * { visibility: visible !important; }
  .qr-sheet { position: static; page-break-inside: avoid; }
  .qr-sheet button { display: none !important; }
}

/* Opening hours: one row a day, the two times aligned down the column so a
   week reads as a shape rather than seven separate forms. */
.hours-week { display: grid; gap: 6px; margin: 10px 0 14px; }
.hours-row { align-items: center; gap: 10px; }
.hours-row .hours-day { flex: 0 0 96px; font-size: 13px; }
.hours-row input[type="time"] { width: 130px; }
@media (max-width: 520px) {
  .hours-row { flex-wrap: wrap; }
  .hours-row .hours-day { flex-basis: 100%; }
  .hours-row input[type="time"] { width: calc(50% - 26px); }
}

/* A pickup request or a ready page stands out in the thread: it is the one
   message that asks staff to do something at the counter. */
.bubble[data-kind] { box-shadow: inset 3px 0 0 var(--accent); }

/* "Alerts are off": the one banner a staff console should never hide. */
.alerts-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin: 0 0 14px; padding: 12px 14px;
  border: 1px solid var(--warn); border-radius: var(--radius);
  background: var(--warn-soft); color: var(--text);
}
.alerts-banner p { margin: 0; font-size: 14px; }
.alerts-banner b { color: var(--warn); }

/* Instant answers: a label and its answer side by side on a wide screen,
   stacked on a phone. */
.answer-row { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.answer-row textarea { min-height: 38px; }
@media (max-width: 640px) { .answer-row { grid-template-columns: 1fr; } }

/* Busy hours: 24 bars, one per hour of the place's own day. */
.busy-hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 96px; margin-top: 8px; }
.busy-hours .bar { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }
.busy-hours .bar[data-peak="true"] { opacity: 1; }
.busy-hours-axis { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; font-size: 10px; color: var(--text-faint); text-align: center; }
.stat-row { flex-wrap: wrap; }

.feedback-list { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.feedback-list li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.feedback-list li span { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }

/* Table tents: printed on plain paper, cut, folded. Two across. */
.tent-sheet { position: fixed; inset: 0; z-index: 60; overflow: auto; background: #ffffff; color: #111111; padding: 24px; }
.tent-sheet .tent-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 16px; }
.tent-sheet .tent-actions button { width: auto; }
.tent-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.tent { border: 1px dashed #999999; border-radius: 12px; padding: 18px; text-align: center; page-break-inside: avoid; break-inside: avoid; }
.tent svg { width: 60%; height: auto; }
.tent h3 { margin: 6px 0 2px; font-size: 26px; color: #111111; }
.tent p { margin: 4px 0 0; font-size: 13px; color: #333333; }
.tent .tent-place { font-weight: 600; font-size: 15px; color: #111111; }
@media print {
  .tent-sheet, .tent-sheet * { visibility: visible !important; }
  .tent-sheet { position: static; padding: 0; }
  .tent-sheet .tent-actions { display: none !important; }
}

/* Right now: a running deal reads as live, not as a form. */
.deal-running { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 12px; border-radius: var(--radius); background: var(--ok-soft); border: 1px solid var(--ok); }
.deal-running p { margin: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-row button { width: auto; }
.announcement-last { padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: 14px; }
.announcement-last span { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }

/* Deals: one row each, the state first so running and scheduled read apart. */
.deal-list { display: grid; gap: 8px; margin-bottom: 6px; }
.deal-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.deal-row[data-status="running"] { border-color: var(--ok); background: var(--ok-soft); }
.deal-row .deal-text { flex: 1 1 220px; min-width: 0; }
.deal-row .deal-text b { display: block; }
.deal-row .deal-text span { font-size: 13px; color: var(--text-muted); }
.deal-row button { width: auto; }
.deal-form-title { font-size: 15px; margin: 18px 0 8px; }

/* The admission radius on a map (radius_map.js). Tiles are plain images laid
   out by the script; the circles are an SVG on top. */
.radius-map-field { margin-top: 4px; }
.radius-map { position: relative; height: 320px; overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-sunken); cursor: crosshair; }
.radius-map-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; }
.radius-map-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.radius-map-radius { fill: rgba(29, 78, 216, 0.16); stroke: #1d4ed8; stroke-width: 2.5; }
.radius-map-allowance { fill: none; stroke: #1d4ed8; stroke-width: 1.5; stroke-dasharray: 6 5; opacity: 0.75; }
.radius-map-pin { fill: #c2410c; stroke: #ffffff; stroke-width: 2.5; }
.radius-map-zoom { position: absolute; top: 10px; right: 10px; display: grid; gap: 4px; }
.radius-map-zoom button { width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1; background: var(--surface); }
.radius-map-credit { position: absolute; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px;
  background: rgba(255, 255, 255, 0.85); color: #333333; }
.radius-map-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  text-align: center; color: var(--text-muted); font-size: 14px; }
.radius-map[data-tiles-failed="true"]::after { content: "Map tiles could not load. The circle is still to scale.";
  position: absolute; left: 10px; bottom: 10px; padding: 4px 8px; font-size: 12px; border-radius: 6px;
  background: var(--warn-soft); color: var(--warn); }
.radius-map-caption { margin-top: 8px; }

/* Menu editor: name, price, heading on one line, the description under it.
   Stacked on a phone, where an owner is most likely to be editing. */
.menu-switch { display: flex; gap: 10px; align-items: flex-start; padding: 12px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-sunken); cursor: pointer; }
.menu-switch input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.menu-switch span { display: grid; gap: 2px; }
.menu-paste { margin-bottom: 12px; }
.menu-paste summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.menu-paste textarea { width: 100%; margin-top: 6px; font-family: inherit; }
.menu-paste-actions { justify-content: space-between; margin-top: 6px; }
.menu-row { display: grid; grid-template-columns: minmax(140px, 2fr) 90px minmax(100px, 1fr) auto auto;
  gap: 6px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.menu-row .menu-description { grid-column: 1 / -1; }
.menu-row input.invalid { border-color: var(--danger); }
.menu-available { display: flex; gap: 4px; align-items: center; font-size: 13px; white-space: nowrap; }
.menu-actions { margin-top: 12px; }
@media (max-width: 640px) {
  .menu-row { grid-template-columns: 1fr 90px; }
  .menu-row .menu-description { grid-column: 1 / -1; }
}

/* Sold out: one switch per item, big enough to hit with a thumb mid-shift. */
.menu-section-title { margin: 14px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.sold-out-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center;
  min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.sold-out-row input { width: 20px; height: 20px; }

/* An app order in the thread: a ticket, not a bubble. It is the one message
   staff act on rather than answer. */
.order-ticket { margin: 8px 0; padding: 12px; border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface); }
.order-ticket[data-status="making"] { border-left-color: var(--warn); }
.order-ticket[data-status="ready"] { border-left-color: var(--ok); }
.order-ticket[data-status="done"],
.order-ticket[data-status="declined"],
.order-ticket[data-status="cancelled"] { border-left-color: var(--border-strong); opacity: .75; }
.order-ticket-head { display: flex; justify-content: space-between; gap: 8px; }
.order-lines { margin: 8px 0; padding: 0; list-style: none; font-size: 15px; }
.order-lines li { padding: 2px 0; }
.order-lines b { display: inline-block; min-width: 2.2em; }
.order-note { margin: 4px 0; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--warn-soft); }
.order-total { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.order-actions { margin-top: 10px; }
.order-decline { flex-basis: 100%; }
.order-decline input { flex: 1; min-width: 160px; }
button.danger-text { color: var(--danger); }
.order-actions select { width: auto; min-width: 0; flex: none; }
