/* ============================================================
   FLOWMD - NATIVE MOBILE-FIRST CSS ARCHITECTURE
   Unified Dark Theme, HSL Tokens & Android Material Design
   ============================================================ */

/* --- Inline SVG icons (Material Symbols paths, no icon font) ---
   Every icon is an <svg class="material-symbols-outlined"> referencing a
   hidden sprite via <use href="#fmd-i-{name}"/>. Sized with 1em so the
   existing per-context font-size rules keep working unchanged; colored via
   currentColor so existing color rules keep working unchanged. */
.material-symbols-outlined {
  width: 1em;
  height: 1em;
  display: inline-block;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: -0.125em;
}

/* --- CSS Tokens & Theme Palette --- */
:root, [data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-hover: #1f2937;
  --bg-surface-raised: #1e293b;
  --border-color: #1f293d;
  --border-subtle: #2d3748;
  
  --accent-primary: #6c3baa;
  --accent-primary-hover: #5a2f8e;
  --accent-gradient: linear-gradient(135deg, #6c3baa 0%, #8b5cf6 100%);
  --accent-glow: rgba(108, 59, 170, 0.25);
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-secondary: #a855f7;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);

  /* Retro color tokens (used by both themes) */
  --retro-green: #00ff88;
  --retro-cyan: #00f0ff;
  --retro-gold: #ffcc00;
  --retro-red: #ff5555;
  --retro-purple: #a855f7;

  --retro-bg: #090a0f;
  --retro-surface: #0d1017;
  --retro-card: #131722;
  --retro-border: #282f42;

  --font-pixel: "Press Start 2P", "Courier New", ui-monospace, monospace;
  --font-mono: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* ========== MODERN THEME DEFAULTS (data-theme-style="modern" or unset) ========== */
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-hud: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --v2-ink: rgba(0, 0, 0, 0.1);
  --v2-sky-cobalt: #6c3baa;
  --v2-sunset-vermillion: #ef4444;
  --v2-pine-green: #10b981;
  --v2-rpg-gold: #f59e0b;
  --v2-purple-accent: #8b5cf6;
}

/* ============================================================
   Global layout safety nets — prevent the recurring failure
   classes structurally (horizontal page overflow, escaping
   media, inputs that refuse to shrink in flex/grid).
   ============================================================ */
html, body {
  overflow-x: clip;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

input, select, textarea {
  min-width: 0;
  max-width: 100%;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-surface-raised: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  
  --accent-primary: #6c3baa;
  --accent-primary-hover: #5a2f8e;
  --accent-gradient: linear-gradient(135deg, #6c3baa 0%, #8b5cf6 100%);
  --accent-glow: rgba(108, 59, 170, 0.15);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
}

/* --- Global Resets & Base --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* --- FLOWMD RETRO COMPONENT UTILITIES --- */
.fm-crisp {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.fm-shadow {
  box-shadow: 3px 3px 0 0 var(--border-color);
}

.fm-shadow-hover {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fm-shadow-hover:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 var(--accent-primary);
}

.fm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-family: monospace;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-raised);
  color: var(--text-primary);
}

.fm-icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}
.v2-pixel-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.v2-arcade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  color: #ffffff;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow), 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.v2-arcade-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.v2-arcade-btn:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #6366f1 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.v2-arcade-btn:hover::before {
  opacity: 1;
}
.v2-arcade-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25), inset 0 1px 3px rgba(0, 0, 0, 0.15);
}
.v2-arcade-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 14px rgba(59, 130, 246, 0.35);
}

.v2-hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}
.v2-hud-badge:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18) 0%, rgba(99, 102, 241, 0.15) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* --- PROGRESS / HP BAR --- */
.v2-hp-bar-bg {
  position: relative;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.v2-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c3baa 0%, #8b5cf6 50%, #a855f7 100%);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5), 0 0 16px rgba(168, 85, 247, 0.3);
  position: relative;
}
.v2-hp-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%);
  border-radius: 999px;
}

.v2-retro-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 48px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.v2-retro-search-bar:hover,
.v2-retro-search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- QUEST / TASK CHECKLIST --- */
.v2-quest-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px 16px;
  margin-top: 14px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.v2-quest-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.v2-quest-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--v2-purple-accent) 100%);
  color: #ffffff;
  border-radius: 999px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.v2-quest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  border-radius: 8px;
  margin: 0 -6px;
}
.v2-quest-row:hover {
  background-color: rgba(59, 130, 246, 0.04);
  border-color: rgba(59, 130, 246, 0.1);
}

.v2-quest-row:last-child {
  border-bottom: none;
}

/* --- CHECKBOX --- */
.v2-pixel-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.v2-pixel-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.v2-pixel-checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid #475569;
  border-radius: 6px;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.v2-pixel-checkbox-label input[type="checkbox"]:checked + .v2-pixel-checkbox-box {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.v2-pixel-checkbox-box::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s ease;
  margin-top: -2px;
}

.v2-pixel-checkbox-label input[type="checkbox"]:checked + .v2-pixel-checkbox-box::after {
  transform: rotate(45deg) scale(1);
}

.v2-quest-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.v2-quest-row.completed .v2-quest-title {
  text-decoration: line-through;
  opacity: 0.55;
  color: var(--text-muted);
}

.v2-quest-xp {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
  white-space: nowrap;
}

.v2-quest-row.completed .v2-quest-xp {
  opacity: 0.45;
}

/* --- ACHIEVEMENT / ALERT COMPONENT --- */
.v2-achievement-alert {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px 20px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.v2-alert-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.v2-alert-content {
  flex: 1;
  min-width: 0;
}
.v2-alert-category {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  text-transform: uppercase;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.v2-alert-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.25;
}
.v2-alert-body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.v2-alert-close-btn {
  width: 28px;
  height: 28px;
  background-color: var(--bg-surface-hover);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}
.v2-alert-close-btn:hover {
  background-color: var(--bg-surface-raised);
  color: var(--text-primary);
  transform: scale(1.05);
}
.v2-alert-bottom-bar {
  display: none;
}

/* --- Main Layout Container --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* --- Native Topbar --- */
/* --- Search Controls (Minimalist Command Search Architecture) --- */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-box {
  display: none;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 250;
  transition: border-color 0.2s ease;
}

.search-input-box.active {
  display: flex;
  width: calc(100vw - 80px);
  max-width: 440px;
}

.search-input-box:focus-within {
  border-color: var(--text-muted);
}

.search-input-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 400;
}

.search-input-box input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Minimalist Command Search Bar Component --- */
.minimal-search-bar {
  width: 100%;
}

.minimal-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: border-color 0.2s ease;
}

.minimal-search-inner:focus-within {
  border-color: var(--text-muted);
}

.minimal-search-inner input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 400;
}

.minimal-search-inner input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-kbd-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  user-select: none;
  font-family: monospace;
}

/* --- Search Results Grouping --- */
.search-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 0.04em;
  margin: 16px 0 10px 0;
  text-transform: uppercase;
}

.search-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* --- Icon Buttons --- */
.icon-btn, .icon-btn-sm {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
  min-height: 40px;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.icon-btn-sm {
  min-width: 32px;
  min-height: 32px;
}

/* --- Avatar Trigger --- */
.user-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
}

.avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* --- Main View Content --- */
.app-main {
  flex: 1;
  padding: 16px 16px 88px 16px;
  max-width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   FLOWMD V3 ULTRA-SLEEK MODERN UI COMPONENT PRIMITIVES
   ============================================================ */
.modern-card {
  background-color: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.modern-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.modern-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1;
  color: #ffffff;
  background: var(--accent-gradient);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all 0.18s ease;
  user-select: none;
  text-decoration: none;
}

.modern-btn:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #6366f1 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.modern-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.modern-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
  border-radius: 20px;
}

.modern-progress-bg {
  position: relative;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.modern-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern Checkbox & Task Row */
.modern-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background-color 0.15s ease;
}

.modern-task-row:last-child {
  border-bottom: none;
}

.modern-task-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.modern-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.modern-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.modern-checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid #475569;
  border-radius: 6px;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.modern-checkbox-label input[type="checkbox"]:checked + .modern-checkbox-box {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.modern-checkbox-box::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s ease;
  margin-top: -2px;
}

.modern-checkbox-label input[type="checkbox"]:checked + .modern-checkbox-box::after {
  transform: rotate(45deg) scale(1);
}

.modern-task-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.modern-task-row.completed .modern-task-title {
  text-decoration: line-through;
  opacity: 0.55;
  color: var(--text-muted);
}

/* --- FLOWMD PIXELBREADCRUMB COMPONENT PRIMITIVES --- */
.fm-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-hud), monospace;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  user-select: none;
}

.fm-breadcrumb-item {
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s ease;
}

.fm-breadcrumb-item:hover {
  color: var(--accent-primary, #2e5dd6);
  text-decoration: underline;
}

.fm-breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 700;
  cursor: default;
}

.fm-breadcrumb-item.active:hover {
  text-decoration: none;
}

.fm-breadcrumb-separator {
  color: var(--v2-rpg-gold, #ffd700);
  font-family: var(--font-display), monospace;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* --- FEATURE CARD COMPONENT --- */
.fm-feature-card-wrapper {
  margin-bottom: 20px;
}

.fm-feature-card-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fm-badge-green {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fm-badge-code {
  display: none;
}

.fm-feature-card {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 22px;
  box-sizing: border-box;
  overflow: hidden;
}

.fm-feature-card-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

.fm-feature-card-desc {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px 0;
}

/* --- FLOWMD PIXELCOMMAND COMPONENT PRIMITIVES --- */
.fm-command-card {
  background-color: #0d1017;
  border: 2px solid #282f42;
  box-shadow: 6px 6px 0 0 #000000;
}

.fm-command-group-header {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--v2-rpg-gold, #ffd700);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 14px 0 6px 0;
  padding-left: 4px;
}

.fm-command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.fm-command-item:hover {
  background: rgba(46, 93, 214, 0.2);
  border-color: var(--accent-primary, #2e5dd6);
  transform: translateX(2px);
}

.fm-command-label {
  font-family: var(--font-display), monospace;
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fm-command-shortcut {
  font-family: var(--font-hud), monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  padding: 2px 6px;
  letter-spacing: 0.04em;
}

/* --- ALERT COMPONENT --- */
.fm-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: 12px;
  box-sizing: border-box;
}

.fm-alert-icon {
  font-size: 22px;
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--accent-primary);
}

.fm-alert-content {
  flex: 1;
}

.fm-alert-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.fm-alert-message {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Tone Variants */
.fm-alert-success {
  border-left-color: var(--success);
}
.fm-alert-success .fm-alert-icon {
  color: var(--success);
}

.fm-alert-warning {
  border-left-color: var(--warning);
}
.fm-alert-warning .fm-alert-icon {
  color: var(--warning);
}

.fm-alert-danger {
  border-left-color: var(--danger);
}
.fm-alert-danger .fm-alert-icon {
  color: var(--danger);
}

.fm-alert-info {
  border-left-color: var(--accent-primary);
}
.fm-alert-info .fm-alert-icon {
  color: var(--accent-primary);
}

/* --- FLOWMD ACCENT THEMES & SHADOW VARIATIONS --- */
[data-theme-accent="emerald"] {
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --v2-sky-cobalt: #10b981;
}

[data-theme-accent="cobalt"] {
  --accent-primary: #2e5dd6;
  --accent-primary-hover: #1d4ed8;
  --v2-sky-cobalt: #2e5dd6;
}

[data-theme-accent="gold"] {
  --accent-primary: #f59e0b;
  --accent-primary-hover: #d97706;
  --v2-sky-cobalt: #f59e0b;
}

[data-theme-accent="purple"] {
  --accent-primary: #a855f7;
  --accent-primary-hover: #9333ea;
  --v2-sky-cobalt: #a855f7;
}

[data-theme-accent="crimson"] {
  --accent-primary: #ef4444;
  --accent-primary-hover: #dc2626;
  --v2-sky-cobalt: #ef4444;
}

[data-shadow-style="glow"] .v2-pixel-card,
[data-shadow-style="glow"] .fm-feature-card,
[data-shadow-style="glow"] .fm-command-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

[data-shadow-style="flat"] .v2-pixel-card,
[data-shadow-style="flat"] .fm-feature-card,
[data-shadow-style="flat"] .fm-command-card {
  box-shadow: none !important;
}

.heatmap-card-title {
  font-family: var(--font-display), sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- FLOWMD PIXELGOAL PULSE GRID COMPONENT PRIMITIVES --- */
.fm-goal-pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.fm-pulse-card {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: 12px;
  padding: 16px 18px;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fm-pulse-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.fm-pulse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fm-pulse-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fm-pulse-value {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1;
}

.fm-pulse-sub {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 6px;
}

/* --- FLOWMD PIXELSTATMATRIX COMPONENT PRIMITIVES --- */
.fm-hud-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.fm-stat-card {
  position: relative;
  background-color: var(--retro-surface, #0d1017);
  border: 1px solid var(--retro-border, #282f42);
  border-left: 4px solid var(--accent-primary, #00f0ff);
  box-shadow: 4px 4px 0 0 #000000;
  padding: 14px 16px;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fm-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 0 #000000;
}

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

.fm-stat-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display), monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fm-stat-card-value {
  font-family: var(--font-display), monospace;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
  line-height: 1.2;
}

.fm-stat-card-sub {
  font-family: var(--font-hud), monospace;
  font-size: 0.95rem;
  color: #94a3b8;
  letter-spacing: 0.03em;
  white-space: normal;
  word-break: break-word;
}



/* --- FLOWMD PIXEL ICON COMPONENT PRIMITIVES --- */
.fm-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  shape-rendering: crispEdges;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.nav-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.25s ease,
              filter 0.25s ease;
}

.fm-icon-spin {
  animation: pxlSpin 2s infinite linear;
}

@keyframes pxlSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- AVATAR COMPONENT --- */
.fm-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: #ffffff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.fm-avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
  border-radius: 50%;
}

.fm-avatar-md {
  width: 42px;
  height: 42px;
  font-size: 1rem;
  border-radius: 50%;
}

.fm-avatar-lg {
  width: 58px;
  height: 58px;
  font-size: 1.3rem;
  border-radius: 50%;
}

/* Avatar Tone Variants */
.fm-avatar-green {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%) !important;
  color: #ffffff !important;
}

.fm-avatar-cyan {
  background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%) !important;
  color: #ffffff !important;
}

.fm-avatar-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%) !important;
  color: #ffffff !important;
}

.fm-avatar-purple {
  background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%) !important;
  color: #ffffff !important;
}

.fm-avatar-red {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%) !important;
  color: #ffffff !important;
}

/* --- FLOWMD V2 TOPBAR --- */
/* === PRIMARY TOPBAR BLOCK === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 76px;
  box-sizing: border-box;
  background-color: rgba(11, 15, 25, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

[data-theme="light"] .topbar {
  background-color: rgba(255, 255, 255, 0.92);
}

.topbar-brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

/* SVG logo sizing */
.flowmd-topbar-logo {
  height: 36px;
  width: auto;
  display: block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--text-primary);
}

.topbar-brand:hover .flowmd-topbar-logo {
  transform: scale(1.04);
}

/* Hide any JS-injected text beside the logo */
.brand-icon,
.brand-title {
  display: none !important;
}

/* --- Sub-Topbar Search Component --- */
.v2-subtopbar-search-container {
  padding: 12px 16px 4px 16px;
  background-color: var(--bg-body);
}

.v2-subtopbar-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 14px;
  height: 42px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.v2-subtopbar-search-box:hover,
.v2-subtopbar-search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.v2-subtopbar-search-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.92rem;
  cursor: pointer;
}

.v2-subtopbar-search-box input::placeholder {
  color: var(--text-muted);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.88rem;
}

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

/* --- Theme Toggle Switch (Modern pill default, retro square override) --- */
.retro-theme-toggle {
  cursor: pointer;
  user-select: none;
  display: inline-block;
}

.retro-theme-track {
  position: relative;
  width: 50px;
  height: 26px;
  background-color: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  box-sizing: border-box;
}

.retro-theme-track .icon-sun {
  font-size: 13px;
  color: #f59e0b;
  z-index: 1;
}

.retro-theme-track .icon-moon {
  font-size: 13px;
  color: #6366f1;
  z-index: 1;
}

.retro-theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
  z-index: 2;
}

[data-theme="dark"] .retro-theme-thumb {
  transform: translateX(24px);
  background-color: #6366f1;
}

[data-theme="light"] .retro-theme-thumb {
  transform: translateX(0px);
  background-color: #f59e0b;
}

/* --- Manual Sync Button --- */
.sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-raised);
  color: var(--accent-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sync-btn:hover {
  background: var(--accent-primary);
  color: #0b0f19;
  border-color: var(--accent-primary);
  transform: rotate(180deg);
}

.sync-btn:active {
  transform: rotate(180deg) scale(0.95);
}

[data-theme="light"] .sync-btn {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.topbar-arcade-btn {
  background-color: var(--bg-surface-raised);
  border: 2px solid var(--v2-ink, #161310);
  box-shadow: 2px 2px 0 0 var(--v2-ink, #161310);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  cursor: pointer;
  font-family: var(--font-hud), monospace;
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 90ms ease, box-shadow 90ms ease;
  user-select: none;
}

.topbar-arcade-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 0 var(--v2-ink, #161310);
}

/* --- MODERN FLOATING DOCK NAVIGATION BAR --- */
.android-bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  height: 58px;
  background: rgba(12, 15, 24, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  box-sizing: border-box;
}

.android-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #64748b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  flex: 1;
  height: 100%;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.nav-icon {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.25s ease;
}

.nav-bar-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 1px;
  transition: color 0.25s ease;
}

/* Ripple container */
.nav-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  overflow: hidden;
}

.nav-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.android-nav-item.ripple-active .nav-ripple::after {
  animation: navRipple 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes navRipple {
  0% {
    width: 0;
    height: 0;
    opacity: 0.6;
  }
  100% {
    width: 120px;
    height: 120px;
    opacity: 0;
  }
}

/* Hover */
.android-nav-item:hover {
  color: #94a3b8;
  background-color: rgba(255, 255, 255, 0.04);
}

.android-nav-item:hover .nav-icon {
  transform: scale(1.08);
}

/* Active */
.android-nav-item.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.14), rgba(120, 119, 198, 0.08));
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.android-nav-item.active .nav-icon {
  transform: scale(1.12);
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4));
}

.android-nav-item.active .nav-bar-label {
  color: #00f0ff;
}

/* Press */
.android-nav-item:active {
  transform: scale(0.93);
  transition: transform 0.1s ease;
}

/* Focus visible for accessibility */
.android-nav-item:focus-visible {
  outline: 2px solid rgba(0, 240, 255, 0.5);
  outline-offset: 2px;
}

/* --- Card & Section Container Styles --- */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* --- Dashboard Banner & Stats Grid --- */
.dash-welcome-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.dash-welcome-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dash-welcome-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.live-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.stat-box-value {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.stat-box-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- Task & Video Row (Mobile Touch Native) --- */
.react-task-row, .react-subtask-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  gap: 12px;
  transition: border-color 0.2s;
}

.react-task-row:hover, .react-task-row:active {
  border-color: var(--border-subtle);
}

.react-task-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.react-task-checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent-primary);
  border-radius: 4px;
}

.react-task-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.react-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.react-task-right {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

/* --- Badges & Status Pills --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-completed {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-time {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* --- Progress Bars --- */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* --- Accordions & Subject Cards --- */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

.accordion-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.accordion-icon {
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding-left: 4px;
  margin-bottom: 12px;
}

.accordion-body.active {
  display: block;
}

/* --- Bulk Chapter Checkbox --- */
.bulk-chapter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px;
  border-radius: 4px;
  transition: background 0.15s ease;
}
.bulk-chapter-checkbox-label:hover {
  background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}
.bulk-chapter-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}
.bulk-chapter-checkbox-label .material-symbols-outlined {
  font-size: 18px;
  transition: color 0.15s ease;
}

/* --- Slide-Up Bottom Sheet --- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-surface-raised);
  border-radius: 24px 24px 0 0;
  padding: 16px 20px 36px 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  border-top: 1px solid var(--border-subtle);
}

.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.bottom-sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  margin: 0 auto 18px auto;
}

/* --- Form Controls & 16-Bit Retro Pop-up Modals --- */
.modal-backdrop, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-backdrop.active, .modal-overlay.active {
  display: flex !important;
}

.modal-card {
  position: relative;
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4) !important;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 20px;
  box-sizing: border-box;
  color: var(--text-primary);
  border-radius: 16px !important;
  animation: modalFadeIn 0.2s ease;
}

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

/* Curriculum completion legend — how video ticks vs chapter Select All count */
.curriculum-legend {
  margin: 8px 0 16px 0;
  padding: 12px 14px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.curriculum-legend-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 10px;
}

.curriculum-legend-head .material-symbols-outlined {
  font-size: 16px;
}

.curriculum-legend-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.curriculum-legend-row + .curriculum-legend-row {
  margin-top: 6px;
}

.curriculum-legend-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.curriculum-legend-icon-count {
  background: rgba(16, 185, 129, 0.14);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.curriculum-legend-icon-skip {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.curriculum-legend-text {
  flex: 1;
  min-width: 0;
}

.curriculum-legend-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.35;
}

.curriculum-legend-sub {
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.45;
  margin-top: 2px;
}

.curriculum-legend-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 0.64rem;
  white-space: nowrap;
}

.curriculum-legend-badge-count {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.curriculum-legend-badge-skip {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Spotlight search input — never hard-clip the placeholder on narrow screens */
#spotlight-search-input {
  min-width: 0;
  flex: 1 1 0%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

@media (max-width: 480px) {
  #spotlight-search-input {
    font-size: 0.92rem !important;
    letter-spacing: 0.02em !important;
  }
}

[data-theme="light"] .modal-card {
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
  color: var(--text-primary) !important;
}

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

.modal-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

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

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

.form-input, .form-select {
  width: 100%;
  height: 48px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-primary);
}

/* --- Modern Glassmorphic Pill Buttons --- */
.btn-gradient-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gradient);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-gradient-pill:hover, .btn-gradient-pill:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
  filter: brightness(1.1);
}

.btn-gradient-pill .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

/* --- Segmented Mode Control --- */
.segmented-control {
  display: flex;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  height: 42px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.segment-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* --- Refined Goals UI & Target Banners --- */
.goal-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.goal-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.goal-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.goal-metric-value {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.goal-metric-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* --- Analytics Table & Mobile Cards --- */
.anl-table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 12px;
}

.anl-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.anl-table th {
  background-color: var(--bg-surface-raised);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.anl-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.anl-table tr:hover {
  background-color: var(--bg-surface-hover);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- FLOWMD DEDICATED TOAST NOTIFICATION CONTAINER & ALERTS --- */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
}

.fm-toast-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-raised) 100%) !important;
  border: 1px solid var(--border-color) !important;
  border-left: 4px solid var(--accent-primary) !important;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
  animation: pxlToastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  overflow: hidden;
}
.fm-toast-alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.fm-toast-alert.fm-alert-success {
  border-left-color: #10b981 !important;
}
.fm-toast-alert.fm-alert-success .material-symbols-outlined.fm-alert-icon {
  color: #10b981;
}

.fm-toast-alert.fm-alert-warning {
  border-left-color: #f59e0b !important;
}
.fm-toast-alert.fm-alert-warning .material-symbols-outlined.fm-alert-icon {
  color: #f59e0b;
}

.fm-toast-alert.fm-alert-info {
  border-left-color: var(--accent-primary) !important;
}
.fm-toast-alert.fm-alert-info .material-symbols-outlined.fm-alert-icon {
  color: var(--accent-primary);
}

@keyframes pxlToastSlideDown {
  0% { transform: translateY(-16px) scale(0.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- FLOWMD INFO-CIRCLE HELP BUTTON --- */
.help-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: transparent;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  margin-left: 6px;
  opacity: 0.85;
  transition: transform 0.15s ease, opacity 0.15s ease;
  user-select: none;
  vertical-align: middle;
}

.help-icon-btn:hover, .help-icon-btn:active {
  opacity: 1;
  transform: scale(1.18);
}

/* --- Minimalist & Unobtrusive Strategy Cards --- */
.strategy-card, .math-guide-card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px 14px !important;
  box-shadow: none !important;
}

/* --- FLOWMD 16-BIT RPG SUBJECT COMPLETION HEATMAP HUD --- */
.fm-subject-heatmap-card {
  box-sizing: border-box;
  width: 100%;
}

.fm-heatmap-telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
}

.fm-heatmap-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.fm-stat-lbl {
  color: var(--text-secondary) !important;
  font-weight: 500;
}

.fm-stat-val {
  font-weight: 700;
  font-size: 1rem;
}

/* Filter Bar */
.fm-heatmap-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.heatmap-filter-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.heatmap-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fm-heatmap-filter-btn {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.fm-heatmap-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.fm-heatmap-filter-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.fm-heatmap-filter-btn.tier-critical.active {
  border-color: #ff5555;
  color: #ff5555;
  background: rgba(255, 85, 85, 0.1);
}

.fm-heatmap-filter-btn.tier-pace.active {
  border-color: #ffaa00;
  color: #ffaa00;
  background: rgba(255, 170, 0, 0.1);
}

.fm-heatmap-filter-btn.tier-advanced.active {
  border-color: #00f0ff;
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.1);
}

.fm-heatmap-filter-btn.tier-mastered.active {
  border-color: #00ff88;
  color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

/* Heatmap Grid & Tile */
.fm-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 12px;
}

.fm-heatmap-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
  min-height: 140px;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  text-align: center;
  gap: 8px;
}

.fm-heatmap-tile:hover {
  transform: translateY(-3px);
  border-color: var(--subject-accent, var(--accent-primary));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--subject-accent, var(--accent-primary));
}

.fm-heatmap-tile:active {
  transform: translateY(0);
}

.fm-tile-icon-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
}

.fm-tile-icon-area svg {
  width: 52px;
  height: 52px;
  color: inherit;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.fm-tile-icon-area svg path {
  fill: currentColor;
}

.fm-heatmap-tile:hover .fm-tile-icon-area svg {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.fm-tile-name {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spotlight / Curriculum / Detail icon sizing */
.subject-icon-small {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
}
.subject-icon-medium {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
}
.subject-icon-medium svg {
  width: 34px;
  height: 34px;
}
.subject-icon-medium svg path {
  fill: currentColor;
}
.subject-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.subject-icon-wrapper svg {
  width: 34px;
  height: 34px;
}
.subject-icon-wrapper svg path {
  fill: currentColor;
}
.subject-icon-medium-bg {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
}
.subject-icon-large {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
}

.fm-tile-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 4px;
}

.fm-tile-tier-tag {
  font-family: var(--font-hud), monospace;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.fm-tile-telemetry {
  font-family: var(--font-hud), monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1;
}

/* --- PERSONAL PREPARATION GOALS CUSTOM HIGH-TECH PROGRESS BARS --- */
.goal-progress-track {
  position: relative;
  width: 100%;
  height: 14px;
  background: #090d16;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 1.5px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
  margin-top: 10px;
}

[data-theme="light"] .goal-progress-track {
  background: #e2e8f0;
  border-color: #cbd5e1;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.goal-progress-fill {
  position: relative;
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.goal-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  border-radius: 1px;
}

.goal-fill-daily {
  background: linear-gradient(90deg, #00f0ff 0%, #10b981 100%);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.goal-fill-weekly {
  background: linear-gradient(90deg, #8b5cf6 0%, #00f0ff 100%);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.goal-fill-monthly {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.goal-fill-plan-a {
  background: linear-gradient(90deg, var(--accent-primary) 0%, #8b5cf6 100%);
  box-shadow: 0 0 10px var(--accent-glow);
}

.goal-fill-plan-b {
  background: linear-gradient(90deg, #f43f5e 0%, #fb7185 100%);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}

/* Homepage Hero Banner Card */
.hero-banner-card,
[data-theme="light"] .hero-banner-card {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
  color: var(--text-primary) !important;
}

.hero-banner-card .fm-feature-card-title,
[data-theme="light"] .hero-banner-card .fm-feature-card-title {
  color: var(--text-primary) !important;
}

.hero-banner-card .fm-feature-card-desc,
[data-theme="light"] .hero-banner-card .fm-feature-card-desc {
  color: var(--text-secondary) !important;
  margin-bottom: 16px;
}

/* Hero Mastery Block */
.hero-mastery-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.hero-mastery-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.hero-mastery-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display), monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hero-mastery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
}

.hero-mastery-value {
  font-family: var(--font-display), monospace;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1.1;
}

.hero-mastery-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.hero-hp-bar {
  height: 10px;
  margin: 10px 0;
}

/* Support Card — Developer Support & Contact */
.support-card {
  padding: 18px;
  border-left: 4px solid var(--accent-primary);
}

.support-email-reveal {
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
}

.support-email-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface-raised, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.support-email-text {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

/* PWA Install Banner */
.pwa-install-banner {
  padding: 16px;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.pwa-install-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pwa-install-text {
  flex: 1;
  min-width: 240px;
}

.pwa-install-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-install-title {
  font-family: var(--font-display), monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.pwa-install-desc {
  font-family: var(--font-hud), monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* Profile legal links (privacy / terms / source) */
.profile-legal-links {
  display: flex;
  gap: 18px;
  margin-top: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}
.profile-legal-links a {
  color: var(--accent-primary);
}

/* PWA install modal (auto-shown on first visits) */
.pwa-install-modal-card {
  text-align: center;
}
.pwa-install-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.pwa-install-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.pwa-install-modal-icon .material-symbols-outlined {
  font-size: 28px;
  color: var(--accent-primary);
}
.pwa-install-modal-body .pwa-install-title {
  margin-bottom: 6px;
}
.pwa-install-modal-body .pwa-install-desc {
  margin-bottom: 14px;
}
.pwa-install-modal-actions {
  justify-content: center;
  margin-top: 8px;
}
.pwa-install-modal-card .pwa-install-steps {
  text-align: left;
}

/* PWA install helper — step-by-step guide + profile status */
.pwa-install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.pwa-install-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-hud), monospace;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pwa-install-step .material-symbols-outlined {
  font-size: 20px;
  color: var(--accent-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.pwa-install-kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-surface-raised);
  font-family: var(--font-hud), monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.profile-install-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.85rem;
}

.profile-install-status.installed {
  color: var(--success);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* Subject Completion Heatmap */
.fm-subject-heatmap-card,
[data-theme="light"] .fm-subject-heatmap-card {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
  color: var(--text-primary) !important;
}

.fm-subject-heatmap-card .fm-feature-card-title,
.fm-subject-heatmap-card h2,
.fm-subject-heatmap-card h3 {
  color: var(--accent-primary) !important;
}

[data-theme="light"] .fm-heatmap-filter-btn:hover {
  color: #ffffff !important;
  border-color: #64748b !important;
}

/* ============================================================
   RESPONSIVE DESKTOP EXPANSION (@media min-width: 768px)
   ============================================================ */
@media (min-width: 768px) {
  body {
    background-color: #060911;
  }
  
  .app-container {
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--bg-app);
    min-height: 100vh;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }

  .live-stats-row {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .android-bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .search-input-box {
    width: 320px;
  }
}

/* --- Action Queue Completion Micro-Animations --- */
.queue-item-animating {
  animation: completeCheckOut 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes completeCheckOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: none;
  }
  40% {
    opacity: 0.9;
    transform: scale(1.02) translateY(-2px);
    background: rgba(16, 185, 129, 0.28) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-16px);
    filter: blur(4px);
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
  }
}

.congrats-card-pop {
  animation: congratsCardPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes congratsCardPop {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  70% {
    transform: scale(1.03) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- FLOWMD BRANDING & LOGO STYLES --- */
:root {
  --flowmd-pink: #ff3b5c;
  --flowmd-pink-hover: #ff1f46;
  --flowmd-pink-glow: rgba(255, 59, 92, 0.4);
}

/* flowmd-topbar-logo — defined above near line 1443 */

.flowmd-logo-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
}

/* --- DUAL-SUBJECT TRACKING V2 & LIGHT MODE COMPATIBILITY STYLES --- */
.plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  white-space: nowrap;
}

.plan-stat-card {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.plan-stat-card:hover {
  transform: translateY(-2px);
}

.plan-quest-block {
  border-left: 4px solid var(--plan-accent, var(--accent-primary));
  background: color-mix(in srgb, var(--plan-accent, var(--accent-primary)) 6%, transparent);
  border-radius: 12px;
  padding: 14px 14px 12px 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.plan-quest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-quest-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-quest-badge {
  display: inline-flex;
  align-items: center;
  background: var(--plan-accent, var(--accent-primary));
  color: #ffffff;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.plan-quest-subject-name {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-quest-progress {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.plan-quest-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.plan-quest-target-text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.plan-quest-target-text strong {
  font-weight: 700;
}

.quest-video-num {
  color: var(--plan-accent, var(--accent-primary));
  font-weight: 700;
  margin-right: 4px;
}

.quest-video-chapter {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.quest-video-dur {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.goal-plan-tab {
  transition: all 0.15s ease;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.goal-plan-tab.active {
  opacity: 1 !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}



/* Subject Velocity Matrix Table Scrollability (Issue #1) */
.anl-table-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  max-width: 100% !important;
  display: block;
}

.anl-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.anl-table th, .anl-table td {
  white-space: nowrap;
  padding: 10px 12px;
}

.plan-hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid #000000;
  white-space: nowrap;
}

/* ============================================================
   DRIVER.JS SPOTLIGHT TOUR ENGINE & ANDROID PWA UI CHECKLIST
   ============================================================ */

/* 1. Backdrop Overlay & Element Spotlight Outline */
.driver-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  z-index: 100005;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.driver-popover-card, .driver-close-btn, .driver-btn-skip-text, .driver-btn-next-pill {
  pointer-events: auto;
}

.driver-spotlight-box {
  position: fixed;
  z-index: 100006;
  border: 2px solid #00f0ff;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 20px rgba(0, 240, 255, 0.5);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: driverSpotlightPulse 2.5s infinite ease-in-out;
}

@keyframes driverSpotlightPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 16px rgba(0, 240, 255, 0.5); border-color: #00f0ff; }
  50% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 26px rgba(255, 204, 0, 0.7); border-color: #ffcc00; }
}

/* 2. Floating Minimalist Tooltip Card Container (Matches User Reference Image) */
.driver-popover-card {
  position: fixed;
  z-index: 100007;
  width: 90%;
  max-width: 340px;
  background: #18181b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.2) !important;
  padding: 14px 16px !important;
  box-sizing: border-box;
  color: #ffffff !important;
  transition: top 0.25s ease, left 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
  animation: driverTooltipPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes driverTooltipPop {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

/* Dynamic Pointer Arrow Beak */
.driver-popover-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  z-index: 100008;
  transition: left 0.2s ease;
}

.driver-popover-arrow.arrow-down {
  bottom: -9px;
  border-width: 9px 9px 0 9px;
  border-color: #18181b transparent transparent transparent;
}

.driver-popover-arrow.arrow-up {
  top: -9px;
  border-width: 0 9px 9px 9px;
  border-color: transparent transparent #18181b transparent;
}

.driver-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.driver-step-badge {
  font-family: var(--font-hud);
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.driver-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s ease;
}

.driver-close-btn:hover {
  color: #ffffff;
}

.driver-step-body {
  font-family: var(--font-hud);
  font-size: 0.92rem;
  color: #f1f5f9 !important;
  line-height: 1.48;
  min-height: 52px;
  margin-bottom: 12px;
}

.driver-step-body p {
  margin: 0;
  color: #f1f5f9 !important;
}

.driver-step-body strong {
  color: #ffffff !important;
  font-weight: 700;
}

.driver-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

/* Minimalist Pill Pagination Dots (▬ • • • • • •) */
.driver-step-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.driver-step-dot {
  width: 5px;
  height: 5px;
  background: #475569;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.driver-step-dot.active {
  width: 15px;
  height: 5px;
  border-radius: 3px;
  background: #ffffff;
}

/* Sleek Action Buttons */
.driver-btn-skip-text {
  background: none;
  border: none;
  color: #94a3b8;
  font-family: var(--font-hud);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.driver-btn-skip-text:hover {
  color: #ffffff;
}

.driver-btn-next-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  color: #09090b;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.driver-btn-next-pill:hover {
  transform: scale(1.08);
  background: #f4f4f5;
}

.driver-btn-next-pill.last-step {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 3. Skeleton Loading Placeholder Screens */
.driver-skeleton-card {
  padding: 10px 0;
}

.driver-skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-surface-raised) 25%, var(--border-color) 50%, var(--bg-surface-raised) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s infinite ease-in-out;
  border-radius: 2px;
  margin-bottom: 10px;
}

.driver-skeleton-line.short { width: 40%; height: 18px; }
.driver-skeleton-line.medium { width: 70%; }

.driver-skeleton-block {
  height: 90px;
  background: linear-gradient(90deg, var(--bg-surface-raised) 25%, var(--border-color) 50%, var(--bg-surface-raised) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s infinite ease-in-out;
  border-radius: 4px;
  margin-bottom: 12px;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Faculty / Author pill (Enhanced) --- */
.faculty-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.faculty-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--faculty-color, var(--accent-primary)), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.faculty-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.15);
  border-color: var(--faculty-color, var(--accent-primary));
  color: var(--text-primary);
}

.faculty-pill:hover::before {
  opacity: 0.12;
}

.faculty-pill:active {
  transform: translateY(0) scale(0.98);
}

.faculty-pill-avatar {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--faculty-color, var(--accent-primary));
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 6px -1px var(--faculty-color, var(--accent-primary));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.faculty-pill:hover .faculty-pill-avatar {
  transform: scale(1.05);
  box-shadow: 0 4px 12px -2px var(--faculty-color, var(--accent-primary));
}

.faculty-pill-name {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
  font-weight: 700;
  transition: color 0.2s ease;
}

.faculty-pill:hover .faculty-pill-name {
  color: var(--faculty-color, var(--accent-primary));
}

.faculty-pill-verified {
  position: relative;
  z-index: 1;
  font-size: 14px;
  color: var(--success);
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.faculty-pill:hover .faculty-pill-verified {
  opacity: 1;
  transform: scale(1.1);
}

.faculty-pill-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at left center, var(--faculty-color, var(--accent-primary)), transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.faculty-pill:hover .faculty-pill-glow {
  opacity: 0.18;
}

/* --- Faculty Card (Subject Detail View) --- */
.faculty-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-family: var(--font-hud), sans-serif;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
  width: 100%;
  max-width: none;
}

.faculty-card:hover {
  background: var(--bg-surface-raised);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.12);
}

.faculty-card-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--faculty-color, var(--accent-primary));
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 10px -2px var(--faculty-color, var(--accent-primary));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.faculty-card:hover .faculty-card-avatar {
  transform: scale(1.05);
  box-shadow: 0 6px 16px -3px var(--faculty-color, var(--accent-primary));
}

.faculty-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.faculty-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.faculty-card-subject {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.faculty-card-verified {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--success);
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin-left: auto;
}

.faculty-card:hover .faculty-card-verified {
  opacity: 1;
  transform: scale(1.1);
}

/* Removed heavy gradient border animation for subtle look */

/* --- Lecture-time hours meter --- */
.hours-meter {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 150px;
  max-width: 210px;
}

.hours-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.hours-meter-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-hud), sans-serif;
}

.hours-meter-nums {
  font-family: var(--font-display), sans-serif;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.hm-sep {
  opacity: 0.4;
  margin: 0 2px;
}

.hm-track {
  position: relative;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.hm-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--faculty-color, var(--accent-primary)), var(--accent-secondary, #8b5cf6));
  border-radius: 3px;
  transition: width 0.3s ease-out;
}

.hm-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, transparent, var(--faculty-color, var(--accent-primary)));
  opacity: 0.7;
  pointer-events: none;
}



/* ============================================================
   MOBILE PWA STYLES � Curriculum Section
   ============================================================ */

/* PWA standalone mode adjustments */
@media (display-mode: standalone) {
  .android-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }
  .app-main {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Mobile-first curriculum card stack */
@media (max-width: 768px) {
  .curriculum-card {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }
  .curriculum-card .subject-icon-wrapper {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
  .curriculum-card .subject-icon-wrapper img {
    width: 28px;
    height: 28px;
  }
  .curriculum-card .v2-hud-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
  }
  .section-title {
    font-size: 1.05rem;
  }
  .section-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Touch-friendly accordion for mobile PWA */
@media (max-width: 768px) {
  .accordion-header {
    min-height: 52px;
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .accordion-title {
    font-size: 0.9rem;
    font-weight: 600;
  }
  .accordion-icon {
    font-size: 1.2rem;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .accordion-body {
    padding-left: 8px;
    padding-right: 4px;
  }
  .v2-quest-row {
    min-height: 44px;
    padding: 8px 10px;
  }
  .v2-quest-title {
    font-size: 0.85rem;
  }
}

/* PWA bottom navigation dock — mobile */
@media (max-width: 768px) {
  .android-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    background: rgba(12, 15, 24, 0.92);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }
  .android-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 56px;
    min-height: 44px;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border-radius: var(--radius-md);
    transition: color 0.2s ease, background-color 0.2s ease;
  }
  .android-nav-item:hover {
    color: #94a3b8;
  }
  .android-nav-item.active {
    color: #00f0ff;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(120, 119, 198, 0.06));
  }
  .android-nav-item.active .nav-icon {
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4));
  }
  .android-nav-item .nav-bar-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
  }
  .android-nav-item .nav-icon {
    width: 22px;
    height: 22px;
  }
}

/* Curriculum nested tab indicator for PWA */
.pwa-curriculum-tab-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  font-family: var(--font-hud);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pwa-curriculum-tab-indicator .tab-level {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pwa-curriculum-tab-indicator .tab-level.active {
  background: var(--accent-primary);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.pwa-curriculum-tab-indicator .tab-level.completed {
  background: var(--success);
}

/* Mobile curriculum swipe hint */
.pwa-swipe-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-hud);
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.pwa-swipe-hint .swipe-arrow {
  animation: pwa-swipe-hint 1.5s ease-in-out infinite;
}

@keyframes pwa-swipe-hint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* PWA orientation lock indicator */
.pwa-orientation-lock {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-family: var(--font-hud);
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 768px) and (orientation: landscape) {
  .pwa-orientation-lock {
    display: flex;
  }
}

/* Mobile curriculum progress bar */
@media (max-width: 768px) {
  .v2-hp-bar-bg {
    height: 8px;
    border-radius: 4px;
  }
  .v2-hp-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
  }
}

/* PWA safe area insets for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .android-bottom-nav {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }
  .topbar {
    padding-top: calc(env(safe-area-inset-top, 0px) + 4px);
  }
}

/* Curriculum section mobile scroll container */
.pwa-curriculum-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: 80px;
}

/* Mobile curriculum card touch feedback */
@media (hover: none) and (pointer: coarse) {
  .curriculum-card {
    transition: none;
  }
  .curriculum-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  }
  .accordion-header:active {
    background-color: var(--bg-surface-raised);
  }
  .android-nav-item:active {
    transform: scale(0.95);
  }
}

/* PWA fullscreen curriculum view */
@media (display-mode: standalone) {
  .app-container {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .app-main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
  }
  .pwa-curriculum-scroll {
    height: 100%;
    max-height: calc(100vh - 120px);
  }
}

/* Reduced motion for PWA */
@media (prefers-reduced-motion: reduce) {
  .accordion-header,
  .curriculum-card,
  .android-nav-item {
    transition: none;
  }
  .pwa-swipe-hint .swipe-arrow {
    animation: none;
  }
}

/* ============================================================
   NESTED TAB CURRICULUM DESIGN � Mobile PWA
   Subject Tabs ? Chapter Tabs ? Video List
   ============================================================ */

/* --- Subject Tab Bar --- */
.pwa-subject-tab-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 4px 12px;
  margin-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.pwa-subject-tab-bar::-webkit-scrollbar {
  display: none;
}

.pwa-subject-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  min-width: 64px;
  min-height: 64px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.15s ease;
  scroll-snap-align: start;
  position: relative;
}

.pwa-subject-tab.active {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.pwa-subject-tab-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-surface-raised);
  border: 1.5px solid var(--border-color);
}

.pwa-subject-tab-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.pwa-subject-tab-label {
  font-family: var(--font-hud);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwa-subject-tab.active .pwa-subject-tab-label {
  color: var(--accent-primary);
}

.pwa-subject-tab-progress {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-surface-raised);
  overflow: hidden;
}

.pwa-subject-tab-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.pwa-subject-tab.active .pwa-subject-tab-progress-fill {
  background: var(--accent-primary);
}

/* --- Chapter Tab Bar --- */
.pwa-chapter-tab-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 4px 10px;
  margin-bottom: 4px;
  scroll-snap-type: x mandatory;
}

.pwa-chapter-tab-bar::-webkit-scrollbar {
  display: none;
}

.pwa-chapter-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.15s ease;
  scroll-snap-align: start;
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pwa-chapter-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.pwa-chapter-tab .chap-badge {
  font-size: 0.65rem;
  opacity: 0.7;
}

.pwa-chapter-tab.active .chap-badge {
  opacity: 1;
  color: rgba(255,255,255,0.8);
}

/* --- Video List --- */
.pwa-video-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
}

.pwa-video-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.12s ease, transform 0.1s ease;
}

.pwa-video-item:active {
  transform: scale(0.98);
  background: var(--bg-surface-raised);
}

.pwa-video-item.completed {
  opacity: 0.6;
  background: rgba(34, 197, 94, 0.04);
  border-color: rgba(34, 197, 94, 0.15);
}

.pwa-video-checkbox {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: all 0.15s ease;
}

.pwa-video-item.completed .pwa-video-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.pwa-video-checkbox .material-symbols-outlined {
  font-size: 16px;
  color: transparent;
  transition: color 0.15s ease;
}

.pwa-video-item.completed .pwa-video-checkbox .material-symbols-outlined {
  color: #fff;
}

.pwa-video-info {
  flex: 1;
  min-width: 0;
}

.pwa-video-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwa-video-item.completed .pwa-video-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.pwa-video-meta {
  font-family: var(--font-hud);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pwa-video-duration {
  flex-shrink: 0;
  font-family: var(--font-hud);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface-raised);
  padding: 3px 8px;
  border-radius: 10px;
}

/* --- Tab Content Transition --- */
.pwa-tab-content {
  animation: pwa-tab-fade-in 0.2s ease;
}

@keyframes pwa-tab-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Subject Detail Header --- */
.pwa-subject-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
}

.pwa-subject-detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-raised);
  border: 1.5px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
}

.pwa-subject-detail-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.pwa-subject-detail-icon svg {
  width: 32px;
  height: 32px;
}

.pwa-subject-detail-icon svg path {
  fill: currentColor;
}

.pwa-subject-detail-info {
  flex: 1;
  min-width: 0;
}

.pwa-subject-detail-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pwa-subject-detail-meta {
  font-family: var(--font-hud);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pwa-subject-detail-progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-surface-raised);
  margin-top: 6px;
  overflow: hidden;
}

.pwa-subject-detail-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

/* --- Back Button --- */
.pwa-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-hud);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pwa-back-btn:hover,
.pwa-back-btn:active {
  background: var(--bg-surface-raised);
  border-color: var(--accent-primary);
}

.pwa-back-btn .material-symbols-outlined {
  font-size: 22px;
}

/* Standalone back button (when not inside header) */
.pwa-curriculum-scroll > .pwa-back-btn {
  align-self: flex-start;
  margin: 8px 4px 12px;
  padding: 8px;
}

/* --- Curriculum Stats Row --- */
.pwa-curriculum-stats {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
}

.pwa-stat-chip {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  text-align: center;
}

.pwa-stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pwa-stat-label {
  font-family: var(--font-hud);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* --- Empty State --- */
.pwa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.pwa-empty-state .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.pwa-empty-state-text {
  font-family: var(--font-hud);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Focus Scope Banner --- */
.pwa-focus-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  margin-bottom: 10px;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.pwa-focus-banner .material-symbols-outlined {
  color: var(--accent-primary);
  font-size: 18px;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .pwa-tab-content {
    animation: none;
  }
  .pwa-video-item,
  .pwa-subject-tab,
  .pwa-chapter-tab {
    transition: none;
  }
}

/* ============================================================
   GOAL MODAL / STUDY PLAN CONFIGURATION
   ============================================================ */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.plan-config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.plan-config-hero {
  padding: 24px 20px 16px;
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(139,92,246,0.06) 100%);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.plan-config-hero-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.plan-config-icon-btn {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.plan-config-icon-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.plan-config-hero-icon {
  font-size: 32px;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.plan-config-hero-kicker {
  font-family: var(--font-hud);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.plan-config-hero-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.plan-config-hero-sub {
  font-family: var(--font-hud);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.plan-config-hero-chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.plan-config-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  font-family: var(--font-hud);
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 700;
}

.plan-config-chip .material-symbols-outlined {
  font-size: 14px;
  color: var(--accent-primary);
}

.plan-config-body {
  padding: 16px 20px 24px;
  flex: 1;
  overflow-y: auto;
}

.plan-config-tabbar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg-surface-raised);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--border-color);
}

.plan-config-sep {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  margin: 0 4px;
  flex-shrink: 0;
}

.plan-config-dual {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}

.plan-config-dual input[type=checkbox] {
  display: none;
}

.plan-config-switch {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-color);
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.plan-config-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 0.2s ease;
}

.plan-config-dual input:checked + .plan-config-switch {
  background: var(--accent-primary);
}

.plan-config-dual input:checked + .plan-config-switch i {
  transform: translateX(16px);
}

.plan-config-dual-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.goal-plan-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.goal-plan-tab.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.plan-config-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.plan-config-tab-name {
  font-weight: 700;
}

.plan-config-tab-sub {
  font-size: 0.65rem;
  opacity: 0.7;
  font-weight: 400;
}

.plan-config-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.plan-config-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-config-plan-role {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.plan-config-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.plan-config-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-config-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-config-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.plan-config-select-wrap .material-symbols-outlined {
  position: absolute;
  right: 8px;
  font-size: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.plan-config-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface-raised);
  border: 1.5px solid var(--border-color);
  font-family: var(--font-hud);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.plan-config-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.plan-config-input option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.plan-config-seg {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-raised);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border-color);
}

.plan-config-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.plan-config-seg-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(59,130,246,0.3);
}

.plan-config-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.12);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.plan-config-hint .material-symbols-outlined {
  color: var(--accent-primary);
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.plan-config-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-config-chips-count {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.7rem;
  color: var(--accent-primary);
  font-weight: 700;
}

.plan-config-pace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.plan-config-pace {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
}

.plan-config-pace-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plan-config-pace-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.plan-config-pace-unit {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.plan-config-pace-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-config-step {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.plan-config-step:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.plan-config-pace-input {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-surface);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 0;
}

.plan-config-pace-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.plan-config-pace-tick {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: pointer;
}

.plan-config-pace-tick .material-symbols-outlined {
  font-size: 14px;
  color: var(--success);
}

.plan-config-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.plan-config-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.15s ease;
  min-height: 44px;
}

.plan-config-btn-prim {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.plan-config-btn-prim:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.plan-config-btn-ghost {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.plan-config-btn-ghost:hover {
  background: var(--bg-surface);
}

.plan-config-guide {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
}

.plan-config-guide-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-config-guide-header .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-primary);
}

.plan-config-guide-arrow {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.plan-config-guide-body {
  display: none;
  margin-top: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.plan-config-guide-body strong {
  color: var(--text-primary);
}

/* Light mode goal modal */
[data-theme="light"] .plan-config-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 24px 48px rgba(0,0,0,0.12);
}

[data-theme="light"] .plan-config-hero {
  background: linear-gradient(135deg, rgba(59,130,246,0.06) 0%, rgba(139,92,246,0.03) 100%);
}

[data-theme="light"] .plan-config-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .plan-config-seg {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .plan-config-seg-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

[data-theme="light"] .plan-config-pace {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .plan-config-step {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .plan-config-step:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

[data-theme="light"] .plan-config-pace-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .plan-config-hint {
  background: rgba(59,130,246,0.04);
  border-color: rgba(59,130,246,0.1);
}

[data-theme="light"] .plan-config-plan-badge {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .plan-config-plan-role {
  color: #64748b;
}

[data-theme="light"] .plan-config-chip {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .plan-config-chip .material-symbols-outlined {
  color: var(--accent-primary);
}

[data-theme="light"] .plan-config-guide {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .plan-config-guide-header {
  color: #1e293b;
}

[data-theme="light"] .plan-config-guide-body {
  color: #475569;
}

[data-theme="light"] .plan-config-actions .plan-config-btn-ghost {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

/* Mobile goal modal */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }
  .plan-config-card {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
  }
  .plan-config-pace-grid {
    grid-template-columns: 1fr;
  }
  .plan-config-hero {
    padding: 16px 12px 12px;
  }
  .plan-config-hero-title {
    font-size: 1rem;
  }
  .plan-config-body {
    padding: 12px;
  }
  .plan-config-tabbar {
    padding: 2px;
  }
  .goal-plan-tab {
    padding: 6px 8px;
    font-size: 0.72rem;
  }
  .plan-config-btn {
    padding: 8px 12px;
    font-size: 0.78rem;
  }
}

/* --- Active Edition Badge (Topbar) --- */
.edition-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-surface-raised), var(--bg-surface));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.edition-badge .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-primary);
}

.edition-badge:hover {
  transform: translateY(-1px);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.25);
}

.edition-badge:active {
  transform: translateY(0) scale(0.97);
}

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

[data-theme="light"] .edition-badge {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .edition-badge-text {
  color: #1e293b;
}

/* --- Edition Chip (Dashboard / Analytics / Curriculum header) --- */
.edition-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

.edition-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.edition-chip:active {
  transform: translateY(0) scale(0.97);
}

.edition-chip .material-symbols-outlined {
  font-size: 15px;
}

.btn-open-source-settings {
  cursor: pointer;
}

[data-theme="light"] .edition-chip {
  background: color-mix(in srgb, var(--accent-primary) 12%, #fff);
  border-color: color-mix(in srgb, var(--accent-primary) 30%, #fff);
  color: var(--accent-primary);
}

/* --- Offline Indicator (Topbar) --- */
.offline-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-full);
  white-space: nowrap;
  animation: pulse-soft 2s infinite;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

[data-theme="light"] .offline-indicator {
  background: rgba(217, 119, 6, 0.15);
  border-color: #d97706;
  color: #d97706;
}

/* --- Topbar source hint --- */
.topbar-source-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Onboarding wizard path hint --- */
.onboarding-hint-path {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  border-radius: 8px;
  text-align: left;
}

.onboarding-hint-path .material-symbols-outlined {
  flex-shrink: 0;
  color: var(--accent-primary);
}

.onboarding-hint-path b {
  color: var(--text-primary);
  font-weight: 700;
}

/* --- Profile Settings card --- */
.profile-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.profile-settings-row-label {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-settings-row-value {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-settings-hint {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.src-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.src-status-dot-active {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* --- Sync status line (Profile — simple last-sync summary) --- */
.sync-basic-status {
  margin: 2px 0 10px 0;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.sync-basic-status-ok {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

.sync-basic-status-fail {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.sync-basic-status-warn {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

/* --- Curriculum subject tab hours badge --- */
.pwa-subject-tab-badge {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.pwa-subject-tab.active .pwa-subject-tab-badge {
  color: var(--accent-primary);
}

/* --- Narrow-screen compaction --- */
@media (max-width: 900px) {
  .topbar-source-hint {
    display: none;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding: 0 10px;
  }
  .flowmd-topbar-logo {
    height: 30px;
  }
  .topbar-right {
    gap: 4px;
  }
  .edition-badge {
    height: 28px;
    padding: 0 10px 0 8px;
    font-size: 0.68rem;
  }
  .edition-badge .material-symbols-outlined {
    font-size: 14px;
  }
  .edition-chip {
    height: 28px;
    padding: 0 10px;
    font-size: 0.68rem;
  }
}

/* Phones: keep bottom-nav labels on one line without clipping */
@media (max-width: 480px) {
  .android-nav-item .nav-bar-label {
    font-size: 0.6rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
}

@media (max-width: 340px) {
  .edition-badge {
    gap: 4px;
    padding: 0 8px 0 7px;
    font-size: 0.64rem;
  }
  .edition-badge .material-symbols-outlined {
    font-size: 13px;
  }
  .profile-settings-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-settings-row > .v2-arcade-btn {
    width: 100%;
  }
}

/* ============================================================
   ANALYTICS SUITE — Study Intelligence Report (.anl-*)
   ============================================================ */
.anl-report-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(99, 102, 241, 0.08) 45%, rgba(14, 165, 233, 0.10) 100%);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.anl-report-hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 70%);
  pointer-events: none;
}

.anl-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.anl-hero-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: #ffffff;
  box-shadow: 0 6px 18px -4px rgba(59, 130, 246, 0.5);
}

.anl-hero-icon .material-symbols-outlined {
  font-size: 26px;
}

.anl-hero-kicker {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 3px;
}

.anl-hero-title {
  font-family: var(--font-display), sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.anl-hero-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.anl-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}

.anl-hero-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}

.anl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.anl-chip b {
  color: var(--text-primary);
  font-weight: 800;
}

.anl-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip, var(--accent-primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip, var(--accent-primary)) 25%, transparent);
}

/* --- Report cards --- */
.anl-report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.anl-report-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.anl-report-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display), sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.anl-report-card-title .material-symbols-outlined {
  color: var(--accent-primary);
  font-size: 20px;
}

.anl-report-focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.anl-report-focus .lbl {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.anl-report-focus .val {
  font-family: var(--font-display), sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.anl-report-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 560px) {
  .anl-report-facts {
    grid-template-columns: repeat(4, 1fr);
  }
}

.anl-report-fact {
  padding: 10px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.anl-report-fact .lbl {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.anl-report-fact .val {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* --- Goal Pulse grid + tiles --- */
.anl-goal-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display), sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 2px 12px;
}

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

/* Empty state — no study target configured yet */
.anl-goal-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 16px;
  margin-bottom: 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  color: var(--text-secondary);
}

.anl-goal-empty .material-symbols-outlined {
  font-size: 28px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.anl-goal-empty strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.anl-goal-empty small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.anl-goal-empty .v2-arcade-btn {
  margin-left: auto;
}

@media (max-width: 480px) {
  .anl-goal-empty .v2-arcade-btn {
    margin-left: 0;
    width: 100%;
  }
}

.anl-goal-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--tile, var(--accent-primary));
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: visible;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.anl-goal-tile:hover {
  transform: translateY(-2px);
  border-color: var(--tile, var(--accent-primary));
}

.anl-goal-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anl-goal-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.anl-goal-ico {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tile, var(--accent-primary)) 16%, transparent);
  color: var(--tile, var(--accent-primary));
}

.anl-goal-ico .material-symbols-outlined {
  font-size: 15px;
}

.anl-goal-title {
  flex: 1;
  min-width: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.anl-goal-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.anl-goal-badge-top {
  position: absolute;
  top: -2px;
  right: 8px;
  flex-shrink: 0;
  padding: 3px 10px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 0 0 6px 6px;
  background: var(--bg-surface-raised);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  z-index: 2;
  white-space: nowrap;
}

.anl-goal-value {
  font-family: var(--font-display), sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.anl-goal-value .unit {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 3px;
}

.anl-goal-desc {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.anl-goal-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.anl-goal-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--fill, var(--tile, var(--accent-primary)));
  transition: width 0.4s ease;
}

.anl-goal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.anl-goal-pct {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--tile, var(--accent-primary));
}

.anl-goal-delta {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
}

/* --- 7-Day Execution Chart (.chart-*) --- */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.chart-titlewrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary);
}

.chart-icon .material-symbols-outlined {
  font-size: 19px;
}

.chart-kicker {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chart-title {
  font-family: var(--font-display), sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.chart-target-badge {
  font-size: 0.7rem;
}

.chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.ex-dot-met { background: var(--success); }
.ex-dot-part { background: var(--warning); }
.ex-dot-zero { background: var(--text-muted); }
.ex-dot-target {
  background: transparent;
  border: 2px dashed var(--accent-primary);
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.chart-plot {
  overflow: visible;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-raised);
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-gridline {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 1 4;
  opacity: 0.6;
}

.chart-baseline {
  stroke: var(--text-muted);
  stroke-width: 1.5;
}

.chart-targetline {
  stroke: var(--accent-secondary, #a855f7);
  stroke-width: 1.5;
  stroke-dasharray: 2 3;
}

.chart-targetlabel {
  fill: var(--accent-secondary, #a855f7);
  font-family: var(--font-hud), sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-anchor: end;
}

.chart-area {
  fill: url(#exChartGrad);
}

.chart-line {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.chart-point {
  cursor: pointer;
}

.chart-point:hover .chart-node {
  r: 6;
  filter: brightness(1.2);
}

.chart-node {
  fill: var(--bg-surface-raised);
  stroke: var(--accent-primary);
  stroke-width: 1.5;
  cursor: pointer;
}

.ex-node-met {
  fill: var(--success);
  stroke: var(--success);
}

.ex-node-part {
  fill: var(--warning);
  stroke: var(--warning);
}

.ex-node-zero {
  fill: var(--text-muted);
  stroke: var(--text-muted);
}

.chart-val {
  fill: var(--text-primary);
  font-family: var(--font-hud), sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
}

.chart-xlabel {
  fill: var(--text-muted);
  font-family: var(--font-hud), sans-serif;
  font-size: 10px;
  text-anchor: middle;
}

.chart-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.ex-day-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  text-align: center;
}

.ex-day-tile.is-met {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--bg-surface-raised));
}

.ex-day-tile.is-part {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-surface-raised));
}

.ex-day-name {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ex-day-count {
  font-family: var(--font-display), sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.ex-day-tile.is-met .ex-day-count { color: var(--success); }
.ex-day-tile.is-part .ex-day-count { color: var(--warning); }

.ex-day-status {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ex-day-track {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-surface);
  overflow: hidden;
  margin-top: 2px;
}

.ex-day-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.ex-day-tile.is-met .ex-day-fill { background: var(--success); }
.ex-day-tile.is-part .ex-day-fill { background: var(--warning); }

.chart-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* --- Analytics responsive --- */
@media (max-width: 480px) {
  .anl-goal-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .chart-days {
    gap: 5px;
  }
  .anl-hero-title {
    font-size: 1.15rem;
  }
}

/* --- Analytics light theme --- */
[data-theme="light"] .anl-report-hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(99, 102, 241, 0.04) 45%, rgba(14, 165, 233, 0.06) 100%);
  border-color: #e2e8f0;
}

[data-theme="light"] .anl-goal-tile,
[data-theme="light"] .anl-report-card,
[data-theme="light"] .chart-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .anl-chip,
[data-theme="light"] .anl-goal-badge,
[data-theme="light"] .anl-goal-badge-top {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .anl-goal-track,
[data-theme="light"] .chart-plot {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .chart-legend {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .anl-report-focus,
[data-theme="light"] .anl-report-fact {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .ex-day-tile {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* --- Onboarding Wizard + Study Source modal (onboarding-* suite) --- */
.onboarding-card {
  text-align: center;
}
.onboarding-step-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.onboarding-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 1px solid var(--text-muted);
  transition: all 0.2s ease;
}
.onboarding-dot.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}
.onboarding-dot.done {
  background: var(--success);
  border-color: var(--success);
}
.onboarding-head {
  text-align: left;
}
.onboarding-title {
  font-family: var(--font-display), sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}
.onboarding-sub {
  font-family: var(--font-hud), sans-serif;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
}
.onboarding-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 8px 0;
}
.onboarding-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s ease;
}
.onboarding-option:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface-hover);
  transform: translateY(-1px);
}
.onboarding-option.checked {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%);
  box-shadow: 0 0 0 1px var(--accent-primary);
}
.onboarding-option.upcoming {
  opacity: 0.7;
}
.onboarding-radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
  position: relative;
  transition: all 0.18s ease;
}
.onboarding-option.checked .onboarding-radio {
  border-color: var(--accent-primary);
}
.onboarding-option.checked .onboarding-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}
.onboarding-option-title {
  display: block;
  font-family: var(--font-display), sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
}
.onboarding-option-sub {
  display: block;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}
.onboarding-option .v2-hud-badge {
  margin-left: auto;
}
.onboarding-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  border-radius: 8px;
  text-align: left;
}
.onboarding-alert .material-symbols-outlined {
  flex-shrink: 0;
  color: var(--accent-primary);
}
.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}
.onboarding-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.onboarding-name-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.onboarding-theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.onboarding-theme-opt {
  padding: 12px 10px;
  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s ease;
}
.onboarding-theme-opt:hover {
  border-color: var(--accent-primary);
}
.onboarding-theme-opt.checked {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%);
  box-shadow: 0 0 0 1px var(--accent-primary);
}
.onboarding-guide-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  text-align: left;
}
.onboarding-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.onboarding-guide-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-hud), sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-glow);
  border: 1px solid var(--accent-primary);
  border-radius: 50%;
}
.onboarding-empty-cta {
  text-align: center;
  padding: 6px 0 2px 0;
}
.onboarding-empty-cta .onboarding-title,
.onboarding-empty-cta .onboarding-sub {
  text-align: center;
}

/* onboarding-* light theme */
[data-theme="light"] .onboarding-option {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .onboarding-option:hover {
  background: #f8fafc;
}
[data-theme="light"] .onboarding-option.checked {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.08);
}
[data-theme="light"] .onboarding-option-sub,
[data-theme="light"] .onboarding-sub {
  color: var(--text-secondary);
}
[data-theme="light"] .onboarding-name-input,
[data-theme="light"] .onboarding-theme-opt {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .onboarding-alert {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}

/* ============ STUDY PLAN CONFIGURATION (inline dashboard section) ============ */
.study-plan-config-section {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px 20px 16px;
  margin-top: 14px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}
.study-plan-config-section:hover {
  border-color: var(--accent-primary);
}

.spc-header {
  margin-bottom: 12px;
}
.spc-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.spc-sub {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
  max-width: 52ch;
}

.spc-body {
  padding: 4px 2px 0 2px;
}

.spc-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.spc-plan-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 200px;
}
.spc-flag-icon {
  position: absolute;
  left: 10px;
  font-size: 18px;
  color: var(--accent-primary);
  pointer-events: none;
}
.spc-select-arrow {
  position: absolute;
  right: 10px;
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.spc-plan-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 10px 34px 10px 34px;
  cursor: pointer;
  font-weight: 600;
}
.spc-dual-toggle {
  flex-shrink: 0;
}

/* Missing plan-config helpers referenced by the section */
.plan-config-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-primary);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.plan-config-btn-danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger, #ef4444);
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.plan-config-btn-danger:hover {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.55);
}
.plan-config-chip.selected {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}
.plan-config-chip.selected .plan-config-chip-vids {
  background: #fff;
  color: var(--accent-primary);
  opacity: 1;
}
.plan-config-chips-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.plan-config-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plan-config-chips-empty {
  font-family: var(--font-hud);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 8px 4px;
}
.plan-config-chip-vids {
  font-family: var(--font-hud);
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 28px;
  text-align: center;
}

/* Light mode overrides for study plan config */
[data-theme="light"] .study-plan-config-section {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
[data-theme="light"] .spc-header-icon {
  box-shadow: 0 2px 8px var(--accent-glow);
}
[data-theme="light"] .plan-config-badge {
  background: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}
