
/* Native hidden state must override component display rules (including .auth-form). */
[hidden] { display: none !important; }
:root {
  --primary: #1d3557;
  --primary-2: #274b74;
  --accent: #457b9d;
  --accent-soft: #e8f1f6;
  --ink: #24303b;
  --muted: #647180;
  --line: #dce3e9;
  --line-strong: #cbd6df;
  --paper: #ffffff;
  --paper-2: #f6f8fa;
  --page: #2d3436;
  --success: #2f7a58;
  --success-soft: #e8f5ee;
  --warning: #a66717;
  --warning-soft: #fff4df;
  --danger: #a34545;
  --danger-soft: #fbecec;
  --shadow: 0 16px 45px rgba(0,0,0,.20);
  --shadow-soft: 0 8px 24px rgba(29,53,87,.10);
  --radius: 14px;
  --radius-sm: 9px;
  --content: 1320px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
img { max-width: 100%; }


.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.98);
  box-shadow: 0 2px 12px rgba(0,0,0,.16);
}
.header-inner {
  max-width: var(--content);
  min-height: 68px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary);
  flex: 0 0 auto;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 1.03rem; text-transform: lowercase; }
.brand-copy small { margin-top: 5px; font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.main-nav { display: flex; align-items: stretch; gap: 4px; margin-left: auto; }
.main-nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 23px 12px 21px;
  color: var(--primary);
  text-decoration: none;
  font-size: .91rem;
  font-weight: 650;
}
.main-nav a:hover { color: var(--accent); }
.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}
.account-button {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--primary);
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 700;
  font-size: .84rem;
  cursor: pointer;
  white-space: nowrap;
}
.account-button:hover { border-color: var(--accent); background: var(--accent-soft); }
.mobile-menu { display: none; margin-left: auto; }

.app-shell {
  width: min(var(--content), calc(100% - 32px));
  margin: 34px auto 70px;
  min-height: 68vh;
}
.page-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page-pad { padding: 30px; }
.page-header {
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfd);
}
.page-header-row { display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.page-header h1, .hero-copy h1 { margin: 4px 0 8px; color: var(--primary); line-height: 1.13; letter-spacing: -.025em; }
.page-header h1 { font-size: clamp(1.6rem, 2.7vw, 2.25rem); }
.page-header p { margin: 0; color: var(--muted); max-width: 780px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 800; }
.muted { color: var(--muted); }
.optional { color: var(--muted); font-size: .78rem; font-weight: 500; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 28px;
  padding: 38px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-copy { padding: 18px 10px 18px 4px; align-self: center; }
.hero-copy h1 { font-size: clamp(2.2rem, 4.2vw, 4rem); max-width: 780px; }
.hero-copy .lead { color: #4b5967; font-size: 1.09rem; max-width: 760px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-panel {
  background: linear-gradient(145deg, var(--primary), #294c72);
  color: white;
  border-radius: 13px;
  padding: 25px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-soft);
}
.hero-panel h2 { margin: 3px 0 18px; font-size: 1.25rem; }
.hero-panel .eyebrow { color: #bcd9e9; }
.hero-stat { padding: 13px 0; border-top: 1px solid rgba(255,255,255,.16); }
.hero-stat:first-of-type { border-top: 0; }
.hero-stat-top { display: flex; justify-content: space-between; gap: 15px; font-size: .88rem; }
.hero-stat strong { font-size: .95rem; }
.hero-panel .progress-track { background: rgba(255,255,255,.16); }
.hero-panel .progress-fill { background: white; }

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 15px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 720;
  font-size: .91rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-2); }
.button.secondary { background: white; color: var(--primary); border-color: var(--line-strong); }
.button.secondary:hover { border-color: var(--accent); background: var(--accent-soft); }
.button.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.button.small { padding: 7px 10px; font-size: .82rem; }
.button.danger { color: var(--danger); border-color: #e5bcbc; background: var(--danger-soft); }

.section-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.study-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255,255,255,.75);
  padding: 24px;
}
.study-card h2, .study-card h3 { color: var(--primary); margin: 0 0 8px; }
.study-card p { color: var(--muted); margin: 0 0 18px; }
.study-card .card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.count-badge { font-size: .78rem; font-weight: 750; color: var(--primary); background: var(--accent-soft); padding: 5px 9px; border-radius: 999px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { border: 1px solid var(--line); border-radius: 11px; padding: 18px; background: #fff; }
.kpi .kpi-label { font-size: .78rem; color: var(--muted); font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.kpi .kpi-value { color: var(--primary); font-size: 1.85rem; font-weight: 820; line-height: 1.15; margin: 6px 0 2px; }
.kpi .kpi-sub { color: var(--muted); font-size: .8rem; }

.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: white; padding: 20px; }
.panel h2 { margin: 0 0 14px; color: var(--primary); font-size: 1.1rem; }
.panel + .panel { margin-top: 0; }
.progress-row { margin: 13px 0; }
.progress-row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: .88rem; }
.progress-row-top strong { color: var(--ink); }
.progress-row-top span { color: var(--muted); }
.progress-track { height: 7px; border-radius: 999px; overflow: hidden; background: #e6ecf0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: inherit; min-width: 0; }

.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.quick-action { border: 1px solid var(--line); background: var(--paper-2); color: var(--primary); text-align: left; border-radius: 10px; padding: 14px; cursor: pointer; font-weight: 720; }
.quick-action small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
.quick-action:hover { border-color: var(--accent); background: var(--accent-soft); }

.filters {
  display: grid;
  grid-template-columns: minmax(240px,1.8fr) repeat(2,minmax(150px,.7fr)) auto;
  gap: 10px;
  padding: 18px 30px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.input, .select, .filters input, .filters select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}
.filters input:focus, .filters select:focus, .dialog-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }
.check-control { display: flex; align-items: center; gap: 7px; padding: 0 8px; color: var(--muted); font-size: .86rem; white-space: nowrap; }

.fellowship-filters { grid-template-columns: minmax(230px,1.5fr) minmax(155px,.7fr) minmax(175px,.9fr) minmax(135px,.65fr) auto; }

.category-tabs { display: flex; gap: 7px; flex-wrap: wrap; padding: 16px 30px 0; }
.category-tab { border: 1px solid var(--line); background: white; color: var(--primary); padding: 7px 11px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: .82rem; }
.category-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.result-summary { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 30px 10px; color: var(--muted); font-size: .86rem; }
.result-list { padding: 0 30px 25px; }
.result-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  padding: 17px 2px;
  border-bottom: 1px solid var(--line);
}
.result-card:last-child { border-bottom: 0; }
.result-title { display: inline-block; color: var(--primary); font-weight: 780; font-size: 1rem; text-decoration: none; margin-bottom: 5px; }
.result-title:hover { color: var(--accent); text-decoration: underline; }
.result-meta { display: flex; gap: 7px 12px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.result-tags { margin-top: 7px; color: #566473; font-size: .8rem; }
.result-side { min-width: 145px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.status-pill, .availability-pill {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 4px 8px; font-size: .73rem; font-weight: 760;
}
.status-pill.unseen { background: #edf1f4; color: #687784; }
.status-pill.needs-work { background: var(--danger-soft); color: var(--danger); }
.status-pill.ok { background: var(--warning-soft); color: var(--warning); }
.status-pill.confident { background: var(--success-soft); color: var(--success); }
.status-pill.complete { background: var(--success-soft); color: var(--success); }
.availability-pill.html { background: #e7f2fb; color: #2d688d; }
.availability-pill.pdf { background: #f0ecfa; color: #66518d; }
.availability-pill.meta { background: #f1f3f5; color: #77818a; }
.bookmark-mini { color: #a8731a; font-size: .82rem; font-weight: 750; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 0 30px 28px; }
.pagination .button[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.list-top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 30px 16px;
}
.list-top-controls .pagination { padding: 0; margin-left: auto; }
.page-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 650;
  white-space: nowrap;
}
.page-size-control select {
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 28px 7px 9px;
  outline: 0;
}
.page-size-control select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }

.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 295px; gap: 22px; padding: 25px 30px 30px; }
.content-panel { min-width: 0; }
.study-sidebar { align-self: start; position: sticky; top: 118px; display: flex; flex-direction: column; gap: 12px; }
.sidebar-card { border: 1px solid var(--line); border-radius: 11px; padding: 17px; background: var(--paper-2); }
.sidebar-card h3 { margin: 0 0 11px; color: var(--primary); font-size: .98rem; }
.sidebar-card p { font-size: .82rem; color: var(--muted); }
.confidence-grid { display: grid; gap: 7px; }
.confidence-button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; background: white; color: var(--ink); text-align: left; cursor: pointer; font-size: .84rem; font-weight: 650; }
.confidence-button.active.needs-work { border-color: #cf8585; background: var(--danger-soft); color: var(--danger); }
.confidence-button.active.ok { border-color: #d0a15d; background: var(--warning-soft); color: var(--warning); }
.confidence-button.active.confident { border-color: #72ae91; background: var(--success-soft); color: var(--success); }
.toggle-row { display: flex; gap: 8px; }
.toggle-row .button { flex: 1; }
.detail-nav { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 17px; }

.content-message { border: 1px dashed var(--line-strong); background: var(--paper-2); border-radius: 11px; padding: 23px; color: var(--muted); }
.content-message h2 { margin-top: 0; color: var(--primary); }
.content-message code { background: #e9edf0; color: #394957; padding: 2px 5px; border-radius: 4px; }

/* Styles for the user's converted Viva HTML fragments */
.viva-card, .viva-container { color: var(--ink); }
.viva-card > .viva-header, .viva-container > .viva-header { border: 0; background: transparent; padding: 0 0 18px; }
.viva-card h1, .viva-container h1 { margin: 0 0 8px; color: var(--primary); line-height: 1.2; font-size: clamp(1.45rem,2.3vw,2rem); }
.viva-lead, .viva-meta { color: #526170; }
.viva-stem, .instruction-box {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin: 13px 0;
}
.viva-section, .viva-questions > .viva-card {
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.viva-section:first-of-type { border-top: 0; }
.viva-section h3, .q-title { color: var(--primary); margin: 0 0 12px; font-size: 1.05rem; }
.viva-columns { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(190px,.65fr); gap: 17px; }
.viva-col-passing, .q-pass-criteria { background: #f7f8f9; border: 1px solid var(--line); border-radius: 9px; padding: 13px; font-size: .88rem; align-self: start; }
.viva-card ul, .viva-container ul, .viva-card ol { padding-left: 22px; }
.viva-card li, .viva-container li { margin-bottom: 5px; }
.q-number { display: inline-block; color: var(--accent); text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .07em; margin-bottom: 4px; }

.fellowship-content { display: grid; gap: 15px; }
.question-block, .answer-block { font-size: .96rem; }
.stem { margin: 0 0 12px; }
.vitals-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin: 14px 0; }
.vitals-grid span { text-align: center; background: #f3f6f8; border: 1px solid var(--line); border-radius: 7px; padding: 8px; font-size: .84rem; }
.clinical-prop { margin: 20px 0; text-align: center; }
.clinical-prop img { max-height: 600px; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-soft); }
.clinical-prop figcaption { color: var(--muted); font-size: .78rem; margin-top: 6px; }
.saq-parts { padding-left: 24px; }
.saq-parts li { margin: 13px 0; padding-left: 4px; }
.marks { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.answer-block h3 { color: var(--primary); font-size: 1rem; margin: 19px 0 6px; }
.answer-block ul { margin-top: 6px; padding-left: 23px; }
.answer-block li { margin-bottom: 5px; }
.answer-reveal { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.answer-reveal > button { width: 100%; border: 0; background: var(--primary); color: white; font-weight: 760; padding: 12px; cursor: pointer; }
.answer-reveal .answer-body { padding: 20px; }
/* Answers revealed inline, directly beneath each sub-question's practice box */
.fellowship-inline-answer { margin: 12px 0 6px; padding: 2px 16px 12px; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 9px; background: #f6f9fb; }
.fellowship-inline-answer[hidden] { display: none; }
.fellowship-inline-answer .answer-block h3:first-child { margin-top: 12px; }
.fellowship-inline-answer .answer-block li { margin: 0 0 5px; padding-left: 0; }
.fellowship-inline-answer .answer-block > :last-child { margin-bottom: 0; }
.source-note { margin-top: 14px; color: var(--muted); font-size: .78rem; }
.clinical-note { margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: #fff6e5; border-left: 3px solid #b45309; font-size: .85rem; color: #6b4407; }
.clinical-note strong { color: #92400e; }
.pdf-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.pdf-frame { width: 100%; height: 740px; border: 1px solid var(--line); border-radius: 10px; background: #e9edf0; }
.pdf-note { border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); padding: 12px; color: var(--muted); font-size: .82rem; margin-bottom: 11px; }

.bookmark-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.bookmark-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: white; }
.bookmark-card h3 { margin: 2px 0 6px; font-size: 1rem; }
.bookmark-card h3 a { color: var(--primary); text-decoration: none; }
.bookmark-card p { margin: 0; color: var(--muted); font-size: .82rem; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state h2 { color: var(--primary); }
.loading-card { background: white; max-width: 520px; margin: 90px auto; padding: 35px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 4px solid #dbe3e9; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog-card { width: min(590px, calc(100% - 28px)); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.dialog-card::backdrop { background: rgba(14,24,32,.62); }
.dialog-card form { padding: 25px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.dialog-heading h2 { color: var(--primary); margin: 3px 0 8px; }
.icon-button { border: 0; width: 34px; height: 34px; background: var(--paper-2); color: var(--muted); border-radius: 50%; cursor: pointer; font-size: 1.4rem; }
.dialog-card label { display: block; font-weight: 700; font-size: .85rem; margin-top: 14px; color: #455462; }
.dialog-card input { display: block; width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 11px; margin-top: 5px; outline: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.wide-dialog { width: min(850px, calc(100% - 28px)); }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.comparison-grid section { border: 1px solid var(--line); border-radius: 11px; padding: 17px; }
.comparison-grid h3 { color: var(--primary); margin-top: 0; }
.check-list, .arrow-list { padding-left: 20px; }
.check-list li, .arrow-list li { margin-bottom: 8px; }

.site-footer {
  width: min(var(--content), calc(100% - 32px));
  margin: 0 auto 30px;
  color: #cbd3d8;
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: .78rem;
}
.site-footer strong { color: white; margin-right: 8px; }
.footer-note { text-align: right; }

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 500; display: grid; gap: 8px; }
.toast { max-width: 340px; background: #17283f; color: white; border-radius: 9px; padding: 11px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-size: .84rem; animation: toast-in .18s ease; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1000px) {
  .header-inner { gap: 12px; }
  .brand-copy small { display: none; }
  .main-nav a { padding-left: 8px; padding-right: 8px; font-size: .85rem; }
  .hero { grid-template-columns: 1fr; }
  .hero-panel { min-height: 250px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .study-sidebar { position: static; }
  .filters, .fellowship-filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .header-inner { min-height: 62px; padding: 0 14px; flex-wrap: wrap; }
  .brand-mark { width: 36px; height: 36px; border-radius: 9px; }
  .brand-copy strong { font-size: .9rem; }
  .mobile-menu { display: inline-flex; border: 1px solid var(--line); background: white; border-radius: 7px; color: var(--primary); padding: 7px 9px; font-weight: 700; }
  .main-nav { order: 4; display: none; width: 100%; flex-direction: column; border-top: 1px solid var(--line); padding: 5px 0 10px; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 9px; }
  .main-nav a.active::after { display: none; }
  .account-button { margin-left: auto; }
  .app-shell { width: min(100% - 20px, var(--content)); margin-top: 18px; }
  .hero { padding: 23px; gap: 10px; }
  .hero-copy { padding: 5px 0; }
  .hero-copy h1 { font-size: 2.25rem; }
  .section-grid, .bookmark-list { grid-template-columns: 1fr; }
  .page-header, .page-pad { padding-left: 18px; padding-right: 18px; }
  .page-header-row { align-items: start; flex-direction: column; }
  .filters, .fellowship-filters { padding: 14px 18px; grid-template-columns: 1fr; }
  .filters > :first-child { grid-column: auto; }
  .category-tabs { padding: 13px 18px 0; }
  .result-summary, .result-list, .pagination, .list-top-controls { padding-left: 18px; padding-right: 18px; }
  .list-top-controls { align-items: flex-start; flex-wrap: wrap; }
  .list-top-controls .pagination { margin-left: 0; }
  .result-card { grid-template-columns: 1fr; gap: 8px; }
  .result-side { min-width: 0; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .detail-grid { padding: 18px; }
  .viva-columns { grid-template-columns: 1fr; }
  .vitals-grid { grid-template-columns: repeat(2,1fr); }
  .pdf-frame { height: 580px; }
  .comparison-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
  .footer-note { text-align: left; }
}

@media (max-width: 480px) {
  .list-top-controls { flex-direction: column; align-items: stretch; }
  .list-top-controls .pagination { width: 100%; justify-content: space-between; }
  .page-size-control { justify-content: space-between; }

  .brand-copy { display: none; }
  .hero-copy h1 { font-size: 1.9rem; }
  .kpi-grid, .quick-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}


/* Exam-specific dashboard and question controls */
.dashboard-stack { display: grid; gap: 22px; }
.dashboard-exam-block { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); gap: 18px; align-items: stretch; }
.exam-progress-panel, .quick-practice-panel { height: 100%; }
.exam-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.exam-panel-heading h2 { margin: 2px 0 0; }
.usage-badge { flex: 0 0 auto; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.exam-quick-grid { grid-template-columns: 1fr; }
.quick-link { display: block; text-decoration: none; }
.preference-toggle { display: flex; align-items: start; gap: 11px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; cursor: pointer; }
.preference-toggle input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); }
.preference-toggle span { display: grid; gap: 2px; }
.preference-toggle strong { color: var(--primary); font-size: .88rem; }
.preference-toggle small { color: var(--muted); font-size: .78rem; }
.recent-panel { margin-top: 2px; }

.question-page-header { padding-bottom: 14px; }
.detail-nav-top { border-top: 0; padding: 0; margin: 12px 0 0; }
.detail-nav-top .button { max-width: none; padding: 5px 9px; font-size: .76rem; min-height: 0; line-height: 1.1; }
.detail-nav-bottom { margin-top: 20px; }
.detail-nav-bottom .button { max-width: 48%; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.detail-nav-bottom .button:last-child { align-items: flex-end; text-align: right; }
/* v3.36.4: bottom navigation left group was introduced for Back to search.
   Constrain the group against the full nav row, not each button against the nested wrapper. */
.detail-nav-bottom > div:first-child {
  flex: 1 1 0;
  min-width: 0;
  max-width: 48%;
}
.detail-nav-bottom > div:first-child .button {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.detail-nav-bottom > div:first-child .nav-question-title {
  display: block;
  width: 100%;
  max-width: 100%;
}

.nav-question-title { font-size: .72rem; font-weight: 520; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.viva-answer-reveal { margin-top: 22px; }
#viva-content.answers-hidden .viva-col-passing,
#viva-content.answers-hidden .q-body,
#viva-content.answers-hidden .q-pass-criteria,
#viva-content.answers-hidden .viva-col-answers p,
#viva-content.answers-hidden .viva-col-answers ul,
#viva-content.answers-hidden .viva-col-answers ol,
#viva-content.answers-hidden .viva-col-answers table,
#viva-content.answers-hidden .viva-col-answers img,
#viva-content.answers-hidden .viva-col-answers .instruction-box,
#viva-content.answers-hidden .viva-col-answers blockquote { display: none !important; }
#viva-content.answers-hidden .viva-col-answers { background: transparent; }
#viva-content.answers-hidden .viva-col-answers h4 { color: var(--muted); opacity: .55; }

.exam-interest-fieldset { margin: 18px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.exam-interest-fieldset legend { padding: 0 6px; color: var(--primary); font-weight: 780; }
.field-help { margin: 0 0 12px; font-size: .82rem; }
.exam-interest-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.exam-interest-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); cursor: pointer; }
.exam-interest-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.exam-interest-option input { flex: 0 0 auto; margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); }
.exam-interest-option span { display: grid; gap: 2px; }
.exam-interest-option strong { color: var(--primary); font-size: .88rem; }
.exam-interest-option small { color: var(--muted); font-size: .77rem; line-height: 1.35; }
.form-error { margin: 10px 0 0; color: var(--danger); font-size: .82rem; font-weight: 700; }
.exam-interest-panel { padding: 20px; }
.exam-interest-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.exam-interest-heading h2 { margin: 2px 0 0; }
.exam-interest-heading p { margin: 0; color: var(--muted); max-width: 520px; font-size: .84rem; }
.dashboard-interest-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
.empty-dashboard-panel { padding: 22px; }
.empty-dashboard-panel h2 { margin-top: 0; color: var(--primary); }

.source-image-link { appearance: none; border: 0; padding: 0; background: transparent; color: var(--accent); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; text-align: left; }
.exam-zoomable-image { cursor: zoom-in; transition: outline-color .15s ease, box-shadow .15s ease; }
.exam-zoomable-image:hover, .exam-zoomable-image:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.image-lightbox { width: min(1180px, calc(100% - 20px)); height: min(900px, calc(100vh - 20px)); max-width: none; max-height: none; border: 0; border-radius: 14px; padding: 0; overflow: hidden; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.image-lightbox[open] { display: flex; flex-direction: column; }
.image-lightbox::backdrop { background: rgba(8,15,22,.86); }
.lightbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: white; }
.lightbox-heading { min-width: 0; }
.lightbox-toolbar h2 { color: var(--primary); margin: 2px 0 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 580px; }
.lightbox-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; flex: 0 1 auto; }
.lightbox-controls .button { min-width: 38px; padding: 7px 10px; }
.lightbox-rotate-button { font-size: 1.05rem; line-height: 1; }
.lightbox-zoom-level { width: 52px; text-align: center; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.lightbox-stage { flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; background: #e9edf0; padding: 16px; text-align: center; touch-action: none; user-select: none; }
.lightbox-stage.is-pannable { cursor: grab; }
.lightbox-stage.is-dragging { cursor: grabbing; }
.lightbox-stage img { flex: 0 0 auto; max-width: none; max-height: none; object-fit: contain; background: white; box-shadow: var(--shadow-soft); transform-origin: center center; will-change: transform; user-select: none; -webkit-user-drag: none; }

@media (max-width: 900px) {
  .dashboard-exam-block { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .exam-panel-heading { flex-direction: column; }
  .exam-interest-options, .dashboard-interest-options { grid-template-columns: 1fr; }
  .exam-interest-heading { align-items: start; flex-direction: column; gap: 6px; }
  .detail-nav .button { max-width: 49%; }
  .nav-question-title { display: none; }
  .lightbox-toolbar { align-items: flex-start; gap: 8px; padding: 10px; }
  .lightbox-heading .eyebrow { display: none; }
  .lightbox-toolbar h2 { max-width: 42vw; font-size: .9rem; }
  .lightbox-controls { gap: 4px; }
  .lightbox-controls .button { min-width: 34px; padding: 6px 8px; }
  .lightbox-zoom-level { width: 44px; font-size: .72rem; }
  .lightbox-stage { padding: 8px; }
}

/* Production account/branding additions */
.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: white;
}
.production-hero { overflow: hidden; }
.hero-brand-panel { position: relative; min-height: 410px; padding-top: 18px; }
.hero-logo {
  width: min(100%, 310px);
  max-height: 300px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.16));
}
.hero-progress-summary { margin-top: auto; }
.service-note {
  border-left: 4px solid var(--warning);
  background: var(--warning-soft);
  padding: 10px 12px;
  border-radius: 7px;
  color: #6d4b18;
  max-width: 760px;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 18px; }
.auth-tab {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--primary);
  border-radius: 8px;
  min-height: 40px;
  font-weight: 750;
  cursor: pointer;
}
.auth-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.auth-form { display: grid; gap: 14px; }
.auth-form label, .compact-form label, .dialog-card > form > label {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-weight: 680;
  font-size: .9rem;
}
.auth-form input, .compact-form input, .dialog-card input[type="email"], .dialog-card input[type="password"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}
.auth-form label small, .compact-form label small { color: var(--muted); font-weight: 500; }
.form-error { margin: 0; color: var(--danger); background: var(--danger-soft); border-radius: 7px; padding: 8px 10px; font-size: .84rem; }
.form-success { margin: 0; color: var(--success); background: var(--success-soft); border-radius: 7px; padding: 8px 10px; font-size: .84rem; }
.split-actions { justify-content: space-between; }
.account-email-line { margin: 0 0 18px; padding: 10px 12px; border-radius: 8px; background: var(--paper-2); }
.account-section { padding: 18px 0; border-top: 1px solid var(--line); }
.account-section h3 { margin: 0 0 7px; color: var(--primary); }
.account-section:first-of-type { border-top: 0; padding-top: 0; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.compact-form .form-error { grid-column: 1 / -1; }
.danger-zone { margin-top: 4px; }
.prose-page { max-width: 850px; }
.prose-page h2 { color: var(--primary); margin-top: 26px; }
.narrow-page { max-width: 680px; margin: 0 auto; }
.reset-form { max-width: 500px; }
.inline-source-fallback {
  border: 1px dashed var(--line-strong);
  background: var(--paper-2);
  padding: 12px;
  border-radius: 8px;
  margin: 10px 0;
}
.inline-source-fallback p { margin: 0 0 8px; color: var(--muted); }
.site-footer a { color: #dbe8f0; }

@media (max-width: 760px) {
  .hero-brand-panel { min-height: auto; }
  .hero-logo { max-height: 230px; }
  .compact-form { grid-template-columns: 1fr; }
  .compact-form .form-error { grid-column: auto; }
  .brand-copy small { display: none; }
}
#auth-dialog > .dialog-heading { padding: 24px 25px 0; }
#auth-dialog > .auth-tabs { margin: 18px 25px 0; }
#auth-dialog > .auth-form { padding-top: 18px; }
#account-dialog { padding: 25px; }
#account-dialog > .dialog-heading { margin-bottom: 10px; }
#account-dialog > .dialog-actions { margin-bottom: 0; }
#viva-content.answers-hidden .viva-col-answers p.viva-question-prompt { display: block !important; color: var(--ink); }


/* v3.2 authentication feedback */
button:disabled, .button:disabled {
  opacity: .62;
  cursor: wait;
}
button[aria-busy="true"] {
  min-width: 7.5rem;
}

.staging-build{margin-left:12px;font-size:.72rem;opacity:.55;white-space:nowrap}


/* Fellowship automated PDF-to-HTML conversion */
.auto-converted-source .source-page { margin:0; padding-bottom:0; border-bottom:0; }
.auto-converted-source .source-block { margin:0 0 10px; line-height:1.55; white-space:normal; }
.auto-converted-source h3 { color:var(--primary); margin:4px 0 12px; }


/* v3.8 Viva spoken-practice recorder */
.viva-practice-recorder {
  margin: 24px 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
}
.viva-recorder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.viva-recorder-heading h3 {
  margin: 3px 0 0;
  color: var(--primary);
  font-size: 1.08rem;
}
.viva-recorder-clock {
  min-width: 112px;
  text-align: right;
}
.viva-recorder-clock strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--ink);
}
.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--danger);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.recording-indicator[hidden] { display: none !important; }
.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  animation: recorder-pulse 1.25s ease-in-out infinite;
}
@keyframes recorder-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .28; }
}
.viva-recorder-help {
  margin: 12px 0 14px;
  color: var(--muted);
  line-height: 1.5;
}
.viva-recorder-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.viva-recorder-controls button:disabled {
  cursor: not-allowed;
}
.viva-recorder-status {
  min-height: 1.35em;
  margin: 11px 0 8px;
  font-size: .86rem;
  color: var(--muted);
}
.viva-recorder-status[data-state="recording"] {
  color: var(--danger);
  font-weight: 700;
}
.viva-recorder-status[data-state="paused"],
.viva-recorder-status[data-state="processing"],
.viva-recorder-status[data-state="waiting"] {
  color: var(--primary);
  font-weight: 650;
}
.viva-recorder-status[data-state="error"] {
  color: var(--danger);
  font-weight: 650;
}
.viva-recorder-status[data-state="ready"] {
  color: var(--success);
  font-weight: 650;
}
.viva-recorder-playback {
  width: 100%;
  max-width: 620px;
  margin: 3px 0 8px;
}
.viva-recorder-playback[hidden] { display: none !important; }
.viva-recorder-privacy {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}
.viva-recorder-unavailable {
  margin: 12px 0;
  color: var(--muted);
}

@media (max-width: 600px) {
  .viva-practice-recorder { padding: 15px; }
  .viva-recorder-heading { align-items: center; }
  .viva-recorder-clock { min-width: 90px; }
  .viva-recorder-clock strong { font-size: 1.35rem; }
  .viva-recorder-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .viva-recorder-controls .button {
    width: 100%;
    justify-content: center;
  }
}

/* Viva recorder playback controls — build 3.10.0 */
.viva-playback-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 760px;
  margin: 7px 0 10px;
}
.viva-playback-button {
  min-width: 116px;
  justify-content: center;
}
.viva-recorder-scrubber {
  width: 100%;
  min-width: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.viva-recorder-scrubber:disabled {
  cursor: not-allowed;
  opacity: .48;
}
.viva-recorder-playback-time {
  min-width: 92px;
  text-align: right;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#viva-recorder-fallback-audio[hidden] { display: none !important; }

@media (max-width: 600px) {
  .viva-playback-row {
    grid-template-columns: auto 1fr;
    gap: 8px 10px;
  }
  .viva-recorder-playback-time {
    grid-column: 2;
    text-align: right;
  }
}


/* v3.10 responsive Viva recorder placement */
#viva-recorder-desktop-anchor:empty,
#viva-recorder-inline-anchor:empty { display: none; }

@media (min-width: 1001px) {
  .study-sidebar #viva-recorder-desktop-anchor { display: block; }
  .study-sidebar .viva-practice-recorder {
    margin: 0;
    padding: 17px;
  }
  .study-sidebar .viva-recorder-heading {
    display: grid;
    gap: 10px;
  }
  .study-sidebar .viva-recorder-clock {
    min-width: 0;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .study-sidebar .viva-recorder-clock strong {
    font-size: 1.35rem;
  }
  .study-sidebar .viva-recorder-help {
    font-size: .82rem;
  }
  .study-sidebar .viva-recorder-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .study-sidebar .viva-recorder-controls .button {
    width: 100%;
    justify-content: center;
  }
  .study-sidebar .viva-playback-row {
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: none;
  }
  .study-sidebar .viva-playback-button {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
  .study-sidebar .viva-recorder-playback-time {
    min-width: 0;
    text-align: right;
  }
}


/* Fellowship active-practice answer boxes (build 3.11.0) */
.fellowship-practice-response {
  margin: 10px 0 18px;
  padding: 11px 12px 12px;
  border: 1px solid #cbd5da;
  border-radius: 9px;
  background: #f8fafb;
}
.saq-parts > li > .fellowship-practice-response { margin-left: -4px; }
.fellowship-practice-response label {
  display: block;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 780;
}
.fellowship-practice-response label > span {
  color: var(--muted);
  font-weight: 650;
}
.fellowship-practice-response textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  margin-top: 7px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid #b9c5ca;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: .94rem;
  line-height: 1.45;
}
.fellowship-practice-response textarea:focus {
  outline: 3px solid rgba(38, 115, 137, .15);
  border-color: var(--primary);
}
.fellowship-practice-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
}
.fellowship-practice-controls strong { color: var(--primary); }
.fellowship-practice-controls p {
  margin: 3px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
}
.fellowship-practice-controls .button { flex: 0 0 auto; }

@media (max-width: 700px) {
  .fellowship-practice-response { padding: 10px; }
  .fellowship-practice-response textarea { min-height: 108px; }
  .fellowship-practice-controls { align-items: stretch; flex-direction: column; gap: 11px; }
  .fellowship-practice-controls .button { width: 100%; }
}

.fellowship-source-answer-placeholder { display: none; }


/* Fellowship structured table practice responses (build 3.29.0) */
.fellowship-pdf-header-artifact,
.fellowship-source-table-flattened { display: none !important; }

/* Fellowship clinical-data readability (build 3.41.0) */
.fellowship-vital-list,
.fellowship-vital-line,
.fellowship-vital-context { display: block; }
.fellowship-vital-list { margin: .45rem 0; }
.fellowship-vital-line { line-height: 1.55; }
.fellowship-vital-context { margin-top: .35rem; }
.fellowship-laboratory-prop img {
  width: auto;
  max-width: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #fff;
}

.fellowship-practice-table-response {
  padding: 12px;
  overflow: hidden;
}
.fellowship-practice-table-label {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 780;
}
.fellowship-practice-table-label > span {
  color: var(--muted);
  font-weight: 650;
}
.fellowship-practice-table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid #b9c5ca;
  border-radius: 8px;
  background: #fff;
}
.fellowship-practice-table {
  width: 100%;
  min-width: var(--practice-table-min-width, 640px);
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.fellowship-practice-table th,
.fellowship-practice-table td {
  border: 1px solid #c5cfd4;
  padding: 8px;
  vertical-align: top;
  white-space: pre-line;
}
.fellowship-practice-table th {
  background: #eef3f5;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 720;
  text-align: left;
}
.fellowship-practice-table-static {
  background: #f8fafb;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 600;
}
.fellowship-practice-table-editable {
  padding: 6px !important;
  background: #fff;
}
.fellowship-practice-cell-prompt {
  margin: 1px 3px 4px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 720;
  white-space: pre-line;
}
.fellowship-practice-table td textarea {
  display: block;
  width: 100%;
  min-height: max(54px, calc(var(--practice-row-height, 72px) - 18px));
  margin: 0;
  padding: 8px 9px;
  resize: vertical;
  border: 1px solid #c4cfd4;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  line-height: 1.4;
}
.fellowship-practice-cell-prompt + textarea {
  min-height: max(44px, calc(var(--practice-row-height, 72px) - 42px));
}
.fellowship-practice-table td textarea:focus {
  outline: 3px solid rgba(38, 115, 137, .14);
  border-color: var(--primary);
}

@media (max-width: 700px) {
  .fellowship-practice-table-response { padding: 9px; }
  .fellowship-practice-table { min-width: var(--practice-table-min-width, 620px); }
  .fellowship-practice-table th,
  .fellowship-practice-table td { padding: 7px; }
}

/* Fellowship answer tables — plain content tables reproducing a tabular model
   answer from the source PDF verbatim (build 3.36.5). */
.answer-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 10px 0 16px;
}
.answer-table th,
.answer-table td {
  border: 1px solid #c5cfd4;
  padding: 8px;
  vertical-align: top;
  text-align: left;
  font-size: .9rem;
  line-height: 1.45;
}
.answer-table thead th,
.answer-table th[scope="row"] {
  background: #eef3f5;
  font-weight: 720;
}

/* Reference tables in the question stem (lab panels, blood gases) get the same
   ruled cells as answer tables, so each value lines up with its test. Any
   content table saved without a class gets the same style as a safety net
   (build 3.101.0). */
.reference-table,
.fellowship-content table:not([class]) {
  border-collapse: collapse;
  background: #fff;
  margin: 10px 0 16px;
}
.reference-table { width: auto; min-width: min(100%, 340px); }
.fellowship-content table:not([class]) { width: 100%; }
.reference-table th,
.reference-table td,
.fellowship-content table:not([class]) th,
.fellowship-content table:not([class]) td {
  border: 1px solid #c5cfd4;
  padding: 6px 12px;
  vertical-align: top;
  text-align: left;
  font-size: .9rem;
  line-height: 1.45;
}
.reference-table thead th,
.reference-table th[scope="row"],
.fellowship-content table:not([class]) thead th {
  background: #eef3f5;
  font-weight: 720;
}


/* Fellowship props: keep visual material beside the prompt when the source
   gives us an unambiguous mapping; otherwise show a clear bottom-of-page cue. */
.fellowship-inline-props {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 14px 0 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft, #f7f9fa);
}
.fellowship-inline-prop { min-width: 0; }
.fellowship-inline-prop-label {
  margin-bottom: 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: .9rem;
}
.fellowship-inline-props .clinical-prop { margin: 0; }
.fellowship-inline-props .clinical-prop img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
}
.fellowship-prop-notice {
  margin: 10px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft, #f7f9fa);
  color: var(--primary);
  font-weight: 700;
}
@media (max-width: 700px) {
  .fellowship-inline-props { grid-template-columns: 1fr; padding: 10px; }
}

/* Build 3.35.1: robust mobile tables, image controls and touch viewer */
@media (max-width: 760px) {
  .image-lightbox {
    box-sizing: border-box;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .image-lightbox[open] { inset: 0; }
  .lightbox-toolbar {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: calc(7px + env(safe-area-inset-top)) 8px 7px;
  }
  .lightbox-heading { width: 100%; text-align: center; }
  .lightbox-toolbar h2 { max-width: 100%; margin: 0; font-size: .82rem; white-space: nowrap; }
  .lightbox-controls {
    display: flex !important;
    width: 100%; max-width: 100%;
    align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 4px;
    visibility: visible !important;
  }
  .lightbox-controls .button,
  .lightbox-controls .icon-button,
  .lightbox-zoom-level {
    display: inline-flex !important;
    visibility: visible !important;
    flex: 0 0 auto;
  }
  .lightbox-controls .button { min-width: 34px; min-height: 34px; padding: 5px 8px; }
  .lightbox-controls .icon-button { width: 34px; height: 34px; }
  .lightbox-zoom-level { width: 44px; align-items: center; justify-content: center; font-size: .72rem; }
  .lightbox-stage {
    min-width: 0; min-height: 0; padding: 4px;
    touch-action: none !important;
    overscroll-behavior: contain;
  }
}

@media (max-width: 700px) {
  .fellowship-content,
  .fellowship-content .source-page,
  .fellowship-content .question-block,
  .fellowship-content .answer-block,
  .fellowship-practice-table-response,
  .fellowship-practice-table-scroll {
    box-sizing: border-box;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .fellowship-practice-table-response { padding: 6px; overflow: hidden; }
  .fellowship-practice-table-scroll { overflow-x: hidden !important; border-radius: 6px; }
  .fellowship-practice-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }
  .fellowship-practice-table col { width: auto !important; min-width: 0 !important; }
  .fellowship-practice-table th,
  .fellowship-practice-table td {
    box-sizing: border-box;
    min-width: 0 !important;
    max-width: none !important;
    padding: 3px !important;
    overflow: hidden;
    overflow-wrap: anywhere !important;
    word-break: break-word;
    white-space: normal !important;
    font-size: .68rem;
    line-height: 1.15;
  }
  .fellowship-practice-cell-prompt {
    margin: 1px 1px 3px;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: .64rem;
    line-height: 1.12;
  }
  .fellowship-practice-table td textarea {
    box-sizing: border-box;
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 56px;
    margin: 0;
    padding: 4px;
    font-size: 16px;
    line-height: 1.18;
  }
  .fellowship-content table:not(.fellowship-practice-table) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }
  .fellowship-content table:not(.fellowship-practice-table) col { width: auto !important; }
  .fellowship-content table:not(.fellowship-practice-table) th,
  .fellowship-content table:not(.fellowship-practice-table) td {
    min-width: 0 !important;
    max-width: none !important;
    padding: 3px !important;
    overflow-wrap: anywhere !important;
    word-break: break-word;
    white-space: normal !important;
    font-size: .68rem;
    line-height: 1.15;
  }
}

@media (max-width: 380px) {
  .lightbox-controls { gap: 3px; }
  .lightbox-controls .button { min-width: 31px; padding: 4px 6px; }
  .lightbox-controls .icon-button { width: 31px; height: 31px; }
  .lightbox-zoom-level { width: 38px; }
  .fellowship-practice-table th,
  .fellowship-practice-table td,
  .fellowship-content table:not(.fellowship-practice-table) th,
  .fellowship-content table:not(.fellowship-practice-table) td {
    padding: 2px !important;
    font-size: .64rem;
  }
}
.fellowship-layout-anchor{display:none}

/* v3.97.0: Back to search + Random question always sit under the Fellowship title.
   Keep Next at its natural height when the left group wraps on phones. */
.detail-nav-top { align-items: flex-start; }
.detail-nav-top > a:last-child { flex: 0 0 auto; white-space: nowrap; }

/* v3.101.0: lab/reference tables are narrow (Test | Result | Range), so on
   phones keep them at a readable size instead of the shrink-to-fit size used
   for wide tables above. */
@media (max-width: 700px) {
  .fellowship-content table.reference-table th,
  .fellowship-content table.reference-table td {
    padding: 5px 8px !important;
    font-size: .85rem;
    line-height: 1.3;
  }
}

/* ---------- Home page (3.104.0) ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 32px;
  align-items: center;
  padding: 40px 44px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.home-hero-copy h1 { margin: 6px 0 10px; color: var(--primary); font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1.1; letter-spacing: -.025em; max-width: 820px; }
.home-hero-copy .lead { color: #4b5967; font-size: 1.07rem; margin: 0; max-width: 720px; }
.home-hero-art { width: 100%; max-height: 260px; object-fit: contain; filter: drop-shadow(0 10px 20px rgba(29,53,87,.18)); }

.home-search { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper-2); max-width: 820px; }
.home-search input[type="search"] { flex: 1 1 260px; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1rem; padding: 10px 10px; color: var(--ink); outline: none; }
.home-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.home-search-scope { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.home-search-scope label { cursor: pointer; }
.home-search-scope input { position: absolute; opacity: 0; pointer-events: none; }
.home-search-scope span { display: block; padding: 6px 10px; border-radius: 7px; font-size: .82rem; font-weight: 720; color: var(--muted); }
.home-search-scope input:checked + span { background: var(--primary); color: #fff; }
.home-search-scope input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.home-continue { display: grid; gap: 3px; margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line-strong); border-left: 5px solid var(--accent); border-radius: 10px; text-decoration: none; color: var(--ink); max-width: 820px; background: #fff; transition: border-color .15s ease, transform .15s ease; }
.home-continue:hover { border-color: var(--accent); transform: translateY(-1px); }
.home-continue-label { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.home-continue strong { color: var(--primary); font-size: 1.08rem; }
.home-continue-meta { color: var(--muted); font-size: .86rem; }

/* v3.120.0: "Save as an app" box at the bottom of the home page */
.home-install { margin-top: 22px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px 20px; padding: 20px 24px; background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.home-install-icon { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 4px 12px rgba(29,53,87,.18); }
.home-install-copy h2 { margin: 0 0 4px; color: var(--primary); font-size: 1.2rem; }
.home-install-copy p { margin: 0; color: var(--muted); }
.home-install-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.install-dialog > .dialog-heading { padding: 24px 25px 0; }
.install-dialog-body { padding: 0 25px 22px; }
.install-dialog-body > p { margin: 0 0 10px; }
.install-steps { margin: 0 0 14px; padding-left: 1.3em; display: grid; gap: 10px; }
.install-steps li { padding-left: 4px; line-height: 1.5; }
.install-glyph { display: inline-flex; vertical-align: -3px; color: var(--accent); }
@media (max-width: 640px) {
  .home-install { grid-template-columns: auto 1fr; padding: 18px; }
  .home-install-actions { grid-column: 1 / -1; justify-content: stretch; }
  .home-install-actions .button.primary { flex: 1; }
}
.home-exams { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.home-exam-tile { display: flex; flex-direction: column; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 26px; }
.home-exam-tile h2 { margin: 4px 0 8px; color: var(--primary); font-size: 1.6rem; }
.home-exam-tile > p { color: var(--muted); margin: 0 0 16px; }
.home-tile-progress { margin-bottom: 16px; }
.home-tile-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.home-chip { appearance: none; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .82rem; cursor: pointer; }
.home-chip strong { color: var(--primary); }
.home-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.home-tile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }

.home-account-strip { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 22px; border-radius: var(--radius); background: linear-gradient(145deg, var(--primary), #294c72); color: #fff; }
.home-account-strip p { margin: 0; max-width: 760px; }
.home-account-strip div { display: flex; gap: 8px; }
.home-account-strip .button.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.home-account-strip .button.secondary:hover { background: rgba(255,255,255,.1); }
.home-account-strip .button.primary { background: #fff; color: var(--primary); }

.home-how { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.home-how-step { display: flex; gap: 14px; align-items: flex-start; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 20px; }
.home-how-num { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--primary); font-weight: 800; }
.home-how-step h3 { margin: 2px 0 4px; color: var(--primary); font-size: 1rem; }
.home-how-step p { margin: 0; color: var(--muted); font-size: .9rem; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; padding: 26px; }
  .home-hero-art { display: none; }
  .home-exams, .home-how { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .home-hero { padding: 22px 18px; }
  .home-hero-copy h1 { font-size: 1.85rem; }
  .home-search { padding: 6px; }
  .home-search input[type="search"] { flex-basis: 100%; }
  .home-search-scope { flex: 1 1 auto; }
  .home-search-scope label { flex: 1; text-align: center; }
  .home-search .button { flex: 0 0 auto; }
  .home-exam-tile { padding: 20px; }
  .home-tile-actions .button { flex: 1 1 100%; }
  .home-account-strip { padding: 16px 18px; }
}

/* ---- Dashboard (3.105.0) ---------------------------------------------- */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); align-items: end; gap: 22px 32px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 30px 34px; }
.dash-hero:has(> :only-child) { grid-template-columns: 1fr; }
.dash-hero h1 { margin: 4px 0 8px; color: var(--primary); font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -.025em; }
.dash-hero .lead { margin: 0; color: #4b5967; font-size: 1.02rem; max-width: 700px; }
.dash-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.dash-continue { margin-top: 0; }

.dash-exam { margin-top: 18px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 26px 30px; border: 0; }
.dash-exam-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 18px; }
.dash-exam-head h2 { margin: 2px 0 0; color: var(--primary); font-size: 1.55rem; }
.dash-exam-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.dash-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 12px; }
.dash-stat { appearance: none; font: inherit; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); color: var(--ink); }
button.dash-stat { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
button.dash-stat:hover { border-color: var(--accent); background: var(--accent-soft); }
.dash-stat-label { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dash-stat-value { font-size: 2rem; font-weight: 820; line-height: 1.1; color: var(--primary); margin-top: 4px; }
.dash-stat-sub { font-size: .84rem; color: var(--muted); }
.dash-stat .progress-track { display: block; margin-top: 10px; }
.dash-stat .progress-fill { display: block; }
.dash-stat.is-alert .dash-stat-value { color: var(--danger); }
.dash-stat.is-alert .dash-stat-sub { color: var(--danger); font-weight: 650; }
.dash-ratings { background: #fff; }
.dash-rating-bar { display: flex; gap: 2px; height: 14px; margin: 12px 0 10px; border-radius: 999px; overflow: hidden; background: #e6ecf0; }
.dash-rating-seg { flex-basis: 0; min-width: 6px; }
.dash-rating-seg.confident, .dash-rating-legend i.confident { background: var(--success); }
.dash-rating-seg.ok, .dash-rating-legend i.ok { background: #d8a03f; }
.dash-rating-seg.needs-work, .dash-rating-legend i.needs-work { background: var(--danger); }
.dash-rating-seg.unrated, .dash-rating-legend i.unrated { background: #9aa8b4; }
.dash-rating-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.dash-rating-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dash-rating-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dash-rating-legend strong { color: var(--ink); }
.dash-empty-note { margin: 10px 0 0; font-size: .88rem; }

.dash-groups-wrap { margin-top: 22px; }
.dash-groups-wrap h3 { margin: 0 0 10px; color: var(--primary); font-size: 1rem; }
.dash-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 12px; }
.dash-group { appearance: none; font: inherit; text-align: left; display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.dash-group:hover { border-color: var(--accent); background: var(--accent-soft); }
.dash-group-top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.dash-group-top span { color: var(--muted); white-space: nowrap; }
.dash-group .progress-track { display: block; height: 6px; }
.dash-group .progress-fill { display: block; }
.dash-group-flag { font-size: .76rem; font-weight: 750; color: var(--danger); }
/* v3.117.0: Primary Viva detailed tracking */
.dash-groups-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.dash-groups-wrap .dash-groups-head h3 { margin: 0; }
.dash-groups-wrap { container-type: inline-size; }
.dash-detailed-tracking { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
/* v3.118.0: column wrappers are invisible on narrow screens (cards flow in order)... */
.dash-track-col { display: contents; }
/* ...and become real stacked columns when there is room for three. */
@container (min-width: 980px) {
  .dash-detailed-tracking { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-track-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
}
.dash-detailed-tracking[hidden], .dash-groups[hidden] { display: none; }
.dash-domain { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.dash-domain-head, .dash-subject-row { appearance: none; font: inherit; color: var(--ink); background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; display: grid; grid-template-columns: minmax(0, 9.5rem) 1fr auto; align-items: center; gap: 10px; }
.dash-domain-head { padding: 10px 12px; background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.dash-domain-head strong { color: var(--primary); }
.dash-subject-list { list-style: none; margin: 0; padding: 4px 0; }
.dash-subject-row { padding: 6px 12px; font-size: .86rem; }
.dash-domain-head:hover, .dash-subject-row:hover { background: var(--accent-soft); }
.dash-subject-row:hover .progress-track { background: #fff; }
.dash-subject-name { min-width: 0; overflow-wrap: anywhere; }
.dash-subject-name small { display: block; font-size: .72rem; }
.dash-domain .progress-track { display: block; height: 6px; }
.dash-domain .progress-fill { display: block; }
.dash-track-count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .84rem; min-width: 4.5em; text-align: right; }
.dash-domain-head .dash-track-count { color: var(--ink); font-weight: 700; }
@media (max-width: 760px) {
  .dash-detailed-tracking { grid-template-columns: 1fr; }
  .dash-domain-head, .dash-subject-row { grid-template-columns: minmax(0, 7.5rem) 1fr auto; }
}
.dash-more { margin-top: 10px; }
.dash-more summary { cursor: pointer; color: var(--accent); font-weight: 720; font-size: .9rem; padding: 6px 0; }
.dash-more .dash-groups { margin-top: 8px; }

.dash-lower { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.dash-lower .panel { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 24px 26px; }
.dash-recent-list { list-style: none; margin: 0; padding: 0; }
.dash-recent-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.dash-recent-item:first-child { border-top: 0; padding-top: 2px; }
.dash-recent-item a { display: grid; gap: 1px; min-width: 0; text-decoration: none; }
.dash-recent-item a strong { color: var(--primary); font-size: .95rem; }
.dash-recent-item a:hover strong { color: var(--accent); text-decoration: underline; }
.dash-recent-item a span { color: var(--muted); font-size: .8rem; }
.dash-recent-side { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dash-recent-side small { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.dash-settings h3 { margin: 16px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dash-settings h2 + h3 { margin-top: 0; }
.dash-settings .preference-toggle { border-top: 0; margin-top: 0; padding-top: 6px; padding-bottom: 6px; }
.dash-settings .exam-interest-option { align-items: center; }
.dash-settings .exam-interest-option input { margin-top: 0; }

@media (max-width: 1000px) {
  .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-ratings { grid-column: 1 / -1; }
  .dash-lower { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dash-hero { grid-template-columns: 1fr; padding: 24px 20px; }
  .dash-exam { padding: 22px 18px; }
  .dash-exam-actions { width: 100%; }
  .dash-exam-actions .button { flex: 1 1 auto; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-stats .dash-stat:first-child { grid-column: 1 / -1; }
  .dash-stat { padding: 14px; }
  .dash-stat-value { font-size: 1.65rem; }
  .dash-groups { grid-template-columns: 1fr; }
  .dash-lower .panel { padding: 20px 18px; }
  .dash-recent-item { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ---- Search pages (3.105.0) ------------------------------------------- */
.list-header .page-header-row { align-items: flex-start; }
.list-search { position: relative; margin-top: 20px; max-width: 820px; }
.list-search svg { position: absolute; left: 15px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.list-search input { width: 100%; min-height: 52px; padding: 12px 14px 12px 46px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); font-size: 1.02rem; outline: none; }
.list-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.category-tab span { margin-left: 4px; font-weight: 600; opacity: .65; font-size: .76rem; }
.list-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 16px 30px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.category-tabs + .list-filters { margin-top: 16px; border-top: 1px solid var(--line); }
.filter-field { display: grid; gap: 4px; min-width: 190px; flex: 0 1 250px; }
.filter-field span { font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.filter-field select { width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); padding: 8px 10px; outline: none; }
.filter-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }
.list-filters .check-control { min-height: 42px; padding: 0 4px; color: var(--ink); }
.list-filters .check-control input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.list-clear { min-height: 42px; color: var(--accent); }
.list-clear:hover { text-decoration: underline; }

.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 16px 30px 6px; }
.list-toolbar .result-summary { display: block; padding: 0; font-size: .92rem; color: var(--muted); }
.list-toolbar .result-summary strong { color: var(--primary); }
.list-toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.list-toolbar-right .pagination { padding: 0; }

.list-page .result-card { position: relative; padding: 15px 12px; margin: 0 -12px; border-radius: 10px; border-bottom: 1px solid var(--line); transition: background .12s ease; }
.list-page .result-card:hover { background: var(--paper-2); }
.list-page .result-title { font-size: 1.02rem; margin-bottom: 4px; }
.list-page .result-title::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.list-page .result-title:focus-visible { outline: none; }
.list-page .result-title:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.list-page .result-title:hover { text-decoration: none; }
.list-page .result-card:hover .result-title { color: var(--accent); }
.result-id { font-variant-numeric: tabular-nums; font-weight: 750; color: var(--primary); }
.result-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.subject-chip { font-size: .74rem; font-weight: 700; color: #3c5a74; background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; }
.list-page .result-side { min-width: 0; }
mark { background: #fde9a8; color: inherit; border-radius: 3px; padding: 0 1px; }

@media (max-width: 760px) {
  .list-search { margin-top: 16px; }
  .list-filters { padding: 14px 18px; display: grid; grid-template-columns: 1fr 1fr; }
  .filter-field { min-width: 0; }
  .list-filters .filter-field:only-of-type, .list-filters .filter-field:first-child:nth-last-child(1) { grid-column: 1 / -1; }
  .list-filters .check-control, .list-clear { grid-column: auto; justify-self: start; }
  .list-toolbar { padding: 14px 18px 4px; }
  .list-page .result-card { margin: 0 -8px; padding: 14px 8px; }
  .list-page .result-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 480px) {
  .list-header .page-header-row .button { width: 100%; }
  .list-toolbar-right { width: 100%; justify-content: space-between; }
}

/* The main area takes focus after each page change (for screen readers); no ring needed. */
#app:focus { outline: none; }

/* ---------------------------------------------------------------------------
   Question discussion / comments (3.106.0)
   --------------------------------------------------------------------------- */
.comments-section { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; scroll-margin-top: 110px; }
.comments-toggle { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 18px; background: var(--paper-2); border: 0; cursor: pointer; text-align: left; color: var(--primary); }
.comments-toggle:hover { background: var(--accent-soft); }
.comments-toggle:focus-visible { outline: 3px solid rgba(69,123,157,.35); outline-offset: -3px; }
.comments-toggle-icon { display: inline-flex; color: var(--accent); flex: none; }
.comments-toggle-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.comments-toggle-text strong { font-size: 1rem; }
.comments-toggle-hint { font-size: .76rem; color: var(--muted); font-weight: 500; }
.comments-toggle-count { margin-left: auto; font-size: .82rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.comments-chevron { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 2px; transition: transform .18s ease; flex: none; }
.comments-section.is-open .comments-chevron { transform: rotate(-135deg); margin-top: 4px; }
.comments-section.is-open .comments-toggle { border-bottom: 1px solid var(--line); }
.comments-panel { padding: 16px 18px 20px; }

.comments-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.comments-sort { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; background: var(--paper-2); }
.comments-sort button { border: 0; background: transparent; border-radius: 999px; padding: 5px 13px; font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.comments-sort button.active { background: var(--primary); color: #fff; }

.comments-login, .comments-banned { border: 1px dashed var(--line-strong); background: var(--paper-2); border-radius: 11px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.comments-login p, .comments-banned { margin: 0; font-size: .88rem; color: var(--muted); }
.comments-login div { display: flex; gap: 8px; }

.comment-form, .comment-edit-form, .comment-rename-form, .comment-report-form { display: grid; gap: 9px; }
.comment-form textarea, .comment-edit-form textarea { width: 100%; resize: vertical; min-height: 74px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .93rem; line-height: 1.5; color: var(--ink); background: #fff; }
.comment-form.is-reply textarea { min-height: 58px; }
.comment-form textarea:focus, .comment-edit-form textarea:focus, .comment-name-field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }
.comment-name-field { display: grid; gap: 4px; font-size: .84rem; font-weight: 700; color: var(--primary); }
.comment-name-field input { border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; font-weight: 500; max-width: 340px; }
.comment-name-field small { font-weight: 500; color: var(--muted); font-size: .76rem; }
.comment-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.comment-form-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment-form-footer > span:first-child { margin-right: auto; font-size: .78rem; color: var(--muted); }
.comment-char-count { font-size: .76rem; color: var(--warning); }
.comment-form .form-error, .comment-edit-form .form-error, .comment-rename-form .form-error, .comment-report-form .form-error { margin: 0; }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.comment-turnstile:empty { display: none; }

.comments-list { margin-top: 18px; display: grid; gap: 4px; }
.comments-none, .comments-empty p { color: var(--muted); font-size: .9rem; margin: 6px 0; }
.comments-empty { text-align: center; padding: 10px 0; }
.comments-loading { text-align: center; padding: 18px 0; color: var(--muted); font-size: .88rem; }
.comments-loading .spinner { width: 24px; height: 24px; border-width: 3px; margin-bottom: 8px; }

.comment { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.comments-list > .comment:first-child { border-top: 0; }
.comment.is-new { animation: comment-flash 1.6s ease; }
@keyframes comment-flash { from { background: var(--accent-soft); } to { background: transparent; } }
.comment.is-deleted { grid-template-columns: minmax(0,1fr); }
.comment-deleted-text { margin: 0; color: var(--muted); font-style: italic; font-size: .86rem; }
.comment.is-pending > .comment-main > .comment-body, .comment.is-hidden > .comment-main > .comment-body { opacity: .72; }

.comment-vote { display: flex; flex-direction: column; align-items: center; gap: 1px; padding-top: 1px; }
.vote-button { width: 30px; height: 24px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #9aa6b2; cursor: pointer; font-size: .78rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.vote-button:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line); }
.vote-button:disabled { cursor: default; opacity: .45; }
.vote-up.active { color: var(--success); background: var(--success-soft); border-color: #b9dcc9; }
.vote-down.active { color: var(--danger); background: var(--danger-soft); border-color: #e5bcbc; }
.vote-score { font-weight: 800; font-size: .86rem; color: var(--ink); min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }

.comment-main { min-width: 0; }
.comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: .8rem; color: var(--muted); }
.comment-author { color: var(--primary); font-size: .86rem; }
.comment-edited { font-style: italic; }
.comment-badge { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); color: var(--muted); }
.comment-badge.moderator { background: var(--accent-soft); border-color: #bcd6e5; color: var(--primary); }
.comment-badge.you { background: #eef1f4; }
.comment-badge.pending { background: var(--warning-soft); border-color: #ecd2a5; color: var(--warning); text-transform: none; letter-spacing: 0; }
.comment-badge.hidden-badge, .comment-badge.reported { background: var(--danger-soft); border-color: #e5bcbc; color: var(--danger); text-transform: none; letter-spacing: 0; }
.comment-body { font-size: .92rem; color: var(--ink); overflow-wrap: anywhere; }
.comment-body p { margin: 6px 0 0; }
.comment-body a { word-break: break-all; }
.comment-expand { margin-top: 6px; border: 1px dashed var(--line-strong); background: var(--paper-2); border-radius: 8px; padding: 6px 10px; font-size: .8rem; color: var(--muted); cursor: pointer; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 6px; }
.comment-actions button { border: 0; background: none; padding: 2px 0; font: inherit; font-size: .78rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.comment-actions button:hover { color: var(--accent); }
.comment-actions button.is-confirming { color: var(--danger); }
.comment-actions .danger-link:hover { color: var(--danger); }
.comment-mod-actions { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.comment-mod-actions button { color: var(--primary); }
.comment-reported-note { font-size: .78rem; color: var(--muted); font-style: italic; }
.comment-inline-slot:not(:empty) { margin-top: 8px; }
.comment-report-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 4px; font-size: .86rem; }
.comment-report-form legend { font-weight: 700; color: var(--primary); padding: 0 4px; }
.comment-report-form label { display: flex; gap: 8px; align-items: center; }

.comment-replies:not(:empty) { margin-top: 6px; padding-left: 14px; border-left: 2px solid var(--line); }
.comment-replies > .comment { padding: 10px 0 6px; }
.comment-replies > .comment:first-child { border-top: 0; }
.comment-reply-slot:not(:empty) { margin-top: 8px; padding-left: 16px; }

.moderation-queue { display: grid; gap: 14px; }
.moderation-item { border: 1px solid var(--line); border-radius: 11px; padding: 6px 16px 10px; background: var(--paper); }
.moderation-where { margin: 8px 0 0; font-size: .84rem; font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.moderation-reasons { font-weight: 600; color: var(--danger); }
.moderation-item .comment { border-top: 0; }
/* v3.118.0: All comments list on the moderation page */
.moderation-all { border-top: 1px solid var(--line); margin-top: 8px; }
.moderation-all h2 { margin: 0 0 4px; color: var(--primary); }
.moderation-all > .muted { margin: 0 0 14px; max-width: 70ch; }
.moderation-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.moderation-filter-label { font-weight: 700; font-size: .9rem; margin-right: 4px; }
.moderation-date { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 650; }
.moderation-date[hidden] { display: none; }
.moderation-date input { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }
.moderation-all-summary { margin: 0; font-weight: 650; }
.moderation-more { justify-self: start; }

@media (max-width: 600px) {
  .comments-toggle { padding: 13px 14px; gap: 10px; }
  .comments-toggle-hint { display: none; }
  .comments-panel { padding: 14px 12px 16px; }
  .comment { grid-template-columns: 30px minmax(0,1fr); gap: 8px; }
  .comment-replies:not(:empty) { padding-left: 10px; }
  .comment-reply-slot:not(:empty) { padding-left: 0; }
  .comments-login { flex-direction: column; align-items: stretch; }
  .comment-form-footer > span:first-child { flex-basis: 100%; }
  .comment-form-footer .button { flex: 1; }
}
@media print { .comments-section { display: none !important; } }
.comment-mod-actions.is-only { padding-left: 0; border-left: 0; }

/* Full-text search (3.107.0) */
.result-snippet { margin-top: 6px; font-size: .84rem; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-snippet mark { background: #fff1b8; color: var(--ink); border-radius: 3px; padding: 0 2px; }
.result-snippet-answer { font-style: italic; font-size: .8rem; }
.search-status { margin-left: 10px; font-size: .8rem; color: var(--muted); font-weight: 500; }
.search-status.is-loading::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid #dbe3e9; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }

/* Dashboard: clear saved answers (3.109.0) */
.dash-saved-summary, .dash-saved-none { font-size: .84rem; margin: 0 0 10px; }
.dash-clear-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.dash-clear-row select { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 9px; font-size: .84rem; background: #fff; color: var(--ink); }
.button.button.is-confirming, .button.button.is-confirming:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
#dash-clear-error { margin-top: 8px; }

/* ---------------------------------------------------------------------------
   v3.110.0 — re-converted Viva pages (.viva-v2)
   Question text, stem and genuine prompts are always visible. Everything in
   .viva-answer (expected answer, pass mark, examiner notes, references) is
   hidden until "Show answers".
   ------------------------------------------------------------------------ */
.viva-v2 { color: var(--ink); font-size: .98rem; line-height: 1.55; }
.viva-v2 > .viva-header { padding: 0 0 6px; border: 0; background: transparent; }
.viva-v2 .viva-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; }
.viva-v2 .viva-meta span { font-size: .76rem; font-weight: 700; color: var(--primary); background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.viva-v2 .viva-label { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.viva-v2 .viva-stem { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 9px 9px 0; padding: 12px 15px; margin: 0 0 16px; }
.viva-v2 .viva-stem p { margin: 0 0 6px; }
.viva-v2 .viva-stem > :last-child { margin-bottom: 0; }
.viva-v2 .viva-prop-wrapper { margin: 4px 0 18px; text-align: center; }
.viva-v2 .viva-prop-wrapper img, .viva-v2 .viva-q-body img { max-width: 100%; max-height: 560px; border: 1px solid var(--line); border-radius: 9px; }

.viva-v2 .viva-q { border-top: 1px solid var(--line); padding: 18px 0 16px; }
.viva-v2 .viva-q:first-of-type, .viva-v2 > .viva-header + .viva-q { border-top: 0; padding-top: 6px; }
.viva-v2 .viva-q-title { display: flex; align-items: flex-start; gap: 11px; margin: 0; color: var(--primary); font-size: 1.04rem; line-height: 1.45; font-weight: 720; }
.viva-v2 .viva-q-num { flex: 0 0 auto; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-top: -1px; }
.viva-v2 .viva-q-text { flex: 1 1 auto; min-width: 0; }
.viva-v2 .viva-q-body { margin: 10px 0 0 39px; }
.viva-v2 .viva-q-body > :first-child { margin-top: 0; }
.viva-v2 .viva-prompts { margin: 11px 0 0 39px; padding: 9px 13px; border: 1px dashed var(--line-strong, #c5d0d9); border-radius: 9px; background: #fcfdfd; font-size: .92rem; }
.viva-v2 .viva-prompts ul { margin: 0; padding-left: 19px; }
.viva-v2 .viva-prompts li { margin: 0 0 3px; }
.viva-v2 .viva-prompts li:last-child { margin-bottom: 0; }

.viva-v2 .viva-answer { margin: 13px 0 0 39px; padding: 14px 16px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; }
.viva-v2 .viva-answer > :first-child { margin-top: 0; }
.viva-v2 .viva-answer > :last-child { margin-bottom: 0; }
.viva-v2 .viva-answer-body > :first-child { margin-top: 0; }
.viva-v2 .viva-answer-body > :last-child { margin-bottom: 0; }
.viva-v2 .viva-answer-body h4 { margin: 14px 0 4px; font-size: .9rem; color: var(--primary); }
.viva-v2 .viva-answer-body h4:first-child { margin-top: 0; }
.viva-v2 .viva-answer ul, .viva-v2 .viva-answer ol { margin: 4px 0 8px; padding-left: 22px; }
.viva-v2 .viva-answer li { margin-bottom: 4px; }
.viva-v2 .viva-answer li > ul, .viva-v2 .viva-answer li > ol { margin: 4px 0 2px; }
.viva-v2 table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: .9rem; background: #fff; }
.viva-v2 th, .viva-v2 td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.viva-v2 th { background: #eef2f5; color: var(--primary); font-weight: 720; }
.viva-v2 .viva-pass, .viva-v2 .viva-notes { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .92rem; }
.viva-v2 .viva-pass .viva-label { color: #2f7a4f; }
.viva-v2 .viva-notes .viva-label { color: var(--muted); }
.viva-v2 .viva-pass p, .viva-v2 .viva-notes p { margin: 0 0 4px; }
.viva-v2 .viva-pass > :last-child, .viva-v2 .viva-notes > :last-child { margin-bottom: 0; }
.viva-v2 .viva-pass ul, .viva-v2 .viva-notes ul { margin: 2px 0 0; }
.viva-v2 .viva-ecnote { margin-top: 12px; padding: 9px 12px; border: 1px solid #ecd3a6; border-left: 3px solid var(--warning, #a66717); border-radius: 8px; background: var(--warning-soft, #fff4df); font-size: .92rem; }
.viva-v2 .viva-ecnote .viva-label { color: var(--warning, #a66717); }
.viva-v2 .viva-ecnote p { margin: 0 0 4px; }
.viva-v2 .viva-ecnote > :last-child { margin-bottom: 0; }
.viva-v2 .viva-ref { margin: 10px 0 0; color: var(--muted); font-size: .8rem; font-style: italic; }
.viva-v2 .viva-ref + .viva-ref { margin-top: 2px; }

#viva-content.answers-hidden .viva-v2 .viva-answer { display: none !important; }

@media (max-width: 640px) {
  .viva-v2 .viva-q-body, .viva-v2 .viva-prompts, .viva-v2 .viva-answer { margin-left: 0; }
  .viva-v2 .viva-answer { padding: 12px 13px; }
  .viva-v2 table { display: block; overflow-x: auto; }
}

@media print {
  #viva-content.answers-hidden .viva-v2 .viva-answer { display: none !important; }
  .viva-v2 .viva-answer { background: #fff; }
}
.viva-v2 .viva-answer img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---- Timed exam mode (3.111.0) ------------------------------------------ */
.list-header-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Setup page */
.exam-active-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px 16px; margin-bottom: 20px; border: 1px solid #e3c48f; background: var(--warning-soft); border-radius: 11px; }
.exam-setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.exam-setup-card { border: 1px solid var(--line); border-radius: 12px; padding: 22px; background: var(--paper-2); display: flex; flex-direction: column; gap: 12px; }
.exam-setup-card h2 { margin: 0; color: var(--primary); font-size: 1.2rem; }
.exam-setup-card > p { margin: 0; font-size: .9rem; }
.exam-setup-card > .button[type="submit"] { align-self: flex-start; margin-top: auto; }
.exam-field { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .85rem; color: #455462; }
.exam-field select, .exam-field input, .exam-time-fields input { border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; background: #fff; color: var(--ink); font-weight: 500; outline: 0; max-width: 100%; }
.exam-field select:focus, .exam-field input:focus, .exam-time-fields input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }
.exam-field input { width: 110px; }
.exam-time-fields { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.exam-time-fields legend { font-weight: 700; font-size: .85rem; color: #455462; padding: 0; margin-bottom: 5px; }
.exam-time-fields label { display: flex; align-items: center; gap: 7px; font-size: .88rem; color: var(--muted); }
.exam-time-fields input { width: 76px; }
.exam-pace-hint { margin: 0; font-size: .82rem; color: var(--muted); }
.exam-pace-hint .button.ghost { padding: 2px 6px; text-decoration: underline; }
.exam-check { padding: 0; white-space: normal; }
.exam-rules { margin-top: 24px; }
.exam-rules h2, .exam-history h2 { color: var(--primary); font-size: 1.1rem; margin: 0 0 8px; }
.exam-rules ul { margin: 0; padding-left: 20px; color: #455462; font-size: .9rem; }
.exam-rules li { margin: 4px 0; }
.exam-history { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.exam-history > p { margin: 0 0 10px; font-size: .86rem; }
.exam-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.exam-history-list a { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--primary); background: #fff; }
.exam-history-list a:hover { border-color: var(--accent); background: var(--accent-soft); }
.exam-history-list .muted { font-size: .82rem; }

/* Exam and review pages. The card must not clip, or the sticky bar stops sticking. */
.page-card.exam-mode { overflow: visible; }
.exam-bar { position: sticky; top: 68px; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 12px 22px; background: var(--primary); color: #fff; border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 6px 16px rgba(29,53,87,.18); }
.exam-bar .eyebrow { color: #bcd9e9; display: block; }
.exam-bar-info { min-width: 0; flex: 1 1 auto; }
.exam-bar-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-clock { display: flex; flex-direction: column; align-items: center; padding: 4px 14px; border-radius: 9px; background: rgba(255,255,255,.12); min-width: 132px; }
.exam-clock-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #d4e5ef; }
.exam-clock-value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.2; }
.exam-clock.is-low { background: #c98a2e; }
.exam-clock.is-over { background: #b54848; }
.exam-clock.is-paused { background: rgba(255,255,255,.28); }
.exam-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.exam-bar .button.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.exam-bar .button.secondary:hover { background: rgba(255,255,255,.12); }
.exam-bar .button.primary { background: #fff; color: var(--primary); }
.exam-grid-toggle { display: none; }

.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; padding: 22px 26px 28px; }
.exam-main { min-width: 0; position: relative; }
.exam-question-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.exam-question-head h1 { margin: 0; color: var(--primary); font-size: 1.55rem; }
.exam-question-head h1 span { color: var(--muted); font-size: 1rem; font-weight: 600; }
.exam-flag.is-flagged { background: var(--warning-soft); border-color: #d9a75b; color: var(--warning); }
.exam-question-body.is-paused { visibility: hidden; max-height: 0; overflow: hidden; }
.exam-paused { text-align: center; padding: 60px 20px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--paper-2); }
.exam-paused h2 { margin: 0 0 6px; color: var(--primary); }
.exam-question-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 22px; }
.exam-review-source { margin: -6px 0 14px; color: var(--muted); font-size: .86rem; }
.exam-readonly-answer { background: #f7f9fb !important; }

.exam-navigator { align-self: start; position: sticky; top: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--paper-2); }
.exam-navigator-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.exam-navigator-head h2 { margin: 0; color: var(--primary); font-size: 1rem; }
.exam-navigator-head .muted { font-size: .8rem; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.exam-cell { position: relative; display: grid; place-items: center; height: 38px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); font-weight: 750; font-size: .88rem; text-decoration: none; font-variant-numeric: tabular-nums; }
.exam-cell:hover { border-color: var(--accent); }
.exam-cell.is-answered { background: var(--accent-soft); border-color: #9fc0d4; color: var(--primary); }
.exam-cell.is-flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #d08a1e; }
.exam-cell.is-current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 2px rgba(29,53,87,.22); }
.exam-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: .76rem; color: var(--muted); }
.exam-legend li { display: flex; align-items: center; gap: 6px; }
.exam-legend-swatch { position: relative; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); background: #fff; flex: none; }
.exam-legend-swatch.is-answered { background: var(--accent-soft); border-color: #9fc0d4; }
.exam-legend-swatch.is-current { background: var(--primary); border-color: var(--primary); }
.exam-legend-swatch.is-flagged::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: #d08a1e; }

.exam-dialog { padding: 24px; }
.exam-dialog-summary { margin: 6px 0 10px; padding-left: 20px; }
.exam-dialog-summary li { margin: 4px 0; }

/* Results page */
.exam-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.exam-kpi { border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 2px; }
.exam-kpi span { font-size: .74rem; color: var(--muted); font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.exam-kpi strong { color: var(--primary); font-size: 1.5rem; line-height: 1.2; }
.exam-kpi small { color: var(--muted); }
.exam-kpi.is-over strong { color: var(--danger); }
.exam-export { margin-bottom: 22px; background: var(--paper-2); }
.exam-export > p { margin: 0 0 10px; }
.exam-export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.exam-export-options fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.exam-export-options legend { font-weight: 750; color: var(--primary); font-size: .88rem; margin-bottom: 4px; padding: 0; }
.exam-export-options .check-control { padding: 0; white-space: normal; color: var(--ink); }
.exam-export-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.exam-export-note { font-size: .8rem; margin: 10px 0 0 !important; }
.exam-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exam-review-head h2 { color: var(--primary); font-size: 1.1rem; margin: 0; }
.exam-result-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.exam-result-row a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--ink); background: #fff; }
.exam-result-row a:hover { border-color: var(--accent); background: var(--accent-soft); }
.exam-result-num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--paper-2); color: var(--primary); font-weight: 800; font-size: .85rem; }
.exam-result-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.exam-result-main strong { color: var(--primary); font-size: .92rem; }
.exam-result-main .muted { font-size: .8rem; }
.exam-result-status { flex: none; font-size: .78rem; font-weight: 700; color: var(--muted); }
.exam-result-status.is-answered { color: var(--success); }
.exam-results-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-grid-toggle { display: inline-flex; }
  .exam-navigator { display: none; position: static; order: -1; }
  .exam-navigator.is-open { display: block; }
}
@media (max-width: 760px) {
  .exam-bar { top: 62px; flex-wrap: wrap; padding: 10px 14px; gap: 8px 12px; }
  .exam-bar-info { flex-basis: calc(100% - 150px); }
  .exam-clock { min-width: 120px; padding: 3px 10px; }
  .exam-clock-value { font-size: 1.2rem; }
  .exam-bar-actions { flex-basis: 100%; justify-content: stretch; }
  .exam-bar-actions .button { flex: 1 1 auto; }
  .exam-layout { padding: 16px 14px 22px; }
  .exam-setup-grid, .exam-export-options { grid-template-columns: 1fr; }
  .exam-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-result-status { display: none; }
}
@media print { .exam-bar, .exam-navigator, .exam-question-nav { display: none !important; } }

/* Link to the classic (pre-upgrade) site, bottom of the home page (3.113.0) */
.home-classic { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 22px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-soft); }
.home-classic h2 { margin: 0 0 3px; color: var(--primary); font-size: 1.02rem; }
.home-classic p { margin: 0; color: var(--muted); font-size: .9rem; max-width: 780px; }
@media (max-width: 560px) { .home-classic { padding: 16px 18px; } .home-classic .button { width: 100%; } }

/* ---- Contact & About (3.114.0) ------------------------------------------- */
.footer-note a + a { margin-left: 14px; }
.about-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 34px; align-items: start; }
.about-contact { position: sticky; top: 92px; display: grid; gap: 14px; }
.about-contact-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--paper-2); }
.about-contact-card h2, .about-contact-card h3 { margin: 0 0 6px; color: var(--primary); font-size: 1.05rem; }
.about-contact-card p { margin: 0 0 12px; font-size: .9rem; }
.about-email { width: 100%; word-break: break-all; }
.about-tip { margin: 12px 0 0 !important; font-size: .82rem !important; }
.about-links { display: grid; gap: 4px; }
.about-links a { padding: 6px 0; font-weight: 650; font-size: .9rem; text-decoration: none; border-bottom: 1px solid var(--line); }
.about-links a:last-child { border-bottom: 0; }
.about-links a:hover { text-decoration: underline; }
.about-story { max-width: 760px; }
.about-story h2:first-child { margin-top: 0; }
.about-story p { line-height: 1.7; }
.about-signoff { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .about-layout { grid-template-columns: 1fr; }
  .about-contact { position: static; }
}

/* ---- Misc: video library (3.114.0) -------------------------------------- */
.video-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 30px; border-bottom: 1px solid var(--line); background: var(--paper-2); position: sticky; top: 68px; z-index: 30; }
.video-toolbar input[type="search"] { flex: 1 1 260px; min-width: 0; max-width: 380px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; background: #fff; color: var(--ink); outline: 0; }
.video-toolbar input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,123,157,.14); }
.video-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.video-chip { border: 1px solid var(--line-strong); background: #fff; color: var(--primary); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 700; cursor: pointer; }
.video-chip:hover { border-color: var(--accent); }
.video-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.video-library { display: grid; gap: 34px; }
.video-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.video-section-head h2 { margin: 2px 0 4px; color: var(--primary); font-size: 1.45rem; }
.video-section-head p { margin: 0; max-width: 820px; font-size: .92rem; }
.video-count { flex: none; font-size: .78rem; font-weight: 750; color: var(--primary); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; }
.video-subsection + .video-subsection { margin-top: 20px; }
.video-subsection h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--primary); font-size: 1rem; }
.video-subsection h3 span { font-size: .74rem; font-weight: 750; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.video-grid { display: grid; gap: 12px; }
.video-grid-feature { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.video-grid-compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.video-card { appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 0; text-align: left; cursor: pointer; color: var(--ink); font: inherit; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.video-card:hover, .video-card:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-soft); transform: translateY(-1px); outline: none; }
.video-card[hidden] { display: none; }
.video-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #dfe6ec; overflow: hidden; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play { position: absolute; left: 50%; top: 50%; width: 46px; height: 32px; margin: -16px 0 0 -23px; border-radius: 9px; background: rgba(29,53,87,.88); }
.video-play::after { content: ""; position: absolute; left: 19px; top: 9px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; }
.video-card:hover .video-play { background: #c4302b; }
.video-card-text { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.video-card-text strong { color: var(--primary); font-size: .9rem; line-height: 1.35; }
.video-card-text span { color: var(--muted); font-size: .78rem; }
/* Compact rows: small thumbnail beside the title */
.video-grid-compact .video-card { flex-direction: row; align-items: center; border-radius: 9px; }
.video-grid-compact .video-thumb { flex: 0 0 104px; aspect-ratio: 16 / 9; }
.video-grid-compact .video-play { width: 28px; height: 20px; margin: -10px 0 0 -14px; border-radius: 6px; }
.video-grid-compact .video-play::after { left: 11px; top: 5px; border-width: 5px 0 5px 8px; }
.video-grid-compact .video-card-text { padding: 8px 12px; }
.video-grid-compact .video-card-text strong { font-size: .86rem; font-weight: 700; }
.video-empty { text-align: center; padding: 30px 0; }

.video-dialog { width: min(1000px, calc(100% - 24px)); max-width: none; border: 0; border-radius: 14px; padding: 0; overflow: hidden; background: #0e1720; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.video-dialog::backdrop { background: rgba(8,15,22,.86); }
.video-dialog-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; }
.video-dialog-heading { flex: 1 1 auto; min-width: 0; }
.video-dialog-heading h2 { margin: 1px 0 0; color: var(--primary); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-frame { aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 760px) {
  .video-toolbar { top: 62px; padding: 12px 18px; }
  .video-toolbar input[type="search"] { max-width: none; flex-basis: 100%; }
  .video-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; width: 100%; }
  .video-chip { flex: none; }
  .video-grid-feature { grid-template-columns: 1fr 1fr; }
  .video-grid-compact { grid-template-columns: 1fr; }
  .video-dialog-bar .button { display: none; }
}
@media (max-width: 420px) { .video-grid-feature { grid-template-columns: 1fr; } }
/* Sticky panels need the card not to clip. */
.page-card.misc-page, .page-card.about-page { overflow: visible; }
/* v3.119.0: Misc page text runs the full width (no early line breaks); filter bar removed. */
.misc-page > .page-header p, .misc-page .video-section-head p { max-width: none; }
.misc-page > .page-header { border-bottom: 1px solid var(--line); }
.misc-page > .page-header, .about-page > .page-header { border-radius: var(--radius) var(--radius) 0 0; }
/* Six top-menu links (3.114.0): keep each on one line; on narrower screens
   above the phone menu, show the logo without the site name. */
.main-nav a { white-space: nowrap; }
@media (max-width: 1080px) and (min-width: 761px) {
  .brand-copy { display: none; }
  .header-inner { gap: 10px; padding: 0 16px; }
  .main-nav { gap: 0; }
  .main-nav a { padding-left: 7px; padding-right: 7px; font-size: .82rem; }
  .account-button { padding-left: 10px; padding-right: 10px; }
}

/* v3.121.0: Site activity page for administrators (#/site-stats) */
.moderation-stats-link { margin-top: 10px !important; }
.site-stats-page .page-pad { display: grid; gap: 0; }
.stats-filter { margin-bottom: 18px; }
.stats-staff-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); margin-left: auto; cursor: pointer; }
.stats-staff-toggle input { width: 16px; height: 16px; accent-color: var(--primary); }
#site-stats-body { transition: opacity .15s; }
#site-stats-body.is-refreshing { opacity: .45; pointer-events: none; }
.stats-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stats-tile { border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: var(--paper); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats-tile-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.stats-tile-value { font-size: 1.9rem; line-height: 1.15; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stats-tile-note { font-size: .78rem; color: var(--muted); }
.stats-tiles-small .stats-tile-value { font-size: 1.45rem; }
.stats-change { font-weight: 650; }
.stats-change.up { color: var(--success); }
.stats-change.down { color: var(--danger); }
.stats-section { border-top: 1px solid var(--line); padding: 22px 0 6px; margin-top: 14px; min-width: 0; }
.stats-section h2 { margin: 0 0 4px; color: var(--primary); font-size: 1.2rem; }
.stats-section h3 { margin: 0 0 8px; color: var(--primary); font-size: 1.02rem; }
.stats-small { font-size: .84rem; margin: 0 0 12px; max-width: 80ch; }
.stats-after { margin-top: 12px; }
.stats-two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; }
.stats-two-col > div { min-width: 0; }

/* Column chart (one series) */
.stats-chart { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; height: 210px; margin: 6px 0 4px; }
.stats-chart-grid { display: flex; flex-direction: column; justify-content: space-between; font-size: .72rem; color: var(--muted); text-align: right; padding-bottom: 22px; font-variant-numeric: tabular-nums; min-width: 22px; }
.stats-chart-cols { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; align-items: end; border-bottom: 1px solid var(--line-strong); padding-bottom: 0; margin-bottom: 22px;
  background: linear-gradient(to bottom, var(--line) 1px, transparent 1px) 0 0 / 100% 50%; }
.stats-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.stats-col::before { content: ""; position: absolute; inset: 0 -1px; border-radius: 4px; }
.stats-col:hover::before, .stats-col:focus-visible::before { background: rgba(69,123,157,.10); }
.stats-col-bar { position: relative; width: 100%; max-width: 38px; background: var(--accent); border-radius: 4px 4px 0 0; }
.stats-col:hover .stats-col-bar, .stats-col:focus-visible .stats-col-bar { background: var(--primary); }
.stats-col-label { position: absolute; top: 100%; margin-top: 4px; font-size: .68rem; color: var(--muted); white-space: nowrap; left: 50%; transform: translateX(-50%); }

/* Horizontal bars */
.stats-hbars { display: grid; gap: 8px; }
.stats-hbar { display: grid; grid-template-columns: minmax(110px, 13em) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; border-radius: 6px; outline: none; }
.stats-hbar:hover, .stats-hbar:focus-visible { background: var(--paper-2); }
.stats-hbar-label { color: var(--ink); }
.stats-hbar-track { height: 12px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.stats-hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.stats-hbar-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 4.5em; }
.stats-hbar-value small { font-weight: 600; color: var(--muted); }

.stats-tooltip { position: fixed; z-index: 400; pointer-events: none; background: var(--primary); color: white; font-size: .8rem; font-weight: 600; padding: 6px 9px; border-radius: 7px; box-shadow: var(--shadow-soft); max-width: 260px; }

/* Study by exam */
.stats-study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.stats-study-card { border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: var(--paper); }
.stats-subhead { margin: 12px 0 4px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.stats-dl { margin: 0; display: grid; gap: 4px; }
.stats-dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.stats-dl > div:last-child { border-bottom: 0; }
.stats-dl dt { color: var(--muted); }
.stats-dl dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.stats-dl dd small { font-weight: 500; color: var(--muted); }

/* Top questions */
.stats-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.stats-top-list { margin: 0; padding-left: 1.6em; display: grid; gap: 6px; }
.stats-top-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.stats-top-list li a { text-decoration: none; font-weight: 600; }
.stats-top-list li a:hover { text-decoration: underline; }
.stats-top-type { color: var(--muted); font-weight: 700; font-size: .78rem; margin-right: 4px; }
.stats-top-exam { grid-column: 1; font-size: .78rem; }
.stats-top-count { grid-column: 2; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; }
.stats-top-count small { font-weight: 500; color: var(--muted); }

/* Accounts table */
.stats-accounts-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin: 8px 0 12px; font-size: .86rem; font-weight: 650; }
.stats-accounts-controls label { display: inline-flex; flex-direction: column; gap: 3px; }
.stats-accounts-controls select, .stats-accounts-controls input { font: inherit; font-weight: 500; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: white; }
.stats-search input { min-width: 200px; }
#site-stats-accounts { display: grid; gap: 10px; }
.stats-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.stats-table th { text-align: left; background: var(--paper-2); color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 9px 10px; white-space: nowrap; }
.stats-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tbody tr:hover { background: var(--paper-2); }
.stats-email { display: block; font-weight: 650; word-break: break-all; }
.stats-table td small { display: block; }
.stats-footnote { margin-top: 22px; }

@media (max-width: 900px) {
  .stats-two-col, .stats-study-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-staff-toggle { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 600px) {
  .stats-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats-tile { padding: 10px 12px; }
  .stats-tile-value { font-size: 1.45rem; }
  .stats-chart { height: 170px; }
  .stats-hbar { grid-template-columns: minmax(0, 1fr) auto; }
  .stats-hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .stats-search input { min-width: 0; width: 100%; }
  .stats-accounts-controls label { flex: 1 1 140px; }
  /* Account table becomes stacked cards on phones */
  .stats-table-wrap { border: 0; overflow: visible; }
  .stats-table thead { display: none; }
  .stats-table, .stats-table tbody, .stats-table tr, .stats-table td { display: block; width: 100%; }
  .stats-table tr { border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .stats-table td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 8px; text-align: right; font-size: .82rem; min-width: 0; }
  .stats-table td:first-child { grid-column: 1 / -1; }
  .stats-table td::before { content: attr(data-label); color: var(--muted); font-weight: 650; text-align: left; }
  .stats-table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .stats-table td:first-child::before { content: none; }
}
