:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --ela: #7c3aed;
  --ela-soft: #f5f3ff;
  --math: #0284c7;
  --math-soft: #f0f9ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #273449;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --ela: #a78bfa;
  --ela-soft: rgba(139, 92, 246, 0.15);
  --math: #38bdf8;
  --math-soft: rgba(14, 165, 233, 0.15);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

p {
  margin: 0 0 0.75rem;
}

.hidden {
  display: none !important;
}

.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 0.92rem; }
.muted-xs { color: var(--muted); font-size: 0.8rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* Cards & Buttons */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.62rem 1.05rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-lg { padding: 0.78rem 1.35rem; font-size: 0.98rem; }
.btn-sm { padding: 0.44rem 0.8rem; font-size: 0.84rem; border-radius: 8px; }
.btn-xs { padding: 0.28rem 0.56rem; font-size: 0.77rem; border-radius: 7px; }

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--text);
}
.btn-active-tool {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border-color: var(--primary);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.68rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}
.pill-accent { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pill-ela { background: var(--ela-soft); color: var(--ela); border-color: transparent; }
.pill-math { background: var(--math-soft); color: var(--math); border-color: transparent; }
.pill-honors { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* Form Inputs */
.input-field, .input-select {
  width: 100%;
  padding: 0.58rem 0.78rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}
.input-field:focus, .input-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.input-sm { padding: 0.36rem 0.58rem; font-size: 0.84rem; width: auto; }

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

/* Topbars */
.auth-topbar, .dash-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: -0.03em;
}
.brand-title { font-weight: 800; font-size: 1.04rem; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }

.topbar-controls, .topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Auth View */
.auth-grid {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.auth-hero-card h1 {
  font-size: 1.75rem;
  margin-top: 0.75rem;
}
.quick-guest-box {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 11px;
  background: var(--primary-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}
.guest-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.existing-accounts-block {
  margin-top: 1.5rem;
}
.account-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.65rem;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.84rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.account-meta { flex: 1; min-width: 0; }
.account-name { font-weight: 700; font-size: 0.95rem; }
.account-sub { font-size: 0.8rem; color: var(--muted); }
.account-row-actions { display: flex; gap: 0.35rem; }

.pin-prompt {
  margin-top: 0.8rem;
  padding: 0.75rem;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--primary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-top: 1rem;
}
.form-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.import-backup-row {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.import-label { cursor: pointer; }

/* Dashboard */
.grade-season-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.inline-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.dash-main, .report-main {
  max-width: 1180px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.info-banner {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
}
.subject-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.subject-ela { border-top: 4px solid var(--ela); }
.subject-math { border-top: 4px solid var(--math); }

.subject-header {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: flex-start;
}
.subject-header h2 {
  margin-top: 0.45rem;
  font-size: 1.22rem;
}
.bench-mini {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.76rem;
  min-width: 145px;
}
.bench-mini > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.launch-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
}

.custom-drawer {
  margin-top: 0.5rem;
  padding: 0.95rem;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.custom-drawer-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.55rem;
}
.domain-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  cursor: pointer;
}
.custom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.two-col-section {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.35rem;
}

.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.fix-queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.fix-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.86rem;
}
.mini-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.14rem 0.44rem;
  border-radius: 6px;
  margin-right: 0.4rem;
}
.tag-ela { background: var(--ela-soft); color: var(--ela); }
.tag-math { background: var(--math-soft); color: var(--math); }
.fix-drill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.history-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}
.mini-chart-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem;
}
.mini-chart-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.history-svg { width: 100%; height: auto; }

.history-table-wrap { overflow-x: auto; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.history-table th, .history-table td {
  padding: 0.48rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.history-table th { color: var(--muted); font-size: 0.76rem; }

/* Strategy Guide */
.tab-bar {
  display: inline-flex;
  background: var(--surface-alt);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 0.25rem;
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.38rem 0.78rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}
.tip-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.tip-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cheat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}
.cheat-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.cheat-box h4 {
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.cheat-box ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

/* Testing Workspace */
.test-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.test-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 1.35rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.test-meta-left, .test-tools-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.diff-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-alt);
}
.test-progress-center {
  flex: 1;
  min-width: 190px;
  max-width: 340px;
}
.progress-text {
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 0.28rem;
}
.progress-track {
  height: 7px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  transition: width 0.25s ease;
}

.test-body-wrap {
  flex: 1;
  max-width: 1260px;
  width: 100%;
  margin: 1.35rem auto 2.5rem;
  padding: 0 1.25rem;
  position: relative;
}

.test-stage.single-pane {
  max-width: 780px;
  margin: 0 auto;
}
.test-stage.split-pane {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.3rem;
  align-items: start;
}

.stimulus-pane {
  max-height: 74vh;
  overflow-y: auto;
}
.passage-header h3 {
  font-size: 1.2rem;
  margin-top: 0.2rem;
}
.passage-body {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.68;
  margin-top: 0.75rem;
}
.visual-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.visual-label { align-self: flex-start; }

.q-domain-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.calc-pill {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
}
.calc-yes { background: var(--success-soft); color: var(--success); }
.calc-no { background: var(--warn-soft); color: var(--warn); }

.question-prompt {
  font-size: 1.09rem;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 1.15rem;
}

.choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.choice-btn.choice-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.choice-btn.choice-correct {
  border-color: var(--success);
  background: var(--success-soft);
}
.choice-btn.choice-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.choice-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.choice-selected .choice-letter {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.choice-correct .choice-letter {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.choice-wrong .choice-letter {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.question-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Feedback & Explanations */
.coach-feedback-box {
  margin-top: 1.15rem;
  padding: 1rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.feedback-ok { background: var(--success-soft); border-color: var(--success); }
.feedback-err { background: var(--danger-soft); border-color: var(--danger); }
.feedback-title { font-weight: 800; font-size: 1rem; }

.trap-alert {
  padding: 0.65rem 0.8rem;
  border-radius: 9px;
  background: var(--warn-soft);
  border: 1px solid rgba(217, 119, 6, 0.35);
  font-size: 0.89rem;
}
.steps-box ol, .fix-walkthrough ol {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.rule-box {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--primary-soft);
  font-size: 0.88rem;
}

/* Tool Drawers (Scratchpad & Calculator) */
.tool-drawer {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  width: 345px;
  max-width: calc(100vw - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
  padding: 0.85rem;
  z-index: 40;
}
.tool-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}
#scratch-canvas {
  width: 100%;
  height: 190px;
  border-radius: 9px;
  border: 1px dashed var(--border);
  background: var(--surface-alt);
  touch-action: none;
  cursor: crosshair;
}
.scratch-notes {
  width: 100%;
  margin-top: 0.5rem;
  min-height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.calc-display {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: monospace;
  font-size: 1.1rem;
  text-align: right;
}
.calc-preview {
  min-height: 22px;
  text-align: right;
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 700;
  margin: 0.25rem 0 0.45rem;
}
.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
.calc-key {
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.calc-key:hover { border-color: var(--primary); }
.calc-eq { background: var(--primary); color: #fff; grid-column: span 2; }
.calc-clear { color: var(--danger); }

/* SVG Styling */
.math-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
}
.math-svg-square { max-width: 300px; }
.svg-axis { stroke: var(--text); }
.svg-axis-fill { fill: var(--text); }
.svg-grid { stroke: var(--border); }
.svg-muted-dash { stroke: var(--muted); }
.svg-label { fill: var(--text); font-family: var(--font-sans); }
.svg-accent { stroke: var(--primary); }
.svg-accent-fill { fill: var(--primary); }
.svg-accent-text { fill: var(--primary); font-family: var(--font-sans); }
.svg-secondary { stroke: var(--success); }
.svg-shape { fill: var(--primary-soft); stroke: var(--text); }

.svg-table-wrap { width: 100%; overflow-x: auto; }
.q-data-table {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.q-data-table th, .q-data-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: center;
}
.q-data-table th {
  background: var(--surface-alt);
  font-weight: 700;
}

/* Report View */
.report-score-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: 1.5rem;
  align-items: center;
}
.tier-pill {
  display: inline-block;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}
.tier-honors { background: var(--success-soft); color: var(--success); }
.tier-advanced { background: var(--primary-soft); color: var(--primary); }
.tier-ontrack { background: #e0f2fe; color: #0369a1; }
.tier-somerisk { background: var(--warn-soft); color: var(--warn); }
.tier-highrisk { background: var(--danger-soft); color: var(--danger); }

.score-readout {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.35rem 0 0.75rem;
}
.scale-number {
  font-size: 3.1rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--primary);
}
.goal-callouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.goal-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
}
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-info { background: var(--primary-soft); color: var(--primary); }
.chip-honors { background: var(--success-soft); color: var(--success); }

.score-visuals-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gauge-wrap, .traj-wrap {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}
.gauge-svg, .trajectory-svg { width: 100%; height: auto; }

.report-cta-bar {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.domain-diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 0.9rem;
}
.domain-diag-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.domain-diag-head, .domain-diag-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
}
.status-tag {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.16rem 0.48rem;
  border-radius: 6px;
}
.st-ok { background: var(--success-soft); color: var(--success); }
.st-mid { background: var(--warn-soft); color: var(--warn); }
.st-low { background: var(--danger-soft); color: var(--danger); }

.domain-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.domain-bar-fill { height: 100%; border-radius: 999px; }
.fill-ok { background: var(--success); }
.fill-mid { background: var(--warn); }
.fill-low { background: var(--danger); }

.review-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.review-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rev-missed { border-left: 4px solid var(--danger); }
.rev-correct { border-left: 4px solid var(--success); }
.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.q-num-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.8rem;
  margin-right: 0.45rem;
}
.rev-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-err { background: var(--danger-soft); color: var(--danger); }

.review-prompt { font-weight: 600; font-size: 1rem; }
.review-visual { max-width: 340px; }
.passage-collapse summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--primary);
}
.passage-mini {
  margin-top: 0.55rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--font-serif);
  font-size: 0.92rem;
}

.review-answers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}
.ans-box {
  padding: 0.65rem 0.8rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.ans-wrong { background: var(--danger-soft); border-color: rgba(220, 38, 38, 0.35); }
.ans-right { background: var(--success-soft); border-color: rgba(5, 150, 105, 0.35); }
.ans-tag {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.fix-walkthrough {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mini-retest-card {
  margin-top: 0.4rem;
  padding: 0.9rem;
  border-radius: 10px;
  border: 1.5px dashed var(--primary);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.mini-retest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
}
.mini-retest-prompt { font-weight: 600; font-size: 0.95rem; }
.mini-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.feedback-ok-line {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
  font-size: 0.88rem;
}
.feedback-err-line {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--danger-soft);
  font-size: 0.86rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.empty-celebration {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--success-soft);
  border-radius: 12px;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: opacity 0.25s ease;
}
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }
.toast-hide { opacity: 0; }

/* Responsive */
@media (max-width: 900px) {
  .auth-grid, .subject-grid, .two-col-section, .test-stage.split-pane, .report-score-grid {
    grid-template-columns: 1fr;
  }
  .stimulus-pane { max-height: none; }
  .mini-choices { grid-template-columns: 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; }
}
