/* ==========================================================================
   RAKEEN ENGINEERING ACADEMY — FE CIVIL SPACE v6.2
   Professional Dark Sidebar + Clean Light Content Workspace
   NCEES CBT Simulator Grade | Pixel-Perfect Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Cairo:wght@400;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ──────────────────────────────────────────────────────────
   DESIGN TOKENS
────────────────────────────────────────────────────────── */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --primary-subtle: #ecfdf5;
  --primary-border: #a7f3d0;

  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #475569;
  --sidebar-text-active: #065f46;
  --sidebar-accent: #059669;
  --sidebar-hover: #f0fdf4;
  --sidebar-active-bg: #ecfdf5;
  --sidebar-active-border: #059669;

  --bg-body: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f0fdf4;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --accent-blue: #0284c7;
  --accent-amber: #d97706;
  --accent-rose: #dc2626;
  --accent-purple: #7c3aed;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-en: 'Outfit', sans-serif;
  --font-ar: 'Cairo', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.10);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --shadow-green: 0 4px 16px rgba(5,150,105,0.25);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-w: 260px;
  --topbar-h: 60px;
}

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

body {
  font-family: var(--font-ar), var(--font-en), sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* APP SHELL */
.academy-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* TOPBAR */
.academy-topbar {
  height: var(--topbar-h);
  background: #090e1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 0;
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

.brand-section { display: flex; align-items: center; gap: 0; flex-shrink: 0; height: 100%; }

.brand-badge-logo {
  width: var(--sidebar-w);
  height: 100%;
  background: #0b1120;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #34d399;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.15);
}

.brand-titles { display: flex; flex-direction: column; gap: 1px; }
.brand-title-ar { font-size: 15px; font-weight: 900; color: #ffffff; font-family: var(--font-en); letter-spacing: 0.3px; line-height: 1.2; }
.brand-title-en { font-size: 10.5px; color: #94a3b8; font-weight: 700; font-family: var(--font-ar); line-height: 1.2; }

/* Topbar Breadcrumb */
.topbar-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 22px;
  font-size: 12px;
}
.breadcrumb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.breadcrumb-title {
  color: #f1f5f9;
  font-weight: 800;
  font-size: 12.5px;
  font-family: var(--font-ar);
}
.breadcrumb-sep {
  color: #475569;
  font-size: 11px;
}
.breadcrumb-sub {
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-en);
  letter-spacing: 0.3px;
}

.trainee-status-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: var(--transition-fast);
}
.trainee-status-pill:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0.1); }
}

.trainee-name { font-size: 12px; font-weight: 700; color: #f1f5f9; }
.trainee-badge {
  font-size: 10.5px; font-weight: 800;
  background: rgba(16,185,129,0.2); color: #34d399;
  padding: 2px 8px; border-radius: var(--radius-full);
  border: 1px solid rgba(52,211,153,0.3);
}

.btn-icon-nav {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-ar);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #cbd5e1;
  text-decoration: none; white-space: nowrap;
}
.btn-icon-nav:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.2);
}
.btn-icon-nav.btn-green {
  background: rgba(5,150,105,0.18);
  border-color: rgba(5,150,105,0.45);
  color: #34d399;
}
.btn-icon-nav.btn-green:hover {
  background: rgba(5,150,105,0.3);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(5,150,105,0.2);
}
.btn-exit {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.25);
  color: #f87171;
}
.btn-exit:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.45);
  color: #fca5a5;
  box-shadow: 0 2px 10px rgba(239,68,68,0.15);
}

/* BODY */
.academy-body { display: flex; flex: 1; overflow: hidden; }

/* SIDEBAR */
.academy-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-left: 1px solid var(--sidebar-border);
  box-shadow: -1px 0 0 rgba(15,23,42,0.02), 2px 0 10px rgba(15,23,42,0.03);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 0;
}

.sidebar-heading {
  font-size: 10px; font-weight: 900;
  color: #64748b;
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 0 18px 10px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 9.5px; font-weight: 900;
  color: #64748b;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 10px 18px 4px;
}

.sidebar-separator {
  height: 1px; background: var(--sidebar-border);
  margin: 10px 18px;
}

.sidebar-nav-list { display: flex; flex-direction: column; gap: 3px; padding: 0 10px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition-fast);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 700;
  position: relative; border: 1px solid transparent;
}
.nav-item svg, .nav-item i {
  width: 18px; height: 18px; flex-shrink: 0;
  color: #94a3b8;
  transition: var(--transition-fast);
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  border-color: var(--primary-border);
}
.nav-item:hover svg, .nav-item:hover i {
  color: var(--primary);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  border-color: var(--primary-border);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(5,150,105,0.12);
}
.nav-item.active::before {
  content: ''; position: absolute; right: 0; top: 15%; bottom: 15%;
  width: 3.5px; background: var(--sidebar-accent); border-radius: 2px 0 0 2px;
  box-shadow: 0 0 8px rgba(5,150,105,0.3);
}
.nav-item.active svg, .nav-item.active i {
  color: var(--primary);
}

.sidebar-footer-card {
  margin: auto 12px 16px;
  background: linear-gradient(135deg, var(--primary-subtle) 0%, #f0fdfa 100%);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md); padding: 14px;
}

.exam-readiness-bar { height: 6px; background: rgba(5,150,105,0.12); border-radius: var(--radius-full); margin: 8px 0 4px; overflow: hidden; }
.exam-readiness-fill { height: 100%; background: linear-gradient(90deg, #059669, #34d399); border-radius: var(--radius-full); transition: width 1s ease; }

/* STAGE */
.academy-stage { flex: 1; overflow-y: auto; background: var(--bg-body); }

.view-panel { display: none; flex-direction: column; min-height: 100%; animation: fadeSlideIn 0.25s ease; }
.view-panel.active { display: flex; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.stage-header {
  background: var(--bg-surface); border-bottom: 1px solid var(--border-color);
  padding: 18px 28px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.stage-title-group h2 { font-size: 17px; font-weight: 900; color: var(--text-main); margin-bottom: 3px; }
.stage-title-group p { font-size: 12px; color: var(--text-muted); line-height: 1.5; max-width: 600px; }
.stage-content { padding: 24px 28px; flex: 1; }

/* CARDS */
.knowledge-card {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 20px;
  transition: all var(--transition-fast); position: relative; overflow: hidden;
}
.knowledge-card::before {
  content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-blue) 100%);
  opacity: 0; transition: var(--transition-fast);
}
.knowledge-card:hover { border-color: rgba(5,150,105,0.3); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.knowledge-card:hover::before { opacity: 1; }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(5,150,105,0.25);
}
.stat-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.stat-card:hover .stat-icon-wrap { transform: scale(1.06); }
.stat-info { display: flex; flex-direction: column; gap: 3px; }
.stat-info h5 { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.stat-value {
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-en), var(--font-ar);
  line-height: 1.2;
}

/* CBT EXAM MODAL — OFFICIAL PEARSON VUE / NCEES LIGHT CBT THEME */
#cbtExamModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  background: #f1f5f9;
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.exam-topbar {
  height: 60px; background: #0f2942; border-bottom: 2px solid #0284c7;
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.exam-title-chip {
  font-size: 14px; font-weight: 800; color: #ffffff;
  font-family: 'Outfit', sans-serif; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.exam-timer-wrap {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px; border-radius: var(--radius-full);
}

#cbtTimerDisplay {
  font-size: 18px; font-weight: 900; color: #ffffff;
  font-family: var(--font-mono); letter-spacing: 1px;
  min-width: 70px; text-align: center; transition: color 0.3s;
}

.timer-warning { color: #f59e0b !important; }
.timer-danger { color: #f87171 !important; animation: timer-flash 1s infinite; }
@keyframes timer-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.exam-progress-bar-wrap { height: 4px; background: rgba(0,0,0,0.06); flex-shrink: 0; }
.exam-progress-bar-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #059669); transition: width 0.4s ease; }

.exam-body {
  display: flex;
  flex: 1 1 0%;
  min-height: 0 !important;
  height: 0;
  overflow: hidden;
  background: #f8fafc;
}

.exam-question-panel {
  flex: 1 1 0%;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 18px 32px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
  direction: ltr !important;
  text-align: left !important;
  background: #f8fafc;
}

.q-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  direction: ltr !important;
  justify-content: flex-start;
}

.q-topic-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; padding: 4px 12px;
  border-radius: 16px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
  direction: ltr !important; font-family: 'Outfit', sans-serif;
}

.q-difficulty-badge {
  display: none !important;
  /* Difficulty levels removed from exam interface per admin requirement */
}

.q-handbook-ref {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; color: #047857;
  background: #ecfdf5; border: 1px solid #a7f3d0;
  padding: 4px 10px; border-radius: 16px; font-family: var(--font-mono);
  direction: ltr !important; transition: var(--transition-fast);
}
.q-handbook-ref:hover { background: #d1fae5; border-color: #6ee7b7; color: #059669; }

/* Final numbered step in a solution's step-by-step breakdown — visually
   emphasized so the actual answer doesn't blend in with the intermediate
   working steps above it. */
.fe-step-final { background: #ecfdf5 !important; border-color: #a7f3d0 !important; }
.fe-step-final .fe-latex-step { font-weight: 800 !important; }

.q-number-display {
  font-size: 13.5px; font-weight: 800; color: #0f2942;
  font-family: 'Outfit', sans-serif;
  direction: ltr !important;
  text-align: left !important;
  letter-spacing: 0.3px;
}

.q-text {
  font-size: 15px; font-weight: 600; color: #0f172a; line-height: 1.65;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: ltr !important;
  text-align: left !important;
  user-select: text;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

.q-arabic-translation-box {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #14532d;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  direction: rtl !important;
  text-align: right !important;
  box-shadow: 0 1px 4px rgba(5,150,105,0.06);
  animation: slideDownIn 0.2s ease;
}

.q-diagram-box {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 14px 0 18px 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  overflow-x: auto;
  direction: ltr !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  /* Prevent SVG from bleeding outside the box */
  contain: layout paint;
  position: relative;
  min-height: 80px;
}
.q-diagram-box svg {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  /* Ensure SVG viewBox is respected and doesn't overflow */
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.q-options-list {
  display: flex; flex-direction: column; gap: 8px;
  direction: ltr !important;
}

.cbt-option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: #ffffff; border: 1.5px solid #cbd5e1;
  border-radius: 8px; cursor: pointer; transition: all 0.15s ease;
  direction: ltr !important;
  text-align: left !important;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.cbt-option-item:hover {
  background: #f8fafc; border-color: #2563eb;
  transform: translateX(3px); box-shadow: 0 3px 10px rgba(37,99,235,0.08);
}
.cbt-option-item.selected {
  background: #eff6ff; border-color: #2563eb;
  border-width: 1.5px;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.18), 0 2px 8px rgba(37,99,235,0.1);
}

.cbt-option-letter {
  width: 28px; height: 28px; border-radius: 6px;
  background: #f1f5f9; color: #1e293b; border: 1.5px solid #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; flex-shrink: 0;
  transition: all 0.15s ease; font-family: 'Outfit', sans-serif;
}
.cbt-option-item.selected .cbt-option-letter {
  background: #2563eb; color: #ffffff; border-color: #2563eb;
  box-shadow: 0 1px 4px rgba(37,99,235,0.35);
}

.cbt-option-text {
  flex: 1; color: #1e293b; font-size: 14.5px; font-weight: 600; line-height: 1.5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: ltr !important;
  text-align: left !important;
  letter-spacing: normal !important;
}
.cbt-option-item.selected .cbt-option-text {
  color: #1d4ed8; font-weight: 700;
}

/* ═══════════════ QUESTION LIST PANEL (قائمة الأسئلة التفاعلية) ═══════════════ */
.exam-nav-list-panel {
  width: 290px;
  background: #ffffff;
  border-left: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  height: 100%;
  box-shadow: -2px 0 10px rgba(0,0,0,0.02);
}

.exam-nav-list-header {
  padding: 12px 16px;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  flex-shrink: 0;
  font-family: 'Outfit', var(--font-ar);
}

.exam-nav-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.exam-nav-list-items::-webkit-scrollbar { width: 4px; }
.exam-nav-list-items::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.cbt-nav-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Outfit', sans-serif;
  text-decoration: none;
  color: #334155;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.cbt-nav-list-row:hover {
  background: #f8fafc;
  border-color: #2563eb;
  transform: translateX(2px);
}
.cbt-nav-list-row.current {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  border-left: 4px solid #2563eb !important;
  box-shadow: 0 2px 8px rgba(37,99,235,0.15);
}
.cbt-nav-list-row.answered {
  background: #f0fdf4;
  border-color: #a7f3d0;
}
.cbt-nav-list-row.flagged {
  background: #fffbeb;
  border-color: #fde68a;
}

.list-row-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
}
.cbt-nav-list-row.current .list-row-num {
  background: #2563eb;
  color: #ffffff;
}

.list-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.list-row-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row-topic {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-status {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.status-answered { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.status-flagged { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-unanswered { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }

.exam-nav-list-footer {
  padding: 10px 14px;
  border-top: 1.5px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}
.btn-submit-list {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: 'Outfit', var(--font-ar);
  box-shadow: 0 2px 6px rgba(5,150,105,0.25);
}
.btn-submit-list:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ═══════════════ EXAM BODY LAYOUT ═══════════════ */
.exam-body {
  display: flex;
  flex: 1 1 0%;
  min-height: 0 !important;
  height: 0;
  overflow: hidden;
  background: #f8fafc;
}

.exam-question-panel {
  flex: 1 1 0%;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 20px 32px 30px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  direction: ltr !important;
  text-align: left !important;
  background: #f8fafc;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.exam-question-panel::-webkit-scrollbar { width: 6px; }
.exam-question-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }

.exam-question-footer {
  position: relative;
  z-index: 999;
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  padding: 0 24px;
  background: #ffffff;
  border-top: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0 !important;
  gap: 12px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

.exam-nav-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 8px;
  font-weight: 800; font-size: 13.5px; cursor: pointer;
  transition: all 0.2s ease; border: 1.5px solid transparent;
  font-family: 'Outfit', var(--font-ar);
}
.exam-nav-btn.secondary {
  background: #f1f5f9; border-color: #cbd5e1; color: #334155;
}
.exam-nav-btn.secondary:hover {
  background: #e2e8f0; border-color: #94a3b8; color: #0f172a; transform: translateY(-1px);
}
.exam-nav-btn.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); color: #ffffff;
  box-shadow: 0 3px 12px rgba(37,99,235,0.25);
}
.exam-nav-btn.primary:hover {
  filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.exam-nav-btn.danger {
  background: #fee2e2; border-color: #fca5a5; color: #b91c1c;
}
.exam-nav-btn.danger:hover {
  background: #fecaca; color: #991b1b;
}

.exam-flag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px;
  font-weight: 800; font-size: 13px; cursor: pointer;
  background: #f8fafc; border: 1.5px solid #cbd5e1; color: #475569;
  transition: all 0.2s ease; font-family: 'Outfit', var(--font-ar);
}
.exam-flag-btn:hover { border-color: #f59e0b; color: #d97706; }
.exam-flag-btn.flagged {
  background: #fffbeb; border-color: #f59e0b; color: #b45309;
  box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}

/* SCORE REPORT MODAL — AUTHENTIC NCEES DIAGNOSTIC REPORT */
#cbtReportModal {
  position: fixed; inset: 0;
  background: rgba(11,17,32,0.88); backdrop-filter: blur(8px);
  z-index: 20000; display: none; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}

.ncees-report-card {
  background: #ffffff; border-radius: 12px;
  width: 95%; max-width: 920px; max-height: 94vh; overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35); animation: popIn 0.3s ease-out;
  padding: 36px 40px; color: #000000; font-family: 'Inter', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  direction: ltr !important; text-align: left !important;
}

.ncees-header-wrap {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; border-bottom: 1px solid #e2e8f0; padding-bottom: 16px;
}

.ncees-logo-box {
  display: flex; align-items: center; gap: 12px;
}

.ncees-logo-svg {
  width: 44px; height: 44px; flex-shrink: 0;
}

.ncees-logo-text {
  font-size: 26px; font-weight: 900; color: #475569; letter-spacing: 1.5px;
  font-family: 'Outfit', -apple-system, sans-serif;
}

.ncees-exam-title {
  font-size: 14px; font-weight: 800; color: #0f172a; margin-top: 4px;
}

.ncees-examinee-info {
  text-align: right; font-size: 13px; font-weight: 700; color: #1e293b; line-height: 1.6;
}

.ncees-examinee-name {
  font-size: 14px; font-weight: 800; color: #0f172a;
}

.ncees-examinee-date {
  font-size: 12.5px; color: #475569; font-weight: 600;
}

/* NCEES Diagnostic Table */
.ncees-table {
  width: 100%; border-collapse: collapse; margin-bottom: 24px;
  border: 1.5px solid #000000; font-size: 12px;
}

.ncees-table th, .ncees-table td {
  border: 1px solid #000000; padding: 6px 10px;
}

.ncees-table th {
  background: #ffffff; color: #000000; font-weight: 800; text-align: center;
  line-height: 1.3;
}

.ncees-table td.topic-name-cell {
  font-weight: 700; color: #000000; text-align: left;
}

.ncees-table td.num-cell {
  text-align: center; font-weight: 700; font-family: 'Outfit', sans-serif; font-size: 13px;
}

.ncees-table td.score-cell {
  text-align: center; font-weight: 800; font-family: 'Outfit', sans-serif; font-size: 13px;
}

.ncees-scale-container {
  position: relative; width: 100%; height: 16px; background: #d4d4d8;
  border-radius: 8px; overflow: visible; display: flex; align-items: center;
}

.ncees-pass-avg-line {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  border-right: 2px dashed #000000; z-index: 2;
}

.ncees-pass-avg-label {
  position: absolute; top: -14px; font-size: 12px; font-weight: 900; color: #000000;
  transform: translateX(-50%);
}

.ncees-user-score-line {
  position: absolute; top: -3px; bottom: -3px; width: 3.5px; background: #000000;
  z-index: 3; border-radius: 1px;
}

.ncees-user-score-box {
  position: absolute; height: 100%; background: #ffffff;
  border-radius: 6px; z-index: 1;
}

.ncees-actions-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-top: 1.5px solid #e2e8f0; padding-top: 20px;
}

@media print {
  body * { visibility: hidden !important; }
  #cbtReportModal, #cbtReportModal * { visibility: visible !important; }
  #cbtReportModal { position: absolute; left: 0; top: 0; width: 100%; height: auto; background: none; padding: 0; }
  .ncees-report-card { width: 100% !important; max-width: 100% !important; box-shadow: none !important; padding: 10px !important; }
  .ncees-actions-bar { display: none !important; }
}

/* CHECKOUT MODAL */
#academyCheckoutModal {
  position: fixed; inset: 0; background: rgba(11,17,32,0.8);
  backdrop-filter: blur(8px); z-index: 15000;
  display: none; align-items: center; justify-content: center; padding: 20px;
}

/* FORMULA/HANDBOOK CARDS */
.formula-card {
  background: var(--sidebar-bg); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md); padding: 18px; transition: var(--transition-fast);
}
.formula-card:hover { border-color: rgba(56,189,248,0.3); box-shadow: 0 4px 16px rgba(2,132,199,0.1); }
.formula-display {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm); padding: 12px; font-family: var(--font-mono);
  color: #34d399; font-size: 13px; direction: ltr; text-align: left; overflow-x: auto;
  margin: 10px 0; line-height: 1.7;
}

.handbook-search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface); border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md); padding: 10px 16px; margin-bottom: 20px; transition: var(--transition-fast);
}
.handbook-search-wrap:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(2,132,199,0.1); }
.handbook-search-wrap input { flex: 1; border: none; outline: none; font-size: 13.5px; font-family: var(--font-ar); color: var(--text-main); background: transparent; }

/* CALCULATOR (DRAGGABLE & COMPACT) */
.calc-floating {
  position: fixed; top: 75px; right: 260px; left: auto; width: 340px;
  background: #1e293b; border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg); box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  z-index: 100005 !important; overflow: hidden;
  animation: slideDownIn 0.2s ease; direction: ltr; display: none;
  user-select: none;
}
@keyframes slideDownIn { from { opacity: 0; transform: translateY(-10px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.calc-header {
  background: #0f172a; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  cursor: grab;
  user-select: none;
}
.calc-header:active { cursor: grabbing; }
.calc-title { font-size: 12px; font-weight: 800; color: #cbd5e1; font-family: var(--font-en); pointer-events: none; }

.calc-status-bar {
  background: #0b1120; padding: 5px 14px 0; display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
}
.calc-status-bar span { padding: 2px 6px; border-radius: 4px; }
#calcModeBadge { background: rgba(56,189,248,0.15); color: #38bdf8; cursor: pointer; }
#calcMemBadge { background: rgba(167,139,250,0.15); color: #a78bfa; }
#calc2ndBadge { background: rgba(52,211,153,0.15); color: #34d399; }

.calc-display-wrap { background: #0b1120; padding: 6px 14px 12px; min-height: 46px; display: flex; align-items: flex-end; justify-content: flex-end; }
#calcDisplay { font-size: 20px; font-weight: 700; color: #ffffff; font-family: var(--font-mono); word-break: break-all; text-align: right; max-width: 100%; }

.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: rgba(255,255,255,0.05); }
.calc-btn { padding: 10px 3px; border: none; font-size: 12px; font-weight: 700; cursor: pointer; transition: var(--transition-fast); font-family: var(--font-mono); display: flex; align-items: center; justify-content: center; }
.calc-btn:hover { filter: brightness(1.15); }
.calc-btn:active { filter: brightness(0.9); transform: scale(0.96); }
.calc-btn.num { background: #1e293b; color: #e2e8f0; }
.calc-btn.op { background: #2d3f55; color: #38bdf8; }
.calc-btn.fn { background: #162032; color: #a78bfa; font-size: 11px; }
.calc-btn.mem { background: #1a2740; color: #60a5fa; font-size: 10.5px; }
.calc-btn.mode { background: #1e2a44; color: #fbbf24; font-size: 10px; }
.calc-btn.mode.active { background: #b45309; color: #ffffff; }
.calc-btn.eq { background: #059669; color: #ffffff; }
.calc-btn.clear { background: #7f1d1d; color: #fca5a5; }
.calc-btn.del { background: #1c2a3f; color: #f87171; }

/* NOTE — DRAGGABLE DRAW & WRITE SCRATCH WORKSPACE */
.notes-floating {
  position: fixed; top: 75px; right: 620px; left: auto; width: 380px; height: 480px;
  background: #1e293b; border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg); box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  z-index: 100006 !important; overflow: hidden;
  animation: slideDownIn 0.2s ease; direction: ltr;
  display: none; flex-direction: column; user-select: none;
}
.notes-header {
  background: #0f172a; padding: 10px 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.07); cursor: grab; user-select: none;
}
.notes-header:active { cursor: grabbing; }
.notes-title { font-size: 12px; font-weight: 800; color: #cbd5e1; font-family: var(--font-en); pointer-events: none; }
.notes-icon-btn { background: rgba(255,255,255,0.1); border: none; color: #cbd5e1; cursor: pointer; font-size: 13px; line-height: 1; width: 22px; height: 22px; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.notes-icon-btn:hover { background: rgba(255,255,255,0.18); }

.notes-tabs { display: flex; flex-shrink: 0; background: #0b1120; }
.notes-tab {
  flex: 1; padding: 9px 0; background: transparent; border: none; border-bottom: 2px solid transparent;
  color: #94a3b8; font-size: 11.5px; font-weight: 700; font-family: var(--font-ar); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px; transition: var(--transition-fast);
}
.notes-tab:hover { color: #e2e8f0; }
.notes-tab.active { color: #34d399; border-bottom-color: #059669; }

.notes-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.notes-toolbar {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; background: #0b1120; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.notes-tool-group { display: flex; gap: 4px; }
.notes-tool-btn {
  width: 26px; height: 26px; border-radius: 6px; background: #1c2a3f; border: 1px solid transparent;
  color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.notes-tool-btn:hover { background: #24344c; color: #cbd5e1; }
.notes-tool-btn.active { background: rgba(5,150,105,0.2); border-color: #059669; color: #34d399; }
.notes-color-group { display: flex; gap: 5px; align-items: center; }
.notes-color-dot { width: 15px; height: 15px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-sizing: border-box; }
.notes-color-dot.active { border-color: #ffffff; }
.notes-size-range { width: 64px; accent-color: #059669; }
.notes-action-group { display: flex; gap: 4px; margin-left: auto; }
.notes-action-group button { width: 26px; height: 26px; border-radius: 6px; background: #1c2a3f; border: none; color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.notes-action-group button:hover { background: #7f1d1d; color: #fca5a5; }

.notes-canvas-wrap { flex: 1; min-height: 0; background: #ffffff; }
#notesCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

.notes-textarea {
  flex: 1; width: 100%; border: none; outline: none; resize: none; box-sizing: border-box;
  padding: 14px; background: #ffffff; color: #1e293b; font-size: 13px; line-height: 1.7;
  font-family: var(--font-mono); direction: rtl;
}

@media (max-width: 900px) {
  .notes-floating { right: 16px; left: 16px; width: auto; }
}

/* HISTORY TABLE */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th { background: #f8fafc; color: #475569; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 12px 16px; text-align: right; border-bottom: 2px solid var(--border-color); white-space: nowrap; }
.history-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; transition: background var(--transition-fast); }
.history-table tr:hover td { background: #f8fafc; }
.history-table tr:last-child td { border-bottom: none; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 800; font-size: 13px; cursor: pointer; transition: all var(--transition-fast); border: none; font-family: var(--font-ar); white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #ffffff; box-shadow: var(--shadow-green); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }
.btn-blue { background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); color: #ffffff; box-shadow: 0 4px 14px rgba(2,132,199,0.3); }
.btn-blue:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 11.5px; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.badge-green { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-red { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* UTILITIES */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-auto-lg { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(5,150,105,0.15); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--border-color); margin: 20px 0; }

/* RESPONSIVE */
.dashboard-mastery-split {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 960px) {
  .dashboard-mastery-split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 220px; }
  .exam-nav-panel { display: none; }
  .stage-content { padding: 16px; }
}
@media (max-width: 600px) {
  .academy-sidebar { display: none; }
  .brand-badge-logo { width: auto; }
}

/* ══════════════════════════════════════════════════════════════════════
   REFERENCE HANDBOOK — black & white, print/PDF-style document
   ══════════════════════════════════════════════════════════════════════ */
.hb-toolbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 2;
  background: #1a1a1a; color: #ffffff; display: flex; align-items: center;
  gap: 16px; padding: 0 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.hb-toolbar-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.hb-toolbar-search { flex: 1; display: flex; align-items: center; gap: 8px; background: #2e2e2e; border-radius: 6px; padding: 6px 12px; max-width: 420px; }
.hb-toolbar-search input { flex: 1; background: transparent; border: none; outline: none; color: #ffffff; font-size: 12.5px; font-family: inherit; }
.hb-toolbar-search input::placeholder { color: #9a9a9a; }
#handbookResultCount { font-size: 10.5px; color: #9a9a9a; font-weight: 700; white-space: nowrap; }
.hb-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.hb-toolbar-actions button { display: flex; align-items: center; gap: 6px; background: #2e2e2e; border: 1px solid #444; color: #ffffff; padding: 7px 12px; border-radius: 6px; font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.hb-toolbar-actions button:hover { background: #3c3c3c; }

.hb-doc-scroll { position: absolute; inset: 0; top: 52px; overflow-y: auto; padding: 28px 16px 60px; }
.hb-doc { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; direction: ltr; }

/* Minimized handbook — collapses the full-screen modal into a small
   draggable floating panel (drag via the toolbar) so a learner can keep
   searching/reading the handbook while the exam question stays visible
   behind it, the same way the calculator already floats. Inline positioning
   styles on #handbookModal (position:fixed; inset:0) need !important here
   to be overridden by a class. */
#handbookModal.hb-minimized {
  inset: auto !important; right: 22px !important; bottom: 22px !important; top: auto !important; left: auto !important;
  width: 500px !important; height: 620px !important; min-width: 340px; min-height: 360px;
  max-width: 96vw; max-height: 90vh;
  border-radius: 12px; overflow: hidden; resize: both;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.12);
}
#handbookModal.hb-minimized .hb-toolbar { cursor: grab; border-radius: 12px 12px 0 0; }
#handbookModal.hb-minimized .hb-toolbar:active { cursor: grabbing; }
#handbookModal.hb-minimized .hb-toolbar-title span { display: none; }
#handbookModal.hb-minimized .hb-toolbar-search { max-width: none; }
#handbookModal.hb-minimized #hbMinimizeBtn span { display: none; }
#handbookModal.hb-minimized .hb-doc-scroll { padding: 14px; }
#handbookModal.hb-minimized .hb-doc { max-width: none; gap: 14px; }

/* Compact reflow — the document's two-column, generously-padded print
   layout doesn't fit a ~500px floating panel, so minimized mode collapses
   it to one column with tighter spacing and a smaller type scale instead
   of shrinking everything proportionally (which just makes the math
   illegible). Long equations get their own horizontal scrollbar rather
   than being allowed to blow out the layout. */
#handbookModal.hb-minimized .hb-page {
  box-shadow: none; min-height: 0; padding: 20px 18px; border-width: 1px; outline: none; font-size: 12.5px;
}
#handbookModal.hb-minimized .hb-chapter-body { column-count: 1 !important; }
#handbookModal.hb-minimized .hb-chapter-header { gap: 10px; padding: 10px 0; margin-bottom: 14px; }
#handbookModal.hb-minimized .hb-chapter-icon { width: 30px; height: 30px; border-radius: 7px; }
#handbookModal.hb-minimized .hb-chapter-icon svg { width: 15px; height: 15px; }
#handbookModal.hb-minimized .hb-chapter-title { font-size: 16px; }
#handbookModal.hb-minimized .hb-chapter-title-ar { font-size: 12px; }
#handbookModal.hb-minimized .hb-chapter-num { font-size: 9.5px; letter-spacing: 1px; }
#handbookModal.hb-minimized .hb-formula-item { margin-bottom: 14px; padding-bottom: 12px; }
#handbookModal.hb-minimized .hb-katex-line .katex { font-size: 0.85em; }
#handbookModal.hb-minimized .hb-formula-box { overflow-x: auto; padding-bottom: 2px; }
#handbookModal.hb-minimized .hb-page-footer { display: none; }
#handbookModal.hb-minimized .hb-cover, #handbookModal.hb-minimized .hb-copyright-page { padding-top: 26px; }
#handbookModal.hb-minimized .hb-cover-title { font-size: 22px; }
#handbookModal.hb-minimized .hb-cover-stats { transform: scale(0.85); }
#handbookModal.hb-minimized .hb-toc-name-ar { display: none; }

.hb-page {
  background: #ffffff; color: #000000; width: 100%; min-height: 1050px;
  padding: 60px 56px; box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  font-family: 'Times New Roman', Georgia, serif; position: relative; box-sizing: border-box;
  direction: ltr; text-align: left;
  border: 1.5px solid #111;
  outline: 1px solid #111; outline-offset: -8px;
}

/* Cover page v2 — "modern editorial" redesign. All decorative art is either
   a soft background blob (behind everything, no hard edges to collide with
   text) or contained in a small fixed corner box — never a full-bleed
   graphic with content-dependent overlap risk. Green is this document's one
   accent color; it appears at full strength here and as tasteful accents
   through the rest of the book, while page content stays black & white. */
.hb-cover { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; border-color: #059669; outline-color: #a7f3d0; position: relative; overflow: hidden; padding-top: 54px; }
.hb-cover-blob {
  position: absolute; top: -160px; right: -160px; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(16,185,129,0.16), rgba(5,150,105,0.03) 70%);
  pointer-events: none; z-index: 0;
}
.hb-cover-corner-art { position: absolute; left: 30px; bottom: 30px; width: 130px; height: auto; opacity: 0.4; pointer-events: none; z-index: 0; }
.hb-cover-masthead { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 56px; width: 100%; }
.hb-cover-mast-rule { flex: 1; max-width: 90px; height: 1px; background: #a7f3d0; }
.hb-cover-logo-img { height: 22px; width: auto; object-fit: contain; }
.hb-cover-mast-text { font-size: 9.5px; font-weight: 800; letter-spacing: 2.5px; color: #64748b; white-space: nowrap; }
.hb-cover-emblem { margin-bottom: 22px; position: relative; z-index: 1; }
.hb-cover-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 3px; color: #059669; margin-bottom: 14px; position: relative; z-index: 1; }
.hb-cover-title { font-size: 33px; font-weight: 700; margin: 0 0 12px; letter-spacing: 0.3px; line-height: 1.18; position: relative; z-index: 1; }
.hb-cover-title-ar { font-size: 18px; font-weight: 700; margin: 0; direction: rtl; color: #047857; position: relative; z-index: 1; }
.hb-cover-diamond-rule { display: flex; align-items: center; gap: 10px; margin: 26px 0; position: relative; z-index: 1; }
.hb-cover-diamond-rule span { width: 60px; height: 1px; background: #a7f3d0; }
.hb-cover-diamond-rule i { width: 7px; height: 7px; background: #059669; transform: rotate(45deg); display: inline-block; }
.hb-cover-sub { font-size: 13.5px; color: #333; margin-bottom: 40px; max-width: 420px; line-height: 1.85; direction: rtl; text-align: center; position: relative; z-index: 1; }
.hb-cover-stats { display: flex; gap: 0; position: relative; z-index: 1; background: #059669; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 22px rgba(5,150,105,0.22); }
.hb-cover-stat { padding: 14px 26px; text-align: center; border-right: 1px solid rgba(255,255,255,0.25); }
.hb-cover-stat:last-child { border-right: none; }
.hb-cover-stat strong { display: block; font-size: 15px; font-weight: 800; color: #ffffff; white-space: nowrap; }
.hb-cover-stat span { display: block; font-size: 8.5px; color: #d1fae5; letter-spacing: 0.6px; text-transform: uppercase; margin-top: 3px; }
.hb-cover-footline { position: absolute; bottom: 30px; left: 0; right: 0; font-size: 9.5px; color: #94a3b8; letter-spacing: 0.5px; z-index: 1; }

/* Copyright / legal-notice page — a formal colophon page, separate from the
   cover, so cover art stays uncluttered */
.hb-copyright-page { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 90px; }
.hb-copyright-mark { font-size: 40px; font-weight: 700; color: #059669; line-height: 1; margin-bottom: 18px; }
.hb-copyright-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.hb-copyright-title-ar { font-size: 14px; font-weight: 600; color: #047857; direction: rtl; margin-bottom: 20px; }
.hb-copyright-rule { width: 70px; height: 2px; background: #059669; margin-bottom: 40px; }
.hb-copyright-clauses { max-width: 520px; width: 100%; }
.hb-copyright-clause { text-align: right; direction: rtl; padding: 18px 0; border-top: 1px solid #e5e5e5; }
.hb-copyright-clause:first-child { border-top: none; padding-top: 0; }
.hb-copyright-clause-label { font-size: 9.5px; font-weight: 800; letter-spacing: 1.5px; color: #059669; text-transform: uppercase; margin-bottom: 8px; direction: ltr; text-align: right; }
.hb-copyright-clause p { font-size: 12px; line-height: 1.95; color: #222; margin: 0; }
.hb-copyright-footer { margin-top: auto; padding-top: 30px; font-size: 10px; color: #94a3b8; letter-spacing: 0.5px; }

/* Table of contents */
.hb-toc-title { font-size: 22px; font-weight: 700; border-bottom: 3px solid #000; padding-bottom: 12px; margin-bottom: 28px; }
.hb-toc-row { display: flex; align-items: baseline; gap: 8px; padding: 9px 4px 9px 8px; border-bottom: 1px dotted #999; border-left: 2px solid transparent; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease; }
.hb-toc-row:hover { background: #fafafa; border-left-color: #059669; }
.hb-toc-icon { width: 13px; height: 13px; color: #059669; flex-shrink: 0; align-self: center; }
.hb-toc-num { font-weight: 700; width: 22px; flex-shrink: 0; }
.hb-toc-name { flex-shrink: 0; font-weight: 600; }
.hb-toc-name-ar { flex-shrink: 0; direction: rtl; color: #333; }
.hb-toc-fill { flex: 1; border-bottom: 1px dotted #999; margin: 0 6px; transform: translateY(-4px); }
.hb-toc-bar { display: inline-block; width: 56px; height: 5px; background: #e5e5e5; border-radius: 3px; overflow: hidden; flex-shrink: 0; align-self: center; }
.hb-toc-bar span { display: block; height: 100%; background: linear-gradient(90deg,#10b981,#059669); border-radius: 3px; }
.hb-toc-count { font-size: 11px; color: #555; flex-shrink: 0; }
.hb-toc-page { font-size: 11px; color: #000; font-weight: 700; flex-shrink: 0; width: 22px; text-align: right; }

/* Chapter pages — two-column layout like the real NCEES handbook, with a
   green icon chip identifying each knowledge area at a glance */
.hb-chapter-header { border-bottom: 3px solid #000; border-top: 3px solid #059669; padding: 14px 0; margin-bottom: 22px; display: flex; align-items: center; gap: 14px; }
.hb-chapter-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 9px; background: #059669; color: #fff; display: flex; align-items: center; justify-content: center; }
.hb-chapter-icon svg { width: 20px; height: 20px; }
.hb-chapter-header-text { flex: 1; min-width: 0; }
.hb-chapter-num { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: #444; }
.hb-chapter-title { font-size: 22px; font-weight: 700; margin-top: 4px; }
.hb-chapter-title-ar { font-size: 15px; font-weight: 600; direction: rtl; text-align: right; color: #333; margin-top: 2px; }

.hb-chapter-body { column-count: 2; column-gap: 36px; }

.hb-formula-item { break-inside: avoid; page-break-inside: avoid; margin-bottom: 20px; padding-bottom: 18px; padding-left: 10px; border-bottom: 1px solid #e5e5e5; border-left: 2px solid #d1fae5; transition: background-color 0.4s ease; }
.hb-formula-item:last-child { border-bottom: none; }
.hb-formula-item-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.hb-formula-item-num { font-size: 9.5px; font-weight: 700; background: #059669; color: #fff; border-radius: 3px; padding: 2px 6px; flex-shrink: 0; letter-spacing: 0.3px; }
.hb-formula-item-title { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.hb-formula-flash { background-color: #d1fae5; border-radius: 4px; }

/* Formula display: real KaTeX-typeset math, no border box (matches the real
   handbook, which never boxes equations — just clean indented display math) */
.hb-formula-box { margin: 0 0 8px; direction: ltr; text-align: left; overflow-x: auto; }
.hb-katex-line { margin: 5px 0; }
.hb-katex-line .katex-display { margin: 0; text-align: left; }
.hb-katex-line .katex { font-size: 1em; }

/* Nomenclature list — hanging-indent "symbol = definition" rows, same
   convention the real NCEES handbook uses for variable definitions */
.hb-vars-list { margin: 0 0 8px; }
.hb-vars-row { display: flex; align-items: baseline; gap: 6px; font-size: 10.5px; line-height: 1.55; padding: 1px 0; }
.hb-vars-sym { font-style: italic; flex-shrink: 0; min-width: 20px; }
.hb-vars-eq { flex-shrink: 0; color: #059669; font-weight: 700; }
.hb-vars-def { color: #333; direction: ltr; text-align: left; }

/* Prose entries (ethics canons, licensure, contracts) — no math typesetting */
.hb-prose-box { margin: 0 0 8px; }
.hb-prose-line { font-size: 11px; line-height: 1.65; margin-bottom: 5px; direction: ltr; text-align: left; }

.hb-formula-desc { font-size: 10.5px; color: #222; line-height: 1.55; direction: rtl; text-align: right; }

/* Solution-approach note — brief procedural guidance for multi-step formulas,
   visually distinct (dashed top rule) from the plain description above it */
.hb-approach-box { font-size: 10px; color: #333; line-height: 1.6; direction: rtl; text-align: right; margin-top: 5px; padding: 5px 8px 5px 0; border-top: 1px dashed #999; border-right: 2px solid #059669; }
.hb-approach-label { font-weight: 700; color: #047857; }

.hb-diagram-box { display: flex; justify-content: center; align-items: center; margin: 8px 0; padding: 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.hb-diagram-box svg { display: block; }
#handbookModal.hb-minimized .hb-diagram-box { padding: 4px; }
#handbookModal.hb-minimized .hb-diagram-box svg { max-width: 220px; }

.hb-page-footer { position: absolute; bottom: 24px; left: 56px; right: 56px; display: flex; justify-content: space-between; font-size: 10px; color: #555; border-top: 1px solid #ccc; padding-top: 8px; }
.hb-page-footer-num { font-weight: 700; color: #000; }

@media (max-width: 900px) {
  .hb-chapter-body { column-count: 1; }
}

mark.hb-hl { background: #059669; color: #fff; padding: 0 2px; border-radius: 2px; }

@media print {
  body * { visibility: hidden; }
  #handbookModal, #handbookModal * { visibility: visible; }
  .handbook-no-print { display: none !important; }
  #handbookModal { position: absolute; inset: 0; background: #fff; }
  .hb-doc-scroll { position: static; overflow: visible; padding: 0; }
  .hb-doc { max-width: none; gap: 0; }
  .hb-page { box-shadow: none; min-height: 100vh; page-break-after: always; }
  .hb-page:last-child { page-break-after: auto; }
}

@media (max-width: 700px) {
  .hb-page { padding: 40px 24px; }
  .hb-toolbar-title span { display: none; }
  .hb-toolbar-actions button span { display: none; }
  .hb-cover-title { font-size: 25px; }
  .hb-cover-stats { flex-direction: column; width: 100%; max-width: 260px; }
  .hb-cover-stat { border-right: none; border-bottom: 1px solid #a7f3d0; }
  .hb-cover-stat:last-child { border-bottom: none; }
  .hb-toc-name-ar, .hb-toc-bar { display: none; }
  .hb-chapter-header { flex-wrap: wrap; }
}

