/* ================================================================
   PULSE LMS — Design System & Styles
   Sana-inspired Scandinavian minimal aesthetic
   ================================================================ */

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-tertiary: #f0efed;
  --bg-sidebar: #fafaf8;
  --bg-dark: #1a1a1a;
  --bg-hover: #f2f2f0;
  --bg-overlay: rgba(0,0,0,0.4);

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #9a9a9a;
  --text-inverse: #ffffff;

  /* Accent palette */
  --accent-orange: #ff5c00;
  --accent-green: #34c759;
  --accent-red: #ff3b30;
  --accent-cyan: #00d4ff;
  --accent-yellow: #ffd60a;
  --accent-purple: #af52de;
  --accent-blue: #007aff;

  /* Borders */
  --border-light: #e8e8e6;
  --border-medium: #d4d4d2;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 80px rgba(0,0,0,0.12);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);

  /* Radii — generous Sana-style rounding */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography — Inter as Sana's custom font substitute */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.75rem;
  --text-4xl: 3.5rem;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  --tracking-tight: -0.02em;
  --tracking-normal: -0.01em;

  /* Z-index layers */
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 400;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  overflow: hidden;
  height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; border: none; outline: none; background: transparent; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* Scrollbar — Sana uses thin, subtle scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── APP SHELL ─────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; width: 100vw; }
.app-shell.with-login { display: none; }

/* ── LOGIN SCREEN ──────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: var(--bg-secondary);
}

.login-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 40px; height: 40px;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-inverse); font-weight: 900; font-size: 20px;
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text-primary);
  transition: border-color var(--duration-fast);
}
.form-input:focus { border-color: var(--text-primary); }
.form-input::placeholder { color: var(--text-tertiary); }

.form-error {
  font-size: var(--text-xs);
  color: var(--accent-red);
  margin-top: 6px;
  display: none;
}
.form-error.show { display: block; }

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-dark);
  color: var(--text-inverse);
  font-size: var(--text-base);
  font-weight: 600;
  transition: opacity var(--duration-fast);
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.login-alt {
  text-align: center;
  margin-top: 20px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.login-alt a { color: var(--text-primary); font-weight: 600; cursor: pointer; }
.login-alt a:hover { text-decoration: underline; }

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 20px 20px;
  font-weight: 700; font-size: var(--text-base);
}

.sidebar-brand .brand-icon {
  width: 28px; height: 28px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px; font-weight: 800;
}

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

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { color: var(--text-primary); background: var(--bg-hover); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; opacity: 0.6; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }

.nav-divider { height: 1px; background: var(--border-light); margin: 12px 20px; }

.nav-group-label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  font-size: var(--text-xs); font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color var(--duration-fast);
}
.nav-group-label:hover { color: var(--text-secondary); }

.nav-group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── MAIN CONTENT ──────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ── SCREENS ───────────────────────────────────────────── */
.screen, .editor-screen, .skill-tree-screen, .manage-screen { display: none; height: 100%; }
.screen.active, .editor-screen.active, .skill-tree-screen.active, .manage-screen.active { display: flex; flex-direction: column; }

/* ── TOP BAR ───────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  position: sticky; top: 0;
  z-index: var(--z-sticky);
  min-height: 56px;
}

.top-bar-user { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); font-weight: 500; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0c27f, #fc5c7d);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.top-bar-actions { display: flex; align-items: center; gap: 16px; }

.top-bar-link { font-size: var(--text-sm); color: var(--text-secondary); cursor: pointer; }
.top-bar-link:hover { color: var(--text-primary); }

.notification-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer;
}
.notification-dot::after {
  content: '';
  width: 8px; height: 8px;
  background: var(--accent-orange);
  border-radius: 50%;
  position: absolute; top: 2px; right: 2px;
  border: 2px solid white;
}

/* ── DASHBOARD ─────────────────────────────────────────── */
.dashboard-content {
  padding: 32px 40px 60px;
  max-width: 1100px;
  flex: 1;
  overflow-y: auto;
}

.greeting h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}
.greeting p {
  font-size: var(--text-lg);
  color: var(--text-tertiary);
  margin-top: 4px; font-weight: 400;
}

/* Assignment Table */
.assignment-section { margin-top: 32px; }

.assignment-table { width: 100%; border-collapse: collapse; }

.assignment-table thead th {
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-tertiary);
  text-align: left;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border-light);
}

.assignment-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.assignment-table tbody tr:hover { background: var(--bg-hover); }
.assignment-table td { padding: 14px 12px; font-size: var(--text-sm); }

.assignment-name { display: flex; align-items: center; gap: 12px; font-weight: 500; }

.assignment-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.assignment-desc {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  margin-left: 4px;
}

.type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-xs); color: var(--text-secondary);
}
.type-badge svg { width: 14px; height: 14px; }

.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress-bar-bg {
  width: 80px; height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 3px;
  background: var(--accent-green);
  transition: width 0.4s ease;
}
.progress-text { font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; }

.priority-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); font-weight: 500;
}
.priority-dot { width: 7px; height: 7px; border-radius: 50%; }
.priority-high .priority-dot { background: var(--accent-red); }
.priority-high { color: var(--accent-red); }
.priority-mandatory { color: var(--text-secondary); }
.priority-mandatory .priority-dot { background: var(--text-tertiary); }
.priority-optional { color: var(--text-tertiary); }
.priority-optional .priority-dot { background: var(--bg-tertiary); }

.date-cell { font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; }

/* Recent Section */
.section-header {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 40px; margin-bottom: 16px;
}
.section-header h2 { font-size: var(--text-lg); font-weight: 700; }
.section-header .count { font-size: var(--text-base); color: var(--text-tertiary); font-weight: 400; }

.recent-scroll {
  display: flex; gap: 16px;
  overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.recent-card {
  min-width: 200px; max-width: 200px;
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform var(--duration-fast);
}
.recent-card:hover { transform: translateY(-2px); }

.recent-card-img {
  width: 100%; height: 130px;
  border-radius: var(--radius-md);
  overflow: hidden; position: relative;
}
.recent-card-img img { width: 100%; height: 100%; object-fit: cover; }

.card-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(255,255,255,0.95);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(4px);
}
.card-badge.live { color: var(--accent-red); }
.card-badge.live::before {
  content: ''; width: 6px; height: 6px;
  background: var(--accent-red); border-radius: 50%;
}
.card-badge.completed { color: var(--accent-green); }
.card-badge.edit { color: var(--text-secondary); }
.card-badge.program { color: var(--accent-purple); }

.card-time-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent-yellow);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700;
  color: var(--text-primary);
}

.recent-card-title { font-size: var(--text-sm); font-weight: 600; margin-top: 10px; line-height: var(--leading-snug); }
.recent-card-meta { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

/* Featured */
.featured-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

.featured-card {
  border-radius: var(--radius-lg);
  padding: 32px; min-height: 180px;
  display: flex; align-items: flex-end;
  overflow: hidden; cursor: pointer;
  transition: transform var(--duration-fast);
}
.featured-card:hover { transform: scale(1.01); }
.featured-card h3 {
  font-size: var(--text-xl); font-weight: 800;
  color: white; line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

/* ── COURSE PLAYER ─────────────────────────────────────── */
.course-player { display: flex; height: 100%; }

.course-sidebar {
  width: 240px; min-width: 240px;
  border-right: 1px solid var(--border-light);
  padding: 24px 0;
  overflow-y: auto; background: var(--bg-primary);
}

.course-sidebar-label {
  padding: 0 24px 12px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.course-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 24px;
  font-size: var(--text-sm); color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.course-sidebar-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.course-sidebar-item.active {
  color: var(--text-primary); font-weight: 600;
  background: var(--bg-hover);
  border-left: 2px solid var(--text-primary);
}
.course-sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.5; }
.course-sidebar-item.active svg { opacity: 1; }
.course-sidebar-item.completed-lesson { color: var(--text-tertiary); }
.course-sidebar-item.completed-lesson::after {
  content: '✓'; margin-left: auto;
  font-size: 11px; color: var(--accent-green); font-weight: 700;
}

.course-main { flex: 1; overflow-y: auto; position: relative; }

.course-content-area {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 40px 120px;
}

.course-hero-images {
  display: flex; justify-content: center;
  margin-bottom: 40px;
}
.course-hero-img {
  width: 140px; height: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: rotate(-6deg);
  box-shadow: var(--shadow-lg);
}
.course-hero-img:nth-child(2) { transform: rotate(4deg); margin-left: -20px; }

.course-content-area h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 24px;
}
.course-content-area .sana-icon { display: inline-flex; margin-right: 12px; vertical-align: middle; }

.course-content-area p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.course-content-area blockquote {
  border-left: 3px solid var(--border-medium);
  padding: 16px 0 16px 24px;
  margin: 28px 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-style: italic;
  line-height: 1.4;
  color: var(--text-primary);
}
.course-content-area blockquote cite {
  display: block;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-style: normal;
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* Interactive Exercise Card — Sana's signature orange CTA */
.exercise-card {
  background: var(--accent-orange);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin: 32px 0;
  display: flex; align-items: center; justify-content: space-between;
  color: white; cursor: pointer;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.exercise-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 92, 0, 0.3);
}
.exercise-card-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; font-size: 18px;
}
.exercise-card-label { font-size: var(--text-xs); font-weight: 500; opacity: 0.8; margin-bottom: 4px; }
.exercise-card-title { font-size: var(--text-base); font-weight: 600; line-height: var(--leading-snug); }
.exercise-card-btn {
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: var(--text-sm); font-weight: 600; color: white;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: background var(--duration-fast);
}
.exercise-card-btn:hover { background: rgba(255,255,255,0.3); }

/* Lesson Complete Section */
.lesson-complete-section {
  margin: 40px 0 20px;
  padding: 24px;
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
}
.lesson-complete-section.completed {
  border-style: solid;
  border-color: var(--accent-green);
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.lesson-complete-check {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-green);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.lesson-complete-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #166534;
}
.lesson-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 14px;
  animation: gentleBounce 2s ease-in-out infinite;
}
@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}
.lesson-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  background: var(--bg-dark);
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--duration-fast);
  border: none;
  cursor: pointer;
}
.lesson-complete-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.lesson-complete-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}
.lesson-complete-btn.milestone {
  background: var(--accent-green);
}
.lesson-complete-btn-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.lesson-complete-btn:not(:disabled) .lesson-complete-btn-icon {
  border-color: white;
  background: rgba(255,255,255,0.15);
}

/* Content Tags */
.content-tags { display: flex; align-items: center; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.content-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.content-tag:hover { background: var(--bg-hover); border-color: var(--border-medium); }

/* Recommended cards */
.recommended-section { margin-top: 40px; }
.recommended-section h3 { font-size: var(--text-sm); font-weight: 500; color: var(--text-tertiary); margin-bottom: 16px; }
.recommended-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rec-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px; cursor: pointer;
  transition: all var(--duration-fast);
}
.rec-card:hover { background: var(--bg-tertiary); transform: translateY(-1px); }
.rec-card-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  margin-bottom: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
}
.rec-card h4 { font-size: var(--text-sm); font-weight: 600; line-height: var(--leading-snug); margin-bottom: 4px; }
.rec-card p { font-size: var(--text-xs); color: var(--text-tertiary); }

/* Chat bar at bottom */
.course-chat-bar {
  position: absolute; bottom: 0; left: 240px; right: 0;
  padding: 16px 40px;
  background: linear-gradient(transparent, var(--bg-primary) 30%);
  pointer-events: none;
}
.chat-input-wrap {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 8px 12px 8px 16px;
  box-shadow: var(--shadow-md);
  pointer-events: all;
}
.chat-ai-icon {
  width: 28px; height: 28px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; flex-shrink: 0;
}
.chat-input-wrap input {
  flex: 1; font-size: var(--text-sm); color: var(--text-primary);
}
.chat-input-wrap input::placeholder { color: var(--text-tertiary); }
.chat-send-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast); flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--bg-dark); color: white; }

/* ── EDITOR ────────────────────────────────────────────── */
.editor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  font-size: var(--text-sm);
}

.editor-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-tertiary); font-size: var(--text-sm);
}
.editor-breadcrumb span { color: var(--text-primary); font-weight: 500; }

.editor-actions { display: flex; align-items: center; gap: 8px; }

.editor-action-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  transition: all var(--duration-fast);
  border: 1px solid var(--border-light);
}
.editor-action-btn:hover { background: var(--bg-hover); border-color: var(--border-medium); }
.editor-action-btn.primary { background: var(--bg-dark); color: white; border-color: var(--bg-dark); }
.editor-action-btn.primary:hover { opacity: 0.9; }

.editor-body { display: flex; flex: 1; overflow: hidden; }

.editor-sidebar {
  width: 230px; min-width: 230px;
  border-right: 1px solid var(--border-light);
  padding: 16px 0; overflow-y: auto; background: var(--bg-primary);
}

.editor-sidebar-back {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px; font-size: var(--text-sm);
  color: var(--text-secondary); cursor: pointer; margin-bottom: 8px;
}
.editor-sidebar-back:hover { color: var(--text-primary); }

.editor-sidebar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px; font-size: var(--text-sm);
  color: var(--text-tertiary); cursor: pointer; margin-bottom: 4px;
}

.editor-sidebar-glossary {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px; font-size: var(--text-sm);
  color: var(--text-tertiary); margin-bottom: 12px;
}

.editor-tree-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 20px 7px 24px;
  font-size: var(--text-sm); color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.editor-tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.editor-tree-item.active {
  background: var(--bg-hover); color: var(--text-primary);
  font-weight: 600; border-left: 2px solid var(--text-primary);
}
.editor-tree-item.child { padding-left: 44px; }
.editor-tree-item svg { width: 14px; height: 14px; opacity: 0.5; flex-shrink: 0; }

.editor-tree-add {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px 10px 24px;
  font-size: var(--text-sm); color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast);
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}
.editor-tree-add:hover { background: var(--bg-hover); color: var(--accent-orange); }
.editor-tree-add svg { width: 14px; height: 14px; opacity: 0.5; flex-shrink: 0; }
.editor-tree-add:hover svg { opacity: 1; }

.editor-tree-group {
  padding: 6px 20px;
  font-size: var(--text-xs); font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; margin-top: 8px;
}
.editor-tree-group svg { width: 12px; height: 12px; }

/* Editor Canvas */
.editor-canvas { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.editor-mode-toggle {
  display: flex; align-items: center; gap: 2px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
}
.mode-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
}
.mode-btn.active { background: var(--bg-dark); color: white; }
.mode-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }

.editor-canvas-scroll { flex: 1; overflow-y: auto; }

/* Markdown Editor */
.markdown-editor { width: 100%; min-height: 100%; padding: 40px; max-width: 820px; margin: 0 auto; }

.markdown-textarea {
  width: 100%; min-height: 500px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 14px; line-height: 1.7;
  color: var(--text-primary);
  resize: none; padding: 0;
}

/* Rendered Markdown */
.markdown-rendered { width: 100%; max-width: 820px; margin: 0 auto; padding: 40px; }

.markdown-rendered .hero-block {
  background: var(--bg-dark);
  border-radius: var(--radius-xl);
  padding: 60px 48px; margin-bottom: 32px;
  color: white; overflow: hidden;
}
.markdown-rendered .hero-block .hero-tag {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--accent-orange); margin-bottom: 16px;
}
.markdown-rendered .hero-block h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl); font-weight: 800;
  line-height: var(--leading-tight); color: white;
  margin: 0;
}

.markdown-rendered h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl); font-weight: 700;
  margin: 40px 0 16px; line-height: var(--leading-tight);
}
.markdown-rendered h2 { font-size: var(--text-xl); font-weight: 700; margin: 32px 0 12px; }
.markdown-rendered h3 { font-size: var(--text-lg); font-weight: 600; margin: 24px 0 8px; }
.markdown-rendered p {
  font-size: var(--text-base); line-height: var(--leading-relaxed);
  color: var(--text-secondary); margin-bottom: 16px;
}
.markdown-rendered blockquote {
  border-left: 3px solid var(--border-medium);
  padding: 12px 0 12px 24px; margin: 24px 0;
  font-family: var(--font-display);
  font-size: var(--text-xl); font-style: italic;
  color: var(--text-primary);
}
.markdown-rendered ul, .markdown-rendered ol { margin: 12px 0; padding-left: 24px; }
.markdown-rendered li {
  font-size: var(--text-base); color: var(--text-secondary);
  line-height: var(--leading-relaxed); margin-bottom: 6px;
  list-style: disc;
}
.markdown-rendered ol li { list-style: decimal; }
.markdown-rendered code {
  background: var(--bg-tertiary); padding: 2px 8px;
  border-radius: 4px; font-size: 13px; font-family: var(--font-mono);
}
.markdown-rendered pre {
  background: var(--bg-dark); color: #e0e0e0;
  padding: 20px; border-radius: var(--radius-md);
  overflow-x: auto; margin: 16px 0;
}
.markdown-rendered pre code { background: none; padding: 0; color: inherit; }
.markdown-rendered strong { color: var(--text-primary); font-weight: 600; }
.markdown-rendered hr { border: none; height: 1px; background: var(--border-light); margin: 32px 0; }

/* ── QUIZ EDITOR (inside editor canvas) ──────────────── */
.quiz-editor {
  width: 100%; max-width: 820px; margin: 0 auto; padding: 40px;
}
.qe-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}
.qe-header-info h3 {
  font-size: var(--text-xl); font-weight: 700; margin: 0 0 4px;
}
.qe-question-count {
  font-size: var(--text-sm); color: var(--text-tertiary); font-weight: 400;
}
.qe-settings-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-secondary); border: 1px solid var(--border-light);
  background: var(--bg-primary); cursor: pointer;
  transition: all var(--duration-fast);
}
.qe-settings-btn:hover { background: var(--bg-hover); border-color: var(--border-medium); }

.qe-questions { display: flex; flex-direction: column; gap: 16px; }

.qe-question-card {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  background: var(--bg-primary); transition: border-color var(--duration-fast);
}
.qe-question-card:hover { border-color: var(--border-medium); }

.qe-question-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 20px 12px; gap: 12px;
}
.qe-question-number {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary);
}
.qe-question-text {
  flex: 1; font-size: var(--text-base); font-weight: 500;
  color: var(--text-primary); line-height: 1.5;
}
.qe-question-actions {
  display: flex; gap: 4px; flex-shrink: 0;
}
.qe-question-action {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); cursor: pointer;
  transition: all var(--duration-fast);
}
.qe-question-action:hover { background: var(--bg-hover); color: var(--text-primary); }
.qe-question-action.danger:hover { background: #fef2f2; color: var(--accent-red); }
.qe-question-action svg { width: 14px; height: 14px; }

.qe-options-list { padding: 0 20px 16px; }

.qe-option-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: var(--text-sm); color: var(--text-secondary);
}
.qe-option-letter {
  width: 22px; height: 22px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border-medium);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
  color: var(--text-tertiary);
}
.qe-option-row.correct .qe-option-letter {
  border-color: var(--accent-green); background: var(--accent-green); color: white;
}
.qe-option-row.correct { color: var(--text-primary); font-weight: 500; }

.qe-question-feedback {
  padding: 0 20px 16px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.qe-feedback-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 500; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qe-feedback-pill.correct { background: #f0fdf4; color: #166534; }
.qe-feedback-pill.wrong { background: #fef2f2; color: #991b1b; }

.qe-add-question-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px; margin-top: 16px;
  border: 2px dashed var(--border-light); border-radius: var(--radius-lg);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-tertiary); cursor: pointer;
  background: transparent; transition: all var(--duration-fast);
}
.qe-add-question-btn:hover {
  border-color: var(--accent-orange); color: var(--accent-orange);
  background: rgba(255, 92, 0, 0.03);
}

.qe-empty {
  text-align: center; padding: 48px 24px;
  color: var(--text-tertiary);
}
.qe-empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.qe-empty h4 { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.qe-empty p { font-size: var(--text-sm); }

/* Question Modal option rows */
.qm-hint {
  font-size: var(--text-xs); color: var(--text-tertiary); margin: 4px 0 12px;
}
.qm-options-list { display: flex; flex-direction: column; gap: 8px; }

.qm-option-row {
  display: flex; align-items: center; gap: 8px;
}
.qm-option-row input[type="radio"] {
  width: 18px; height: 18px; accent-color: var(--accent-green);
  cursor: pointer; flex-shrink: 0;
}
.qm-option-row .form-input { flex: 1; }
.qm-option-remove {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); cursor: pointer; flex-shrink: 0;
  font-size: 16px; transition: all var(--duration-fast);
}
.qm-option-remove:hover { background: #fef2f2; color: var(--accent-red); }

.qm-add-option-btn {
  font-size: var(--text-xs); font-weight: 500;
  color: var(--accent-orange); cursor: pointer;
  padding: 6px 0; background: none; border: none;
  transition: opacity var(--duration-fast);
}
.qm-add-option-btn:hover { opacity: 0.8; }

/* Add Lesson type grid */
.al-type-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px;
}
.al-type-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; border: 2px solid var(--border-light);
  border-radius: var(--radius-lg); cursor: pointer;
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500;
  transition: all var(--duration-fast);
}
.al-type-card:hover { border-color: var(--border-medium); background: var(--bg-hover); }
.al-type-card.active {
  border-color: var(--accent-orange); background: rgba(255, 92, 0, 0.04);
  color: var(--accent-orange);
}

/* AI Floating Toolbar */
.ai-toolbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: none; align-items: center; gap: 4px; padding: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-light);
  z-index: var(--z-sticky);
}
.ai-toolbar.show { display: flex; }

.ai-toolbar-btn {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.ai-toolbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ai-toolbar-btn svg { width: 14px; height: 14px; }
.ai-toolbar-divider { width: 1px; height: 20px; background: var(--border-light); margin: 0 2px; }

/* ── QUIZ MODAL ────────────────────────────────────────── */
.quiz-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: var(--z-overlay);
  align-items: center; justify-content: center;
}
.quiz-overlay.show { display: flex; }

.quiz-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 580px; max-width: 90vw; max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.quiz-header { padding: 28px 32px 0; }
.quiz-progress { display: flex; gap: 4px; margin-bottom: 24px; }
.quiz-progress-dot {
  flex: 1; height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  transition: background 0.3s;
}
.quiz-progress-dot.done { background: var(--accent-green); }
.quiz-progress-dot.current { background: var(--accent-orange); }

.quiz-question-num {
  font-size: var(--text-xs); font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.quiz-question {
  font-size: var(--text-xl); font-weight: 700;
  line-height: var(--leading-tight); margin-bottom: 24px;
}

.quiz-options { padding: 0 32px 32px; display: flex; flex-direction: column; gap: 10px; }

.quiz-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
  font-size: var(--text-sm); font-weight: 500;
}
.quiz-option:hover { border-color: var(--border-medium); background: var(--bg-hover); }
.quiz-option.selected { border-color: var(--bg-dark); background: var(--bg-hover); }
.quiz-option.correct { border-color: var(--accent-green); background: #f0fdf4; }
.quiz-option.wrong { border-color: var(--accent-red); background: #fef2f2; }

.quiz-option-letter {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700;
  color: var(--text-tertiary); flex-shrink: 0;
  transition: all var(--duration-fast);
}
.quiz-option.selected .quiz-option-letter { border-color: var(--bg-dark); background: var(--bg-dark); color: white; }
.quiz-option.correct .quiz-option-letter { border-color: var(--accent-green); background: var(--accent-green); color: white; }
.quiz-option.wrong .quiz-option-letter { border-color: var(--accent-red); background: var(--accent-red); color: white; }

.quiz-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.quiz-btn {
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 600;
  transition: all var(--duration-fast);
}
.quiz-btn.secondary { color: var(--text-secondary); }
.quiz-btn.secondary:hover { color: var(--text-primary); }
.quiz-btn.primary { background: var(--bg-dark); color: white; }
.quiz-btn.primary:hover { opacity: 0.9; }
.quiz-btn.primary:disabled { opacity: 0.3; cursor: not-allowed; }

.quiz-feedback {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 0 32px 24px;
  font-size: var(--text-sm); line-height: var(--leading-normal);
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: #f0fdf4; color: #166534; }
.quiz-feedback.wrong-fb { background: #fef2f2; color: #991b1b; }

/* ── SKILL TREE ────────────────────────────────────────── */
.skill-tree-header {
  padding: 20px 40px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.skill-tree-header h2 { font-size: var(--text-lg); font-weight: 700; white-space: nowrap; }
.skill-tree-legend { display: flex; align-items: center; gap: 16px; font-size: var(--text-xs); color: var(--text-tertiary); margin-left: auto; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.completed { background: var(--accent-green); }
.legend-dot.in-progress { background: var(--accent-orange); }
.legend-dot.locked { background: var(--bg-tertiary); }

/* Program tabs */
.program-tabs { display: flex; align-items: center; gap: 8px; }
.program-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--duration-fast);
}
.program-tab:hover { background: var(--bg-tertiary); }
.program-tab.active {
  background: white; color: var(--text-primary); font-weight: 600;
  border-color: var(--tab-color, #1a1a1a);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.program-tab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tab-color, #1a1a1a);
}
.program-tab-pct {
  font-size: 10px; opacity: 0.5; margin-left: 2px;
}

.skill-tree-canvas {
  flex: 1; overflow: auto;
  background: var(--bg-secondary);
  cursor: grab;
  padding: 20px;
}
.skill-tree-canvas:active { cursor: grabbing; }
.skill-tree-svg { width: 1200px; height: 800px; }

.skill-node { cursor: pointer; transition: filter 0.15s; }
.skill-node:hover { filter: brightness(0.96); }

/* Program chips (publish modal) */
.program-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.program-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
  cursor: pointer; transition: all var(--duration-fast);
}
.program-chip:hover { background: var(--bg-tertiary); }
.program-chip.selected {
  background: white; color: var(--text-primary); font-weight: 600;
  border-color: var(--chip-color, #1a1a1a);
  box-shadow: 0 0 0 1px var(--chip-color, #1a1a1a);
}
.program-chip.add-new {
  border-style: dashed; color: var(--text-tertiary);
}
.program-chip.add-new:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.program-chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--chip-color, #1a1a1a); flex-shrink: 0;
}

/* Slide-over Panel */
.slideover {
  position: fixed; top: 0; right: -420px;
  width: 420px; height: 100vh;
  background: var(--bg-primary);
  box-shadow: -8px 0 30px rgba(0,0,0,0.1);
  z-index: var(--z-overlay);
  transition: right 0.3s var(--ease-out);
  overflow-y: auto;
}
.slideover.open { right: 0; }

.slideover-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.slideover-header span { font-size: var(--text-sm); font-weight: 600; color: var(--text-tertiary); }
.slideover-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
}
.slideover-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.slideover-body { padding: 24px; }
.slideover-body h3 { font-size: var(--text-xl); font-weight: 700; margin-bottom: 8px; }

.slideover-program-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  background: var(--bg-secondary); color: var(--text-secondary);
  margin-bottom: 12px;
}

.slideover-body .skill-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; margin-bottom: 16px;
}
.slideover-body .skill-status.completed { background: #f0fdf4; color: #166534; }
.slideover-body .skill-status.in-progress { background: #fff7ed; color: #9a3412; }
.slideover-body .skill-status.not-started { background: var(--bg-tertiary); color: var(--text-tertiary); }

.slideover-progress-bar {
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--bg-tertiary); overflow: hidden;
  margin-bottom: 6px;
}
.slideover-progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--accent-green);
  transition: width 0.3s var(--ease-out);
}
.slideover-progress-label {
  font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: 20px;
}

.slideover-body p {
  font-size: var(--text-sm); color: var(--text-secondary);
  line-height: var(--leading-relaxed); margin-bottom: 20px;
}
.slideover-lessons h4 { font-size: var(--text-sm); font-weight: 600; margin-bottom: 12px; }
.slideover-lesson {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
  cursor: pointer; transition: background var(--duration-fast);
}
.slideover-lesson:hover { background: var(--bg-hover); margin: 0 -24px; padding: 10px 24px; }
.slideover-lesson-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 11px;
}
.slideover-lesson-check.done { background: var(--accent-green); border-color: var(--accent-green); color: white; }
.slideover-lesson-check.in-prog { border-color: var(--accent-orange); color: var(--accent-orange); }
.slideover-lesson-type {
  margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary);
  text-transform: capitalize;
}
.slideover-lesson-duration { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); }
.slideover-start-btn {
  width: 100%; padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-dark); color: white;
  font-size: var(--text-sm); font-weight: 600;
  margin-top: 24px; text-align: center;
  transition: opacity var(--duration-fast);
}
.slideover-start-btn:hover { opacity: 0.9; }

.slideover-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: calc(var(--z-overlay) - 10);
}
.slideover-backdrop.show { display: block; }

/* ── CMD+K COMMAND PALETTE ─────────────────────────────── */
.cmd-palette {
  display: none; position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  align-items: flex-start; justify-content: center;
  padding-top: 20vh;
}
.cmd-palette.show { display: flex; }

.cmd-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  width: 560px; max-width: 90vw;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.cmd-input-wrap svg { width: 20px; height: 20px; color: var(--text-tertiary); flex-shrink: 0; }
.cmd-input-wrap input { flex: 1; font-size: var(--text-base); color: var(--text-primary); }
.cmd-input-wrap input::placeholder { color: var(--text-tertiary); }

.cmd-results { max-height: 320px; overflow-y: auto; padding: 8px; }
.cmd-group-label {
  font-size: var(--text-xs); font-weight: 600;
  color: var(--text-tertiary);
  padding: 8px 12px 4px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  font-size: var(--text-sm);
}
.cmd-item:hover, .cmd-item.active { background: var(--bg-hover); }
.cmd-item svg { width: 18px; height: 18px; color: var(--text-tertiary); flex-shrink: 0; }
.cmd-item-shortcut { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); display: flex; gap: 4px; }
.cmd-item-shortcut kbd {
  background: var(--bg-tertiary);
  padding: 2px 6px; border-radius: 4px;
  font-family: inherit; font-size: 11px;
}

.cmd-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 16px;
  font-size: var(--text-xs); color: var(--text-tertiary);
}

/* ── TOAST NOTIFICATIONS ───────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-dark); color: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s var(--ease-out);
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }

/* ── LOADING ───────────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── ANIMATIONS ────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-in { animation: fadeInUp var(--duration-slow) ease forwards; }
.delay-1 { animation-delay: 0.05s; opacity: 0; }
.delay-2 { animation-delay: 0.1s; opacity: 0; }
.delay-3 { animation-delay: 0.15s; opacity: 0; }
.delay-4 { animation-delay: 0.2s; opacity: 0; }

/* ── MANAGE SCREEN ─────────────────────────────────────── */
.manage-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 24px 40px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  position: sticky; top: 0;
  z-index: var(--z-sticky);
}
.manage-header h2 { font-size: var(--text-lg); font-weight: 700; }
.manage-subtitle { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 2px; }

.manage-header-actions { display: flex; align-items: center; gap: 12px; }
.manage-filter-group { display: flex; align-items: center; gap: 8px; }

.manage-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9a9a'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  transition: border-color var(--duration-fast);
}
.manage-select:hover { border-color: var(--border-medium); }
.manage-select:focus { border-color: var(--text-primary); outline: none; }

.manage-create-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-dark); color: white;
  font-size: var(--text-sm); font-weight: 600;
  transition: opacity var(--duration-fast);
}
.manage-create-btn:hover { opacity: 0.9; }
.manage-create-btn svg { width: 16px; height: 16px; }

.manage-body { flex: 1; overflow-y: auto; padding: 0 40px 60px; }

.manage-table { width: 100%; border-collapse: collapse; margin-top: 0; }
.manage-table thead th {
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-tertiary);
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.manage-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration-fast);
}
.manage-table tbody tr:hover { background: var(--bg-hover); }
.manage-table td { padding: 14px 12px; font-size: var(--text-sm); vertical-align: middle; }

.manage-course-cell {
  display: flex; align-items: center; gap: 14px;
}
.manage-course-thumb {
  width: 44px; height: 32px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.manage-course-info { display: flex; flex-direction: column; }
.manage-course-title { font-weight: 600; line-height: var(--leading-snug); }
.manage-course-desc {
  font-size: var(--text-xs); color: var(--text-tertiary);
  max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.manage-category-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary);
}
.manage-category-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.manage-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.manage-status.published { background: #f0fdf4; color: #166534; }
.manage-status.published::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-green);
}
.manage-status.draft { background: var(--bg-tertiary); color: var(--text-tertiary); }
.manage-status.draft::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--border-medium);
}

.manage-meta { font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; }

.manage-actions { display: flex; align-items: center; gap: 4px; }
.manage-action-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
  position: relative;
}
.manage-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.manage-action-btn.danger:hover { background: #fef2f2; color: var(--accent-red); }
.manage-action-btn svg { width: 16px; height: 16px; }
.manage-action-btn[title]:hover::after {
  content: attr(title);
  position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--bg-dark); color: white;
  font-size: 11px; white-space: nowrap;
  border-radius: 4px;
  pointer-events: none;
}

.manage-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-tertiary);
}
.manage-empty-icon {
  width: 56px; height: 56px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 24px;
}
.manage-empty h3 { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.manage-empty p { font-size: var(--text-sm); }

/* ── MODAL (generic) ──────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 520px; max-width: 90vw;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.modal-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-card-header h3 { font-size: var(--text-lg); font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-card-body { padding: 24px 28px; }
.modal-card-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
}

.form-textarea {
  resize: vertical; min-height: 60px;
  line-height: var(--leading-normal);
}

.color-picker-row { display: flex; gap: 8px; margin-top: 4px; }
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--duration-fast);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-primary); }

/* ── COURSE DETAIL VIEW ────────────────────────────────── */
.cd-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 0;
  font-size: var(--text-sm); color: var(--text-secondary);
  cursor: pointer; transition: color var(--duration-fast);
}
.cd-back:hover { color: var(--text-primary); }

.cd-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 0 24px; gap: 16px;
}
.cd-header-info { display: flex; align-items: center; gap: 16px; }
.cd-thumb {
  width: 56px; height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.cd-header h2 { font-size: var(--text-lg); font-weight: 700; margin-bottom: 2px; }
.cd-desc { font-size: var(--text-sm); color: var(--text-tertiary); max-width: 500px; }

.cd-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 28px;
}
.cd-stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.cd-stat-value { font-size: var(--text-xl); font-weight: 700; line-height: 1; }
.cd-stat-label { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 4px; }

.cd-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cd-section-header h3 { font-size: var(--text-base); font-weight: 600; }
.cd-filter-group { display: flex; gap: 8px; }

.cd-assign-table .cd-user-cell {
  display: flex; align-items: center; gap: 10px;
}
.cd-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.cd-user-info { display: flex; flex-direction: column; }
.cd-user-name { font-weight: 500; font-size: var(--text-sm); }
.cd-user-email { font-size: 11px; color: var(--text-tertiary); }

.cd-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.cd-status-pill.completed { background: #f0fdf4; color: #166534; }
.cd-status-pill.completed::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-green); }
.cd-status-pill.in_progress { background: #fff7ed; color: #9a3412; }
.cd-status-pill.in_progress::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-orange); }
.cd-status-pill.not_started { background: var(--bg-tertiary); color: var(--text-tertiary); }
.cd-status-pill.not_started::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--border-medium); }

/* ── ASSIGN MODAL ─────────────────────────────────────── */
.assign-user-list {
  max-height: 200px; overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.assign-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--duration-fast);
  border-bottom: 1px solid var(--border-light);
}
.assign-user-row:last-child { border-bottom: none; }
.assign-user-row:hover { background: var(--bg-hover); }
.assign-user-row.selected { background: #f0fdf4; }

.assign-user-check {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-medium);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px; color: white;
  transition: all var(--duration-fast);
}
.assign-user-row.selected .assign-user-check {
  background: var(--accent-green); border-color: var(--accent-green);
}

.assign-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.assign-user-name { flex: 1; font-size: var(--text-sm); font-weight: 500; }
.assign-user-email { font-size: 11px; color: var(--text-tertiary); }
.assign-user-role {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.assign-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.assign-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  font-size: var(--text-xs); font-weight: 500;
}
.assign-tag-remove {
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.assign-tag-remove:hover { background: var(--bg-tertiary); color: var(--accent-red); }

/* ── PUBLISH MODAL ─────────────────────────────────────── */
.pub-generate-btn {
  position: absolute; bottom: 8px; right: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-dark); color: white;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  transition: opacity var(--duration-fast);
}
.pub-generate-btn:hover { opacity: 0.85; }

.pub-visibility-options { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pub-vis-option { cursor: pointer; }
.pub-vis-option input { display: none; }
.pub-vis-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}
.pub-vis-card strong { font-size: var(--text-sm); font-weight: 600; }
.pub-vis-card span { font-size: var(--text-xs); color: var(--text-tertiary); }
.pub-vis-option input:checked + .pub-vis-card {
  border-color: var(--text-primary);
  background: var(--bg-hover);
}

/* ── SHARE MODAL ──────────────────────────────────────── */
.share-link-row { display: flex; gap: 8px; }
.share-link-row .form-input { flex: 1; background: var(--bg-secondary); }
.share-copy-btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-dark); color: white;
  font-size: var(--text-sm); font-weight: 600;
  white-space: nowrap;
  transition: opacity var(--duration-fast);
}
.share-copy-btn:hover { opacity: 0.9; }

.share-collab-row { display: flex; gap: 8px; }
.share-collab-row .form-input { flex: 1; }
.share-invite-btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--duration-fast);
}
.share-invite-btn:hover { border-color: var(--border-medium); background: var(--bg-hover); }

.share-collab-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
}
.share-collab-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.share-collab-name { flex: 1; }
.share-collab-role { font-size: var(--text-xs); color: var(--text-tertiary); }

/* ── NARRATION BANNER ─────────────────────────────────── */
.narration-banner {
  display: none; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(90deg, #1a1a1a, #333);
  color: white;
  font-size: var(--text-sm);
}
.narration-banner.show { display: flex; }
.narration-banner-text { flex: 1; }
.narration-banner button {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  transition: opacity var(--duration-fast);
}
.narration-stop { background: var(--accent-red); color: white; }
.narration-stop:hover { opacity: 0.9; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar-brand span,
  .nav-item span,
  .nav-group-label { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-group-label { justify-content: center; padding: 10px; }

  .course-sidebar { width: 200px; min-width: 200px; }
  .course-chat-bar { left: 200px; }

  .editor-sidebar { width: 180px; min-width: 180px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .course-sidebar { display: none; }
  .course-chat-bar { left: 0; }
  .editor-sidebar { display: none; }
  .dashboard-content { padding: 24px 20px 60px; }
  .featured-grid { grid-template-columns: 1fr; }
  .recommended-grid { grid-template-columns: 1fr; }
  .assignment-table th:nth-child(n+3),
  .assignment-table td:nth-child(n+3) { display: none; }
  .manage-header { flex-direction: column; gap: 12px; padding: 20px; }
  .manage-header-actions { flex-wrap: wrap; width: 100%; }
  .manage-body { padding: 0 20px 60px; }
  .manage-table th:nth-child(n+3),
  .manage-table td:nth-child(n+3) { display: none; }
  .manage-table th:last-child,
  .manage-table td:last-child { display: table-cell; }
}
