/* ============================================================
   Assessment Engine — Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overscroll-behavior: none; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --primary: #4f8ef7;
  --primary-dark: #3a72d4;
  --success: #34c77b;
  --danger: #e05252;
  --warn: #f5a623;
  --text: #e8eaf0;
  --muted: #8891b0;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top);
}

a { color: var(--primary); text-decoration: none; }

/* ---- Header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 max(2rem, env(safe-area-inset-right)) 0 max(2rem, env(safe-area-inset-left));
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner { width: 100%; max-width: 1200px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 1.2rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 0.4rem; }
.brand-icon { font-size: 1.5rem; }

/* ---- Main ---- */
.main-content { flex: 1; padding: 2rem 1.5rem; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ---- Footer ---- */
.site-footer { text-align: center; padding: 1.5rem 1.5rem max(1.5rem, env(safe-area-inset-bottom)); color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); }

/* ---- Alerts ---- */
.alert {
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  font-size: 0.95rem;
}
.alert-error { background: #3b1a1a; border: 1px solid var(--danger); color: #fca5a5; }
.alert-success { background: #0f2a1e; border: 1px solid var(--success); color: #86efac; }
.alert-warn { background: rgba(245, 166, 35, 0.12); border: 1px solid var(--warn); color: #f8d189; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c43e3e; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn-full { width: 100%; }
.mt-1 { margin-top: 1rem; }

/* ============================================================
   Upload Page
   ============================================================ */
.upload-page { display: flex; justify-content: center; padding: 2rem 0; }
.upload-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 560px; }
.upload-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--muted); margin-bottom: 2rem; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1.5rem;
}
.drop-zone.drag-over { border-color: var(--primary); background: #1a2744; }
.drop-icon { font-size: 3rem; margin-bottom: 0.8rem; }
.drop-text { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.drop-sub { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; }
.file-name { margin-top: 0.75rem; font-size: 0.9rem; color: var(--primary); }

.form-row { margin-bottom: 1.2rem; }
.form-row label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.admin-nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Reveal mode radio cards */
.reveal-options { display: flex; flex-direction: column; gap: 0.5rem; }
.reveal-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.reveal-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(79, 142, 247, 0.08);
}
.reveal-option input[type="radio"] { margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.reveal-option-content { display: flex; flex-direction: column; gap: 2px; }
.reveal-title { font-weight: 600; font-size: 0.9rem; }
.reveal-desc { font-size: 0.8rem; color: var(--muted); }
.form-row input[type="number"],
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
}
.form-row select {
  appearance: none;
}
.form-row input[type="text"]:focus,
.form-row input[type="email"]:focus,
.form-row input[type="password"]:focus,
.form-row input[type="number"]:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-hint {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.auth-card {
  max-width: 460px;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.auth-card h1 {
  margin-bottom: 0.4rem;
}
.auth-links {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.upload-progress {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(79, 142, 247, 0.08);
}
.upload-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 0.55rem;
}
.upload-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.upload-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f8ef7 0%, #34c77b 100%);
  transition: width 0.25s ease;
}

.format-hint { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.format-hint h3 { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.75rem; }
.format-hint pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.82rem;
  color: #b0c4de;
  overflow-x: auto;
  margin-bottom: 0.6rem;
  white-space: pre-wrap;
}
.format-hint p { font-size: 0.85rem; color: var(--muted); }
.format-hint code { background: var(--surface2); padding: 0.1rem 0.35rem; border-radius: 4px; color: var(--primary); }

/* ============================================================
   Test Page
   ============================================================ */
.test-layout {
  display: grid;
  grid-template-columns: minmax(196px, 232px) minmax(0, 860px);
  justify-content: center;
  gap: clamp(1rem, 2vw, 1.75rem);
  align-items: start;
}

/* Sidebar */
.question-grid-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 72px;
  width: 100%;
  align-self: start;
  max-height: calc(100dvh - 92px);
  overflow: auto;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}
.question-grid-panel h3 { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.progress-summary {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  padding: 0.75rem;
  border: 1px solid rgba(79, 142, 247, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.08), rgba(79, 142, 247, 0.02));
  font-size: 0.8rem;
}
.prog-answered { color: var(--success); font-weight: 600; }
.prog-remaining { color: var(--muted); }
.prog-bookmarked { color: #fbbf24; font-weight: 600; }

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.grid-btn {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 600;
}
.grid-btn.answered { background: #0f2a1e; border-color: var(--success); color: var(--success); }
.grid-btn.bookmarked {
  background: rgba(251, 191, 36, 0.12);
  border-color: #fbbf24;
  color: #fbbf24;
}
.grid-btn.answered.bookmarked {
  background: linear-gradient(135deg, #0f2a1e 0%, #0f2a1e 58%, rgba(251, 191, 36, 0.28) 58%, rgba(251, 191, 36, 0.28) 100%);
  border-color: #fbbf24;
  color: #f8fafc;
}
.grid-btn.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.grid-btn:hover:not(.current) { border-color: var(--primary); color: var(--text); }

.legend {
  display: grid;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.legend-dot.unanswered { background: var(--surface2); border: 1px solid var(--border); }
.legend-dot.answered { background: #0f2a1e; border: 1px solid var(--success); }
.legend-dot.bookmarked { background: rgba(251, 191, 36, 0.2); border: 1px solid #fbbf24; }
.legend-dot.current { background: var(--primary); }

/* Main question panel */
.question-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  width: 100%;
}

.test-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(180deg, rgba(26, 29, 39, 0.98), rgba(26, 29, 39, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
}
.q-counter { font-weight: 600; color: var(--muted); }
.test-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  color: var(--text);
  transition: color 0.3s, border-color 0.3s;
}
.timer.timer-warn { color: var(--warn); border-color: var(--warn); }

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 2vw, 2rem);
  min-height: 300px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.16);
}
.q-number { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.question-meta .q-number { margin-bottom: 0; }
.bookmark-btn {
  border: 1px solid #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
  white-space: nowrap;
}
.bookmark-btn:hover {
  background: rgba(251, 191, 36, 0.16);
}
.bookmark-btn.active {
  background: #fbbf24;
  color: #2a1d00;
}
.multi-hint { font-size: 0.82rem; font-weight: 600; color: var(--primary); margin: -1rem 0 1rem; letter-spacing: 0.02em; }
.q-text {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.8rem;
  white-space: pre-wrap;
}

.question-images {
  display: grid;
  gap: 0.9rem;
  margin: -0.6rem 0 1.4rem;
}

.question-image-frame {
  margin: 0;
  padding: 0.75rem;
  background: #111622;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}

.question-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 420px;
  margin: 0 auto;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.options { display: flex; flex-direction: column; gap: 0.75rem; }
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
  font-size: 0.97rem;
  line-height: 1.5;
}
.option-btn:hover { border-color: var(--primary); background: #1a2744; }
.option-btn.selected { border-color: var(--primary); background: #1a2744; color: #fff; }
.option-btn.selected .option-label { background: var(--primary); }
.option-label {
  min-width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 0.12s;
}
.option-text { flex: 1; }
.option-visual-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.7rem;
}
.option-visual {
  display: block;
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #fff;
  object-fit: contain;
}
.option-text-caption {
  color: var(--muted);
  font-size: 0.88rem;
}
.option-btn.selected .option-text-caption {
  color: rgba(255, 255, 255, 0.82);
}

/* ---- Answer Feedback Panel ---- */
.answer-feedback {
  display: none;
  margin-top: 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.answer-feedback.feedback-show { display: block; }
.answer-feedback.feedback-is-correct {
  border-color: var(--success);
  background: rgba(52, 199, 123, 0.08);
}
.answer-feedback.feedback-is-wrong {
  border-color: var(--danger);
  background: rgba(224, 82, 82, 0.08);
}
.answer-feedback.feedback-is-pending {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.08);
}
.feedback-correct {
  font-weight: 700;
  color: var(--success);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.feedback-pending {
  font-weight: 600;
  color: var(--primary);
}
.feedback-wrong {
  font-weight: 700;
  color: var(--danger);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.feedback-icon { font-size: 1.1rem; }
.feedback-correct-ans {
  color: var(--text);
  margin-bottom: 0.6rem;
}
.feedback-explanation {
  color: var(--muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.feedback-explanation strong { color: var(--text); }

.nav-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: 0.15rem;
}
.nav-bar .btn { min-width: 130px; }

.loading, .error { color: var(--muted); padding: 1rem; text-align: center; font-style: italic; }
.error { color: var(--danger); }

.test-settings-fab {
  position: fixed;
  right: max(0.9rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 160;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(79, 142, 247, 0.28);
  border-radius: 50%;
  background: rgba(19, 24, 38, 0.82);
  color: #dbe7ff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  backdrop-filter: blur(10px);
  opacity: 0.9;
}
.test-settings-fab:hover {
  background: rgba(26, 39, 68, 0.94);
  opacity: 1;
}
.test-settings-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.05rem;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: min(560px, calc(100vw - 2rem));
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}
.modal-box h2 { margin-bottom: 0.75rem; }
.modal-box p { color: var(--muted); margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.reveal-options-compact {
  margin-top: 0.4rem;
}
.settings-drawer {
  width: min(360px, calc(100vw - 1rem));
  height: 100dvh;
  margin-left: auto;
  padding: 1.15rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(18, 23, 36, 0.98), rgba(22, 29, 45, 0.98));
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -20px 0 48px rgba(0, 0, 0, 0.36);
  overflow: auto;
}
.settings-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.settings-drawer-head h2 {
  margin-bottom: 0.3rem;
}
.settings-drawer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  flex: 1;
}
.settings-drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.settings-drawer-summary {
  margin-bottom: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(79, 142, 247, 0.12);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(79, 142, 247, 0.08);
  color: #d5e6ff;
  font-size: 0.82rem;
  line-height: 1.45;
}
.settings-save-progress {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(79, 142, 247, 0.16);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(79, 142, 247, 0.07);
}
.settings-save-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.83rem;
}
.settings-save-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.settings-save-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f8ef7 0%, #34c77b 100%);
  transition: width 0.25s ease;
}
.settings-confirm-actions {
  display: grid;
  gap: 0.75rem;
}
.modal-box-warn {
  border-color: var(--warn);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.modal-box-warn h2 { color: var(--warn); }
#test-settings-modal {
  justify-content: flex-end;
  background: rgba(4, 8, 14, 0.52);
}

/* ============================================================
   Results Page
   ============================================================ */
.results-page { max-width: 900px; margin: 0 auto; }

.results-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.score-circle {
  width: 130px; height: 130px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 5px solid var(--border);
  flex-shrink: 0;
}
.score-circle.pass { border-color: var(--success); }
.score-circle.fail { border-color: var(--danger); }
.score-circle.neutral { border-color: var(--primary); }

.score-pct { font-size: 1.8rem; font-weight: 800; }
.score-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.score-circle.pass .score-label { color: var(--success); }
.score-circle.fail .score-label { color: var(--danger); }

.score-detail p { color: var(--muted); margin-bottom: 0.4rem; }
.score-detail p:first-child { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.hint { font-size: 0.85rem !important; font-style: italic; }

.result-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.share-note {
  width: 100%;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
}
.share-note a {
  color: var(--primary);
  overflow-wrap: anywhere;
}
.btn-whatsapp {
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #4ade80;
}
.btn-whatsapp:hover:not(:disabled) {
  background: rgba(37, 211, 102, 0.18);
  border-color: rgba(37, 211, 102, 0.58);
}
.btn-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.btn-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-action-icon:hover:not(:disabled) {
  background: #2b3149;
  border-color: #4b567b;
}
.btn-download {
  color: #dbe7ff;
}
.btn-action-secondary {
  padding: 0.62rem 0.95rem;
  border-radius: 999px;
  background: transparent;
}
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}
.action-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.feedback-card {
  width: 100%;
  margin-top: 1.25rem;
  padding: 1.15rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.08) 0%, rgba(34, 38, 58, 0.92) 100%);
}
.feedback-copy h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.feedback-copy p {
  color: var(--muted);
  margin: 0;
}
.feedback-ratings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.feedback-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 0.55rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.72);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.feedback-rating:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 142, 247, 0.72);
  background: rgba(26, 39, 68, 0.8);
}
.feedback-rating.is-selected {
  border-color: var(--primary);
  background: rgba(79, 142, 247, 0.18);
  box-shadow: inset 0 0 0 1px rgba(79, 142, 247, 0.25);
}
.feedback-face {
  font-size: 1.6rem;
  line-height: 1;
}
.feedback-rating-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.feedback-rating.is-selected .feedback-rating-label {
  color: var(--text);
}
.feedback-status {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.84rem;
  min-height: 1.2em;
}
.feedback-status.is-error {
  color: var(--danger);
}

.email-section { margin-top: 1.5rem; }
.email-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.email-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.email-input {
  flex: 1; min-width: 200px;
  padding: 0.5rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}
.email-input:focus { outline: none; border-color: var(--primary); }
.email-status { font-size: 0.82rem; margin-top: 0.4rem; min-height: 1.2em; }
.email-ok { color: var(--success); }
.email-error { color: var(--danger); }

/* Review table */
.review-section h2 { margin-bottom: 1rem; }
.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.review-table th {
  background: var(--surface2);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.review-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.review-table tr:last-child td { border-bottom: none; }
.review-table tr.row-correct { background: #0a1f16; }
.review-table tr.row-wrong { background: #1f0a0a; }
.q-text-cell { max-width: 320px; }
.skipped-text { color: var(--muted); }
.review-image {
  margin-top: 0.75rem;
  text-align: center;
}
.review-image img {
  max-width: 280px;
  max-height: 200px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
}
.review-explanation {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.review-explanation strong { color: var(--text); }

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-pass { background: #0f2a1e; color: var(--success); }
.badge-fail { background: #2a0f0f; color: var(--danger); }
.badge-answered { background: #0f1e2a; color: var(--primary); }
.badge-skipped { background: var(--surface2); color: var(--muted); }

/* ============================================================
   Admin Dashboard
   ============================================================ */
.admin-main {
  max-width: 1320px;
}
.admin-login-card,
.admin-hero,
.admin-panel,
.admin-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-login-card {
  max-width: 460px;
  margin: 3rem auto;
  padding: 2rem;
}
.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.admin-hero h1 {
  font-size: 2rem;
  margin-bottom: 0.45rem;
}
.admin-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}
.admin-note {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(79, 142, 247, 0.1);
  border: 1px solid rgba(79, 142, 247, 0.25);
  color: #cbdcff;
  font-size: 0.82rem;
  font-weight: 600;
}
.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-kpi-card {
  padding: 1.2rem 1.25rem;
}
.admin-kpi-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}
.admin-kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
}
.admin-kpi-note {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-grid-tables {
  align-items: start;
}
.admin-panel {
  padding: 1.35rem;
}
.admin-panel-head {
  margin-bottom: 1rem;
}
.admin-panel-head h2 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.admin-panel-head p {
  color: var(--muted);
  font-size: 0.88rem;
}
.admin-chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.admin-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.admin-chart-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.admin-chart-swatch-1,
.admin-chart-bar-1 {
  background: #4f8ef7;
}
.admin-chart-swatch-2,
.admin-chart-bar-2 {
  background: #34c77b;
}
.admin-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22px, 1fr));
  gap: 0.55rem;
  align-items: end;
  min-height: 220px;
}
.admin-chart-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: center;
}
.admin-chart-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--muted);
  font-size: 0.72rem;
}
.admin-chart-bars {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
}
.admin-chart-bar {
  flex: 1;
  min-width: 7px;
  border-radius: 999px 999px 3px 3px;
  position: relative;
}
.admin-chart-bar span {
  position: absolute;
  top: -1.35rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.68rem;
}
.admin-bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.admin-bar-item,
.admin-mini-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.admin-bar-copy,
.admin-mini-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}
.admin-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface2);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.admin-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f8ef7 0%, #34c77b 100%);
}
.admin-split-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.admin-mini-list h3,
.admin-insight-columns h3 {
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.admin-table th,
.admin-table td {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}
.admin-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-table-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.admin-table-sub {
  color: var(--muted);
  font-size: 0.78rem;
}
.admin-insight-overview {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}
.admin-insight-columns {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1.25rem;
}
.admin-insight-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.admin-insight-card {
  padding: 1rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.admin-insight-card h4 {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.95rem;
}
.admin-insight-card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}
.admin-priority-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-priority-high {
  background: rgba(224, 82, 82, 0.12);
  color: #f7b2b2;
}
.admin-priority-medium {
  background: rgba(245, 166, 35, 0.12);
  color: #f5d08e;
}
.admin-priority-low {
  background: rgba(52, 199, 123, 0.12);
  color: #9de7bf;
}
.admin-bullet-list {
  padding-left: 1.1rem;
  margin-bottom: 1rem;
  color: var(--muted);
  line-height: 1.7;
}
.admin-model-note,
.admin-empty {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 1rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .test-layout {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }
  .question-panel {
    order: 1;
  }
  .question-grid-panel {
    order: 2;
    position: static;
    max-height: none;
    box-shadow: none;
  }
  .progress-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.7rem;
  }
  .legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
  }
  .test-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .test-topbar-actions {
    justify-content: space-between;
  }
  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-grid,
  .admin-insight-columns,
  .admin-split-lists {
    grid-template-columns: 1fr;
  }
  .admin-hero {
    flex-direction: column;
  }
  .admin-hero-meta {
    align-items: flex-start;
  }
  .results-hero { flex-direction: column; align-items: flex-start; }
  .feedback-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-table { font-size: 0.82rem; }
  .q-text-cell { max-width: 180px; }
  .question-image { max-height: 320px; }
}

@media (max-width: 640px) {
  .admin-kpis {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Admin Dashboard Refresh
   ============================================================ */
.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-spotlight {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 1.5rem;
  padding: 2rem;
  border-radius: 24px;
  border: 1px solid rgba(108, 168, 255, 0.2);
  background:
    radial-gradient(circle at top left, rgba(108, 168, 255, 0.22), transparent 40%),
    radial-gradient(circle at bottom right, rgba(71, 219, 197, 0.16), transparent 35%),
    linear-gradient(135deg, rgba(17, 23, 38, 0.96), rgba(22, 28, 46, 0.96));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
}

.admin-spotlight::after {
  content: '';
  position: absolute;
  right: -70px;
  top: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(165, 140, 255, 0.15), transparent 70%);
  pointer-events: none;
}

.admin-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cad7f7;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-spotlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.admin-spotlight-meta span {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cdd8f4;
  font-size: 0.78rem;
}

.admin-spotlight h1 {
  max-width: 14ch;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 0.8rem;
}

.admin-spotlight .subtitle {
  max-width: 65ch;
  margin-bottom: 1.4rem;
  color: #aeb7d3;
}

.admin-highlight-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.admin-inline-stat {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.admin-inline-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.admin-inline-stat strong {
  font-size: 1.05rem;
}

.admin-spotlight-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-content: center;
}

.admin-ai-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-ai-banner strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.admin-ai-banner p {
  margin: 0;
  color: #b9c6e5;
  line-height: 1.5;
  font-size: 0.9rem;
}

.admin-ai-banner-label {
  display: inline-flex;
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(108, 168, 255, 0.14);
  color: #9ecbff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-ai-banner-meta {
  align-self: center;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9e4fb;
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-ai-banner-error {
  border-color: rgba(255, 191, 95, 0.24);
  background: rgba(255, 191, 95, 0.08);
}

.admin-summary-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.admin-summary-card {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  padding: 1.2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    var(--surface);
}

.admin-summary-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
}

.admin-summary-eyebrow {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-summary-value {
  margin-bottom: 0.7rem;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.admin-summary-copy {
  margin-bottom: 0.55rem;
  color: #dbe4f7;
  line-height: 1.55;
}

.admin-summary-note {
  color: #99a8cb;
  font-size: 0.88rem;
  line-height: 1.5;
}

.admin-detail-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-section-head h2 {
  margin-bottom: 0.25rem;
  font-size: 1.2rem;
}

.admin-section-head p {
  margin: 0;
  color: var(--muted);
}

.admin-hero-meter {
  --meter: 0%;
  position: relative;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-hero-meter-ring {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(from -90deg, #6ca8ff 0 var(--meter), rgba(255, 255, 255, 0.08) var(--meter) 100%);
}

.admin-meter-alt .admin-hero-meter-ring {
  background:
    conic-gradient(from -90deg, #47dbc5 0 var(--meter), rgba(255, 255, 255, 0.08) var(--meter) 100%);
}

.admin-hero-meter-inner {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(12, 16, 28, 0.95);
  text-align: center;
  padding: 0.8rem;
}

.admin-hero-meter-inner strong {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.admin-hero-meter-inner span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.admin-metric-card {
  position: relative;
  overflow: hidden;
  min-height: 158px;
  padding: 1.25rem 1.2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02)),
    var(--surface);
}

.admin-metric-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  opacity: 0.9;
}

.admin-tone-primary::before { background: linear-gradient(90deg, #6ca8ff, #90c5ff); }
.admin-tone-success::before { background: linear-gradient(90deg, #47dbc5, #7ae9b7); }
.admin-tone-accent::before { background: linear-gradient(90deg, #a58cff, #c1a7ff); }
.admin-tone-warn::before { background: linear-gradient(90deg, #ffbf5f, #ffd98d); }
.admin-tone-neutral::before { background: linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)); }

.admin-metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.admin-metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}

.admin-metric-note {
  color: #a8b1cc;
  font-size: 0.88rem;
  line-height: 1.5;
}

.admin-visual-grid-main {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
}

.admin-visual-grid-secondary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.admin-panel-xl {
  min-height: 420px;
}

.admin-chart-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-chart-svg {
  width: 100%;
  min-height: 260px;
}

.admin-chart-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.admin-chart-axis {
  fill: rgba(255, 255, 255, 0.42);
  font-size: 12px;
}

.admin-chart-area {
  fill-opacity: 1;
}

.admin-chart-area-1 {
  fill: url(#adminActivityArea);
}

.admin-chart-path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-chart-path-1 { stroke: #6ca8ff; }
.admin-chart-path-2 { stroke: #47dbc5; }

.admin-chart-dot {
  stroke: #111726;
  stroke-width: 2;
}

.admin-chart-dot-1 { fill: #6ca8ff; }
.admin-chart-dot-2 { fill: #47dbc5; }

.admin-chart-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.admin-chart-summary-compact {
  margin-bottom: 1rem;
}

.admin-chart-summary-card {
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}

.admin-chart-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.admin-chart-summary-card strong {
  font-size: 1.25rem;
}

.admin-chart-summary-one strong { color: #8ec1ff; }
.admin-chart-summary-two strong { color: #7ae9b7; }
.admin-chart-summary-three strong { color: #ffd98d; }

.admin-funnel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-funnel-step {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-funnel-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
  font-size: 0.92rem;
}

.admin-funnel-copy span { color: #d8def0; }
.admin-funnel-copy strong { font-size: 1rem; }

.admin-funnel-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.admin-funnel-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6ca8ff, #47dbc5);
}

.admin-funnel-meta {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-score-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: end;
  min-height: 250px;
}

.admin-score-shell {
  display: flex;
  flex-direction: column;
}

.admin-score-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.admin-score-bar-track {
  width: 100%;
  min-height: 180px;
  padding: 0.3rem;
  display: flex;
  align-items: flex-end;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-score-bar-fill {
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(180deg, #a58cff 0%, #6ca8ff 100%);
}

.admin-score-bar-value {
  min-height: 1rem;
  color: #cad7f7;
  font-size: 0.7rem;
}

.admin-score-bar-label {
  min-height: 0.95rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.admin-status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.admin-status-card {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}

.admin-status-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-status-card strong {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.admin-status-card small {
  color: #b7c5e6;
  font-size: 0.8rem;
}

.admin-status-1 strong { color: #73df8f; }
.admin-status-2 strong { color: #a58cff; }
.admin-status-3 strong { color: #ffbf5f; }

.admin-donut {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 1rem;
  align-items: center;
}

.admin-donut-visual {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto;
  border-radius: 50%;
}

.admin-donut-hole {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #121825;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-donut-hole strong {
  font-size: 1.45rem;
  margin-bottom: 0.2rem;
}

.admin-donut-hole span {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-donut-hole small {
  margin-top: 0.25rem;
  color: #cdd8f4;
  font-size: 0.75rem;
}

.admin-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.admin-donut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-donut-row-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.admin-donut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.admin-donut-label {
  color: #dbe2f4;
  min-width: 0;
}

.admin-donut-row-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.admin-donut-row-fill {
  height: 100%;
  border-radius: inherit;
}

.admin-donut-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.admin-donut-row-meta strong {
  font-size: 0.95rem;
}

.admin-donut-row-meta small {
  color: var(--muted);
}

.admin-distribution {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.admin-distribution-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-distribution-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.admin-distribution-copy span {
  color: #d8def0;
}

.admin-distribution-meta {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.admin-distribution-meta small {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-distribution-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.admin-distribution-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6ca8ff, #47dbc5, #ffbf5f);
}

.admin-insights-panel {
  background:
    radial-gradient(circle at top right, rgba(165, 140, 255, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    var(--surface);
}

.admin-insight-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.admin-health-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-health-healthy,
.admin-health-active {
  background: rgba(115, 223, 143, 0.15);
  color: #8befa3;
}

.admin-health-warning,
.admin-health-idle {
  background: rgba(255, 191, 95, 0.16);
  color: #ffd48d;
}

.admin-health-critical,
.admin-health-stale,
.admin-health-expired {
  background: rgba(255, 124, 118, 0.16);
  color: #ffb0ab;
}

.admin-danger-btn {
  border-color: rgba(255, 124, 118, 0.4);
  color: #ffb0ab;
}

.admin-danger-btn:hover {
  border-color: rgba(255, 124, 118, 0.65);
  background: rgba(255, 124, 118, 0.1);
}

@media (max-width: 1180px) {
  .admin-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-summary-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-visual-grid-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .admin-spotlight,
  .admin-visual-grid-main,
  .admin-visual-grid-secondary {
    grid-template-columns: 1fr;
  }

  .admin-highlight-row,
  .admin-spotlight-side,
  .admin-status-row,
  .admin-chart-summary {
    grid-template-columns: 1fr;
  }

  .admin-summary-rail {
    grid-template-columns: 1fr;
  }

  .admin-ai-banner,
  .admin-insight-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .admin-donut {
    grid-template-columns: 1fr;
  }

  .admin-donut-visual {
    width: 150px;
    height: 150px;
  }

  .admin-score-bars {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
}

@media (max-width: 768px) {
  .admin-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-spotlight {
    padding: 1.4rem;
  }

  .admin-highlight-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-spotlight h1 {
    max-width: none;
    font-size: 2rem;
  }

  .admin-metric-grid,
  .admin-grid,
  .admin-grid-tables {
    grid-template-columns: 1fr;
  }

  .admin-metric-card {
    min-height: 140px;
  }
}

/* ============================================================
   Mobile / Touch / Capacitor Optimizations
   ============================================================ */
@media (max-width: 768px) {
  /* Enlarge question grid buttons for touch (44px minimum) */
  .grid-btn {
    width: 100%;
    height: 44px;
    font-size: 0.85rem;
  }

  /* Adequate touch area for answer options */
  .option-btn {
    padding: 1rem 1.2rem;
    min-height: 48px;
  }

  /* Navigation buttons need bigger touch targets */
  .nav-bar .btn {
    min-height: 48px;
    min-width: 110px;
  }

  /* Modal buttons */
  .modal-actions .btn {
    min-height: 44px;
    padding: 0.65rem 1.2rem;
  }

  /* Bookmark button */
  .bookmark-btn {
    padding: 0.5rem 1rem;
    min-height: 40px;
  }

  /* Upload area: larger drop zone on mobile */
  .drop-zone {
    padding: 3rem 1.5rem;
  }

  /* Prevent horizontal scroll on test page */
  .test-layout {
    overflow-x: hidden;
  }

  /* Better spacing for upload card on mobile */
  .upload-card {
    padding: 1.5rem;
  }

  .question-card {
    padding: 1.1rem;
  }

  .test-settings-fab {
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: max(0.8rem, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }

  .main-content {
    padding: 1rem 1rem;
  }

  /* Prevent iOS zoom on input focus (font-size must be >= 16px) */
  .form-row input[type="number"],
  .form-row input[type="text"],
  .form-row input[type="email"],
  .form-row input[type="password"],
  .form-row select,
  .email-input,
  .auth-form input {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .progress-summary {
    grid-template-columns: 1fr;
  }
  .legend {
    grid-template-columns: 1fr;
  }
  .test-topbar-actions {
    align-items: stretch;
  }
  .test-topbar-actions > * {
    width: 100%;
  }
  .test-settings-fab {
    right: max(0.75rem, env(safe-area-inset-right));
    left: auto;
    bottom: max(0.85rem, env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }
  .timer {
    justify-content: center;
  }
  .nav-bar {
    flex-direction: column;
  }
  .nav-bar .btn {
    width: 100%;
  }
}

/* Capacitor native app: extra notch/home-indicator padding */
html.capacitor-native body {
  padding-bottom: env(safe-area-inset-bottom);
}
