/* ===== NoteFlow — Clean Student Theme ===== */
/* White + Black | Outfit + Inter | Minimal */

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

/* ===== Design Tokens ===== */
:root {
  /* Surfaces — clean whites */
  --bg-base: #f8f9fb;
  --bg-raised: #ffffff;
  --bg-overlay: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-solid: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-glass: #f8f9fb;

  /* Borders */
  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-glass: #e2e8f0;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Brand — Blue */
  --brand: #2563EB;
  --brand-light: #2563EB;
  --brand-lighter: #93C5FD;
  --brand-dark: #1d4ed8;
  --brand-glow: rgba(37, 99, 235, 0.06);
  --brand-glow-strong: rgba(37, 99, 235, 0.12);
  --brand-glow-intense: rgba(37, 99, 235, 0.2);

  /* Accent — Violet */
  --accent: #7c3aed;
  --accent-light: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.06);
  --accent-glow-strong: rgba(124, 58, 237, 0.12);

  /* Semantic */
  --success: #16a34a;
  --success-light: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #d97706;
  --warning-light: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-light: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;

  /* Layout */
  --sidebar-w: 240px;
  --content-max: 1100px;

  /* Shape */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-glow-blue: none;
  --shadow-glow-accent: none;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Base ===== */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  letter-spacing: -0.03em;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border-default);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark svg { flex-shrink: 0; }

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.nav-links {
  list-style: none;
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-normal) var(--ease-out);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}

.nav-link svg { width: 20px; height: 20px; stroke-width: 1.75; flex-shrink: 0; }

.nav-link:hover {
  background: var(--brand-glow);
  color: var(--text-secondary);
}

.nav-link.active {
  background: var(--brand-glow);
  color: var(--brand-light);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--brand-glow-strong);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-glass);
}

.sidebar-footer-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.sidebar-footer-text svg { width: 14px; height: 14px; color: var(--accent); }

/* ===== Main Content ===== */
#app {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: calc(var(--content-max) + 5rem);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  transition: opacity 80ms ease-out;
  position: relative;
  z-index: 1;
}

/* ===== Loading ===== */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Page Header ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.breadcrumb a:hover { color: var(--brand-light); }

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.5;
}

/* ===== Cards ===== */
.card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.card-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.card-footer {
  display: flex;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-footer svg { width: 14px; height: 14px; }

.card-footer-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ===== Subject Card ===== */
.subject-card {
  cursor: pointer;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--subject-color, var(--brand));
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: width var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal);
}

.subject-card:hover::before {
  width: 4px;
}

.subject-card .card-title { padding-left: 0.5rem; }
.subject-card .card-subtitle { padding-left: 0.5rem; }

.subject-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.subject-icon svg { width: 20px; height: 20px; }

/* ===== Lecture Card ===== */
.lecture-card { cursor: pointer; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand);
  color: white;
}
.btn-primary:hover {
  background: var(--brand-dark);
}
.btn-primary:active { filter: brightness(0.95); }

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.btn-danger:hover { background: var(--danger); color: white; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.btn-success:hover { background: var(--success); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem;
}
.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

.btn-icon {
  padding: 0.4rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { color: var(--text-primary); background: var(--bg-surface-solid); }

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }

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

input[type="text"], input[type="date"], input[type="email"],
input[type="number"], input[type="password"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--duration-normal) var(--ease-out);
  line-height: 1.5;
  backdrop-filter: blur(4px);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* ===== Badges & Status ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge svg { width: 12px; height: 12px; }

.badge-primary { background: var(--brand-glow); color: var(--brand-light); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-success { background: var(--success-bg); color: var(--success-light); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning-light); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger-light); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-secondary { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.15); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.empty { background: var(--text-muted); }
.status-dot.has_files { background: var(--warning); box-shadow: 0 0 8px var(--warning-bg); }
.status-dot.processing { background: var(--info); box-shadow: 0 0 8px var(--info-bg); animation: pulse-glow 2s ease-in-out infinite; }
.status-dot.completed { background: var(--success); box-shadow: 0 0 8px var(--success-bg); }

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--info-bg); }
  50% { opacity: 0.5; box-shadow: 0 0 16px var(--info); }
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab svg { width: 16px; height: 16px; }

.tab:hover { color: var(--text-secondary); background: rgba(255, 255, 255, 0.04); }

.tab.active {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; animation: fadeSlideIn 0.3s var(--ease-out); }
.tab-content.active { display: block; }

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

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  color: var(--text-muted);
  background: var(--bg-glass);
  position: relative;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--brand);
  background: var(--brand-glow);
  color: var(--text-primary);
}

.upload-area input[type="file"] { display: none; }

.upload-icon { margin-bottom: 0.75rem; }

.upload-icon svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.25;
  color: var(--brand);
}

.upload-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== File List ===== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.file-item:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-hover);
}

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

.file-icon svg { width: 18px; height: 18px; }

.file-icon-audio { background: var(--brand-glow); color: var(--brand-light); }
.file-icon-pdf { background: var(--danger-bg); color: var(--danger-light); }
.file-icon-image { background: var(--accent-glow); color: var(--accent-light); }
.file-icon-text { background: var(--success-bg); color: var(--success-light); }

.file-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.file-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

.file-item.dragging {
  opacity: 0.4;
  border-style: dashed;
  border-color: var(--brand);
}

.file-item audio {
  height: 32px;
  max-width: 200px;
  border-radius: var(--radius-sm);
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  align-items: center;
}

.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 16px; height: 16px; }

.file-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-glow), var(--accent-glow));
  color: var(--brand-light);
  font-size: .72rem;
  font-weight: 700;
  margin-right: 0.25rem;
  flex-shrink: 0;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* ===== Deepening Sources ===== */
.deepening-sources {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}
.deepening-source {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: .85rem;
  color: var(--text-secondary);
}
.deepening-source svg { width: 16px; height: 16px; flex-shrink: 0; }
.deepening-source.source-ok { color: var(--success-light); }
.deepening-source.source-ok svg { color: var(--success); }
.deepening-source.source-missing { color: var(--text-muted); }

.deepening-mode-section { margin-top: 1.25rem; }

.deepening-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mode-option { cursor: pointer; }
.mode-option input[type="radio"] { display: none; }

.mode-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-glass);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
}

.mode-option input:checked + .mode-card {
  border-color: var(--brand);
  background: var(--brand-glow);
  box-shadow: 0 0 20px var(--brand-glow);
}

.mode-card:hover { border-color: var(--border-strong); }
.mode-option input:checked + .mode-card:hover { border-color: var(--brand-light); }

.mode-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-solid);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.mode-icon svg { width: 18px; height: 18px; }
.mode-option input:checked + .mode-card .mode-icon {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white;
  box-shadow: 0 0 12px var(--brand-glow-strong);
}

.mode-info { display: flex; flex-direction: column; gap: 0.15rem; }
.mode-info strong { font-size: .9rem; color: var(--text-primary); }
.mode-info span { font-size: .78rem; color: var(--text-muted); }
.mode-option input:checked + .mode-card .mode-info span { color: var(--text-secondary); }

@media (max-width: 480px) {
  .deepening-modes { grid-template-columns: 1fr; }
}

/* ===== Progress — Refined ===== */
.progress-container {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-title svg { width: 16px; height: 16px; }

.progress-bar-track {
  background: #e2e8f0;
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease-out);
}

.progress-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.progress-step {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.progress-step svg { width: 14px; height: 14px; animation: spin 1s linear infinite; }

.progress-pct {
  color: var(--brand-light);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

/* ===== Content Display (inline preview) ===== */
.content-display {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  line-height: 1.8;
  max-height: 650px;
  overflow-y: auto;
}

.content-display h1 { color: var(--text-primary); font-size: 1.5rem; margin: 2rem 0 1rem; font-weight: 700; }
.content-display h2 { color: var(--text-primary); margin: 1.75rem 0 0.75rem; font-size: 1.25rem; font-weight: 700; }
.content-display h3 { color: var(--text-secondary); margin: 1.25rem 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.content-display p { margin-bottom: 0.75rem; color: var(--text-secondary); }
.content-display ul, .content-display ol { margin: 0.5rem 0 1rem 1.5rem; color: var(--text-secondary); }
.content-display li { margin-bottom: 0.3rem; }
.content-display code {
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--brand);
}
.content-display pre {
  background: #f8f9fb;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border-default);
}
.content-display pre code { background: none; padding: 0; color: var(--text-primary); }
.content-display strong { color: var(--text-primary); font-weight: 600; }
.content-display blockquote {
  border-left: 3px solid var(--brand);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: #f0f9ff;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

/* ===== Explanation Preview Card (clickable) ===== */
.explanation-preview {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.explanation-preview:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}
.explanation-preview-info { flex: 1; }
.explanation-preview-info h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.explanation-preview-info h4 svg { width: 18px; height: 18px; color: var(--brand); }
.explanation-preview-info p { font-size: 0.85rem; color: var(--text-muted); }
.explanation-preview-arrow {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--brand-glow); color: var(--brand);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.explanation-preview-arrow svg { width: 18px; height: 18px; }

/* ===== Fullscreen Explanation View ===== */
.fullscreen-explanation {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #ffffff;
  display: flex;
  animation: fadeSlideIn 0.25s var(--ease-out);
}

.fullscreen-explanation .fe-sidebar {
  width: 280px;
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #f8f9fb;
  flex-shrink: 0;
}

.fullscreen-explanation .fe-sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fullscreen-explanation .fe-sidebar-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.fullscreen-explanation .fe-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}
.fullscreen-explanation .fe-close:hover { color: var(--text-primary); border-color: var(--border-strong); }
.fullscreen-explanation .fe-close svg { width: 16px; height: 16px; }

.fullscreen-explanation .fe-toc {
  padding: 0.75rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fullscreen-explanation .fe-toc-item {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.fullscreen-explanation .fe-toc-item:hover { background: #e2e8f0; color: var(--text-primary); }
.fullscreen-explanation .fe-toc-item.active { background: var(--brand-glow); color: var(--brand); font-weight: 600; }

.fullscreen-explanation .fe-content {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3rem;
  max-width: 800px;
}

.fullscreen-explanation .fe-content h1 { font-size: 1.6rem; font-weight: 800; margin: 2.5rem 0 1rem; color: var(--text-primary); scroll-margin-top: 1rem; }
.fullscreen-explanation .fe-content h2 { font-size: 1.3rem; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text-primary); scroll-margin-top: 1rem; }
.fullscreen-explanation .fe-content h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text-secondary); scroll-margin-top: 1rem; }
.fullscreen-explanation .fe-content p { margin-bottom: 0.85rem; color: var(--text-secondary); line-height: 1.85; }
.fullscreen-explanation .fe-content ul, .fullscreen-explanation .fe-content ol { margin: 0.5rem 0 1.25rem 1.5rem; color: var(--text-secondary); line-height: 1.8; }
.fullscreen-explanation .fe-content li { margin-bottom: 0.4rem; }
.fullscreen-explanation .fe-content strong { color: var(--text-primary); }
.fullscreen-explanation .fe-content code { background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; font-family: 'SF Mono', monospace; }
.fullscreen-explanation .fe-content blockquote { border-left: 3px solid var(--brand); padding: 0.5rem 1rem; margin: 1rem 0; background: #f0f9ff; border-radius: 0 6px 6px 0; }

/* Math rendering */
.fullscreen-explanation .fe-content .katex-display { margin: 1rem 0; overflow-x: auto; }
.math-fallback { font-family: 'SF Mono', monospace; font-size: 0.9em; }
.content-display .katex-display { margin: 1rem 0; overflow-x: auto; }

/* ===== Markdown Tables ===== */
.md-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  line-height: 1.5;
}

.md-table th {
  background: var(--bg-surface-hover, #f1f5f9);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 2px solid var(--brand, #2563EB);
  white-space: nowrap;
}

.md-table td {
  padding: 0.55rem 1rem;
  color: var(--text-secondary, #475569);
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}

.md-table tbody tr:hover {
  background: var(--brand-glow, rgba(37, 99, 235, 0.04));
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

/* Fullscreen chat toggle button */
.fe-chat-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  z-index: 310;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fe-chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(37, 99, 235, 0.45); }
.fe-chat-toggle svg { width: 22px; height: 22px; }

.fe-pdf-btn {
  position: absolute;
  top: 1rem;
  right: 4rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease-out);
  z-index: 310;
}
.fe-pdf-btn:hover { transform: scale(1.08); background: var(--brand); color: #fff; border-color: var(--brand); }
.fe-pdf-btn svg { width: 20px; height: 20px; }

/* Combined PDF modal */
.combined-pdf-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 400px; overflow-y: auto; }
.cpdf-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
  background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: 8px;
  cursor: grab; user-select: none; transition: border-color 0.15s;
}
.cpdf-item:hover { border-color: var(--brand); }
.cpdf-item input[type="checkbox"] { flex-shrink: 0; }
.cpdf-grip { display: flex; width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.cpdf-grip svg { width: 18px; height: 18px; }
.cpdf-info { display: flex; flex-direction: column; gap: 2px; }
.cpdf-info strong { font-size: 0.95rem; }
.cpdf-info span { font-size: 0.8rem; color: var(--text-muted); }

/* Subject shared files section */
.subject-shared-files { margin-bottom: 2rem; }

/* Fullscreen chat panel */
.fe-chat-panel {
  width: 380px;
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--bg-raised);
  animation: fadeSlideIn 0.2s var(--ease-out);
}

.fe-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.fe-chat-header span { display: flex; align-items: center; gap: 0.5rem; }
.fe-chat-header svg { width: 18px; height: 18px; }

.fe-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fe-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.fe-chat-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.4;
  background: var(--bg-input);
  color: var(--text-primary);
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}
.fe-chat-input-area textarea:focus { border-color: var(--brand); }

@media (max-width: 768px) {
  .fullscreen-explanation { flex-direction: column; }
  .fullscreen-explanation .fe-sidebar { width: 100%; height: auto; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--border-default); }
  .fullscreen-explanation .fe-content { padding: 1.5rem; }
  .fe-chat-panel { width: 100%; height: 50vh; border-left: none; border-top: 1px solid var(--border-default); }
  .fe-chat-toggle { top: auto; bottom: 1rem; right: 1rem; }
  .fe-pdf-btn { top: auto; bottom: 1rem; right: 4rem; }
}

/* ===== Section Header ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-header svg { width: 18px; height: 18px; color: var(--brand); }

/* ===== Modal — Glass ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeSlideIn 0.2s var(--ease-out);
}

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

.modal {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s var(--ease-spring);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: #ffffff;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-surface-hover); }

#modal-body { padding: 1.5rem; }

/* ===== Slide Preview ===== */
.slide-preview-container {
  position: relative;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 1rem;
  background: #0f0f23;
}

.slide-preview-container iframe {
  display: block;
  width: 100%;
  aspect-ratio: 960 / 700;
  border: none;
}

/* Slide toolbar buttons (top-right) */
.slide-toolbar {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.35rem;
  z-index: 10;
}
.slide-toolbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(15, 15, 35, 0.7);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s;
}
.slide-toolbar-btn:hover { background: rgba(37,99,235,0.85); color: #fff; }
.slide-toolbar-btn svg { width: 16px; height: 16px; }

/* Slide nav buttons (prev/next) */
.slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 56px;
  border: none;
  border-radius: 8px;
  background: rgba(15, 15, 35, 0.5);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s;
  font-size: 1.1rem;
}
.slide-nav:hover { background: rgba(37,99,235,0.85); color: #fff; }
.slide-nav-prev { left: 0.5rem; }
.slide-nav-next { right: 0.5rem; }

/* Slide counter (bottom-center) */
.slide-counter {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 35, 0.7);
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  backdrop-filter: blur(8px);
  z-index: 10;
  font-family: var(--font-mono, 'SF Mono', monospace);
}

/* Sidebar hidden during slide fullscreen */
#sidebar.sidebar-hidden { display: none; }
#app.no-sidebar { margin-left: 0; width: 100%; }

/* Slide fullscreen mode */
.slide-preview-container.slide-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
  border: none;
  margin: 0;
  background: #0f0f23;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-preview-container.slide-fullscreen iframe {
  width: 100%;
  height: 100%;
  max-width: calc(100vh * 960 / 700);
  max-height: calc(100vw * 700 / 960);
  aspect-ratio: 960 / 700;
  border: none;
}
.slide-preview-container.slide-fullscreen .slide-toolbar {
  top: 1rem;
  right: 1rem;
}
.slide-preview-container.slide-fullscreen .slide-toolbar-btn {
  width: 40px;
  height: 40px;
  background: rgba(15, 15, 35, 0.8);
}
.slide-preview-container.slide-fullscreen .slide-nav {
  width: 44px;
  height: 72px;
}
.slide-preview-container.slide-fullscreen .slide-counter {
  font-size: 0.85rem;
  padding: 0.3rem 1rem;
}

/* Slide regeneration overlay */
.slide-regen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 35, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: var(--radius-xl);
  backdrop-filter: blur(4px);
}
.slide-regen-overlay .regen-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}
.slide-regen-overlay .regen-label {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}
.slide-regen-overlay .regen-bar-track {
  width: 220px;
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.slide-regen-overlay .regen-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.6s ease;
  width: 0%;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  animation: toastIn 0.35s var(--ease-spring);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

.toast-success { background: #f0fdf4; color: var(--success); border: 1px solid var(--success-border); }
.toast-error { background: #fef2f2; color: var(--danger); border: 1px solid var(--danger-border); }
.toast-info { background: #f0f9ff; color: var(--info); border: 1px solid var(--info-border); }

@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--brand-glow), var(--accent-glow));
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg { width: 30px; height: 30px; color: var(--brand-light); }

.empty-state h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--duration-normal) var(--ease-out);
}

.stat-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon-blue { background: #eff6ff; color: var(--brand); }
.stat-icon-purple { background: #f5f3ff; color: var(--accent); }
.stat-icon-amber { background: #fffbeb; color: var(--warning); }
.stat-icon-green { background: #f0fdf4; color: var(--success); }

.stat-info { display: flex; flex-direction: column; }

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 500;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dashboard-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-section-title svg { width: 16px; height: 16px; }

/* ===== Table ===== */
.table-container { overflow-x: auto; }

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

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== Actions Row ===== */
.actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  gap: 1.5rem;
  max-width: 640px;
}

.settings-section {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.settings-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section-title svg { width: 20px; height: 20px; color: var(--brand); }

.system-check {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  transition: all var(--duration-fast);
}

.check-item:hover { background: var(--bg-surface-hover); }

.check-status {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.check-status svg { width: 16px; height: 16px; }

.check-ok { background: var(--success-bg); color: var(--success); }
.check-fail { background: var(--danger-bg); color: var(--danger); }

.check-name { font-weight: 600; font-size: 0.9rem; }
.check-detail { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

/* ===== Color Picker ===== */
.color-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-option {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.color-option:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

.color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* ===== Deepening Card ===== */
.deepening-card {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.deepening-card h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.deepening-card h4 svg { width: 20px; height: 20px; color: var(--brand-light); }

.deepening-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  body::before { display: none; }

  #sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
  }

  .sidebar-header { padding: 0.75rem 1rem; border-bottom: none; }
  .sidebar-footer { display: none; }

  .nav-links {
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    padding: 0.5rem;
    flex: 1;
  }

  .nav-link { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
  .nav-link span { display: none; }
  .nav-link.active::before { display: none; }

  #app {
    margin-left: 0;
    width: 100%;
    padding: 1rem;
  }

  body { flex-direction: column; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
}

/* ===== Chat AI ===== */
.chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  z-index: 250;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(37, 99, 235, 0.45); }
.chat-fab svg { width: 26px; height: 26px; }

.chat-window {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 400px;
  height: 520px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  z-index: 260;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.chat-header span { display: flex; align-items: center; gap: 0.5rem; }
.chat-header svg { width: 18px; height: 18px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg h1, .chat-msg h2, .chat-msg h3 { font-size: 1rem; margin: 0.5rem 0 0.25rem; }
.chat-msg ul { padding-left: 1.2rem; margin: 0.3rem 0; }
.chat-msg code { background: var(--bg-surface-hover); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.85rem; }
.chat-msg strong { font-weight: 600; }

.chat-msg-user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-msg-assistant {
  align-self: flex-start;
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 0.25rem;
}

.chat-thinking-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-style: italic;
}
.chat-thinking-dots svg { width: 16px; height: 16px; animation: spin 1s linear infinite; }

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.chat-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.4;
  background: var(--bg-input);
  color: var(--text-primary);
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input-area textarea:focus { border-color: var(--brand); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.chat-send-btn:disabled { opacity: 0.5; cursor: default; }
.chat-send-btn svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .chat-fab { bottom: 1rem; right: 1rem; }
}

/* ===== Audio Folder Browser ===== */
.btn-import-folder {
  margin-top: 0.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-import-folder svg { width: 18px; height: 18px; }

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  width: 90%;
  max-width: 540px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s var(--ease-spring);
}
.modal-box .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-box .modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.modal-box .modal-header h3 svg { width: 20px; height: 20px; color: var(--brand); }
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.afb-count { font-size: 0.82rem; color: var(--text-muted); }

.afb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.afb-bc-item {
  cursor: pointer;
  color: var(--brand);
  font-weight: 500;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.afb-bc-item:hover { background: var(--brand-glow); }
.afb-bc-sep { color: var(--text-muted); }

.afb-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  min-height: 200px;
  max-height: 400px;
}

.afb-loading, .afb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.afb-entry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 0.85rem;
}
.afb-entry:hover { background: var(--bg-surface-hover); }

.afb-folder { font-weight: 500; color: var(--text-primary); }
.afb-folder .afb-entry-icon svg { width: 18px; height: 18px; color: var(--brand); }
.afb-folder .afb-entry-arrow { margin-left: auto; color: var(--text-muted); font-size: 1.2rem; }

.afb-file .afb-entry-icon svg { width: 16px; height: 16px; color: var(--text-muted); }
.afb-file .afb-entry-size { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); }
.afb-file.selected { background: var(--brand-glow); }
.afb-file.selected .afb-entry-name { color: var(--brand); font-weight: 500; }

.afb-check {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

.afb-entry-icon { display: flex; align-items: center; flex-shrink: 0; }
.afb-entry-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Login Page ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-base);
}
.login-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}
.login-logo h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.login-error {
  color: var(--danger);
  font-size: 14px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.btn-full { width: 100%; justify-content: center; }

/* ===== Sidebar User & Logout ===== */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.sidebar-user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.sidebar-user-role {
  font-size: 11px;
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 0;
  transition: color var(--duration-fast) var(--ease-out);
}
.btn-logout:hover { color: var(--danger); }
.btn-logout svg { width: 16px; height: 16px; }

/* ===== Admin Panel ===== */
.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.admin-user-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.admin-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-user-stats {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}
.admin-user-actions {
  display: flex;
  gap: 6px;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  cursor: pointer;
  color: var(--text-secondary);
}
.btn-sm:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-bg); }

/* ===== Upload Progress Inline ===== */
._upload-progress {
  margin-top: .6rem;
  padding: .6rem .8rem;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 10px;
  animation: upFadeIn .2s ease;
}
._upload-progress.up-done { animation: upFadeOut .4s ease .8s forwards; }
@keyframes upFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes upFadeOut { to { opacity: 0; transform: translateY(-4px); } }
.up-files { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.up-fname {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
  color: var(--text-muted, #666);
  background: var(--bg, #fff);
  padding: .2rem .5rem;
  border-radius: 5px;
}
.up-fname svg { width: 12px; height: 12px; }
.up-bar-wrap { width: 100%; height: 6px; background: var(--bg, #e5e5e5); border-radius: 6px; overflow: hidden; }
.up-bar { height: 100%; width: 0%; background: var(--primary, #000); border-radius: 6px; transition: width .15s ease; }
.up-info { margin-top: .35rem; font-size: .78rem; font-weight: 600; color: var(--text, #000); }
