:root {
  --bg-primary: #0d1310;
  --bg-secondary: #141d18;
  --bg-card: #1b2620;
  --bg-card-hover: #22322a;
  --border-color: #2a3d32;
  --border-highlight: #3e5e4d;
  
  --text-primary: #e6ede8;
  --text-secondary: #9cb1a4;
  --text-muted: #6b8274;
  
  --accent-green: #2ecc71;
  --accent-emerald: #10b981;
  --accent-gold: #f59e0b;
  --accent-amber: #d97706;
  --accent-danger: #ef4444;
  --accent-info: #3b82f6;
  --accent-purple: #8b5cf6;
  
  --ladder-l1: #3b82f6;
  --ladder-l2: #10b981;
  --ladder-l3: #f59e0b;
  --ladder-l4: #8b5cf6;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, Cambria, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="light"] {
  --bg-primary: #f4f6f4;
  --bg-secondary: #e9ece8;
  --bg-card: #ffffff;
  --bg-card-hover: #f8faf8;
  --border-color: #d1dbd4;
  --border-highlight: #a3b8aa;
  
  --text-primary: #19251f;
  --text-secondary: #4a5c52;
  --text-muted: #788c80;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* App Header & Top Bar */
.top-navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.badge-tag.ai-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.brand-title p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.metrics-strip {
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-pill strong {
  color: var(--text-primary);
}

.metric-pill.alert {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
  background: var(--bg-card);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* App Main Container */
.app-container {
  display: flex;
  flex: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Navigation Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding-left: 8px;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 600;
  border-left: 3px solid #10b981;
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-badge {
  font-size: 0.72rem;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.nav-item.active .nav-badge {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.5);
  color: #fff;
}

/* Recall Ladder Level indicators in Sidebar */
.ladder-tracker {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.ladder-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ladder-step.active {
  color: var(--text-primary);
  font-weight: 600;
}

.step-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: bold;
}

.step-1 { border-color: var(--ladder-l1); color: var(--ladder-l1); }
.step-2 { border-color: var(--ladder-l2); color: var(--ladder-l2); }
.step-3 { border-color: var(--ladder-l3); color: var(--ladder-l3); }
.step-4 { border-color: var(--ladder-l4); color: var(--ladder-l4); }

.step-active-1 { background: var(--ladder-l1); color: #fff; }
.step-active-2 { background: var(--ladder-l2); color: #fff; }
.step-active-3 { background: var(--ladder-l3); color: #fff; }
.step-active-4 { background: var(--ladder-l4); color: #fff; }

/* Main Content Workspace */
.workspace {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 65px);
}

/* Command Prompt / Employee Assistant Bar */
.command-console-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.employee-speech {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.command-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.command-input-box {
  flex: 1;
  position: relative;
}

.command-input-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 16px 12px 42px;
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.command-input-box input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.prompt-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-emerald);
  font-weight: bold;
}

.quick-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.quick-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

/* Tab Views & Dynamic Containers */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* Card and Content Containers */
.content-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.card-title-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Primer Box */
.primer-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 24px;
}

.primer-title {
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.primer-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.primer-list li strong {
  color: var(--text-primary);
}

/* MCQ Interactive Interface */
.mcq-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mcq-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.difficulty-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.diff-easy { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.diff-medium { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.diff-hard { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.question-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-line;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  border-radius: 10px;
  color: var(--text-primary);
  text-align: left;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.option-btn:hover:not(.disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateX(4px);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 600;
}

.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

.option-btn.disabled {
  cursor: default;
}

.mcq-explanation-card {
  margin-top: 15px;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: var(--bg-card);
  border-left: 4px solid #10b981;
  display: none;
  animation: fadeIn 0.3s ease;
}

.mcq-explanation-card.show {
  display: block;
}

.mcq-explanation-card.fail {
  border-left-color: #ef4444;
}

.rationale-block {
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.distractor-block {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  background: rgba(0,0,0,0.2);
  padding: 10px 14px;
  border-radius: 6px;
}

.memory-hook-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed var(--accent-gold);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cloze Deletions Interface */
.cloze-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  margin-bottom: 20px;
}

.cloze-sentence {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 2;
  margin-bottom: 24px;
}

.cloze-input-inline {
  background: var(--bg-secondary);
  border: 2px dashed var(--accent-emerald);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: #34d399;
  font-weight: 600;
  outline: none;
  min-width: 140px;
  display: inline-block;
}

.cloze-input-inline:focus {
  border-style: solid;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.cloze-reveal-box {
  margin-top: 15px;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--accent-emerald);
  display: none;
}

.cloze-reveal-box.show {
  display: block;
}

.anki-syntax-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-primary);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-block;
  margin-top: 8px;
}

/* 3D Flashcards Interface */
.flashcard-stage {
  perspective: 1200px;
  width: 100%;
  max-width: 680px;
  margin: 20px auto;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 320px;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard-inner.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  min-height: 320px;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.card-face.card-front {
  background: linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
}

.card-face.card-back {
  background: linear-gradient(145deg, #182820 0%, #111a14 100%);
  border-color: var(--border-highlight);
  transform: rotateY(180deg);
}

.flip-prompt {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-face-content {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.8;
  margin: auto 0;
  text-align: left;
}

.card-face-content.back-text {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-line;
}

.anki-rating-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.btn-rate {
  padding: 12px 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.rate-again { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.rate-hard  { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.rate-good  { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.rate-easy  { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }

.btn-rate:hover { transform: translateY(-2px); filter: brightness(1.2); }
.rate-sub { font-size: 0.68rem; opacity: 0.8; font-weight: normal; }

/* SAQ and Mains Evaluator Interface */
.answer-box-wrapper {
  margin-top: 15px;
}

.answer-textarea {
  width: 100%;
  min-height: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.answer-textarea:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.answer-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.diagram-banner {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--accent-purple);
  color: #c4b5fd;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.evaluation-results-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
  display: none;
}

.evaluation-results-box.show {
  display: block;
}

.score-display-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.score-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

.score-tag {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.rubric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.rubric-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
}

.rubric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rubric-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.kw-pill {
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.kw-found {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.kw-missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.model-answer-block {
  margin-top: 20px;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 18px;
  border: 1px solid var(--border-color);
}

.model-answer-block h4 {
  color: var(--accent-gold);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.model-answer-content {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-line;
}

/* Syllabus Matrix Table & Topic Badges */
.topic-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.topic-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.topic-tile:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.topic-tile.weak {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.03);
}

.topic-tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.topic-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topic-paper {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.topic-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 12px 0;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.topic-actions {
  display: flex;
  gap: 8px;
}

/* Modal Windows (Adaptability Config & Profile) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-emerald);
}

/* Review Queue Banner */
.review-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.1) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.review-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Chat Log Stream for Interactive AI Mode */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-top-left-radius: 2px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-top-right-radius: 2px;
}

.chat-input-bar {
  padding: 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

/* Anki Export Preview Area */
.export-code-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #34d399;
  max-height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
  }
  .metrics-strip {
    display: none;
  }
}

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