/* ═══════════════════════════════════════════════════════════════════════════
   Neo AI v2.0 — Premium UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg: #050508;
  --bg-2: #0c0c14;
  --bg-3: #111120;
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --surface-active: rgba(99,102,241,0.12);
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #475569;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --grad-soft: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1), rgba(6,182,212,0.08));
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --bg-3: #e2e8f0;
  --surface: rgba(0,0,0,0.03);
  --surface-hover: rgba(0,0,0,0.06);
  --surface-active: rgba(99,102,241,0.08);
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ════════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition);
  z-index: 100;
}
.sidebar.collapsed { width: 60px; }

.sidebar-header {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.neo-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.neo-logo-icon { width: 28px; height: 28px; flex-shrink: 0; }
.neo-logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.neo-logo-ai {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar.collapsed .neo-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .sidebar-actions-row span { display: none; }
.sidebar.collapsed .neo-logo-icon { margin: 0 auto; }

.sidebar-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-toggle svg { width: 16px; height: 16px; }

/* Nav */
.sidebar-nav {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--surface-active);
  color: var(--accent);
}
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--grad);
  color: white;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item .nav-icon { margin: 0; }

/* Chat history mini */
.chat-history-mini {
  padding: 0 8px;
  max-height: 120px;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
  flex-shrink: 0;
}
.sidebar-actions-row {
  display: flex;
  gap: 4px;
}
.sidebar-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-action-btn:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-action-btn svg { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-section {
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* Section headers */
.section-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.section-title-main {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.section-subtitle { font-size: 13px; color: var(--text-2); }

/* ════════════════════════════════════════════════════════════════════════════
   HOME DASHBOARD
   ════════════════════════════════════════════════════════════════════════════ */
.home-container {
  padding: 28px 32px;
  max-width: 1200px;
  width: 100%;
  overflow-y: auto;
  flex: 1;
}
.home-greeting-area {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.home-greeting h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.8px;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}
.greeting-date { font-size: 13px; color: var(--text-2); }

.demo-mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--grad);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.demo-mode-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.5); }
.demo-mode-btn svg { width: 12px; height: 12px; }

/* Grid */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}
.home-card:hover { border-color: var(--border-hover); background: var(--surface-hover); }
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.card-icon { font-size: 14px; }
.card-title { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.8px; flex: 1; }
.card-action-btn, .card-refresh-btn {
  font-size: 11px; color: var(--accent); background: none; border: none; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; transition: all var(--transition); font-weight: 500;
}
.card-action-btn:hover, .card-refresh-btn:hover { background: var(--surface-active); }

.briefing-card { grid-column: span 2; }
.briefing-text { font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* Mission card */
.mission-preview { margin-bottom: 12px; }
.no-mission-text { font-size: 13px; color: var(--text-3); }
.inline-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500; }
.xp-bar-container { margin-top: 8px; }
.xp-bar-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.xp-bar { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.xp-fill { height: 100%; background: var(--grad); border-radius: 2px; transition: width 0.6s ease; }

/* Tasks card */
.home-tasks-list { display: flex; flex-direction: column; gap: 6px; }
.home-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  padding: 4px 0;
}
.home-task-check { width: 14px; height: 14px; border: 1.5px solid var(--border-hover); border-radius: 3px; flex-shrink: 0; }
.home-task-item.done { text-decoration: line-through; opacity: 0.5; }
.empty-tasks-text { font-size: 13px; color: var(--text-3); }

/* Productivity score */
.productivity-score-display {
  display: flex;
  align-items: center;
  gap: 16px;
}
.score-ring { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.score-ring svg { transform: rotate(-90deg); width: 80px; height: 80px; }
.score-value {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.score-label { font-size: 13px; color: var(--text-2); }

/* Quick actions */
.quick-actions-section { margin-bottom: 32px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px; }
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.quick-action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.quick-action-card:hover {
  border-color: var(--accent);
  background: var(--surface-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.2);
}
.qa-icon { font-size: 24px; }
.qa-label { font-size: 13px; font-weight: 600; color: var(--text); }
.qa-desc { font-size: 11px; color: var(--text-3); }

/* Recent chats */
.recent-chats-section { margin-bottom: 24px; }
.recent-chats-list { display: flex; flex-direction: column; gap: 6px; }
.recent-chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-2);
}
.recent-chat-item:hover { border-color: var(--border-hover); background: var(--surface-hover); color: var(--text); }
.recent-chat-icon { font-size: 14px; }
.recent-chat-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-chat-time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.empty-state-small { font-size: 13px; color: var(--text-3); padding: 12px 0; }

/* ════════════════════════════════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════════════════════════════════ */
.chat-layout { display: flex; height: 100vh; overflow: hidden; }
.chat-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header { padding: 14px 12px 10px; border-bottom: 1px solid var(--border); }
.new-chat-btn {
  width: 100%;
  padding: 9px 14px;
  background: var(--surface-active);
  border: 1px dashed rgba(99,102,241,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.new-chat-btn:hover { background: rgba(99,102,241,0.2); }
.chat-mode-selector { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.chat-mode-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); display: block; margin-bottom: 6px; }
.chat-history-list { flex: 1; overflow-y: auto; padding: 8px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12.5px;
  color: var(--text-2);
  position: relative;
}
.history-item:hover { background: var(--surface-hover); color: var(--text); }
.history-item.active { background: var(--surface-active); color: var(--accent); }
.history-item-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.6; }
.history-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-delete-btn {
  width: 20px; height: 20px; background: none; border: none; cursor: pointer;
  color: var(--text-3); display: none; align-items: center; justify-content: center;
  border-radius: 4px; padding: 2px; opacity: 0.7;
}
.history-delete-btn:hover { background: rgba(239,68,68,0.15); color: var(--danger); opacity: 1; }
.history-item:hover .history-delete-btn { display: flex; }
.history-delete-btn svg { width: 12px; height: 12px; }

/* Chat main */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Empty state */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px 20px;
}
.empty-neo-logo { width: 56px; height: 56px; margin-bottom: 16px; }
.chat-empty-state h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.3px; }
.chat-empty-state p { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }
.empty-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggestion-chip {
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}
.suggestion-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-active); }

/* Messages */
.message-row {
  display: flex;
  gap: 12px;
  max-width: 820px;
}
.message-row.user {
  flex-direction: row-reverse;
  align-self: flex-end;
  max-width: 70%;
}
.message-row.assistant { align-self: flex-start; }
.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}
.message-row.user .bubble {
  background: var(--grad);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}
.message-row.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

/* Typing dots */
.typing-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  animation: bounce 1.3s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,80%,100% { transform:translateY(0); } 40% { transform:translateY(-6px); } }

.error-text { color: var(--danger); font-size: 13px; }

/* Code snippets in chat */
.code-snippet {
  margin: 10px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.code-snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.code-snippet-lang { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.code-snippet-actions { display: flex; gap: 6px; align-items: center; }
.code-run-btn, .code-copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all var(--transition);
}
.code-run-btn { background: rgba(16,185,129,0.15); color: #10b981; }
.code-run-btn:hover { background: rgba(16,185,129,0.25); }
.code-copy-btn { background: var(--surface-hover); color: var(--text-2); }
.code-copy-btn:hover { background: var(--surface-active); color: var(--text); }
.code-run-btn svg { width: 10px; height: 10px; }
.code-copy-btn .icon-check { display: none; }
.code-copy-btn.copied .icon-copy { display: none; }
.code-copy-btn.copied .icon-check { display: inline; }
.code-copy-btn svg { width: 12px; height: 12px; }
.code-snippet-block {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
  padding: 14px;
  color: var(--text);
  white-space: pre;
  resize: vertical;
  width: 100%;
  background: var(--bg);
  border: none;
  outline: none;
}
.code-output {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}
.code-output-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); display: block; margin-bottom: 6px; }
.code-output-label.error { color: var(--danger); }
.code-output-text {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
}
.code-output-text.error { color: var(--danger); }

/* Quiz/options */
.option-group {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 10px 0;
}
.option-group-header { margin-bottom: 10px; }
.option-group-question { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.option-group-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.option-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
  font-size: 13px; text-align: left; transition: all var(--transition);
}
.option-btn:hover { border-color: var(--accent); background: var(--surface-active); }
.option-btn.selected { border-color: var(--accent); background: var(--surface-active); color: var(--accent); }
.option-btn.correct { border-color: var(--success); background: rgba(16,185,129,0.1); color: var(--success); }
.option-btn.wrong { border-color: var(--danger); background: rgba(239,68,68,0.1); color: var(--danger); }
.option-tick { width: 16px; height: 16px; flex-shrink: 0; }
.option-tick svg { width: 16px; height: 16px; }
.option-btn:not(.selected) .option-tick { opacity: 0.2; }
.show-answer-btn, .submit-all-btn {
  margin-top: 8px; padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2);
  font-size: 12px; transition: all var(--transition);
}
.show-answer-btn:hover, .submit-all-btn:hover { border-color: var(--border-hover); color: var(--text); }
.submit-all-btn { background: var(--grad); color: white; border: none; font-weight: 600; }
.answer-reveal {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(16,185,129,0.1); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--success);
}
.icon-eye-off { display: inline; }
.icon-eye { display: none; }
.show-answer-btn.active .icon-eye-off { display: none; }
.show-answer-btn.active .icon-eye { display: inline; }

/* Image preview bar */
.image-preview-bar {
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.image-preview-chip {
  position: relative;
  flex-shrink: 0;
}
.image-preview-chip img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; display: block; }
.image-preview-remove {
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px; background: var(--danger);
  border: none; border-radius: 50%; cursor: pointer; color: white;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}

/* Composer */
.composer {
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 160px;
  line-height: 1.5;
  transition: border-color var(--transition);
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-3); }
.composer-btn {
  width: 38px; height: 38px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all var(--transition);
}
.composer-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-hover); }
.composer-btn svg { width: 16px; height: 16px; }
.send-btn {
  width: 38px; height: 38px;
  background: var(--grad);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(99,102,241,0.5); }
.send-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; }

/* Generated media */
.generated-image { max-width: 100%; border-radius: var(--radius-sm); margin-top: 8px; display: block; }
.generated-video { max-width: 100%; border-radius: var(--radius-sm); margin-top: 8px; display: block; }

/* Edit message */
.edit-btn {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; align-self: flex-end; opacity: 0; transition: opacity var(--transition);
  flex-shrink: 0;
}
.message-row:hover .edit-btn { opacity: 1; }
.edit-btn svg { width: 13px; height: 13px; }
.edit-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text);
  font-size: 14px; font-family: inherit; resize: none; outline: none;
}
.edit-actions { display: flex; gap: 8px; margin-top: 8px; }
.edit-cancel-btn, .edit-save-btn {
  padding: 6px 12px; border-radius: var(--radius-sm); border: none;
  cursor: pointer; font-size: 12px; font-weight: 600; transition: all var(--transition);
}
.edit-cancel-btn { background: var(--surface-hover); color: var(--text-2); }
.edit-save-btn { background: var(--grad); color: white; }

/* Paragraph edit */
.paragraph-edit-textarea {
  background: transparent; border: none; outline: none; resize: none;
  color: var(--text); font-size: 14px; font-family: inherit; line-height: 1.65;
  width: 100%; padding: 0; display: block;
}

/* ════════════════════════════════════════════════════════════════════════════
   SMART TUTOR
   ════════════════════════════════════════════════════════════════════════════ */
.tutor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}
.tutor-controls {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.tutor-subject-row { display: flex; gap: 8px; }
.tutor-topic-row { display: flex; }
.tutor-actions-row { display: flex; flex-direction: column; gap: 8px; }
.tutor-stats {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tutor-stat { flex: 1; text-align: center; }
.stat-value { display: block; font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.tutor-content { flex: 1; overflow-y: auto; padding: 24px; }
.tutor-welcome { text-align: center; padding: 60px 20px; }
.tutor-welcome-icon { font-size: 48px; margin-bottom: 16px; }
.tutor-welcome h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.tutor-welcome p { font-size: 14px; color: var(--text-2); }

/* Quiz in tutor */
.quiz-container { display: flex; flex-direction: column; gap: 20px; }
.quiz-question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.quiz-q-number { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.quiz-q-text { font-size: 15px; font-weight: 500; margin-bottom: 16px; color: var(--text); }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; color: var(--text); font-size: 13.5px;
  text-align: left; transition: all var(--transition); font-family: inherit;
}
.quiz-opt-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-active); }
.quiz-opt-btn.correct { border-color: var(--success); background: rgba(16,185,129,0.1); color: var(--success); }
.quiz-opt-btn.wrong { border-color: var(--danger); background: rgba(239,68,68,0.1); color: var(--danger); }
.quiz-opt-label { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.quiz-explanation {
  margin-top: 10px; padding: 10px 14px;
  background: rgba(99,102,241,0.08); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--text-2); display: none;
}
.quiz-score-banner {
  text-align: center; padding: 24px;
  background: var(--grad-soft); border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-lg);
}
.quiz-score-num { font-size: 48px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Flashcards */
.flashcard-container { perspective: 1000px; }
.flashcard {
  position: relative; width: 100%; min-height: 200px;
  transform-style: preserve-3d; transition: transform 0.5s ease; cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute; width: 100%; min-height: 200px;
  backface-visibility: hidden; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.flashcard-front { background: var(--grad); color: white; }
.flashcard-back { background: var(--surface); border: 1px solid var(--border); transform: rotateY(180deg); }
.flashcard-hint { font-size: 10px; opacity: 0.7; margin-top: 12px; }

/* ════════════════════════════════════════════════════════════════════════════
   CODER
   ════════════════════════════════════════════════════════════════════════════ */
.coder-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.coder-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.coder-controls { display: flex; flex-direction: column; gap: 8px; }
.coder-btn-row { display: flex; gap: 8px; }
.ai-assist-section { display: flex; flex-direction: column; gap: 8px; }
.coder-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.code-editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.code-editor-header {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.code-lang-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; }
.code-editor-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px; background: none; border: none; cursor: pointer;
  color: var(--text-3); display: flex; align-items: center; justify-content: center;
  border-radius: 5px; transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }
.code-editor {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: none;
  outline: none;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.65;
  resize: none;
  overflow-y: auto;
  tab-size: 2;
}
.code-output-panel {
  max-height: 200px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3);
}
.close-output-btn {
  background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 16px;
  line-height: 1; padding: 0 4px; transition: color var(--transition);
}
.close-output-btn:hover { color: var(--text); }
.output-content { overflow-y: auto; padding: 12px 14px; font-family: 'Courier New', monospace; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; }
.coder-ai-panel {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-panel-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.close-btn-small {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 18px; line-height: 1; padding: 0 2px; transition: color var(--transition);
}
.close-btn-small:hover { color: var(--text); }
.ai-panel-content { flex: 1; overflow-y: auto; padding: 14px; font-size: 13.5px; line-height: 1.65; color: var(--text-2); }

/* ════════════════════════════════════════════════════════════════════════════
   RESEARCHER / TRUTHCHECK
   ════════════════════════════════════════════════════════════════════════════ */
.researcher-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}
.researcher-controls {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.mode-toggle-row {
  display: flex;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.mode-toggle-btn {
  flex: 1; padding: 7px 12px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: none; transition: all var(--transition);
}
.mode-toggle-btn.active { background: var(--surface-active); color: var(--accent); }
.researcher-results {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.researcher-welcome { text-align: center; padding: 60px 20px; }
.researcher-welcome-icon { font-size: 48px; margin-bottom: 16px; }
.researcher-welcome h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.researcher-welcome p { font-size: 14px; color: var(--text-2); }

/* Research result */
.research-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
}
.result-streaming { animation: pulse-border 1.5s infinite; }
@keyframes pulse-border { 0%,100% { border-color: var(--border); } 50% { border-color: var(--accent); } }

/* TruthCheck result */
.truthcheck-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.truthcheck-verdict-banner {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.truthcheck-verdict-banner.TRUE { background: rgba(16,185,129,0.12); border-bottom: 1px solid rgba(16,185,129,0.2); }
.truthcheck-verdict-banner.FALSE { background: rgba(239,68,68,0.12); border-bottom: 1px solid rgba(239,68,68,0.2); }
.truthcheck-verdict-banner.UNCERTAIN { background: rgba(245,158,11,0.12); border-bottom: 1px solid rgba(245,158,11,0.2); }
.truthcheck-verdict-banner.MISLEADING { background: rgba(249,115,22,0.12); border-bottom: 1px solid rgba(249,115,22,0.2); }
.truthcheck-verdict-banner.PARTIALLY_TRUE { background: rgba(99,102,241,0.12); border-bottom: 1px solid rgba(99,102,241,0.2); }
.verdict-icon { font-size: 32px; flex-shrink: 0; }
.verdict-info { flex: 1; }
.verdict-label {
  font-size: 20px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px;
}
.TRUE .verdict-label { color: var(--success); }
.FALSE .verdict-label { color: var(--danger); }
.UNCERTAIN .verdict-label { color: var(--warning); }
.MISLEADING .verdict-label { color: #f97316; }
.PARTIALLY_TRUE .verdict-label { color: var(--accent); }
.verdict-summary { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.confidence-bar-container {
  display: flex; align-items: center; gap: 10px;
}
.confidence-bar { height: 6px; width: 80px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 3px; }
.confidence-label { font-size: 12px; font-weight: 700; min-width: 36px; }
.truthcheck-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.truthcheck-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 8px; }
.truthcheck-section p { font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.truthcheck-points { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.truthcheck-points li { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); }
.truthcheck-points li::before { content: '•'; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.truthcheck-limitation { font-size: 12px; color: var(--text-3); font-style: italic; padding: 10px 14px; background: var(--bg-3); border-radius: var(--radius-sm); }

/* ════════════════════════════════════════════════════════════════════════════
   CREATIVE STUDIO
   ════════════════════════════════════════════════════════════════════════════ */
.creative-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 32px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.creative-tab {
  padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: all var(--transition); margin-bottom: -1px;
}
.creative-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.creative-tab-content { flex: 1; overflow-y: auto; padding: 24px 32px; }
.creative-input-section { display: flex; flex-direction: column; gap: 12px; max-width: 700px; margin-bottom: 24px; }
.creative-options { display: flex; gap: 12px; }
.creative-output { max-width: 800px; }
.feature-note { font-size: 12px; color: var(--text-3); font-style: italic; }
.creative-output-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; font-size: 14px; line-height: 1.7; color: var(--text-2);
}
.creative-output-card img { max-width: 100%; border-radius: var(--radius-sm); display: block; margin-top: 12px; }
.creative-output-card video { max-width: 100%; border-radius: var(--radius-sm); display: block; margin-top: 12px; }

/* ════════════════════════════════════════════════════════════════════════════
   LIFE OS
   ════════════════════════════════════════════════════════════════════════════ */
.lifeos-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.lifeos-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.lifeos-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lifeos-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
}
.lifeos-tab {
  padding: 12px 20px; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: all var(--transition); margin-bottom: -1px;
}
.lifeos-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.lifeos-tab-content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.task-add-row, .goal-add-row, .schedule-add-row {
  display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap;
}
.tasks-list, .goals-list, .schedule-list { display: flex; flex-direction: column; gap: 8px; }

/* Task items */
.task-item, .goal-item, .schedule-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.task-item:hover, .goal-item:hover, .schedule-item:hover { border-color: var(--border-hover); }
.task-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); flex-shrink: 0; }
.task-text { flex: 1; font-size: 13.5px; color: var(--text); }
.task-item.done .task-text { text-decoration: line-through; color: var(--text-3); }
.task-priority {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; letter-spacing: 0.5px;
}
.priority-high { background: rgba(239,68,68,0.15); color: var(--danger); }
.priority-medium { background: rgba(245,158,11,0.15); color: var(--warning); }
.priority-low { background: rgba(16,185,129,0.15); color: var(--success); }
.task-delete-btn {
  background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 14px;
  opacity: 0; transition: opacity var(--transition); padding: 2px;
}
.task-item:hover .task-delete-btn, .goal-item:hover .task-delete-btn, .schedule-item:hover .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: var(--danger); }

.goal-progress { flex: 1; }
.goal-title { font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.goal-deadline { font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
.goal-bar { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.goal-fill { height: 100%; background: var(--grad); border-radius: 2px; transition: width 0.4s ease; }

.lifeos-ai-response {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-response-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.ai-response-content { flex: 1; overflow-y: auto; padding: 14px; font-size: 13.5px; line-height: 1.65; color: var(--text-2); }

/* ════════════════════════════════════════════════════════════════════════════
   AGENT STUDIO
   ════════════════════════════════════════════════════════════════════════════ */
.agent-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  gap: 24px;
}
.agent-input-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.agent-examples { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.examples-label { font-size: 11px; color: var(--text-3); font-weight: 600; }
.example-chip {
  padding: 5px 12px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: all var(--transition);
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-active); }

/* Workflow */
.agent-workflow-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.workflow-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.workflow-title { font-size: 16px; font-weight: 700; color: var(--text); }
.workflow-meta { font-size: 12px; color: var(--text-3); }
.workflow-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.workflow-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.workflow-step.running { border-color: var(--accent); background: var(--surface-active); }
.workflow-step.done { border-color: var(--success); }
.workflow-step.error { border-color: var(--danger); }
.step-number {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-3); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-2); flex-shrink: 0;
}
.workflow-step.done .step-number { background: rgba(16,185,129,0.15); border-color: var(--success); color: var(--success); }
.workflow-step.running .step-number { background: var(--surface-active); border-color: var(--accent); color: var(--accent); animation: pulse-step 1s infinite; }
@keyframes pulse-step { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.step-info { flex: 1; }
.step-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.step-desc { font-size: 12px; color: var(--text-3); }
.step-output { margin-top: 8px; font-size: 12.5px; color: var(--text-2); background: var(--bg); border-radius: var(--radius-sm); padding: 10px; max-height: 120px; overflow-y: auto; white-space: pre-wrap; }
.step-status { font-size: 11px; font-weight: 700; flex-shrink: 0; }
.step-status.pending { color: var(--text-3); }
.step-status.running { color: var(--accent); }
.step-status.done { color: var(--success); }
.step-status.error { color: var(--danger); }
.workflow-controls { display: flex; gap: 10px; }

/* Results */
.agent-results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; font-size: 14px; font-weight: 600; color: var(--text); }
.results-content { display: flex; flex-direction: column; gap: 16px; }
.result-block {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}
.result-block-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 8px; }
.result-block-content { font-size: 13.5px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; }

/* ════════════════════════════════════════════════════════════════════════════
   KNOWLEDGE VAULT
   ════════════════════════════════════════════════════════════════════════════ */
.vault-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.vault-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vault-upload-area {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.upload-icon { font-size: 32px; }
.vault-upload-area p { font-size: 13px; color: var(--text-2); }
.upload-note { font-size: 11px; color: var(--text-3); }
.vault-documents-list { flex: 1; overflow-y: auto; padding: 10px; }
.vault-doc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); border: 1px solid transparent;
}
.vault-doc-item:hover { background: var(--surface-hover); border-color: var(--border); }
.vault-doc-item.active { background: var(--surface-active); border-color: rgba(99,102,241,0.3); }
.vault-doc-icon { font-size: 18px; flex-shrink: 0; }
.vault-doc-info { flex: 1; min-width: 0; }
.vault-doc-name { font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vault-doc-size { font-size: 10px; color: var(--text-3); }
.vault-doc-delete { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 14px; opacity: 0; transition: opacity var(--transition); }
.vault-doc-item:hover .vault-doc-delete { opacity: 1; }
.vault-doc-delete:hover { color: var(--danger); }

.vault-qa-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.vault-active-doc {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.no-doc-selected { font-size: 14px; color: var(--text-3); }
.vault-active-doc-info { font-size: 13px; font-weight: 600; color: var(--text); }
.vault-chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.vault-messages { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.vault-message { padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.65; }
.vault-message.user { background: var(--grad); color: white; align-self: flex-end; max-width: 70%; border-radius: var(--radius) var(--radius) 4px var(--radius); }
.vault-message.assistant { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); align-self: flex-start; }
.vault-input-row { display: flex; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.vault-quick-actions { padding: 8px 24px 12px; display: flex; gap: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.quick-vault-btn {
  padding: 6px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: all var(--transition);
}
.quick-vault-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-active); }

/* ════════════════════════════════════════════════════════════════════════════
   MISSIONS
   ════════════════════════════════════════════════════════════════════════════ */
.missions-layout { flex: 1; overflow-y: auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.missions-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.missions-player-stats { display: flex; align-items: center; gap: 16px; }
.player-level-badge {
  background: var(--grad); color: white; padding: 6px 16px;
  border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.player-xp-info { min-width: 160px; }
.xp-label-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.xp-bar-large { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.xp-fill-large { height: 100%; background: var(--grad); border-radius: 3px; transition: width 0.6s ease; }
.player-streak { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); }
.streak-flame { font-size: 16px; }

.missions-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.missions-tab {
  padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: all var(--transition); margin-bottom: -1px;
}
.missions-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.missions-tab-content { display: flex; flex-direction: column; gap: 12px; }

/* Mission cards */
.available-missions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mission-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.mission-card-item:hover { border-color: var(--border-hover); background: var(--surface-hover); transform: translateY(-2px); }
.mission-card-emoji { font-size: 28px; margin-bottom: 10px; }
.mission-card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.mission-card-desc { font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }
.mission-card-meta { display: flex; align-items: center; justify-content: space-between; }
.mission-xp-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  background: rgba(99,102,241,0.15); color: var(--accent); border-radius: 10px;
}
.mission-difficulty { font-size: 11px; color: var(--text-3); }
.mission-start-btn {
  padding: 8px 18px; background: var(--grad); border: none; border-radius: 20px;
  color: white; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all var(--transition); box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.mission-start-btn:hover { transform: scale(1.03); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }

/* Active mission */
.active-mission-card {
  background: var(--surface);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--grad-soft);
}
.active-mission-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.active-mission-emoji { font-size: 28px; }
.active-mission-title { font-size: 15px; font-weight: 700; color: var(--text); }
.active-mission-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 14px; }
.mission-tasks-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mission-task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
  font-size: 13px; color: var(--text-2);
}
.mission-task-item:hover { border-color: var(--border-hover); }
.mission-task-item.done { opacity: 0.6; }
.mission-task-check { width: 16px; height: 16px; border: 1.5px solid var(--border-hover); border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.mission-task-item.done .mission-task-check { background: var(--success); border-color: var(--success); color: white; font-size: 10px; }
.mission-action-btn {
  padding: 9px 20px; border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all var(--transition);
}
.mission-action-btn.primary { background: var(--grad); color: white; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.mission-action-btn.secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }

/* Achievements */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.achievement-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: all var(--transition);
}
.achievement-item.unlocked { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.06); }
.achievement-item.locked { opacity: 0.4; }
.achievement-emoji { font-size: 28px; margin-bottom: 8px; }
.achievement-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.achievement-desc { font-size: 10.5px; color: var(--text-3); }

/* ════════════════════════════════════════════════════════════════════════════
   VOICE OVERLAY
   ════════════════════════════════════════════════════════════════════════════ */
.voice-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,5,8,0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.3s ease;
  backdrop-filter: blur(20px);
}
.voice-overlay.open { opacity: 1; visibility: visible; }
.voice-content { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.voice-orb {
  position: relative; width: 120px; height: 120px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.voice-ring {
  position: absolute; border-radius: 50%; border: 2px solid;
  animation: voice-pulse 2s infinite ease-in-out;
}
.voice-ring-1 { inset: 0; border-color: rgba(99,102,241,0.3); }
.voice-ring-2 { inset: -12px; border-color: rgba(99,102,241,0.15); animation-delay: 0.3s; }
.voice-ring-3 { inset: -24px; border-color: rgba(99,102,241,0.08); animation-delay: 0.6s; }
.voice-orb.listening .voice-ring-1 { animation: voice-pulse-fast 0.8s infinite ease-in-out; }
.voice-orb.listening .voice-ring-2 { animation: voice-pulse-fast 0.8s 0.2s infinite ease-in-out; }
.voice-orb.listening .voice-ring-3 { animation: voice-pulse-fast 0.8s 0.4s infinite ease-in-out; }
.voice-core {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px rgba(99,102,241,0.6);
  z-index: 1;
}
.voice-core svg { width: 28px; height: 28px; color: white; }
@keyframes voice-pulse { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes voice-pulse-fast { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.voice-status-text { font-size: 15px; font-weight: 500; color: var(--text-2); }
.voice-transcript-text { font-size: 16px; color: var(--text); max-width: 500px; text-align: center; line-height: 1.5; min-height: 24px; }
.voice-close-btn {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.voice-close-btn:hover { background: var(--surface-hover); color: var(--text); }
.voice-close-btn svg { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.25s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); min-width: 360px; max-width: 560px; width: 90%;
  animation: modal-in 0.25s ease;
}
.modal-box.small { min-width: 280px; max-width: 380px; padding: 24px; text-align: center; }
.modal-box.small p { font-size: 14px; color: var(--text-2); margin-bottom: 16px; line-height: 1.5; }
.modal-btn-row { display: flex; gap: 10px; justify-content: center; }
@keyframes modal-in { from { transform: scale(0.95) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 28px; height: 28px; background: none; border: none; cursor: pointer;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); }
.settings-row { display: flex; align-items: center; gap: 12px; }
.settings-label { font-size: 13px; color: var(--text-2); min-width: 100px; }
.settings-actions-row { display: flex; gap: 10px; }
.about-text { font-size: 12px; color: var(--text-3); line-height: 1.6; }

/* ════════════════════════════════════════════════════════════════════════════
   DEMO OVERLAY
   ════════════════════════════════════════════════════════════════════════════ */
.demo-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
}
.demo-content {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; width: 90%; max-width: 580px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modal-in 0.3s ease;
}
.demo-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.demo-logo { font-size: 18px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.demo-close { background: none; border: none; cursor: pointer; font-size: 22px; color: var(--text-2); padding: 0 4px; }
.demo-steps { display: flex; flex-direction: column; gap: 10px; }
.demo-step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.demo-step:hover { border-color: var(--border-hover); }
.demo-step-number {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-2); flex-shrink: 0;
}
.demo-step.active .demo-step-number { background: var(--grad); color: white; }
.demo-step-info { flex: 1; }
.demo-step-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.demo-step-desc { font-size: 12px; color: var(--text-3); }
.demo-step-btn {
  padding: 7px 14px; background: var(--surface-active); border: 1px solid rgba(99,102,241,0.3);
  border-radius: 20px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent);
  transition: all var(--transition);
}
.demo-step-btn:hover { background: rgba(99,102,241,0.2); }

/* ════════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ════════════════════════════════════════════════════════════════════════════ */
.neo-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 13px; color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color var(--transition); width: 100%;
}
.neo-input:focus { border-color: var(--accent); }
.neo-input::placeholder { color: var(--text-3); }
.neo-input.small { width: auto; }
.neo-select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 13px; color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
  padding-right: 32px; transition: border-color var(--transition); flex: 1;
}
.neo-select:focus { border-color: var(--accent); }
.neo-select.small { flex: 0; min-width: 120px; }
.neo-textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 13px; color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; resize: vertical; transition: border-color var(--transition); width: 100%;
  line-height: 1.6;
}
.neo-textarea:focus { border-color: var(--accent); }
.neo-textarea::placeholder { color: var(--text-3); }
.neo-textarea.large { min-height: 100px; }
.neo-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); display: block; margin-bottom: 6px; }

/* Buttons */
.neo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: none;
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  transition: all var(--transition); white-space: nowrap;
}
.neo-btn.primary { background: var(--grad); color: white; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.neo-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.neo-btn.secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.neo-btn.secondary:hover { border-color: var(--border-hover); color: var(--text); }
.neo-btn.danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.neo-btn.danger:hover { background: rgba(239,68,68,0.25); }
.neo-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.neo-btn.full-width { width: 100%; }
.neo-btn.small { padding: 6px 12px; font-size: 12px; }
.neo-btn svg { width: 14px; height: 14px; }

/* ════════════════════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 13px; color: var(--text); min-width: 200px;
  box-shadow: var(--shadow); animation: toast-in 0.25s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(20px); opacity: 0; } }
.toast.hiding { animation: toast-out 0.25s ease forwards; }

/* ════════════════════════════════════════════════════════════════════════════
   LOADING SPINNER
   ════════════════════════════════════════════════════════════════════════════ */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; padding: 12px 0; }

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════════════════════════════════════ */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 150;
  width: 36px; height: 36px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
}
.mobile-menu-btn svg { width: 18px; height: 18px; }

@media (max-width: 1024px) {
  .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
  .briefing-card { grid-column: span 1; }
  .home-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.3s ease;
    z-index: 200; width: var(--sidebar-w) !important;
    box-shadow: var(--shadow);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .home-container { padding: 16px; }
  .home-greeting-area { flex-direction: column; gap: 12px; }
  .home-grid { grid-template-columns: 1fr; }
  .briefing-card { grid-column: span 1; }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-layout { flex-direction: column; }
  .chat-sidebar { display: none; }
  .section-header { padding: 16px; }
  .tutor-layout, .coder-layout, .researcher-layout, .lifeos-layout, .vault-layout { flex-direction: column; }
  .tutor-controls, .coder-sidebar, .researcher-controls, .lifeos-sidebar, .vault-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .agent-layout { padding: 16px; }
  .missions-layout { padding: 16px; }
  .missions-header { flex-direction: column; }
}

@media (max-width: 480px) {
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .home-container { padding: 12px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   ANIMATIONS / TRANSITIONS
   ════════════════════════════════════════════════════════════════════════════ */
.app-section { animation: section-fade-in 0.25s ease; }
@keyframes section-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.fade-in { animation: section-fade-in 0.3s ease; }

/* Focus rings for accessibility */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
