/* styles/academy.css
   AccruFlow Academy — Extended styles.
   Loaded only by index.html. Extends main.css without modifying it.
   Covers: gold theme tokens, sidebar, home view, settings panel, Pro gating, certificates.
*/

/* ─────────────────────────────────────────────────────────────────────────────
   ACADEMY GOLD THEME — scoped to index.html (academy.css not loaded by app.html)
   Replaces the app-wide orange accent with professional warm gold.
   Navy remains the dominant base; gold is used as accent/highlight/active only.
   ───────────────────────────────────────────────────────────────────────────── */

body {
  --accent-orange:       #C9A84C;          /* Warm professional gold */
  --accent-orange-hover: #B8942A;          /* Darker gold — hover/pressed */
  --gold-glow:    rgba(201, 168, 76, 0.1);
  --gold-border:  rgba(201, 168, 76, 0.22);
}

/* Gold recalibration in dark mode — slightly brighter to stay legible */
[data-theme="dark"] {
  --accent-orange:       #D4AF50;
  --accent-orange-hover: #C9A84C;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR — Premium navy gradient + gold active state
   ───────────────────────────────────────────────────────────────────────────── */

.sidebar {
  background: linear-gradient(175deg, #06101D 0%, #0B1A32 55%, #091527 100%);
  border-right: 1px solid rgba(201, 168, 76, 0.08);
}

/* Gold active nav item */
.nav-item.active {
  background: rgba(201, 168, 76, 0.1);
  color: #C9A84C;
}

.nav-item.active svg { color: #C9A84C; }

/* User avatar gradient */
.avatar {
  background: linear-gradient(135deg, #C9A84C 0%, #B8942A 100%);
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.25);
}

/* User name gold */
.user-name { color: #C9A84C; }

/* Sidebar footer area — slightly lighter separation */
.sidebar-footer {
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOGO MARK — Two-line brand treatment
   ───────────────────────────────────────────────────────────────────────────── */

.sidebar-logo {
  padding: 28px 22px;
  gap: 14px;
  align-items: center;
}

/* Override logo icon color in main.css — gold mark */
.logo-icon { color: #C9A84C; }

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-logo-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #C9A84C;
  opacity: 0.9;
}

/* ─────────────────────────────────────────────────────────────────────────────
   KEYFRAMES
   ───────────────────────────────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

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

@keyframes rowReveal {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes dashReveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SKELETON LOADING
   ───────────────────────────────────────────────────────────────────────────── */

.skeleton-card,
.skeleton-dashboard {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.skeleton-dashboard {
  grid-column: 1 / -1;
  padding: 28px 32px;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-line.w-30 { width: 30%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-90 { width: 90%; }

/* ─────────────────────────────────────────────────────────────────────────────
   CARD + ROW ANIMATIONS
   ───────────────────────────────────────────────────────────────────────────── */

.card-animated {
  animation: cardReveal 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.row-animated {
  animation: rowReveal 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.academy-dashboard {
  animation: dashReveal 0.3s ease both;
}

/* ─────────────────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────────────────── */

.academy-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: pulse 2.5s infinite;
}

.empty-state-msg {
  font-size: 16px;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PROGRESS DASHBOARD
   ───────────────────────────────────────────────────────────────────────────── */

.academy-dashboard {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dash-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 220px;
}

.dash-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange), #f97316cc);
  color: white;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.dash-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-rank-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-dark);
}

.dash-tier-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-center {
  flex: 2;
  min-width: 200px;
}

.dash-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dash-progress-track {
  height: 8px;
  background: var(--disabled-bg);
  border-radius: 4px;
  overflow: hidden;
}

.dash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange), #f59e0b);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dash-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.dash-stat {
  text-align: center;
}

.dash-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-dark);
  line-height: 1;
  margin-bottom: 4px;
}

.dash-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dash-divider {
  width: 1px;
  height: 36px;
  background: var(--border-color);
}

.dash-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.dash-plan-badge.free {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.dash-plan-badge.pro {
  background: rgba(234, 179, 8, 0.1);
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

/* ─────────────────────────────────────────────────────────────────────────────
   COURSE CARD — PRO ENHANCEMENTS
   ───────────────────────────────────────────────────────────────────────────── */

.subject-card {
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.subject-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

.subject-card.completed {
  border-color: var(--success-green);
}

.subject-card.completed:hover {
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
}

/* Pro course — gold left accent bar */
.subject-card.pro-course {
  border-left: 3px solid rgba(234, 179, 8, 0.6);
}

.subject-card.pro-course:hover {
  border-left-color: rgba(234, 179, 8, 0.9);
  box-shadow: 0 8px 30px rgba(234, 179, 8, 0.12);
}

/* PRO badge in top-right of card */
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: rgba(234, 179, 8, 0.1);
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Fast Track / Placement Quiz bypass badge */
.fast-track-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Coming Soon badge */
.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: rgba(201, 168, 76, 0.1);
  color: #9a7a1e;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CATALOG GRID — ROW TRACK SIZING FIX
   Chrome computes near-zero intrinsic height for flex-column cards that have
   overflow:hidden, so auto grid row tracks collapse to ~50px and card content
   is entirely clipped. Fix: row 1 (progress dashboard) stays at natural height
   via grid-template-rows:auto. The 220px floor is applied directly to
   .subject-card (below) rather than to grid-auto-rows, so full-width rows
   that share the implicit row track — the "View Career Path" banner and the
   track-group headers — aren't forced to the same height and stretched into
   an awkward empty gap.
   ───────────────────────────────────────────────────────────────────────────── */

.catalog-container {
  grid-template-rows: auto;           /* row 1 = dashboard at natural height  */
  grid-auto-rows: auto;
}

.catalog-container .subject-card {
  min-height: 220px;
}

/* ── Phase F: Catalog card layout polish ────────────────────────────────────── */

/* Card title: 2-line wrap, generous line-height, dark mode color fix */
.card-title {
  line-height: 1.35;
  overflow-wrap: break-word;
  hyphens: auto;
}

[data-theme="dark"] .card-title { color: var(--text-main); }

/* Card description: slightly looser line-height, always full wrap */
.card-desc {
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Card header row: top-align when badge wraps on narrow cards, reduce bottom gap */
.card-header-row {
  align-items: flex-start;
  margin-bottom: 10px;
}

/* Subject index (badge text) — allow wrapping for long role titles */
.catalog-container .subject-index {
  white-space: normal;
  max-width: 65%;    /* leave room for PRO / Coming Soon pill */
  line-height: 1.3;
}

/* Coming Soon card state — aspirational, not disabled-looking */
.subject-card.coming-soon {
  opacity: 0.78;
  cursor: default;
  pointer-events: none;
  border-color: var(--gold-border, rgba(201,168,76,0.22));
}

.subject-card.coming-soon .card-title { color: var(--text-sub); }
.subject-card.coming-soon .progress-bar-fill { background: rgba(201,168,76,0.35); }
.subject-card.coming-soon .card-desc { opacity: 0.9; }

/* Completion checkmark overlay in top-right corner */
.card-complete-mark {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: var(--success-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

/* Card header row — badge on left, PRO chip or check on right */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LESSON ROW — PRO LOCK STATE
   ───────────────────────────────────────────────────────────────────────────── */

/* Override main.css pointer-events: none on locked — Pro-locked rows stay interactive */
.lesson-row.pro-locked {
  pointer-events: auto !important;
  opacity: 1 !important;
  background: #fffbeb;
  border-color: rgba(234, 179, 8, 0.35);
  cursor: default;
}

.lesson-row.pro-locked .lesson-row-title {
  color: var(--text-muted);
}

.pro-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 100px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* Upgrade CTA button inside pro-locked lesson rows */
.btn-pro-unlock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #1a56db, #1e3a8a);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.1px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-pro-unlock:hover {
  background: linear-gradient(135deg, #1a46cb, #1e2a7a);
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CERTIFICATE BUTTON
   ───────────────────────────────────────────────────────────────────────────── */

.btn-cert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.1px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
}

.btn-cert:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   COURSE VIEW — PRO LOCK HEADER BANNER
   ───────────────────────────────────────────────────────────────────────────── */

.pro-course-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: #fffbeb;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.pro-course-banner svg {
  flex-shrink: 0;
  color: #d97706;
}

.pro-course-banner-text {
  flex: 1;
}

.pro-course-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 2px;
}

.pro-course-banner-desc {
  font-size: 13px;
  color: #b45309;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LESSON ROW — GENERAL IMPROVEMENTS
   ───────────────────────────────────────────────────────────────────────────── */

.lesson-row {
  transition: all 0.2s ease;
}

.lesson-row.active-tier {
  background: rgba(249, 115, 22, 0.02);
}

.lesson-row.completed:hover {
  background: rgba(16, 185, 129, 0.04);
}

.lesson-row-index {
  font-family: "Inter", monospace;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Completion checkmark in row */
.row-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--success-green);
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR — PLAN INDICATOR
   ───────────────────────────────────────────────────────────────────────────── */

.sidebar-plan-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-plan-badge.free {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

.sidebar-plan-badge.pro {
  background: rgba(234, 179, 8, 0.2);
  color: #f59e0b;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .academy-dashboard {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
  }

  .dash-center {
    width: 100%;
  }

  .dash-right {
    width: 100%;
    justify-content: space-between;
  }

  .dash-divider {
    display: none;
  }

  .course-title-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pro-course-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .pro-course-banner > button {
    align-self: stretch;
    justify-content: center;
  }

  .btn-pro-unlock {
    font-size: 12px;
    padding: 7px 11px;
  }

  .lesson-row {
    padding: 12px 14px;
    gap: 10px;
  }

  .lesson-action {
    flex-shrink: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ACCESSIBILITY — FOCUS STATES
   ───────────────────────────────────────────────────────────────────────────── */

/* Remove default outline only when our custom one is in place */
.btn-pro-unlock:focus,
.btn-cert:focus {
  outline: none;
}

.btn-pro-unlock:focus-visible {
  outline: 2.5px solid #1a56db;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.15);
}

.btn-cert:focus-visible {
  outline: 2.5px solid #d97706;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

/* Subject cards used as interactive "buttons" */
.subject-card:focus-visible {
  outline: 2.5px solid var(--accent-orange, #f97316);
  outline-offset: 3px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MICRO-INTERACTIONS — PRESS / ACTIVE STATES
   ───────────────────────────────────────────────────────────────────────────── */

.btn-pro-unlock:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

.btn-cert:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.2);
}

.subject-card:active {
  transform: translateY(-1px) scale(0.99);
}

/* ─────────────────────────────────────────────────────────────────────────────
   PERFORMANCE — COMPOSITING HINTS
   Activate will-change only during hover/animation, not at rest.
   This avoids unnecessary GPU layers on page load.
   ───────────────────────────────────────────────────────────────────────────── */

.subject-card:hover,
.btn-pro-unlock:hover,
.btn-cert:hover {
  will-change: transform;
}

/* Animation elements: hint browser during the animation frame only */
.card-animated,
.row-animated,
.academy-dashboard {
  will-change: opacity, transform;
}

/* Clear will-change after animation ends — override via animation fill mode */
/* Cards/rows use animation-fill-mode: both, so they hold final state.
   We clear will-change after ~500ms (longest stagger + duration) via a
   subsequent class added by JS if needed. For now, the GPU layer cost is
   minimal since animations are short-lived (≤350ms per element). */

/* ─────────────────────────────────────────────────────────────────────────────
   DARK MODE — prefers-color-scheme: dark
   Academy (index.html) doesn't load theme-dark.css, so we define dark
   overrides here for users with system dark mode enabled.
   ───────────────────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  /* Skeleton */
  .skeleton-card,
  .skeleton-dashboard {
    background: #1e293b;
    border-color: #334155;
  }

  .skeleton-line {
    background: linear-gradient(90deg, #1e293b 25%, #2d3f55 50%, #1e293b 75%);
    background-size: 600px 100%;
  }

  /* Progress dashboard */
  .academy-dashboard {
    background: #1e293b;
    border-color: #334155;
  }

  .dash-rank-name,
  .dash-stat-value {
    color: #f1f5f9;
  }

  .dash-tier-label,
  .dash-stat-label,
  .dash-progress-label {
    color: #94a3b8;
  }

  .dash-progress-track {
    background: #334155;
  }

  .dash-divider {
    background: #334155;
  }

  .dash-plan-badge.free {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border-color: rgba(100, 116, 139, 0.3);
  }

  .dash-plan-badge.pro {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
    border-color: rgba(234, 179, 8, 0.4);
  }

  /* Pro-locked lesson rows */
  .lesson-row.pro-locked {
    background: rgba(234, 179, 8, 0.07);
    border-color: rgba(234, 179, 8, 0.25);
  }

  .lesson-row.pro-locked .lesson-row-title {
    color: #94a3b8;
  }

  .pro-lock-badge {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.25);
    color: #fbbf24;
  }

  /* Pro course banner */
  .pro-course-banner {
    background: rgba(234, 179, 8, 0.07);
    border-color: rgba(234, 179, 8, 0.25);
  }

  .pro-course-banner-title {
    color: #fbbf24;
  }

  .pro-course-banner-desc {
    color: #f59e0b;
  }

  .pro-course-banner svg {
    color: #f59e0b;
  }

  /* Sidebar plan badge */
  .sidebar-plan-badge.free {
    background: rgba(100, 116, 139, 0.25);
    color: #94a3b8;
  }

  .sidebar-plan-badge.pro {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
  }

  /* Pro badges on cards */
  .pro-badge {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
    border-color: rgba(234, 179, 8, 0.35);
  }

  /* Fast Track badge */
  .fast-track-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
  }

  /* Empty state */
  .academy-empty-state {
    color: #64748b;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   PLACEMENT QUIZ MODAL
   ───────────────────────────────────────────────────────────────────────────── */

/* Overlay */
.pq-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
  padding: 20px;
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}

.pq-overlay.pq-hidden {
  display: none;
}

.pq-overlay.pq-visible {
  display: flex;
  animation: pqFadeIn 0.22s ease both;
}

@keyframes pqFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Modal card */
.pq-modal {
  background: #ffffff;
  border-radius: 16px;
  width: 540px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  animation: pqSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pqSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* Header */
.pq-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.pq-header-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-orange, #f97316);
  margin-bottom: 3px;
}

.pq-course-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-dark, #0f172a);
  margin: 0;
  line-height: 1.3;
}

.pq-close {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.pq-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.pq-close:focus-visible {
  outline: 2.5px solid var(--accent-orange, #f97316);
  outline-offset: 2px;
}

/* Progress bar */
.pq-progress {
  padding: 0 24px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pq-progress.pq-hidden {
  display: none;
}

.pq-progress-track {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.pq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange, #f97316), #f59e0b);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pq-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* Body (scrollable) */
.pq-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  overscroll-behavior: contain;
}

/* Footer */
.pq-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}

.pq-btn-full {
  width: 100%;
  justify-content: center;
  padding: 13px 20px;
  font-size: 14px;
}

.pq-mt8 {
  margin-top: 8px;
}

/* ── Intro screen ─────────────────────────────────────────────────────────── */

.pq-intro {
  text-align: center;
  padding: 8px 0 4px;
}

.pq-intro-icon {
  font-size: 48px;
  margin-bottom: 14px;
  line-height: 1;
}

.pq-intro-headline {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy-dark, #0f172a);
  margin: 0 0 8px;
}

.pq-intro-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.6;
}

.pq-prev-attempt {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.pq-prev-pass {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pq-prev-fail {
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.pq-intro-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 8px;
  margin-top: 4px;
}

.pq-meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.pq-meta-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-dark, #0f172a);
  line-height: 1;
}

.pq-meta-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pq-meta-divider {
  width: 1px;
  height: 32px;
  background: #e2e8f0;
}

/* ── Question screen ──────────────────────────────────────────────────────── */

.pq-question {
  animation: pqFadeIn 0.18s ease both;
}

.pq-q-counter {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.pq-q-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-dark, #0f172a);
  line-height: 1.55;
  margin-bottom: 20px;
}

.pq-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pq-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: #334155;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  width: 100%;
}

.pq-option:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.pq-option:focus-visible {
  outline: 2.5px solid var(--accent-orange, #f97316);
  outline-offset: 2px;
}

.pq-option-selected {
  border-color: var(--accent-orange, #f97316) !important;
  background: rgba(249, 115, 22, 0.06) !important;
  color: #7c2d12;
}

.pq-option-selected .pq-option-letter {
  background: var(--accent-orange, #f97316);
  color: white;
  border-color: var(--accent-orange, #f97316);
}

.pq-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  background: white;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pq-option-text {
  flex: 1;
  line-height: 1.45;
}

/* Disabled Next button */
.pq-footer .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Result screen ────────────────────────────────────────────────────────── */

.pq-result {
  text-align: center;
  padding: 8px 0 4px;
  animation: pqFadeIn 0.25s ease both;
}

.pq-score-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.pq-score-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);  /* start from top */
}

.pq-ring-fill {
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.pq-score-pct {
  position: absolute;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy-dark, #0f172a);
  letter-spacing: -1px;
}

.pq-score-sym {
  font-size: 14px;
  font-weight: 600;
  vertical-align: super;
  letter-spacing: 0;
}

.pq-status {
  display: inline-block;
  font-size: 16px;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 100px;
  margin-bottom: 10px;
}

.pq-status-pass {
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
  border: 1.5px solid rgba(16, 185, 129, 0.35);
}

.pq-status-fail {
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
  border: 1.5px solid rgba(239, 68, 68, 0.25);
}

.pq-result-detail {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
}

.pq-result-sub {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .pq-modal {
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
    width: 100%;
  }

  .pq-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .pq-intro-meta {
    flex-wrap: wrap;
    gap: 12px;
  }

  .pq-meta-divider {
    display: none;
  }
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  .pq-modal {
    background: #1e293b;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  }

  .pq-header {
    border-bottom-color: #334155;
  }

  .pq-course-title { color: #f1f5f9; }

  .pq-close {
    background: #334155;
    color: #94a3b8;
  }

  .pq-close:hover {
    background: #475569;
    color: #f1f5f9;
  }

  .pq-progress-track { background: #334155; }

  .pq-footer { border-top-color: #334155; }

  .pq-intro-headline { color: #f1f5f9; }
  .pq-intro-desc     { color: #94a3b8; }

  .pq-intro-meta {
    background: #0f172a;
    border-color: #334155;
  }

  .pq-meta-value  { color: #f1f5f9; }
  .pq-meta-label  { color: #64748b; }
  .pq-meta-divider { background: #334155; }

  .pq-q-text { color: #f1f5f9; }

  .pq-option {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
  }

  .pq-option:hover {
    border-color: #475569;
    background: #1e293b;
  }

  .pq-option-letter {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
  }

  .pq-score-pct { color: #f1f5f9; }

  .pq-result-detail { color: #94a3b8; }
  .pq-result-sub    { color: #64748b; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   DARK MODE — [data-theme="dark"] (manual toggle via settings panel)
   Mirrors the prefers-color-scheme: dark blocks above so the manual toggle
   and OS preference produce identical results.
   NOTE: --navy-dark / --navy-main are intentionally NOT changed here because
   the sidebar and toast use them as dark backgrounds that stay dark in both themes.
   ───────────────────────────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --bg-primary:   #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary:  #162032;
  --text-main:    #f1f5f9;
  --text-muted:   #94a3b8;
  --border-color: #334155;
  --disabled-bg:  #1e293b;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .skeleton-card,
[data-theme="dark"] .skeleton-dashboard {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg, #1e293b 25%, #2d3f55 50%, #1e293b 75%);
  background-size: 600px 100%;
}

[data-theme="dark"] .academy-dashboard {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dash-rank-name,
[data-theme="dark"] .dash-stat-value { color: #f1f5f9; }

[data-theme="dark"] .dash-tier-label,
[data-theme="dark"] .dash-stat-label,
[data-theme="dark"] .dash-progress-label { color: #94a3b8; }

[data-theme="dark"] .dash-progress-track { background: #334155; }
[data-theme="dark"] .dash-divider        { background: #334155; }

[data-theme="dark"] .dash-plan-badge.free {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.3);
}

[data-theme="dark"] .dash-plan-badge.pro {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border-color: rgba(234, 179, 8, 0.4);
}

[data-theme="dark"] .lesson-row.pro-locked {
  background: rgba(234, 179, 8, 0.07);
  border-color: rgba(234, 179, 8, 0.25);
}

[data-theme="dark"] .lesson-row.pro-locked .lesson-row-title { color: #94a3b8; }

[data-theme="dark"] .pro-lock-badge {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.25);
  color: #fbbf24;
}

[data-theme="dark"] .pro-course-banner {
  background: rgba(234, 179, 8, 0.07);
  border-color: rgba(234, 179, 8, 0.25);
}

[data-theme="dark"] .pro-course-banner-title { color: #fbbf24; }
[data-theme="dark"] .pro-course-banner-desc  { color: #f59e0b; }
[data-theme="dark"] .pro-course-banner svg   { color: #f59e0b; }

[data-theme="dark"] .sidebar-plan-badge.free {
  background: rgba(100, 116, 139, 0.25);
  color: #94a3b8;
}

[data-theme="dark"] .sidebar-plan-badge.pro {
  background: rgba(234, 179, 8, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .pro-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border-color: rgba(234, 179, 8, 0.35);
}

[data-theme="dark"] .fast-track-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .pq-modal {
  background: #1e293b;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .pq-header        { border-bottom-color: #334155; }
[data-theme="dark"] .pq-course-title  { color: #f1f5f9; }
[data-theme="dark"] .pq-close         { background: #334155; color: #94a3b8; }
[data-theme="dark"] .pq-close:hover   { background: #475569; color: #f1f5f9; }
[data-theme="dark"] .pq-progress-track { background: #334155; }
[data-theme="dark"] .pq-footer        { border-top-color: #334155; }
[data-theme="dark"] .pq-intro-headline { color: #f1f5f9; }
[data-theme="dark"] .pq-intro-desc    { color: #94a3b8; }

[data-theme="dark"] .pq-intro-meta {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .pq-meta-value   { color: #f1f5f9; }
[data-theme="dark"] .pq-meta-label   { color: #64748b; }
[data-theme="dark"] .pq-meta-divider { background: #334155; }
[data-theme="dark"] .pq-q-text       { color: #f1f5f9; }

[data-theme="dark"] .pq-option {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .pq-option:hover {
  border-color: #475569;
  background: #1e293b;
}

[data-theme="dark"] .pq-option-letter {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .pq-score-pct    { color: #f1f5f9; }
[data-theme="dark"] .pq-result-detail { color: #94a3b8; }
[data-theme="dark"] .pq-result-sub   { color: #64748b; }

/* ─────────────────────────────────────────────────────────────────────────────
   SETTINGS PANEL — slide-in drawer from right
   Injected into <body> once by settings-panel.js on first open().
   ───────────────────────────────────────────────────────────────────────────── */

@keyframes spFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes spSlideIn {
  from { transform: translateX(100%); opacity: 0.6; }
  to   { transform: translateX(0);    opacity: 1;   }
}

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.sp-overlay.sp-hidden { display: none; }

.sp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: spFadeIn 0.22s ease both;
}

.sp-drawer {
  position: relative;
  width: 360px;
  max-width: 100vw;
  height: 100%;
  background: var(--bg-secondary);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: spSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Header */
.sp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sp-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-orange);
  flex-shrink: 0;
}

.sp-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.sp-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.sp-close:hover                { background: var(--border-color); color: var(--text-main); }
.sp-close:focus-visible        { outline: 2.5px solid var(--accent-orange); outline-offset: 2px; }

/* Body */
.sp-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Sections */
.sp-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sp-section:last-child { border-bottom: none; }

.sp-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.sp-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.sp-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sp-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-primary);
  transition: border-color 0.15s;
}

.sp-input:focus          { outline: none; border-color: var(--accent-orange); }
.sp-input::placeholder   { color: var(--text-muted); }

.sp-save-btn {
  height: 38px;
  padding: 0 16px;
  background: var(--accent-orange);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.sp-save-btn:hover        { background: var(--accent-orange-hover); }
.sp-save-btn:active       { transform: scale(0.97); }
.sp-save-btn:focus-visible { outline: 2.5px solid var(--accent-orange); outline-offset: 2px; }

.sp-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

.sp-hint-danger { color: #ef4444; }

/* Theme toggle buttons */
.sp-theme-row {
  display: flex;
  gap: 8px;
}

.sp-theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.sp-theme-btn:hover { border-color: var(--accent-orange); color: var(--text-main); }

.sp-theme-btn.sp-theme-active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.08);
  color: var(--accent-orange);
  font-weight: 700;
}

.sp-theme-icon           { font-size: 14px; line-height: 1; }
.sp-theme-btn:focus-visible { outline: 2.5px solid var(--accent-orange); outline-offset: 2px; }

/* About section */
.sp-section-about { background: var(--bg-primary); }

.sp-about-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sp-about-icon    { color: var(--accent-orange); flex-shrink: 0; }
.sp-about-name    { font-size: 14px; font-weight: 700; color: var(--text-main); }
.sp-about-version { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.sp-about-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 12px;
}

.sp-about-credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sp-terms-link {
  font-size: 12px;
  color: var(--accent-orange);
  text-decoration: none;
  font-weight: 600;
}

.sp-terms-link:hover  { text-decoration: underline; }
.sp-about-copy        { font-size: 11px; color: var(--text-muted); }

/* Danger zone */
.sp-danger-title { color: #ef4444 !important; }

.sp-reset-btn {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.07);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #dc2626;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}

.sp-reset-btn:hover        { background: rgba(239, 68, 68, 0.13); border-color: rgba(239, 68, 68, 0.5); }
.sp-reset-btn:focus-visible { outline: 2.5px solid #ef4444; outline-offset: 2px; }

/* Settings — header layout update */
.sp-header { justify-content: space-between; }
.sp-header-left { display: flex; align-items: center; gap: 12px; }

/* Settings — field grouping */
.sp-field { }
.sp-field-gap { margin-top: 16px; }

/* Settings — email display */
.sp-email-display {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  user-select: all;
}

.sp-not-signed-in { font-style: italic; font-size: 13px; }

/* Settings — certificate preview */
.sp-cert-preview-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1.5px solid var(--gold-border, rgba(201,168,76,0.22));
  border-radius: var(--radius-sm);
}

.sp-cert-preview-label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sp-cert-name-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 20px;
  padding: 4px 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Settings — locked certificate name (Firestore-backed) */
.sp-cert-locked-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
  flex-wrap: wrap;
}
.sp-cert-locked-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.sp-cert-locked-badge {
  font-size: 11px;
  font-weight: 700;
  color: #C9A84C;
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.sp-cert-review {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-main);
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-left: 3px solid #3b82f6;
  border-radius: 8px;
  padding: 9px 11px;
}

/* Settings — per-track certificate slots */
.sp-cert-track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 8px;
}
.sp-cert-track-name { font-weight: 700; font-size: 14px; color: var(--text-main, #1e293b); }
.sp-cert-track-sub { font-size: 12px; color: var(--text-muted, #64748b); margin-top: 2px; }
.sp-cert-track-state { font-size: 12px; font-weight: 600; color: var(--text-muted, #64748b); white-space: nowrap; }
.sp-cert-track-state.locked { color: var(--text-muted, #94a3b8); }

/* Settings — motion toggle (coming soon) */
.sp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sp-toggle-row > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border-color);
  position: relative;
  flex-shrink: 0;
}

.sp-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.sp-toggle-disabled { opacity: 0.45; cursor: not-allowed; }
.sp-muted .sp-label { opacity: 0.55; }

/* Settings — coming soon pill */
.sp-coming-soon-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px 8px;
}

/* Settings — privacy info */
.sp-privacy-info { margin-bottom: 4px; }

/* Settings — export row */
.sp-export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sp-export-row > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-outline-btn {
  height: 32px;
  padding: 0 14px;
  background: transparent;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.sp-disabled-btn { opacity: 0.5; cursor: not-allowed !important; }

/* Settings — danger zone sub-section */
.sp-danger-zone {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(239, 68, 68, 0.15);
}

.sp-danger-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #ef4444;
  margin: 0 0 8px;
}

/* Settings — save button flash state */
.sp-save-btn.sp-saved {
  background: var(--success-green, #22c55e);
  pointer-events: none;
}

/* Settings — sidebar open button */
.sidebar-settings-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-settings-btn:hover       { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.85); }
.sidebar-settings-btn:focus-visible { outline: 2px solid rgba(249, 115, 22, 0.6); outline-offset: 2px; }

/* Settings dark mode */
[data-theme="dark"] .sp-theme-btn.sp-theme-active {
  background: rgba(249, 115, 22, 0.12);
}

[data-theme="dark"] .sp-reset-btn {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

[data-theme="dark"] .sp-reset-btn:hover {
  background: rgba(239, 68, 68, 0.17);
  border-color: rgba(239, 68, 68, 0.45);
}

/* ─────────────────────────────────────────────────────────────────────────────
   HOME VIEW
   Full-height scrollable landing dashboard.
   ───────────────────────────────────────────────────────────────────────────── */

#home-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hv-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 56px;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overscroll-behavior: contain;
}

/* Prevent flex layout from compressing home view sections.
   Without flex-shrink:0, sections with overflow:hidden collapse to 0 height
   because overflow:hidden sets min-height:auto=0 for flex items. */
.hv-hero,
.hv-stats,
.hv-continue,
.hv-courses,
.hv-roadmap,
.hv-footer {
  flex-shrink: 0;
}

/* ── Hero card ────────────────────────────────────────────────────────────── */

.hv-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.05);
}

/* Warm ambient glow — subtle, not distracting */
.hv-hero::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-glow, rgba(201,168,76,0.09)) 0%, transparent 65%);
  pointer-events: none;
}

[data-theme="dark"] .hv-hero {
  background: linear-gradient(145deg, #1e293b 0%, #162032 100%);
  border-color: rgba(201, 168, 76, 0.1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.2);
}

.hv-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.hv-greeting        { display: flex; flex-direction: column; gap: 2px; }
.hv-greeting-text   { font-size: 13px; font-weight: 500; color: var(--text-muted); }

.hv-display-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.hv-rank-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.hv-tier-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(249,115,22,0.1);
  color: var(--accent-orange);
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.hv-rank-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* Progress bar */
.hv-hero-progress { margin-bottom: 20px; }

.hv-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.hv-progress-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.hv-progress-pct   { font-size: 12px; font-weight: 700; color: var(--accent-orange); }

.hv-progress-track {
  height: 8px;
  background: var(--disabled-bg);
  border-radius: 4px;
  overflow: hidden;
}

.hv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange), #f59e0b);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Action buttons */
.hv-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hv-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}

.hv-action-btn:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  background: rgba(249,115,22,0.04);
}

.hv-action-btn:active         { transform: scale(0.97); }
.hv-action-btn:focus-visible  { outline: 2.5px solid var(--accent-orange); outline-offset: 2px; }

.hv-action-primary {
  background: var(--accent-orange);
  color: white;
  border-color: var(--accent-orange);
}

.hv-action-primary:hover {
  background: var(--accent-orange-hover);
  border-color: var(--accent-orange-hover);
  color: white;
}

/* ── Stats row ────────────────────────────────────────────────────────────── */

.hv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.hv-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
}

.hv-stat-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.hv-stat-denom {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}

.hv-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Continue Learning card ───────────────────────────────────────────────── */

.hv-continue {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--course-accent, var(--accent-orange));
  border-radius: 12px;
  padding: 20px 24px;
  position: relative;
  /* overflow: hidden removed — was clipping the card visually */
}

.hv-continue::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--course-bg, rgba(249,115,22,0.03));
  pointer-events: none;
}

.hv-continue-header           { margin-bottom: 14px; }

.hv-continue-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--course-accent, var(--accent-orange));
  margin-bottom: 4px;
}

.hv-continue-course-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.hv-continue-lesson {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.hv-continue-lesson-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden; /* needed for text-overflow: ellipsis in a flex child */
}

.hv-continue-tier-num {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.hv-continue-lesson-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hv-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--course-accent, var(--accent-orange));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0; /* prevent button from collapsing when title is long */
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.hv-continue-btn:hover        { filter: brightness(1.08); transform: translateY(-1px); }
.hv-continue-btn:active       { filter: brightness(0.95); transform: scale(0.98); }
.hv-continue-btn:focus-visible { outline: 2.5px solid var(--course-accent, var(--accent-orange)); outline-offset: 3px; }

.hv-continue-prog {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hv-continue-prog-track {
  flex: 1;
  height: 5px;
  background: var(--disabled-bg);
  border-radius: 3px;
  overflow: hidden;
}

.hv-continue-prog-fill {
  height: 100%;
  background: var(--course-accent, var(--accent-orange));
  border-radius: 3px;
  opacity: 0.55;
  transition: width 0.6s ease;
}

.hv-continue-prog-label { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* ── Course chips ─────────────────────────────────────────────────────────── */

.hv-courses {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px 22px;
}

.hv-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 14px;
}

.hv-course-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.hv-course-chip {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-primary);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  cursor: default;
}

.hv-chip-done,
.hv-chip-active { cursor: pointer; }

.hv-chip-done:hover,
.hv-chip-active:hover {
  border-color: var(--chip-accent, var(--accent-orange));
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.hv-course-chip:focus-visible { outline: 2.5px solid var(--chip-accent, var(--accent-orange)); outline-offset: 2px; }

.hv-chip-accent-bar {
  width: 4px;
  background: var(--chip-accent, var(--accent-orange));
  flex-shrink: 0;
}

.hv-chip-locked .hv-chip-accent-bar { background: var(--border-color); }

.hv-chip-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex: 1;
  min-width: 0;
}

.hv-chip-icon { font-size: 15px; flex-shrink: 0; line-height: 1; }

.hv-chip-info  { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.hv-chip-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hv-chip-done  .hv-chip-name   { color: #10b981; }
.hv-chip-locked .hv-chip-name  { color: var(--text-muted); }

.hv-chip-meta { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); }

/* ── Advanced Finance Roadmap (Coming Soon) ───────────────────────────────── */

.hv-roadmap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 22px 24px 20px;
}

.hv-roadmap-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: -2px 0 18px;
  max-width: 600px;
}

.hv-roadmap-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.hv-roadmap-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.hv-roadmap-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #C9A84C;
  white-space: nowrap;
}

/* ── Advanced Finance Roadmap — list + connector ──────────────────────────── */

/* List container: more left padding so content has breathing room */
.hv-roadmap-list {
  position: relative;
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
}

/* Vertical connector line — stronger gradient, full item height coverage */
.hv-roadmap-list::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    rgba(201, 168, 76, 0.5)  0%,
    rgba(201, 168, 76, 0.25) 50%,
    rgba(201, 168, 76, 0.08) 100%
  );
  border-radius: 2px;
}

/* ── Individual roadmap item ─────────────────────────────────────────────── */
.hv-roadmap-item {
  position: relative;
  padding: 16px 0 16px 18px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.hv-roadmap-item:first-child { padding-top: 4px; }
.hv-roadmap-item:last-child  { border-bottom: none; padding-bottom: 4px; }

/* Connector dot — larger, brighter, centered on top third of item */
.hv-roadmap-item::before {
  content: "";
  position: absolute;
  left: -20px;   /* 28px list-padding − 8px = sits at connector x=8 */
  top: 26px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.18);
  border: 2px solid rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.06);
}

.hv-roadmap-item:first-child::before { top: 10px; }

/* ── Item content hierarchy ──────────────────────────────────────────────── */

/* Row 1: Role badge + Coming Soon pill */
.hv-roadmap-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

/* Role badge — the career level label, color matches course */
.hv-roadmap-role {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  /* color is set via inline style per course */
}

/* Coming Soon pill */
.hv-roadmap-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 100px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #C9A84C;
  white-space: nowrap;
}

/* Row 2: Course title — primary text, full opacity */
.hv-roadmap-course-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 6px;
  overflow-wrap: break-word;
}

/* Row 3: Description — secondary text, full wrap, readable */
.hv-roadmap-desc {
  font-size: 12.5px;
  color: var(--text-sub, var(--text-muted));
  line-height: 1.6;
  margin-bottom: 6px;
  overflow-wrap: break-word;
}

/* Row 4: Tier range + lesson count — bottom metadata */
.hv-roadmap-tiers {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.75;
  margin-top: 2px;
}

/* ── Dark mode overrides ──────────────────────────────────────────────────── */

[data-theme="dark"] .hv-roadmap-item::before {
  background: rgba(201, 168, 76, 0.12);
  border-color: rgba(201, 168, 76, 0.4);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.04);
}

[data-theme="dark"] .hv-roadmap-badge {
  background: rgba(201, 168, 76, 0.12);
  border-color: rgba(201, 168, 76, 0.3);
}

[data-theme="dark"] .hv-roadmap-pill {
  background: rgba(201, 168, 76, 0.1);
  border-color: rgba(201, 168, 76, 0.28);
}

/* ── Home footer ──────────────────────────────────────────────────────────── */

.hv-footer {
  padding: 14px 0 2px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

.hv-footer-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.hv-footer-name   { font-size: 13px; font-weight: 700; color: var(--text-main); }
.hv-footer-dot    { font-size: 13px; color: var(--text-muted); }
.hv-footer-credit { font-size: 13px; color: var(--text-muted); }

.hv-footer-link {
  font-size: 13px;
  color: var(--accent-orange);
  text-decoration: none;
  font-weight: 600;
}

.hv-footer-link:hover { text-decoration: underline; }

.hv-footer-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 6px;
}

.hv-footer-copy { font-size: 12px; color: var(--text-muted); }

/* ── Home view responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .hv-scroll {
    padding: 20px 16px 48px;
    gap: 16px;
  }

  .hv-hero { padding: 20px; }

  .hv-display-name  { font-size: 22px; }

  .hv-hero-top {
    flex-direction: column;
    gap: 10px;
  }

  .hv-rank-badges { align-items: flex-start; }

  .hv-stats { gap: 10px; }

  .hv-stat-card  { padding: 14px 10px; }
  .hv-stat-value { font-size: 22px; }

  .hv-continue-lesson {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hv-continue-btn { align-self: stretch; justify-content: center; }

  .hv-course-chips { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   H.Academy — Enriched lesson components (case study, exercise, reading,
   tips & mistakes, try-it). Token-only; adapts to light/dark automatically.
   Appended below existing slide content by js/script.js renderLessonEnrichment().
   ───────────────────────────────────────────────────────────────────────────── */

.lesson-enrich {
  margin-top: 28px;
  animation: fadeIn 0.3s ease;
}

.enrich-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.enrich-block.enrich-tryit,
.enrich-block.enrich-exercise {
  border-left: 4px solid var(--accent-orange);
}

.enrich-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-orange);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.enrich-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-main);
}
.enrich-body p { margin-bottom: 14px; }
.enrich-body p:last-child { margin-bottom: 0; }
.enrich-body strong { color: var(--text-main); font-weight: 700; }

/* Tips & common mistakes lists */
.enrich-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.enrich-list.enrich-list-mistakes { margin-top: 14px; }
.enrich-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-main);
}
.enrich-ic { flex: 0 0 auto; }

/* Interactive exercise */
.enrich-ex-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: -4px 0 18px;
}
.enrich-ex-q { margin-bottom: 22px; }
.enrich-ex-q:last-child { margin-bottom: 0; }
.enrich-ex-question {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}
.enrich-ex-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.enrich-ex-option {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 14.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
}
.enrich-ex-option:hover {
  border-color: var(--accent-orange);
  background: var(--gold-glow);
}
.enrich-ex-disabled {
  cursor: default;
  pointer-events: none;
}
.enrich-ex-correct {
  border-color: var(--success-green);
  color: var(--success-green);
  font-weight: 700;
}
.enrich-ex-correct::before { content: "✓ "; font-weight: 800; }
.enrich-ex-wrong {
  border-color: var(--error-red);
  color: var(--error-red);
}
.enrich-ex-wrong::before { content: "✗ "; font-weight: 800; }
.enrich-ex-explain {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border-left: 3px solid var(--accent-orange);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}
.enrich-ex-explain strong { color: var(--accent-orange); }

/* ── Quick Drills (Debit/Credit drill) ───────────────────────────────────────
   Mirrors the .pq-* placement-quiz modal pattern. Academy design tokens come
   from main.css :root (--accent-orange / --navy-dark / --text-* / --success-green
   / --error-red / --border-color / --radius-*), NOT tokens.css (the ERP token
   file, which index.html does not load). Hardcoded fallbacks match the .pq-*
   block exactly. */
.qd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
  padding: 20px;
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}
.qd-overlay.qd-hidden { display: none; }
.qd-overlay.qd-visible { display: flex; animation: pqFadeIn 0.22s ease both; }

.qd-modal {
  background: var(--white, #ffffff);
  border-radius: 16px;
  width: 480px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  animation: pqSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.qd-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  flex-shrink: 0;
}
.qd-header-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-orange, #f97316);
  margin-bottom: 3px;
}
.qd-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-dark, #0f172a);
  margin: 0;
  line-height: 1.3;
}
.qd-close {
  background: var(--bg-tertiary, #f1f5f9);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.qd-close:hover { background: #e2e8f0; color: #1e293b; }
.qd-close:focus-visible { outline: 2.5px solid var(--accent-orange, #f97316); outline-offset: 2px; }

/* Progress + stats */
.qd-progress {
  padding: 0 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.qd-progress-track {
  height: 6px;
  background: var(--bg-tertiary, #e2e8f0);
  border-radius: 3px;
  overflow: hidden;
}
.qd-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent-orange, #f97316);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.qd-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}
.qd-streak { color: var(--accent-orange, #f97316); }

/* Body */
.qd-body { padding: 18px 24px 8px; overflow-y: auto; flex: 1; }
.qd-question { text-align: center; }
.qd-q-prompt { font-size: 14px; color: var(--text-muted, #64748b); margin-bottom: 14px; }
.qd-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  background: var(--bg-tertiary, #f1f5f9);
  margin-bottom: 20px;
}
.qd-account-name { font-size: 22px; font-weight: 700; color: var(--navy-dark, #0f172a); }
.qd-account-type {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-orange, #f97316);
}

/* DR/CR choice buttons */
.qd-choices { display: flex; gap: 12px; }
.qd-choice {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-dark, #0f172a);
  background: var(--white, #ffffff);
  border: 2px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.qd-choice:hover:not(:disabled) { border-color: var(--accent-orange, #f97316); transform: translateY(-1px); }
.qd-choice:disabled { cursor: default; }
.qd-choice-key {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted, #94a3b8);
}
.qd-choice.qd-correct {
  border-color: var(--success-green, #10b981);
  background: rgba(16, 185, 129, 0.10);
  color: var(--success-green, #10b981);
}
.qd-choice.qd-correct .qd-choice-key { color: var(--success-green, #10b981); }
.qd-choice.qd-wrong {
  border-color: var(--error-red, #ef4444);
  background: rgba(239, 68, 68, 0.10);
  color: var(--error-red, #ef4444);
}
.qd-choice.qd-wrong .qd-choice-key { color: var(--error-red, #ef4444); }

.qd-feedback { min-height: 20px; margin-top: 14px; font-size: 13px; line-height: 1.4; }
.qd-fb-correct { color: var(--success-green, #10b981); }
.qd-fb-wrong { color: var(--error-red, #ef4444); }
.qd-empty { padding: 40px 10px; text-align: center; color: var(--error-red, #ef4444); }

/* Footer */
.qd-footer { padding: 14px 24px 20px; flex-shrink: 0; border-top: 1px solid var(--border-color, #f1f5f9); }
.qd-btn-full { width: 100%; }
.qd-mt8 { margin-top: 8px; }

/* Round summary */
.qd-summary { text-align: center; padding: 8px 0 4px; }
.qd-summary-headline { font-size: 18px; font-weight: 700; color: var(--navy-dark, #0f172a); margin-bottom: 6px; }
.qd-score-big { font-size: 44px; font-weight: 800; color: var(--accent-orange, #f97316); line-height: 1; margin-bottom: 18px; }
.qd-score-sub { font-size: 20px; font-weight: 600; color: var(--text-muted, #94a3b8); margin-left: 4px; }
.qd-summary-row { display: flex; justify-content: center; gap: 14px; }
.qd-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 84px;
  padding: 12px 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  background: var(--bg-tertiary, #f1f5f9);
}
.qd-summary-val { font-size: 20px; font-weight: 700; color: var(--navy-dark, #0f172a); }
.qd-summary-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted, #94a3b8); }

@media (max-width: 600px) {
  .qd-modal { border-radius: 12px 12px 0 0; max-height: 95vh; width: 100%; }
  .qd-overlay { align-items: flex-end; padding: 0; }
}

/* Dark mode — driven solely by [data-theme="dark"] (index.html's boot script
   always sets data-theme explicitly, so a prefers-color-scheme media block
   would wrongly force dark on a dark-OS device even when the user picked the
   light theme — the rest of the Academy follows [data-theme], so this does too). */
[data-theme="dark"] .qd-modal { background: #1e293b; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .qd-header { border-bottom-color: #334155; }
[data-theme="dark"] .qd-title,
[data-theme="dark"] .qd-account-name,
[data-theme="dark"] .qd-summary-headline,
[data-theme="dark"] .qd-summary-val { color: #f1f5f9; }
[data-theme="dark"] .qd-close { background: #334155; color: #94a3b8; }
[data-theme="dark"] .qd-close:hover { background: #475569; color: #f1f5f9; }
[data-theme="dark"] .qd-progress-track,
[data-theme="dark"] .qd-account,
[data-theme="dark"] .qd-summary-item { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .qd-choice { background: #0f172a; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .qd-footer { border-top-color: #334155; }

/* ── Mixed-format drill additions (journal / concept / classify) ── */
.qd-gone { display: none; }

.qd-type-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-orange, #f97316);
  background: rgba(249, 115, 22, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.qd-scenario {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--navy-dark, #0f172a);
  margin-bottom: 18px;
}
.qd-substep { margin-bottom: 16px; }
.qd-sublabel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  margin-bottom: 10px;
}
/* Stack long option text (journal-entry pairs) full-width, left-aligned */
.qd-choices-col { flex-direction: column; }
.qd-choice-row {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  font-size: 14px;
  padding: 14px 16px;
}

/* Explanation block — always shown after an answer is locked */
.qd-explain {
  margin-top: 16px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  background: var(--bg-tertiary, #f1f5f9);
  border-left: 3px solid var(--accent-orange, #f97316);
  border-radius: 8px;
  color: var(--navy-dark, #0f172a);
}
.qd-explain-title { font-weight: 800; }
.qd-explain-correct { color: var(--success-green, #10b981); }
.qd-explain-wrong { color: var(--error-red, #ef4444); }

/* Dark mode for the new surfaces/text — [data-theme="dark"] only (see note above).
   Re-assert answer feedback: the plain [data-theme] .qd-choice rule has equal
   specificity and comes later, so correct/wrong need explicit dark overrides or
   the green/red highlight is suppressed. */
[data-theme="dark"] .qd-scenario { color: #f1f5f9; }
[data-theme="dark"] .qd-explain { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] .qd-choice.qd-correct { border-color: var(--success-green, #10b981); background: rgba(16, 185, 129, 0.16); color: #34d399; }
[data-theme="dark"] .qd-choice.qd-correct .qd-choice-key { color: #34d399; }
[data-theme="dark"] .qd-choice.qd-wrong { border-color: var(--error-red, #ef4444); background: rgba(239, 68, 68, 0.16); color: #f87171; }
[data-theme="dark"] .qd-choice.qd-wrong .qd-choice-key { color: #f87171; }
