/* ============================================
   FORMATION ELASTIC STACK — Design System
   Theme: Obsidian Slate (Technical & Sober)
   ============================================ */

:root,
[data-theme="dark"] {
  /* Surfaces */
  --bg-primary: #0B0D12;
  --bg-secondary: #10141C;
  --bg-tertiary: #151A24;
  --bg-elevated: #1A202C;
  --bg-hover: #1E2534;
  --bg-active: #252E40;

  /* Borders */
  --border-subtle: #1D2331;
  --border-default: #262F42;
  --border-strong: #35415B;

  /* Typography colors */
  --text-primary: #ECEFF4;
  --text-secondary: #94A0B8;
  --text-tertiary: #647087;
  --text-muted: #475267;

  /* Technical Accents (Elastic-inspired, sober) */
  --accent-primary: #0077CC;
  --accent-primary-hover: #0088E8;
  --accent-primary-fg: #38BDF8;
  --accent-primary-dim: rgba(56, 189, 248, 0.10);
  --accent-primary-border: rgba(56, 189, 248, 0.28);

  --accent-green: #10B981;
  --accent-green-dim: rgba(16, 185, 129, 0.10);
  --accent-green-border: rgba(16, 185, 129, 0.28);

  --accent-amber: #F59E0B;
  --accent-amber-dim: rgba(245, 158, 11, 0.10);
  --accent-amber-border: rgba(245, 158, 11, 0.28);

  --accent-blue: #3B82F6;
  --accent-blue-dim: rgba(59, 130, 246, 0.10);

  --accent-purple: #8B5CF6;
  --accent-purple-dim: rgba(139, 92, 246, 0.10);

  --accent-red: #EF4444;
  --accent-red-dim: rgba(239, 68, 68, 0.10);
  --accent-red-border: rgba(239, 68, 68, 0.28);

  --code-inline-bg: #181E2B;
  --code-inline-fg: #E2E8F0;
  --code-block-bg: #0E1219;
  --code-header-bg: #131822;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --bg-hover: #F1F5F9;
  --bg-active: #E2E8F0;

  --border-subtle: #E2E8F0;
  --border-default: #CBD5E1;
  --border-strong: #94A3B8;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-muted: #94A3B8;

  --accent-primary: #006BB8;
  --accent-primary-hover: #005A9C;
  --accent-primary-fg: #0284C7;
  --accent-primary-dim: rgba(2, 132, 199, 0.08);
  --accent-primary-border: rgba(2, 132, 199, 0.25);

  --accent-green: #059669;
  --accent-green-dim: rgba(5, 150, 105, 0.08);
  --accent-green-border: rgba(5, 150, 105, 0.25);

  --accent-amber: #D97706;
  --accent-amber-dim: rgba(217, 119, 6, 0.08);
  --accent-amber-border: rgba(217, 119, 6, 0.25);

  --accent-blue: #2563EB;
  --accent-blue-dim: rgba(37, 99, 235, 0.08);

  --accent-purple: #7C3AED;
  --accent-purple-dim: rgba(124, 58, 237, 0.08);

  --accent-red: #DC2626;
  --accent-red-dim: rgba(220, 38, 38, 0.08);
  --accent-red-border: rgba(220, 38, 38, 0.25);

  --code-inline-bg: #F1F5F9;
  --code-inline-fg: #0F172A;
  --code-block-bg: #0F172A;
  --code-header-bg: #1E293B;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);
}

:root {
  /* Layout & Spacing */
  --sidebar-width: 288px;
  --header-height: 52px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', monospace;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.8125rem;  /* 13px */
  --font-size-base: 0.9375rem;/* 15px */
  --font-size-md: 1.0625rem;  /* 17px */
  --font-size-lg: 1.25rem;    /* 20px */
  --font-size-xl: 1.5rem;     /* 24px */
  --font-size-2xl: 1.875rem;  /* 30px */

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection {
  background: var(--accent-primary-dim);
  color: var(--accent-primary-fg);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

a {
  color: var(--accent-primary-fg);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base), width var(--transition-base), min-width var(--transition-base);
  z-index: 100;
  position: relative;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-width)));
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: inherit;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  display: block;
}

.sidebar-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Sidebar search */
.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: border-color var(--transition-fast);
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-primary-fg);
}

.search-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  flex: 1;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-shortcut {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* Sidebar progress */
.sidebar-progress {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-count {
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.progress-bar {
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary-fg);
  border-radius: 2px;
  transition: width var(--transition-base);
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

.nav-section {
  padding: 2px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-align: left;
}

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

.nav-item.active {
  background: var(--accent-primary-dim);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary-border);
}

.nav-icon {
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Course list in sidebar */
.course-list {
  padding: 0 8px;
}

.phase-group {
  margin-bottom: 4px;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.phase-header:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.phase-chevron {
  transition: transform var(--transition-fast);
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.phase-header.collapsed .phase-chevron {
  transform: rotate(-90deg);
}

.phase-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.week-group {
  margin-left: 6px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 4px;
}

.week-header {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 5px 8px 3px;
}

.course-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px 6px 12px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  text-align: left;
}

.course-item:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.course-item.active {
  background: var(--accent-primary-dim);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary-border);
  font-weight: 500;
}

.course-item:disabled {
  opacity: 0.4;
  cursor: default;
}

.course-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--text-muted);
  background: transparent;
}

.course-status.status--completed {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.course-status.status--in_progress {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
}

.course-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.course-day-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.track-progress {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn .track-progress {
  margin-left: 4px;
}

/* --- Main Area --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* Header */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
  z-index: 50;
}

.header-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-xs);
}
.header-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.header-breadcrumb {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-weight: 500;
}
.header-breadcrumb a:hover {
  color: var(--text-primary);
}

.header-breadcrumb .bc-sep {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-breadcrumb .bc-current {
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.header-progress-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.mini-progress-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.mini-progress-bar {
  width: 64px;
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: var(--accent-primary-fg);
  border-radius: 2px;
  transition: width var(--transition-base);
}

.mini-progress-text {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
  background: var(--bg-hover);
}

/* Language Switcher (FR / EN) */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  gap: 2px;
  height: 30px;
}

.lang-switch-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 8px;
  height: 24px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lang-switch-btn:hover:not(.active) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.lang-switch-btn.active {
  background: var(--accent-primary-dim);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary-border);
}

.badge--fallback {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  border-color: var(--accent-amber-border);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Content area */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* --- Dashboard (Home View) --- */
.dashboard {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.dashboard-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-primary-fg);
  margin-bottom: 6px;
}

.dashboard-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.dashboard-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 620px;
  line-height: 1.5;
}

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

/* KPI Stats Row */
.welcome-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.stat-card--accent {
  border-color: var(--accent-primary-border);
  background: var(--bg-secondary);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.stat-dot--completed { background: var(--accent-green); }
.stat-dot--progress { background: var(--accent-amber); }

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-card--accent .stat-value {
  color: var(--accent-primary-fg);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Dashboard Two-Column Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
  align-items: start;
}

.dashboard-col-main,
.dashboard-col-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.panel-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.panel-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Next Up Cards */
.next-up-cards {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.next-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.next-card-info {
  min-width: 0;
  flex: 1;
}

.next-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.next-card-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-card-cta {
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent-primary-fg);
  flex-shrink: 0;
}

/* Phases Overview Table */
.phases-overview {
  divide-y: 1px solid var(--border-subtle);
}

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
}
.phase-row:last-child {
  border-bottom: none;
}

.phase-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.phase-row-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-row-weeks {
  color: var(--text-tertiary);
  font-size: 11px;
}

.phase-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.phase-row-bar {
  width: 60px;
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
}

.phase-row-fill {
  height: 100%;
  background: var(--accent-green);
}

.phase-row-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

/* Available Courses List in Dashboard */
.available-courses-list {
  max-height: 520px;
  overflow-y: auto;
}

.avail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.avail-item:last-child {
  border-bottom: none;
}
.avail-item:hover {
  background: var(--bg-hover);
}

.avail-item-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 28px;
}

.avail-item-title {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avail-item-duration {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
}
.btn--primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn--ghost {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn--ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--lg { padding: 9px 16px; font-size: var(--font-size-sm); }

/* --- Course View Layout (Article + Right TOC) --- */
.course-view-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.course-view {
  flex: 1;
  max-width: 780px;
  min-width: 0;
}

.course-toc {
  width: 230px;
  flex-shrink: 0;
  position: sticky;
  top: 28px;
  max-height: calc(100vh - var(--header-height) - 56px);
  overflow-y: auto;
  display: block;
}

.course-toc-inner {
  border-left: 1px solid var(--border-subtle);
  padding-left: 14px;
}

.course-toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.course-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.toc-link {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-tertiary);
  text-decoration: none !important;
  display: block;
  padding: 2px 0;
  transition: color var(--transition-fast);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-link:hover {
  color: var(--text-primary);
}

.toc-link.toc-h3 {
  padding-left: 10px;
  font-size: 11.5px;
}

.course-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.course-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}

.status-select:focus {
  border-color: var(--accent-primary-fg);
}

.course-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 28px;
  margin-top: 40px;
  border-top: 1px solid var(--border-subtle);
}

/* --- Markdown Body --- */
.markdown-body {
  font-size: var(--font-size-base);
  line-height: 1.72;
  color: var(--text-primary);
}

.markdown-body h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  scroll-margin-top: 20px;
}

.markdown-body h3 {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text-primary);
  scroll-margin-top: 20px;
}

.markdown-body h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text-secondary);
}

.markdown-body p {
  margin: 0 0 14px;
}

.markdown-body ul, .markdown-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.markdown-body li {
  margin: 4px 0;
}

.markdown-body li + li {
  margin-top: 5px;
}

.markdown-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.markdown-body em {
  color: var(--text-secondary);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 28px 0;
}

.markdown-body blockquote {
  border-left: 3px solid var(--border-strong);
  padding: 10px 16px;
  margin: 16px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.markdown-body blockquote p:first-child { margin-top: 0; }
.markdown-body blockquote p:last-child { margin-bottom: 0; }

/* Code */
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--code-inline-bg);
  color: var(--code-inline-fg);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

.markdown-body pre {
  margin: 16px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--code-block-bg);
  position: relative;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--code-header-bg);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.code-copy-btn.copied {
  color: var(--accent-green);
  border-color: var(--accent-green-border);
}

.markdown-body pre code {
  display: block;
  padding: 14px 16px;
  background: transparent;
  color: #E6EDF3;
  border: none;
  font-size: 13px;
  line-height: 1.58;
  overflow-x: auto;
  border-radius: 0;
}

/* Tables */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: var(--font-size-sm);
}

.markdown-body th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
}

.markdown-body td {
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.markdown-body tr:hover td {
  background: var(--bg-secondary);
}

/* Details / Collapsible */
.markdown-body details {
  margin: 14px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
}

.markdown-body details summary {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast);
  list-style: none;
}

.markdown-body details summary::-webkit-details-marker {
  display: none;
}

.markdown-body details summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.markdown-body details[open] summary::before {
  transform: rotate(90deg);
}

.markdown-body details summary:hover {
  background: var(--bg-hover);
}

.markdown-body details > *:not(summary) {
  padding: 0 14px;
}

.markdown-body details > p:first-of-type {
  padding-top: 12px;
}

.markdown-body details > *:last-child {
  padding-bottom: 12px;
}

/* Images */
.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* --- Quiz Interactive (Sober Engineering Style) --- */
.quiz-container {
  margin: 24px 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.quiz-question {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.quiz-question:last-of-type {
  border-bottom: none;
}

.quiz-question-text {
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.55;
}

.quiz-answer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-xs);
}

.quiz-answer-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.quiz-answer-btn.revealed {
  cursor: default;
  background: var(--accent-green-dim);
  border-color: var(--accent-green-border);
  color: var(--accent-green);
}

.quiz-answer-detail {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-green);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.65;
}

.quiz-answer-detail.visible {
  display: block;
}

.quiz-score {
  padding: 10px 18px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.quiz-score-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Plan View --- */
.plan-view {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* --- Editor View --- */
.editor-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  flex-wrap: wrap;
}

.editor-toolbar-left, .editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-file-select {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  cursor: pointer;
  min-width: 240px;
  outline: none;
}

.editor-file-select:focus {
  border-color: var(--accent-primary-fg);
}

.editor-tool {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.editor-toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

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

.editor-pane, .preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-pane-header {
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.editor-textarea {
  flex: 1;
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  resize: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: 1.65;
  tab-size: 2;
}

.editor-divider {
  width: 1px;
  background: var(--border-subtle);
}

.preview-pane {
  border-left: 1px solid var(--border-subtle);
}

.preview-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

/* --- Search View --- */
.search-view {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.search-results-title {
  font-size: var(--font-size-md);
  color: var(--text-primary);
  margin-bottom: 20px;
}

.search-result-item {
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.search-result-item:hover {
  border-color: var(--border-strong);
}

.search-result-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: 3px;
}

.search-result-filename {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.search-result-snippet {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.search-result-snippet mark,
.search-modal-item-snippet mark {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-count {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* --- Search Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}

.search-modal {
  width: 90%;
  max-width: 560px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-modal-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-modal-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  outline: none;
}

.search-modal-input::placeholder {
  color: var(--text-tertiary);
}

.search-modal-results {
  max-height: 380px;
  overflow-y: auto;
}

.search-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.search-modal-item:last-child {
  border-bottom: none;
}

.search-modal-item:hover,
.search-modal-item.active {
  background: var(--bg-hover);
}

.search-modal-item-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
  display: flex;
}

.search-modal-item-info {
  flex: 1;
  min-width: 0;
}

.search-modal-item-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-modal-item-snippet {
  font-size: 11px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.search-modal-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
}

/* --- Toasts --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  max-width: 340px;
}

.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error { border-left: 3px solid var(--accent-red); }
.toast--info { border-left: 3px solid var(--accent-primary-fg); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge--day {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary-fg);
  font-weight: 600;
}

.badge--phase {
  color: var(--text-primary);
}

/* --- GitHub Alert Styles --- */
.alert-note {
  border-left-color: var(--accent-blue) !important;
  background: var(--accent-blue-dim) !important;
}
.alert-tip {
  border-left-color: var(--accent-green) !important;
  background: var(--accent-green-dim) !important;
}
.alert-important {
  border-left-color: var(--accent-purple) !important;
  background: var(--accent-purple-dim) !important;
}
.alert-warning {
  border-left-color: var(--accent-amber) !important;
  background: var(--accent-amber-dim) !important;
}
.alert-caution {
  border-left-color: var(--accent-red) !important;
  background: var(--accent-red-dim) !important;
}

.alert-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-right: 6px;
  color: var(--text-primary);
}

/* --- Highlight.js Syntax Colors --- */
.hljs { background: transparent !important; }
.hljs-keyword { color: #FF7B72; }
.hljs-string { color: #A5D6FF; }
.hljs-number { color: #79C0FF; }
.hljs-comment { color: #6E7681; font-style: italic; }
.hljs-function, .hljs-title { color: #D2A8FF; }
.hljs-built_in, .hljs-attr, .hljs-property, .hljs-literal { color: #79C0FF; }
.hljs-type { color: #FFA657; }
.hljs-variable { color: #FFA657; }
.hljs-selector-class, .hljs-addition { color: #7EE787; }
.hljs-selector-tag { color: #FF7B72; }
.hljs-meta { color: #8B949E; }
.hljs-deletion { color: #FFA198; }
.hljs-symbol { color: #D2A8FF; }

/* New file modal */
.new-file-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.new-file-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.new-file-dialog h3 {
  margin-bottom: 14px;
  font-size: var(--font-size-base);
}

.new-file-dialog label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 5px;
  margin-top: 10px;
}

.new-file-dialog input {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  outline: none;
}

.new-file-dialog input:focus {
  border-color: var(--accent-primary-fg);
}

.new-file-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .course-toc {
    display: none;
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .welcome-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .editor-container {
    flex-direction: column;
  }

  .preview-pane {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 640px) {
  .dashboard, .course-view-layout, .plan-view, .search-view {
    padding: 20px 16px;
  }

  .welcome-stats {
    grid-template-columns: 1fr;
  }

  .header-progress-mini .mini-progress-label {
    display: none;
  }
}


/* ============================================
   Auth Page, Split-View, Exam Timer & Notes
   ============================================ */

.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow-y: auto;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--accent-primary-dim), transparent 55%), var(--bg-primary);
}

.auth-topbar {
  position: fixed;
  top: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

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

.auth-title {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.auth-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.auth-setup-hint {
  background: var(--accent-amber-dim);
  border: 1px solid var(--accent-amber-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
  font-size: var(--font-size-xs);
  color: var(--text-primary);
}

.auth-setup-title {
  font-weight: 600;
  color: var(--accent-amber);
  margin-bottom: 4px;
}

.auth-setup-hint code {
  display: block;
  margin-top: 8px;
  padding: 8px;
  background: var(--code-block-bg);
  color: #E2E8F0;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

.auth-error {
  background: var(--accent-red-dim);
  border: 1px solid var(--accent-red-border);
  color: var(--accent-red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-field input {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent-primary-fg);
}

#totpInput {
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-align: center;
  font-size: var(--font-size-base);
}

.auth-2fa-prompt {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

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

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 9px 16px;
  margin-top: 4px;
}

.auth-footer-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-user {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-backup-actions {
  display: flex;
  gap: 4px;
}

.btn--xs {
  padding: 3px 8px;
  font-size: 11px;
}

.btn.active-toggle {
  background: var(--accent-primary-dim);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary-border);
}

/* Split-View EN | FR */
.course-view-layout.split-mode .course-view {
  max-width: 100%;
}

.split-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.split-col {
  min-width: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.split-col-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary-fg);
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Interactive Exam / Certification Drill Bar */
.exam-timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-amber-border);
  border-radius: var(--radius-md);
}

.exam-timer-bar.running {
  background: var(--accent-amber-dim);
}

.exam-timer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exam-timer-badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--accent-amber);
}

.exam-presets {
  display: inline-flex;
  gap: 4px;
}

.exam-preset-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.exam-preset-btn.active {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.exam-preset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.exam-timer-display {
  font-family: var(--font-mono);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.exam-timer-actions {
  display: flex;
  gap: 6px;
}

.course-view.exam-locked details > summary,
.course-view.exam-locked .quiz-answer-btn {
  pointer-events: none;
  opacity: 0.5;
}

.badge--drill {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  border-color: var(--accent-amber-border);
}

/* Personal Notes Drawer */
.notes-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
}

.notes-drawer {
  width: 310px;
  min-width: 310px;
  flex-shrink: 0;
}

.notes-drawer-inner {
  position: sticky;
  top: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 64px);
  max-height: 680px;
  overflow: hidden;
}

.notes-drawer-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notes-drawer-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
}

.notes-drawer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-save-status {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.notes-close-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}
.notes-close-btn:hover {
  color: var(--text-primary);
}

.notes-textarea {
  flex: 1;
  width: 100%;
  background: var(--bg-primary);
  border: none;
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: none;
}

.notes-textarea:focus {
  outline: none;
}

@media (max-width: 1100px) {
  .split-view-grid {
    grid-template-columns: 1fr;
  }
  .notes-drawer {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 150;
    box-shadow: var(--shadow-lg);
  }
}
