/* =========================================
   JARVIS Design System
   Premium Dark Mode • Glassmorphism • Alive
   ========================================= */

/* --- Design Tokens --- */
:root {
  /* Colors */
  --bg-primary: #0B0F1A;
  --bg-secondary: #111827;
  --bg-surface: #1A1F35;
  --bg-surface-hover: #222847;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-strong: rgba(255, 255, 255, 0.08);
  
  --accent-purple: #6C63FF;
  --accent-purple-dim: rgba(108, 99, 255, 0.15);
  --accent-teal: #00D4AA;
  --accent-teal-dim: rgba(0, 212, 170, 0.15);
  --accent-gold: #FFB547;
  --accent-gold-dim: rgba(255, 181, 71, 0.15);
  --accent-red: #FF6B6B;
  --accent-red-dim: rgba(255, 107, 107, 0.15);
  --accent-blue: #4DA6FF;
  --accent-blue-dim: rgba(77, 166, 255, 0.15);
  
  --text-primary: #EAEDF3;
  --text-secondary: #8892A7;
  --text-tertiary: #5A6478;
  --text-accent: #A5B4FC;
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-active: rgba(108, 99, 255, 0.4);
  
  --gradient-primary: linear-gradient(135deg, #6C63FF 0%, #00D4AA 100%);
  --gradient-warm: linear-gradient(135deg, #FFB547 0%, #FF6B6B 100%);
  --gradient-surface: linear-gradient(135deg, rgba(108, 99, 255, 0.08) 0%, rgba(0, 212, 170, 0.05) 100%);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 20px rgba(108, 99, 255, 0.3);
  --shadow-glow-teal: 0 0 20px rgba(0, 212, 170, 0.3);
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  
  /* Animation */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- Loading Screen --- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-logo { position: relative; width: 100px; height: 100px; margin-bottom: 24px; }

.loading-ring {
  position: absolute;
  inset: -10px;
  border: 2px solid transparent;
  border-top-color: var(--accent-purple);
  border-right-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

.loading-icon { width: 100%; height: 100%; }

.loading-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-sub { color: var(--text-secondary); margin-top: 8px; font-size: 0.875rem; }

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--bg-surface);
  border-radius: 3px;
  margin-top: 24px;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  width: 0;
  background: var(--gradient-primary);
  border-radius: 3px;
  animation: loadProgress 2s ease-in-out forwards;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loadProgress { to { width: 100%; } }

/* --- App Layout --- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .ai-status span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-header { justify-content: center; }

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  box-shadow: var(--shadow-glow-purple);
}

.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 2px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-fast);
}
.sidebar-toggle:hover { background: var(--bg-glass-strong); color: var(--text-primary); }

.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-fast);
  position: relative;
}

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

.nav-item.active {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-purple);
  border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-purple);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.nav-badge.projects-badge { background: var(--accent-teal); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.online { background: var(--accent-teal); }
.status-dot.error { background: var(--accent-red); animation: none; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* --- Top Bar --- */
.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius);
  padding: 8px 16px;
  transition: var(--transition-fast);
}

.topbar-search:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-dim);
}

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

.topbar-search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

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

.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.topbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  position: relative;
  transition: var(--transition-fast);
}

.topbar-btn:hover { background: var(--bg-glass-strong); color: var(--text-primary); }

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
}

/* --- View Container --- */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  transition: var(--transition-normal);
}

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

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* --- Dashboard --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.briefing-hero {
  grid-column: 1 / -1;
  background: var(--gradient-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.briefing-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.briefing-greeting {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.briefing-time {
  position: absolute;
  top: 32px;
  right: 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.briefing-summary { color: var(--text-secondary); font-size: 0.95rem; margin-top: 8px; max-width: 70%; }

.briefing-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--accent-purple);
  color: white;
  box-shadow: var(--shadow-glow-purple);
}
.btn-primary:hover { background: #5B52E5; transform: translateY(-1px); }

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

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }

.btn-success { background: var(--accent-teal); color: #0B0F1A; }
.btn-danger { background: var(--accent-red); color: white; }

/* Stat Cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-normal);
}

.stat-card:hover { border-color: var(--border-medium); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

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

.stat-bar { height: 4px; border-radius: 2px; background: var(--bg-glass-strong); margin-top: 8px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width 1s ease; }

/* Project Items */
.project-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
  cursor: pointer;
}

.project-item:hover { background: var(--bg-glass-strong); border-color: var(--border-medium); }

.project-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-info { flex: 1; min-width: 0; }
.project-name { font-weight: 600; font-size: 0.9rem; }
.project-client { font-size: 0.8rem; color: var(--text-secondary); }

.project-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active { background: var(--accent-teal-dim); color: var(--accent-teal); }
.status-at-risk { background: var(--accent-gold-dim); color: var(--accent-gold); }
.status-urgent { background: var(--accent-red-dim); color: var(--accent-red); }

/* Risk Indicators */
.risk-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.risk-low { background: var(--accent-teal-dim); color: var(--accent-teal); }
.risk-medium { background: var(--accent-gold-dim); color: var(--accent-gold); }
.risk-high { background: var(--accent-red-dim); color: var(--accent-red); }

/* Task Items */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.task-item:hover { background: var(--bg-glass-strong); }

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-checkbox.checked {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
}

.task-checkbox.checked::after { content: '✓'; color: white; font-size: 0.7rem; font-weight: 700; }

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 0.9rem; font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--text-tertiary); }
.task-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.task-due {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.due-today { background: var(--accent-gold-dim); color: var(--accent-gold); }
.due-overdue { background: var(--accent-red-dim); color: var(--accent-red); }
.due-upcoming { background: var(--accent-blue-dim); color: var(--accent-blue); }

/* Calendar Items */
.calendar-item {
  display: flex;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-purple);
}

.calendar-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-purple);
  white-space: nowrap;
  min-width: 80px;
}

.calendar-info { flex: 1; }
.calendar-title { font-weight: 600; font-size: 0.9rem; }
.calendar-prep { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* --- Voice FAB --- */
.voice-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-purple);
  z-index: 200;
  transition: var(--transition-normal);
}

.voice-fab:hover { transform: scale(1.1); }
.voice-fab:active { transform: scale(0.95); }

.voice-fab.recording { background: var(--accent-red); box-shadow: 0 0 30px rgba(255, 107, 107, 0.5); }

.voice-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent-purple);
  opacity: 0;
  pointer-events: none;
}

.voice-fab.recording .voice-pulse { animation: voicePulse 1.5s ease-in-out infinite; border-color: var(--accent-red); }

@keyframes voicePulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* --- Voice Modal --- */
.voice-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.voice-modal-content.jarvis-hud {
  position: relative;
  background: radial-gradient(circle at center, rgba(15, 25, 45, 0.95), rgba(7, 12, 22, 0.98));
  border: 1px solid rgba(0, 212, 170, 0.35);
  box-shadow: 0 0 40px rgba(0, 212, 170, 0.15), 0 0 80px rgba(108, 99, 255, 0.12);
  border-radius: var(--border-radius-xl);
  padding: 36px 28px;
  width: 92%;
  max-width: 500px;
  text-align: center;
  overflow: hidden;
}

.hud-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.hud-close:hover { color: #fff; }

.arc-reactor-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.arc-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.ring-outer {
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(0, 212, 170, 0.6);
  animation: arcSpinClockwise 12s linear infinite;
  box-shadow: 0 0 15px rgba(0, 212, 170, 0.3);
}

.ring-mid {
  width: 78%;
  height: 78%;
  border: 2px solid rgba(108, 99, 255, 0.7);
  border-top-color: transparent;
  border-bottom-color: transparent;
  animation: arcSpinCounter 6s linear infinite;
}

.arc-core {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #00D4AA 0%, #6C63FF 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #070C16;
  box-shadow: 0 0 25px #00D4AA, 0 0 45px rgba(108, 99, 255, 0.6);
  animation: arcPulse 2s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes arcSpinClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes arcSpinCounter {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes arcPulse {
  0% { transform: scale(0.96); box-shadow: 0 0 20px #00D4AA; }
  100% { transform: scale(1.06); box-shadow: 0 0 35px #00D4AA, 0 0 60px rgba(108, 99, 255, 0.8); }
}

.hud-title {
  font-size: 1.25rem;
  letter-spacing: 3px;
  font-weight: 700;
  color: #00D4AA;
  text-shadow: 0 0 12px rgba(0, 212, 170, 0.6);
  margin-bottom: 4px;
}

.voice-status {
  font-size: 0.9rem;
  font-weight: 500;
  color: #A8A0FF;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.hud-display {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  max-height: 220px;
  overflow-y: auto;
  margin: 12px 0 20px 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius);
}

.hud-user-transcript {
  font-size: 0.9rem;
  color: #E2E8F0;
  padding: 8px 12px;
  border-left: 2px solid #6C63FF;
  background: rgba(108, 99, 255, 0.1);
  border-radius: 4px;
  line-height: 1.4;
}

.hud-ai-response {
  font-size: 0.92rem;
  color: #00D4AA;
  padding: 10px 12px;
  border-left: 2px solid #00D4AA;
  background: rgba(0, 212, 170, 0.08);
  border-radius: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hud-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 212, 170, 0.2);
  color: #00D4AA;
  border: 1px solid rgba(0, 212, 170, 0.4);
  margin-top: 4px;
  align-self: flex-start;
}

.voice-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.voice-btn {
  padding: 10px 20px;
  border-radius: var(--border-radius);
  border: none;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

#voice-listen-again {
  background: linear-gradient(135deg, #00D4AA, #6C63FF);
  color: #070C16;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.4);
}
#voice-listen-again:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(0, 212, 170, 0.6);
}

.voice-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.voice-btn.cancel:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* --- Chat Overlay --- */
.chat-overlay {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 250;
  animation: slideUp 0.3s ease;
}

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

.chat-container {
  width: 380px;
  max-height: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-header h3 {
  font-size: 1rem;
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

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

.chat-msg {
  padding: 10px 14px;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 90%;
  animation: fadeIn 0.3s ease;
}

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

.chat-msg.user {
  background: var(--accent-purple);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.ai {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.chat-input-wrap input {
  flex: 1;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}

.chat-input-wrap input:focus { border-color: var(--accent-purple); }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  background: var(--accent-purple);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.chat-send-btn:hover { background: #5B52E5; }

/* --- TTS Speaker Button --- */
.speaker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.speaker-btn:hover { background: var(--bg-surface-hover); border-color: var(--accent-purple); }
.speaker-btn.playing { border-color: var(--accent-teal); color: var(--accent-teal); }

/* --- Settings Page --- */
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.setting-label { font-size: 0.9rem; color: var(--text-primary); }
.setting-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.setting-input {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  padding: 8px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  min-width: 180px;
}

.setting-input:focus { border-color: var(--accent-purple); }

.setting-select {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  padding: 8px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  min-width: 180px;
  cursor: pointer;
}

/* Model assignment cards */
.model-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.model-task { font-weight: 600; font-size: 0.9rem; }
.model-reason { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state svg { margin-bottom: 20px; opacity: 0.3; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; color: var(--text-tertiary); max-width: 400px; }

/* --- Sections --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title { font-size: 1.35rem; font-weight: 700; }
.section-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

/* Feed Cards */
.feed-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition-normal);
}

.feed-card:hover { border-color: var(--border-medium); }

.feed-word {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.feed-pronunciation {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.feed-meaning { margin-top: 8px; color: var(--text-primary); font-size: 0.95rem; }
.feed-example { margin-top: 6px; color: var(--text-secondary); font-size: 0.85rem; font-style: italic; }

.news-item {
  padding: 16px 20px;
  border-left: 3px solid var(--accent-teal);
  background: var(--bg-glass);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  margin-bottom: 12px;
}

.news-headline { font-weight: 600; font-size: 0.95rem; }
.news-why { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }
.news-source { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 6px; }

/* --- Add Project Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 500px;
}

.modal-content h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; }

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

.form-input {
  width: 100%;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-input:focus { border-color: var(--accent-purple); }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* Color picker dots */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition-fast);
}

.color-dot:hover, .color-dot.selected { border-color: white; transform: scale(1.15); }

/* --- Typing animation for briefing --- */
.typing-text {
  overflow: hidden;
  white-space: nowrap;
  animation: typing 0.5s steps(40, end);
}

@keyframes typing { from { width: 0; } to { width: 100%; } }

.typing-cursor::after {
  content: '|';
  animation: blink 0.8s step-end infinite;
  color: var(--accent-purple);
  font-weight: 300;
}

@keyframes blink { 50% { opacity: 0; } }

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(11, 15, 26, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 999;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-main);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 60px;
}

.bottom-nav-item svg {
  transition: transform var(--transition-fast);
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item.active {
  color: var(--cyan);
}

.bottom-nav-item.active svg {
  color: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(0, 212, 170, 0.5));
}

.bnav-ai-bubble {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 212, 170, 0.4);
  margin-top: -12px;
  transition: all var(--transition-normal);
}

.bottom-nav-item.active .bnav-ai-bubble {
  transform: scale(1.08);
  box-shadow: 0 0 22px rgba(0, 212, 170, 0.7);
}

.bnav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.bnav-icon-wrap .nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  padding: 1px 5px;
  font-size: 0.6rem;
}

/* --- Full J.A.R.V.I.S Chat View --- */
.chat-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 1000px;
  margin: 0 auto;
  gap: 16px;
}

.chat-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}

.chat-view-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-view-reactor-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 170, 0.1);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.3);
  animation: arcPulse 3s ease-in-out infinite;
}

.chat-view-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-view-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

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

.chat-btn-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-btn-pill:hover {
  background: rgba(0, 212, 170, 0.12);
  color: var(--cyan);
  border-color: rgba(0, 212, 170, 0.4);
}

.chat-btn-pill.primary {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.25), rgba(0, 212, 170, 0.25));
  border-color: var(--cyan);
  color: var(--text-primary);
}

/* Sessions Bar */
.chat-session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scrollbar-width: none;
}
.chat-session-bar::-webkit-scrollbar { display: none; }

.chat-session-chip {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.chat-session-chip.active {
  background: rgba(0, 212, 170, 0.12);
  color: var(--cyan);
  border-color: var(--cyan);
  font-weight: 600;
}

/* Quick Action Chips */
.quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }

.quick-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.quick-chip:hover {
  background: rgba(108, 99, 255, 0.15);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Message Stream */
.chat-view-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.chat-msg-row {
  display: flex;
  gap: 12px;
  max-width: 88%;
}

.chat-msg-row.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chat-msg-row.ai {
  margin-right: auto;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chat-avatar.user {
  background: linear-gradient(135deg, #6C63FF, #4E44CE);
  color: #fff;
}

.chat-avatar.ai {
  background: rgba(0, 212, 170, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.chat-msg-row.user .chat-bubble {
  background: linear-gradient(135deg, #2A2550, #1E1B4B);
  border: 1px solid rgba(108, 99, 255, 0.4);
  color: #F8FAFC;
  border-top-right-radius: 4px;
}

.chat-msg-row.ai .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble p { margin: 0 0 10px 0; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 6px 0 10px 20px; padding: 0; }
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble strong { color: var(--cyan); font-weight: 600; }
.chat-bubble h3, .chat-bubble h4 { color: #FFF; margin: 12px 0 6px 0; font-size: 1rem; }

.chat-bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.chat-bubble-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.chat-action-btn:hover {
  color: var(--cyan);
  background: rgba(0, 212, 170, 0.1);
}

/* Chat Input Bar */
.chat-view-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.chat-view-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
}

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

.chat-view-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-view-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(0, 212, 170, 0.5);
}

.chat-view-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-view-mic-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 212, 170, 0.1);
}

.chat-view-mic-btn.recording {
  background: rgba(255, 71, 87, 0.2);
  border-color: #FF4757;
  color: #FF4757;
  animation: arcPulse 1s infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 1001;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .mobile-menu-btn { display: block; }

  .main-content { width: 100vw; }

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

  .briefing-hero { padding: 20px; }
  .briefing-greeting { font-size: 1.3rem; }
  .briefing-time { position: static; margin-top: 8px; font-size: 1.1rem; }
  .briefing-summary { max-width: 100%; }

  .topbar-search { display: none; }

  .view-container { 
    padding: 14px 14px 84px 14px; /* Space for bottom nav */
  }

  .chat-view {
    height: calc(100vh - 140px);
  }

  .chat-msg-row { max-width: 95%; }

  .chat-overlay { right: 12px; bottom: 80px; }
  .chat-container { width: calc(100vw - 24px); }

  .voice-fab { 
    bottom: 76px; /* Above bottom nav */
    right: 16px; 
    width: 48px;
    height: 48px;
  }

  .stat-value { font-size: 1.8rem; }
}

@media (max-width: 480px) {
  .briefing-actions { flex-direction: column; }
  .briefing-actions .btn { justify-content: center; }
  .chat-header-actions .chat-btn-pill span { display: none; }
}

