:root {
  /* Backgrounds — better separation */
  --bg-primary: #08080e;
  --bg-secondary: rgba(14, 14, 22, 0.85);
  --bg-tertiary: #111119;
  --bg-elevated: #1a1a26;
  /* Borders — more visible */
  --border: rgba(139, 92, 246, 0.12);
  --border-active: rgba(139, 92, 246, 0.28);
  --glass: rgba(255, 255, 255, 0.035);
  --glass-border: rgba(255, 255, 255, 0.07);
  /* Text — stronger contrast */
  --text-primary: #f0f0f5;
  --text-secondary: #a8a8bc;
  --text-muted: #6e6e84;
  /* Accent */
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.12);
  --accent-dim: rgba(139, 92, 246, 0.06);
  /* Status */
  --success: #34d399;
  --error: #ef4444;
  --warning: #f59e0b;
  --axe-accent: #10b981;
  --axe-glow: rgba(16, 185, 129, 0.1);
  /* Components */
  --tool-bg: rgba(139, 92, 246, 0.04);
  --user-bubble: rgba(139, 92, 246, 0.10);
  --assistant-bubble: transparent;
  /* Radii */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  /* Typography */
  --font: 'DM Sans', -apple-system, 'SF Pro Display', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --fs-xs: 10px;
  --fs-sm: 11px;
  --fs-body: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;
  /* Motion */
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: rgba(139, 92, 246, 0.3); color: #f0f0f5; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.2); }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
}

/* ═══ Login Screen ═══ */
.login-screen {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
.login-screen.visible { display: flex; }
.login-screen::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px 40px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  animation: loginAppear 400ms var(--ease-out-expo);
  box-shadow: var(--shadow-xl), 0 0 80px rgba(139, 92, 246, 0.06);
}
@keyframes loginAppear {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 24px; color: white; font-weight: 700;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.3);
  border: 2px solid rgba(139, 92, 246, 0.4);
}
.login-card h2 {
  margin: 0 0 6px; font-size: var(--fs-xl); font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.4px;
}
.login-card .login-subtitle {
  color: var(--text-muted); font-size: var(--fs-body); margin-bottom: 28px;
}
.login-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px; width: 100%;
  background: white; color: #333;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: all 150ms ease;
  box-shadow: var(--shadow-sm);
}
.login-google-btn:hover { background: #f8f8f8; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.login-google-btn:active { transform: translateY(0) scale(0.98); }
.login-divider {
  margin: 20px 0; position: relative; text-align: center;
}
.login-divider hr { border: none; border-top: 1px solid var(--border); }
.login-divider span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg-secondary); padding: 0 14px;
  color: var(--text-muted); font-size: var(--fs-sm);
}
.login-form { display: grid; gap: 12px; text-align: left; }
.login-input {
  width: 100%; padding: 11px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-family: var(--font);
  box-sizing: border-box; outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.10); }
.login-input::placeholder { color: var(--text-muted); }
.login-submit {
  width: 100%; padding: 11px;
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all 150ms ease;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.login-submit:hover { background: #6d4fd4; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35); transform: translateY(-1px); }
.login-submit:active { transform: translateY(0) scale(0.98); }
.login-error {
  color: var(--error); font-size: var(--fs-sm);
  text-align: center; display: none; margin-top: 12px;
}

/* ═══ Layout: Rail + Sidebar + Content ═══ */
.app {
  display: flex;
  height: 100vh;
}

/* ═══ Icon Rail (far left) ═══ */
.rail {
  width: 56px;
  flex-shrink: 0;
  background: rgba(6, 6, 12, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 2px;
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
  flex-shrink: 0;
}
.rail-logo img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
}

.rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 0 6px;
}

.rail-separator {
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

.rail-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  position: relative;
}
.rail-btn:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
}
.rail-btn:active { transform: scale(0.93); }
.rail-btn.active {
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: inset 2px 0 0 var(--accent);
}
.rail-btn.active.axe-active {
  color: var(--axe-accent);
  background: var(--axe-glow);
}

.rail-btn .rail-tooltip {
  position: absolute;
  left: 52px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms;
  z-index: 100;
}
.rail-btn:hover .rail-tooltip {
  opacity: 1;
}

.rail-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
}

.rail-spacer { flex: 1; }

/* ═══ Sasha Sidebar Profile ═══ */
/* ── Sidebar Header: Brand + Agent ── */
.cos-sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, transparent 100%);
}
.cos-brand {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cos-agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sasha-sidebar-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid rgba(139, 92, 246, 0.25);
}
.sasha-sidebar-avatar img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
}
.cos-agent-info { flex: 1; }
.cos-agent-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.cos-agent-status {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
.cos-agent-status .online-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }

/* ═══ Sidebar (contextual) ═══ */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(9, 9, 18, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 200ms ease;
}
.sidebar.collapsed { width: 0; overflow: hidden; opacity: 0; padding: 0; }

.sidebar-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }

.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 12px 18px 6px;
}

/* Sidebar items */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 1px 8px;
  cursor: pointer;
  transition: all 150ms ease;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
}
.sidebar-item:hover { background: rgba(255, 255, 255, 0.05); }
.sidebar-item.active { background: rgba(139, 92, 246, 0.10); color: #c4b5fd; border-left: 2px solid var(--accent); padding-left: 14px; }
.sidebar-item .item-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.sidebar-item .item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item .item-badge {
  font-size: 10px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.sidebar-item .item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Conversation items */
.conv-item {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  margin: 1px 6px;
  cursor: pointer;
  transition: all 150ms ease;
  gap: 6px;
  border-radius: var(--radius-sm);
}
.conv-item:hover { background: rgba(255, 255, 255, 0.04); }
.conv-item.active { background: rgba(139, 92, 246, 0.10); }
.conv-item .conv-title {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-item.active .conv-title { color: #e0d4fc; font-weight: 500; }
.conv-item.private-conv .conv-title { color: #f9a8d4; }
.conv-item.private-conv.active { background: rgba(244, 114, 182, 0.12); }
.conv-item.private-conv.active .conv-title { color: #fbcfe8; }
.conv-item .conv-preview {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  margin-top: 1px;
}

/* New conversation button */
.new-conv-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: rgba(139, 92, 246, 0.07);
  border: 1px solid rgba(139, 92, 246, 0.16);
  border-radius: var(--radius-sm);
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.new-conv-btn:hover { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.25); }
.new-conv-btn:active { transform: scale(0.98); }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #c4b5fd;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-footer .user-name {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar views (toggle via JS) */
.sidebar-view { display: none; flex-direction: column; height: 100%; }
.sidebar-view.active { display: flex; }

.nav-btn { display: none; }
.nav-icon-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 5px; display: flex; align-items: center; justify-content: center;
  transition: color var(--transition);
  border-radius: 6px;
}
.nav-icon-btn:hover { color: var(--accent); }
.nav-icon-btn svg { display: block; }

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

/* ═══ Panels ═══ */
.panel { display: none; flex-direction: column; height: 100vh; overflow: hidden; width: 100%; }
.panel.active { display: flex; }

/* ═══ Panel Header ═══ */
.panel-header {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(9, 9, 15, 0.8);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.2px;
}
.panel-header .badge {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(139, 92, 246, 0.10);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--mono);
}
.panel-header .spacer { flex: 1; }
.header-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all 150ms ease;
}
.header-btn:hover { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.08); box-shadow: var(--shadow-sm); }
.header-btn:active { transform: scale(0.97); }
.cost-period-btn.active { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.4); color: #a78bfa; }

/* Knowledge panel sub-tabs */
.knowledge-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.knowledge-tab {
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: 0.3px;
}
.knowledge-tab:hover { color: var(--text-secondary); }
.knowledge-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Graph Visualization ── */
#graphVisualContainer {
  background: var(--bg-primary);
  position: relative;
}
#graphVisualContainer svg {
  width: 100%;
  height: 100%;
  display: block;
}
.graph-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(17, 17, 25, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  z-index: 10;
  min-width: 200px;
  max-width: 260px;
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.graph-controls h4 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
}
.graph-controls-search {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.graph-controls-search:focus {
  border-color: var(--accent);
}
.graph-controls-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.graph-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: var(--font);
}
.graph-filter-chip.active {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.1);
}
.graph-filter-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.graph-strength-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  margin: 6px 0;
}
.graph-strength-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.3);
}
.graph-stats-bar {
  display: flex;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.graph-stats-bar span {
  font-size: 10px;
  color: var(--text-muted);
}
.graph-stats-bar strong {
  color: var(--accent);
  font-weight: 600;
}
.graph-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 17, 25, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-primary);
  z-index: 20;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.15s;
  font-family: var(--font);
  line-height: 1.5;
}
.graph-tooltip.visible { opacity: 1; }
.graph-tooltip .tt-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.graph-tooltip .tt-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.graph-tooltip .tt-desc {
  color: var(--text-secondary);
  font-size: 11px;
  margin-bottom: 4px;
}
.graph-tooltip .tt-meta {
  font-size: 10px;
  color: var(--text-muted);
}
.graph-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
  padding: 40px;
}
.graph-empty svg { opacity: 0.3; }
.graph-empty p { font-size: 13px; }
.graph-empty .sub { font-size: 11px; margin-top: -8px; }
/* Mobile: collapse controls */
@media (max-width: 768px) {
  .graph-controls {
    top: 8px;
    right: 8px;
    left: 8px;
    min-width: unset;
    max-width: unset;
    padding: 10px;
    font-size: 11px;
  }
  .graph-controls.collapsed .graph-controls-body { display: none; }
  .graph-controls-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    font-family: var(--font);
    margin-bottom: 6px;
  }
}
@media (min-width: 769px) {
  .graph-controls-toggle { display: none; }
}

/* Insight cards */
.insight-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}
.insight-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
}
.insight-card .insight-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}
.insight-card .insight-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.insight-card .insight-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 8px;
  max-height: 60px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}
.insight-category {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.insight-category.insight { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.insight-category.procedure { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.insight-category.commitment { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.insight-category.project { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* Build spec cards */
.spec-card {
  background: var(--bg-tertiary);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}
.spec-card:hover {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.04);
}
.spec-card .spec-title {
  font-size: 14px;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 6px;
}
.spec-card .spec-source {
  font-size: 11px;
  color: var(--text-muted);
}
.spec-card .spec-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 8px;
  white-space: pre-line;
  max-height: 80px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}

/* Council sidebar avatars */
.council-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
}
.council-sidebar-item:hover { background: rgba(255, 255, 255, 0.03); }
.council-sidebar-item .cs-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.council-sidebar-item .cs-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.council-sidebar-item .cs-name { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.council-sidebar-item .cs-domain { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.02); }

/* Axe Charts */
.axe-chart-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0 16px;
  background: rgba(9, 9, 15, 0.4);
}
.axe-chart-tab {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.axe-chart-tab:hover { color: var(--text-secondary); }
.axe-chart-tab.active { color: var(--axe-accent); border-bottom-color: var(--axe-accent); }

.axe-chart-container {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(9, 9, 15, 0.3);
  min-height: 160px;
  position: relative;
}
.axe-chart-view { display: none; }
.axe-chart-view.active { display: block; }
.axe-chart-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.axe-chart-svg { width: 100%; height: 130px; }
.axe-chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}
.axe-chart-legend span { display: flex; align-items: center; gap: 4px; }
.axe-chart-legend .dot { width: 6px; height: 6px; border-radius: 50%; }

/* Axe layout classes */
.axe-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.axe-sidebar {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(9, 9, 15, 0.6);
}
.axe-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.axe-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 8px;
}
.axe-mode-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.axe-mode-badge.paper { background: rgba(76, 175, 80, 0.15); color: #4ade80; }
.axe-mode-badge.live { background: rgba(248, 113, 113, 0.15); color: #f87171; font-weight: 700; }
.axe-market-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--text-muted);
}
.axe-portfolio {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}
.axe-equity {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.axe-equity-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
}
.axe-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.axe-stat-row .label { font-size: 10px; color: var(--text-muted); }
.axe-stat-row .value { font-size: 13px; font-weight: 600; }
.axe-positions { margin-top: 12px; }
.axe-positions .pos-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.axe-pos-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.axe-pos-item .sym { font-weight: 600; color: var(--text-primary); }
.axe-pos-item .pnl { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.axe-pos-item {
  cursor: pointer;
  border-radius: 6px;
  padding: 6px 8px 6px 10px;
  margin: 2px -8px;
  transition: background 150ms;
  border-left: 3px solid transparent;
}
.axe-pos-item.pos-up { border-left-color: #4ade80; }
.axe-pos-item.pos-down { border-left-color: #f87171; }
.axe-pos-item:hover { background: rgba(255,255,255,0.05); }
.axe-pos-item .pos-left { display: flex; flex-direction: column; gap: 1px; }
.axe-pos-item .pos-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.axe-pos-item .pos-meta { font-size: 10px; color: var(--text-muted); display: flex; gap: 6px; }
.axe-pos-item .pos-pnl-dollar { font-size: 10px; font-family: var(--mono); }

/* ═══ Allocation bar ═══ */
.axe-alloc-bar {
  width: 100%; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06);
  margin: 8px 0 12px; overflow: hidden;
}
.axe-alloc-bar .fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 300ms ease; }

/* ═══ Position Detail Panel ═══ */
.pos-detail-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 200ms ease;
}
.pos-detail-overlay.open { display: block; opacity: 1; }
.pos-detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2001;
  width: 380px; background: var(--bg-primary);
  border-left: 1px solid var(--glass-border);
  transform: translateX(100%); transition: transform 300ms var(--ease-out-expo);
  display: flex; flex-direction: column; overflow-y: auto;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.3);
}
.pos-detail-panel.open { transform: translateX(0); }
.pos-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pos-detail-back {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font-size: 13px; display: flex; align-items: center; gap: 4px; font-family: inherit;
  padding: 4px 8px; border-radius: 6px; transition: var(--transition);
}
.pos-detail-back:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.pos-detail-symbol { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.pos-detail-hero { padding: 20px; text-align: center; }
.pos-detail-hero .price { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.pos-detail-hero .change { font-size: 14px; font-weight: 500; margin-top: 4px; }
.pos-detail-sparkline { padding: 0 20px 16px; }
.pos-detail-sparkline svg { width: 100%; height: 80px; }
.pos-detail-stats { padding: 0 20px 20px; }
.pos-detail-stat {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 13px;
}
.pos-detail-stat .label { color: var(--text-muted); }
.pos-detail-stat .value { color: var(--text-primary); font-family: var(--mono); font-weight: 500; }
.pos-detail-actions {
  padding: 16px 20px; display: flex; gap: 10px; margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.pos-detail-actions button {
  flex: 1; padding: 10px 12px; border-radius: 8px; border: 1px solid;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.pos-detail-actions .btn-close-pos {
  background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #f87171;
}
.pos-detail-actions .btn-close-pos:hover { background: rgba(248,113,113,0.2); }
.pos-detail-actions .btn-analyze {
  background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: #10b981;
}
.pos-detail-actions .btn-analyze:hover { background: rgba(16,185,129,0.2); }

.axe-sidebar.live-mode { border-right-color: rgba(248, 113, 113, 0.15); }
.axe-sidebar.live-mode .axe-equity-value { color: var(--error); }
.axe-mode-toggle {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  font-family: inherit;
  transition: var(--transition);
  margin-left: auto;
}
.axe-mode-toggle:hover { border-color: rgba(255,255,255,0.15); color: var(--text-secondary); }

/* Axe chat messages */
.axe-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.axe-msg { padding: 4px 0; }
.axe-msg-user { display: flex; justify-content: flex-end; }
.axe-msg-user .axe-bubble {
  background: rgba(16, 185, 129, 0.12);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  max-width: 92%;
  font-size: 13px;
  text-align: right;
}
.axe-msg-axe { display: flex; gap: 10px; align-items: flex-start; }
.axe-msg-axe .axe-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #059669, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.axe-msg-axe .axe-bubble {
  max-width: 92%;
  font-size: 13px;
  line-height: 1.6;
}
.axe-input-area {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 8px;
  align-items: end;
}
.axe-input-area textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  transition: var(--transition);
}
.axe-input-area textarea:focus { border-color: rgba(16, 185, 129, 0.3); }
.axe-input-area textarea::placeholder { color: var(--text-muted); }
.axe-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Quick actions */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.quick-btn {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.quick-btn:hover { background: rgba(16, 185, 129, 0.15); }

/* ═══ Chat Panel ═══ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.message {
  max-width: 85%;
  animation: fadeSlideIn 200ms ease-out;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  margin-top: 12px;
  width: fit-content;
  max-width: 100%;
}
.message.user .bubble {
  background: rgba(139, 92, 246, 0.10);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.16);
  border-radius: 14px 14px 4px 14px;
  padding: 11px 18px;
  color: #e4dafc;
  width: fit-content;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant { align-self: flex-start; }
.message.assistant .bubble {
  padding: 10px 4px;
  color: #d8d8e8;
  line-height: 1.7;
}
.message.assistant .bubble p { margin-bottom: 8px; }
.message.assistant .bubble p:last-child { margin-bottom: 0; }
.message.assistant .bubble code {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-tertiary); padding: 2px 6px;
  border-radius: 5px; color: #c4b5fd;
}
.message.assistant .bubble pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px; margin: 8px 0;
  overflow-x: auto; font-size: 13px;
  font-family: var(--mono);
  line-height: 1.5;
}

.message.tool-call {
  align-self: flex-start;
  max-width: 70%;
  display: none; /* Hide old-style tool bubbles — reasoning panel handles it */
}
.tool-call-bubble {
  background: var(--tool-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px var(--radius-sm) var(--radius-sm) 2px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
}
.tool-call-bubble .tool-name { color: var(--accent); font-weight: 500; }
.tool-call-bubble .tool-args { color: var(--text-muted); margin-top: 2px; word-break: break-all; }

.message.tool-result { align-self: flex-start; max-width: 70%; display: none; }
.tool-result-bubble {
  background: var(--tool-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 2px var(--radius-sm) var(--radius-sm) 2px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 120px;
  overflow-y: auto;
}
.tool-result-bubble.error { border-left-color: var(--error); }

/* ═══ Council of Advisors Messages ═══ */
.council-system-msg {
  align-self: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 16px;
  margin: 4px 0;
  font-style: italic;
}
.council-system-msg .advisor-icons { font-style: normal; }

.message.council-message {
  align-self: flex-start;
  max-width: 85%;
  margin-top: 6px;
}
.council-bubble {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 4px var(--radius) var(--radius) 4px;
  padding: 14px 16px 12px;
  position: relative;
}
.council-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.council-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.council-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}
.council-advisor-name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.2px;
}
.council-advisor-tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.council-bubble-body {
  color: #c8c8d8;
  line-height: 1.7;
  font-size: 14px;
}
.council-bubble-body p { margin-bottom: 6px; }
.council-bubble-body p:last-child { margin-bottom: 0; }
.council-bubble-body code {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-tertiary); padding: 2px 6px;
  border-radius: 5px; color: #c4b5fd;
}
.council-bubble-body strong { color: #e0e0ee; }

/* ═══ Chat Identity — Speaker Avatars & Names ═══ */
.message-row {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeSlideIn 200ms ease-out;
}
.message-row.user-row {
  flex-direction: row-reverse;
  align-self: flex-end;
  margin-top: 12px;
  width: fit-content;
  max-width: min(85%, calc(100% - 24px));
  margin-left: auto;
}
.message-row.user-row .message-content {
  flex: 0 0 auto;
  width: fit-content;
}
.message-row.assistant-row {
  align-self: flex-start;
  margin-top: 10px;
}
.message-row.council-row {
  align-self: flex-start;
  margin-top: 6px;
}
/* Council Group Chat UI */
.council-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: overlayFadeIn 200ms ease-out;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
.council-modal {
  background: #111118; border: 1px solid rgba(139,92,246,0.2); border-radius: 16px;
  padding: 24px; max-width: 520px; width: 92%; max-height: 80vh; overflow-y: auto;
  animation: modalSlideUp 300ms var(--ease-out-expo);
  box-shadow: var(--shadow-xl);
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.council-modal h3 { margin: 0 0 16px; color: #e4e4ed; font-size: 18px; }
.council-modal input[type="text"] {
  width: 100%; padding: 10px 14px; background: #0a0a10; border: 1px solid rgba(139,92,246,0.15);
  border-radius: 10px; color: #e4e4ed; font-size: 14px; font-family: inherit;
  margin-bottom: 16px; box-sizing: border-box;
}
.council-modal input[type="text"]::placeholder { color: #55556a; }
.council-advisor-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
  margin-bottom: 16px; max-height: 300px; overflow-y: auto;
}
.council-advisor-pick {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(139,92,246,0.1); cursor: pointer; transition: all 0.15s;
  background: transparent;
}
.council-advisor-pick:hover { background: rgba(139,92,246,0.06); }
.council-advisor-pick.selected {
  background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.4);
}
.council-advisor-pick.selected::after {
  content: '✓'; color: #a78bfa; font-weight: bold; margin-left: auto;
}
.council-session-header {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: rgba(139,92,246,0.06); border-bottom: 1px solid rgba(139,92,246,0.1);
  font-size: 13px; color: #a0a0b4;
}
.council-session-header .topic { color: #c4b5fd; font-weight: 500; flex: 1; }
.council-session-header .advisor-icons { font-size: 16px; display: flex; gap: 4px; }
.council-session-header button {
  padding: 4px 12px; background: rgba(220,38,38,0.15); border: 1px solid rgba(220,38,38,0.3);
  border-radius: 8px; color: #fca5a5; font-size: 12px; cursor: pointer; font-family: inherit;
}
.council-session-header button:hover { background: rgba(220,38,38,0.25); }
.council-mention-bar {
  display: flex; gap: 4px; padding: 4px 12px; align-items: center; flex-wrap: wrap;
}
.council-mention-bar .mention-btn {
  padding: 2px 8px; background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.12);
  border-radius: 6px; cursor: pointer; font-size: 12px; color: #a0a0b4; font-family: inherit;
  transition: all 0.15s;
}
.council-mention-bar .mention-btn:hover {
  background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.3); color: #c4b5fd;
}
.council-round-divider {
  text-align: center; color: #55556a; font-size: 11px; padding: 8px 0; position: relative;
}
.council-round-divider::before, .council-round-divider::after {
  content: ''; position: absolute; top: 50%; width: 30%; height: 1px;
  background: rgba(139,92,246,0.1);
}
.council-round-divider::before { left: 10%; }
.council-round-divider::after { right: 10%; }
.conv-council-badge {
  display: inline-block; font-size: 10px; margin-left: 4px; opacity: 0.7;
}
.council-session-ended {
  text-align: center; padding: 12px; color: #55556a; font-size: 12px;
  border-top: 1px solid rgba(139,92,246,0.08);
}
.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid transparent;
  margin-top: 2px;
}
.chat-avatar.sasha {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  font-size: 16px;
  overflow: hidden;
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.1);
}
.chat-avatar.sasha img {
  width: 100%; height: 100%; border-radius: 12px; object-fit: cover; object-position: center 20%;
}
.chat-avatar.user-avatar {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.25);
  color: #a78bfa;
  font-size: 12px;
  font-weight: 600;
}
.chat-avatar.advisor {
  font-size: 20px;
}
.chat-avatar.avatar-collapsed {
  visibility: hidden;
}
.message-content {
  flex: 1;
  min-width: 0;
}
.speaker-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  padding-left: 2px;
}
.speaker-name.collapsed {
  display: none;
}

.message .meta {
  font-size: 11px; color: #3a3a4e;
  margin-top: 6px; padding: 0 2px;
}
.tier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  margin-right: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}
.tier-autonomic { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.tier-active    { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.tier-deep      { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.tier-fallback  { background: rgba(251, 146, 60, 0.2); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.4); animation: fallback-pulse 2s ease-in-out infinite; }
@keyframes fallback-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Pet Mode active — subtle pink theme override with smooth transitions */
body.pet-mode-active .chat-panel {
  border: 1px solid rgba(244, 114, 182, 0.3);
  box-shadow: 0 0 20px rgba(244, 114, 182, 0.08);
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
}
body.pet-mode-active .status-dot.connected { background: #f472b6 !important; transition: background 0.4s ease; }
body.pet-mode-active #statusText { color: #f9a8d4 !important; transition: color 0.4s ease; }
body.pet-mode-active .input-row { border-color: rgba(244, 114, 182, 0.25); transition: border-color 0.4s ease; }
body.pet-mode-active .speaker-name { color: #f9a8d4 !important; }
body.pet-mode-active .sidebar { border-right-color: rgba(244, 114, 182, 0.2); }

/* Pet Mode transition overlay */
.pet-mode-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(244, 114, 182, 0.06);
  pointer-events: none; z-index: 9998;
  opacity: 0; transition: opacity 0.8s ease;
}
.pet-mode-overlay.visible { opacity: 1; }
.pet-mode-overlay.fade-out { opacity: 0; transition: opacity 1.2s ease; }

/* Hide private conversations in sidebar when not in pet mode */
.conv-item[data-private="true"] { display: none; }
body.pet-mode-active .conv-item[data-private="true"] { display: flex; }

/* Pet Mode auth modal — frosted glass overlay */
.pet-mode-auth-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.pet-mode-auth-modal.visible { opacity: 1; pointer-events: all; }
.pm-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pm-modal-card {
  position: relative; z-index: 1;
  background: var(--bg-elevated, #1a1a26);
  border: 1px solid rgba(244, 114, 182, 0.25);
  border-radius: 16px;
  padding: 28px 32px;
  min-width: 300px; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(244, 114, 182, 0.08);
}
.pm-modal-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary, #f0f0f5);
  margin-bottom: 16px; text-align: center;
}
.pm-input {
  width: 100%; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(244, 114, 182, 0.2);
  border-radius: 10px; color: var(--text-primary, #f0f0f5);
  font-size: 14px; outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}
.pm-input:focus { border-color: rgba(244, 114, 182, 0.5); }
.pm-error {
  color: #ef4444; font-size: 12px;
  margin-top: 8px; text-align: center;
}
.pm-actions {
  display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end;
}
.pm-btn {
  padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.2s ease;
}
.pm-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #a8a8bc);
}
.pm-cancel:hover { background: rgba(255, 255, 255, 0.1); }
.pm-submit {
  background: rgba(244, 114, 182, 0.2);
  color: #f9a8d4;
}
.pm-submit:hover { background: rgba(244, 114, 182, 0.35); }

/* Agent panel */
.agent-run-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(139,92,246,0.08);
  border-left: 3px solid #8b5cf6;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}
.agent-run-card.status-done { border-left-color: #4ade80; }
.agent-run-card.status-failed { border-left-color: #ef4444; }
.agent-run-card.status-running { border-left-color: #fbbf24; }
.agent-run-card .agent-goal { color: var(--text); margin: 4px 0; }
.agent-run-card .agent-meta { color: var(--text-muted); font-size: 11px; display: flex; gap: 10px; flex-wrap: wrap; }
.agent-live-feed {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-live-feed::-webkit-scrollbar { width: 5px; }
.agent-live-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.agent-live-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 6px;
  background: rgba(255,255,255,0.015);
  animation: fadeSlideIn 200ms ease-out;
}
.agent-live-item .pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #8b5cf6;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.agent-children {
  margin-left: 16px;
  padding-left: 10px;
  border-left: 2px solid rgba(139,92,246,0.1);
}

/* Council panel — tile grid */
.council-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.advisor-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(139,92,246,0.08);
  border-radius: 12px;
  padding: 18px 14px 14px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.advisor-card:hover { background: rgba(139,92,246,0.06); border-color: rgba(139,92,246,0.2); }
.advisor-card.disabled { opacity: 0.4; cursor: default; }
.advisor-card .advisor-avatar-wrap { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.advisor-card .advisor-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.advisor-card .advisor-icon { font-size: 28px; flex-shrink: 0; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: rgba(139,92,246,0.1); border-radius: 12px; }
.advisor-card .advisor-info { min-width: 0; width: 100%; }
.advisor-card .advisor-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.advisor-card .advisor-domain { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.advisor-card .advisor-ask {
  font-size: 11px; color: var(--accent); opacity: 0;
  transition: opacity 150ms; font-weight: 500; margin-top: 6px;
}
.advisor-card:hover .advisor-ask { opacity: 1; }

/* Thinking indicator */
.thinking {
  align-self: flex-start;
  padding: 10px 2px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  animation: fadeSlideIn 200ms ease-out;
}
.thinking-dots span {
  display: inline-block; width: 7px; height: 7px;
  background: rgba(139, 92, 246, 0.35); border-radius: 50%;
  animation: pulse 1.2s infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Tool step lines — simple inline text, no fancy panels */
.tool-step-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  font-size: 12px;
  color: #9090a8;
  animation: fadeSlideIn 150ms ease-out;
}
.tool-step-line .ts-icon { color: #6b6b80; font-size: 11px; flex-shrink: 0; display: flex; align-items: center; opacity: 0.6; }
.tool-step-line .ts-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tool-step-line .ts-name { color: #7a7a92; font-weight: 400; white-space: nowrap; letter-spacing: 0.01em; opacity: 0.7; }
.tool-step-line .ts-args { color: #7a7a92; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tool-step-line .ts-status { color: #fbbf24; font-family: var(--mono); font-size: 11px; flex-shrink: 0; margin-left: auto; }
.tool-step-line .ts-done { color: #4ade80 !important; }
.tool-step-line .ts-error { color: #f87171 !important; }
.tool-step-line .ts-detail { font-size: 11px; color: #7a7a92; padding: 4px 0 2px 20px; word-break: break-word; white-space: pre-wrap; max-height: 80px; overflow: hidden; }
.tool-step-line .ts-error-detail { display: block; font-size: 11px; color: #f87171; padding: 2px 0 2px 20px; word-break: break-word; white-space: pre-wrap; max-height: 60px; overflow: hidden; border-left: 2px solid #f87171; margin: 2px 0 2px 10px; }

/* ═══ Input Area ═══ */
.chat-input-area {
  padding: 16px 24px 24px;
  background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
  backdrop-filter: blur(16px);
  border-top: none;
  flex-shrink: 0;
}
.input-wrapper {
  display: flex;
  align-items: flex-end;
  background: var(--bg-tertiary);
  border: 1px solid rgba(139, 92, 246, 0.14);
  border-radius: var(--radius);
  overflow: visible;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
  position: relative;
}
.input-wrapper:hover { border-color: rgba(139, 92, 246, 0.2); background: rgba(17, 17, 25, 0.9); }
.input-wrapper:focus-within { border-color: rgba(139, 92, 246, 0.4); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.10); background: rgba(17, 17, 25, 0.95); }

/* ── Recording overlay ── */
.recording-overlay {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  width: 100%;
  height: 100%;
  min-height: 44px;
}
.recording-overlay.active { display: flex; }
.recording-dot {
  width: 10px; height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 1s infinite;
  flex-shrink: 0;
}
.recording-timer {
  font-family: var(--mono);
  font-size: 13px;
  color: #ef4444;
  min-width: 40px;
}
.recording-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 24px;
  overflow: hidden;
}
.recording-bars .bar {
  width: 3px;
  background: #8b5cf6;
  border-radius: 2px;
  transition: height 0.1s;
}
.recording-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.recording-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.recording-actions button:hover { background: var(--bg-secondary); }
.recording-actions .rec-cancel { color: var(--text-muted); }
.recording-actions .rec-text { color: #a78bfa; border-color: #a78bfa40; }
.recording-actions .rec-text:hover { background: #a78bfa20; }
.recording-actions .rec-audio { color: #4ade80; border-color: #4ade8040; }
.recording-actions .rec-audio:hover { background: #4ade8020; }
.transcribing-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
}
.transcribing-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  line-height: 1.5;
}
#chatInput::placeholder { color: var(--text-muted); }

#sendBtn {
  width: 36px; height: 36px;
  margin: 4px 6px;
  border-radius: var(--radius-sm);
  background: #7c3aed;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#sendBtn:hover { background: #6d4fd4; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35); }
#sendBtn:active { transform: scale(0.94); }
#sendBtn:disabled { background: rgba(139, 92, 246, 0.1); color: var(--text-muted); cursor: default; }
#sendBtn.stop-mode { background: rgba(239, 68, 68, 0.25); color: #ef4444; font-size: 12px; }
#sendBtn.stop-mode:hover { background: rgba(239, 68, 68, 0.4); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

/* ── Emoji picker ── */
#emojiBtn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 8px 2px;
  transition: var(--transition);
  flex-shrink: 0;
  opacity: 0.6;
}
#emojiBtn:hover { opacity: 1; transform: scale(1.15); }
.emoji-picker {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 8px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 12px;
  z-index: 1000;
  width: 320px;
  max-height: 360px;
  overflow: hidden;
  display: none;
}
.emoji-picker.visible { display: block; }
.emoji-picker-search {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
}
.emoji-picker-search:focus { border-color: rgba(139, 92, 246, 0.4); }
.emoji-picker-search::placeholder { color: var(--text-muted); }
.emoji-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab {
  background: transparent;
  border: none;
  font-size: 16px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  opacity: 0.5;
  flex-shrink: 0;
}
.emoji-tab:hover, .emoji-tab.active { opacity: 1; background: var(--bg-tertiary); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.emoji-grid button {
  background: transparent;
  border: none;
  font-size: 22px;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  line-height: 1;
}
.emoji-grid button:hover { background: var(--bg-tertiary); transform: scale(1.2); }

.input-status {
  display: flex; gap: 16px;
  padding: 8px 4px 0;
  font-size: 11px; color: var(--text-muted);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--error); }

/* ═══ Voice Conversation Mode ═══ */
.voice-mode-btn {
  background: none; border: 1px solid rgba(139,92,246,0.15); color: #6b6b80;
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 12px;
  font-weight: 500; font-family: inherit; transition: all 0.2s; display: flex;
  align-items: center; gap: 5px;
}
.voice-mode-btn:hover { border-color: rgba(139,92,246,0.3); color: #a0a0b4; }
.voice-mode-btn.active {
  background: rgba(139,92,246,0.15); border-color: #8b5cf6; color: #c4b5fd;
}
.voice-mode-btn.active .vm-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
  animation: voicePulse 1.5s ease-in-out infinite;
}
@keyframes voicePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.voice-mode-btn.voice-recording { border-color: #f87171; background: rgba(248,113,113,0.1); }
.voice-mode-btn.voice-recording .vm-dot { animation: voiceRecordPulse 0.6s ease-in-out infinite; }
@keyframes voiceRecordPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.4); } }
.voice-mode-btn.voice-interrupt .vm-dot { animation: voiceInterruptPulse 2s ease-in-out infinite; background: #60a5fa; }
@keyframes voiceInterruptPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.speaking-indicator {
  display: none; align-items: center; gap: 6px; font-size: 11px; color: #c4b5fd; cursor: pointer; user-select: none;
}
.speaking-indicator.active { display: flex; }
.speaking-indicator.active:hover { color: #f87171; }
.speaking-indicator .stop-hint { display: none; font-size: 10px; color: #f87171; margin-left: 4px; }
.speaking-indicator.active:hover .stop-hint { display: inline; }
.speaking-indicator.active:hover .speaking-dot { background: #f87171; animation: none; }
@media (max-width: 768px) {
  .speaking-indicator.active .stop-hint { display: inline; }
}
.speaking-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #a78bfa;
  animation: speakingPulse 0.8s ease-in-out infinite;
}
@keyframes speakingPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: 0.6; } }

.ptt-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 9999; flex-direction: column; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); gap: 16px;
}
.ptt-overlay.active { display: flex; }
.ptt-overlay .ptt-mic {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; align-items: center; justify-content: center; font-size: 36px;
  box-shadow: 0 0 40px rgba(139,92,246,0.4);
  animation: pttPulse 1s ease-in-out infinite;
}
@keyframes pttPulse { 0%, 100% { box-shadow: 0 0 20px rgba(139,92,246,0.3); } 50% { box-shadow: 0 0 50px rgba(139,92,246,0.6); } }
.ptt-overlay .ptt-text { color: #c4b5fd; font-size: 16px; font-weight: 500; }
.ptt-overlay .ptt-sub { color: #6b6b80; font-size: 12px; }

.council-bubble.speaking {
  border-color: rgba(167,139,250,0.6) !important;
  box-shadow: 0 0 12px rgba(139,92,246,0.3);
  transition: box-shadow 0.3s, border-color 0.3s;
}
.chat-avatar.sasha.speaking {
  animation: avatarPulse 1s ease-in-out infinite;
}
@keyframes avatarPulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 12px rgba(139,92,246,0.5); } }

/* Voice mode active: avatar glow */
body.voice-mode-active #sashaEmptyAvatar {
  border-color: #4ade80 !important;
  box-shadow: 0 0 30px rgba(74,222,128,0.4), 0 0 60px rgba(74,222,128,0.2), 0 0 90px rgba(74,222,128,0.1) !important;
  animation: voiceAvatarGlow 2s ease-in-out infinite;
}
body.voice-mode-active .sasha-sidebar-avatar {
  box-shadow: 0 0 12px rgba(74,222,128,0.5);
  border: 2px solid rgba(74,222,128,0.6);
  border-radius: 14px;
  animation: voiceAvatarGlow 2s ease-in-out infinite;
}
@keyframes voiceAvatarGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(74,222,128,0.3), 0 0 40px rgba(74,222,128,0.1); }
  50% { box-shadow: 0 0 40px rgba(74,222,128,0.5), 0 0 80px rgba(74,222,128,0.2); }
}
body.voice-mode-active #voiceHint { color: #4ade80 !important; }

/* ═══ Floating Voice Controls (mobile) ═══ */
.voice-floating-bar {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 20, 40, 0.97);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 40px;
  padding: 6px 14px 6px 6px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 222, 128, 0.15);
  z-index: 10000;
  animation: voiceBarSlideUp 0.3s ease-out;
}
@keyframes voiceBarSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.voice-float-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(74, 222, 128, 0.5);
  object-fit: cover;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.voice-float-avatar:hover {
  border-color: rgba(74, 222, 128, 0.9);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}
.voice-float-avatar.speaking {
  border-color: #4ade80;
  animation: voiceAvatarPulse 1.5s ease-in-out infinite;
}
@keyframes voiceAvatarPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(74, 222, 128, 0.3); }
  50% { box-shadow: 0 0 14px rgba(74, 222, 128, 0.6); }
}
.voice-float-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.voice-float-btn:hover { background: rgba(255, 255, 255, 0.12); }
.voice-float-btn.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}
.voice-float-stop {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  font-size: 16px;
  font-weight: 600;
}
.voice-float-stop:hover {
  background: rgba(239, 68, 68, 0.3);
}
.voice-float-status {
  font-size: 13px;
  color: #4ade80;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
}

/* Floating mic button — always accessible to start voice mode */
.voice-fab {
  position: fixed;
  bottom: 150px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(20, 20, 40, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 16px rgba(139, 92, 246, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: all 0.3s ease;
}
.voice-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 24px rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.7);
}
.voice-fab:active {
  transform: scale(0.95);
}
.voice-fab-icon {
  font-size: 22px;
}

/* ═══ Full-Screen Voice Overlay ═══ */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;1,300&display=swap');

.vo-overlay {
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  animation: voFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes voFadeIn {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
.vo-overlay[data-closing="true"] {
  animation: voFadeOut 0.3s ease-in forwards;
}
@keyframes voFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(40px); }
}

/* Background — deep dark with subtle grain */
.vo-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(74, 222, 128, 0.03) 0%, transparent 50%),
    #050508;
  z-index: -1;
}
.vo-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

/* Top bar */
.vo-topbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  z-index: 2;
}
.vo-close {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.vo-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

/* Center — avatar + glow */
.vo-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 2;
  margin-top: -40px;
}

.vo-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  filter: blur(40px);
  transition: all 0.8s ease;
  pointer-events: none;
}
.vo-glow[data-state="listening"] {
  background: radial-gradient(circle, rgba(74, 222, 128, 0.12) 0%, transparent 70%);
  width: 260px;
  height: 260px;
  animation: voGlowBreath 3s ease-in-out infinite;
}
.vo-glow[data-state="recording"] {
  background: radial-gradient(circle, rgba(248, 113, 113, 0.18) 0%, transparent 70%);
  width: 300px;
  height: 300px;
  animation: voGlowPulse 1s ease-in-out infinite;
}
.vo-glow[data-state="speaking"] {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(74, 222, 128, 0.06) 50%, transparent 70%);
  width: 340px;
  height: 340px;
  animation: voGlowSpeak 2s ease-in-out infinite;
}
.vo-glow[data-state="thinking"] {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  width: 240px;
  height: 240px;
  animation: voGlowThink 2s ease-in-out infinite;
}
@keyframes voGlowBreath {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes voGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}
@keyframes voGlowSpeak {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  30% { transform: scale(1.12); opacity: 1; }
  60% { transform: scale(1.05); opacity: 0.9; }
}
@keyframes voGlowThink {
  0%, 100% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.vo-avatar-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(74, 222, 128, 0.3));
  position: relative;
  z-index: 2;
  transition: all 0.5s ease;
}
.vo-avatar-ring[data-state="speaking"] {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(74, 222, 128, 0.5));
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
}
.vo-avatar-ring[data-state="recording"] {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.5), rgba(251, 191, 36, 0.4));
}

.vo-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
}

/* Simli Avatar video overlay — sits on top of the static avatar image */
.simli-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  z-index: 3;
  background: #111;
}

.vo-state {
  font-family: 'Crimson Pro', 'DM Sans', serif;
  font-size: 18px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.4s, opacity 0.4s;
}
.vo-state[data-state="listening"] { color: rgba(74, 222, 128, 0.7); }
.vo-state[data-state="recording"] { color: rgba(248, 113, 113, 0.8); }
.vo-state[data-state="speaking"] { color: rgba(139, 92, 246, 0.8); }
.vo-state[data-state="thinking"] { color: rgba(251, 191, 36, 0.7); }

/* Transcript */
.vo-transcript {
  width: 100%;
  max-width: 480px;
  max-height: 180px;
  overflow-y: auto;
  padding: 0 24px;
  margin-bottom: 12px;
  z-index: 2;
  mask-image: linear-gradient(transparent 0%, black 20%, black 100%);
  -webkit-mask-image: linear-gradient(transparent 0%, black 20%, black 100%);
  scrollbar-width: none;
}
.vo-transcript::-webkit-scrollbar { display: none; }

.vo-transcript-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 40px;
}

.vo-line {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  animation: voLineIn 0.3s ease-out;
  padding: 0 4px;
}
.vo-line.vo-user {
  color: rgba(255, 255, 255, 0.85);
  text-align: right;
}
.vo-line.vo-assistant {
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
}
@keyframes voLineIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom controls */
.vo-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 2;
}

.vo-ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s;
}
.vo-ctrl-btn:hover { color: rgba(255, 255, 255, 0.8); }
.vo-ctrl-btn.muted { color: #f87171; }

.vo-ctrl-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.7;
}

.vo-end-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}
.vo-end-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}
.vo-end-btn:active {
  transform: scale(0.95);
}

/* ═══ Voice Chat Panel ═══ */
.voice-panel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.06) 0%, var(--bg-primary) 70%);
  padding: 40px 24px;
  gap: 16px;
  position: relative;
}
.voice-panel-brand {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  position: absolute;
  top: 32px;
}
.voice-panel-agent-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.voice-panel-avatar {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.voice-panel-avatar:hover {
  transform: scale(1.03);
}
.voice-panel-avatar:active {
  transform: scale(0.97);
}
.voice-panel-avatar-inner {
  width: 180px;
  height: 180px;
  border-radius: 40px;
  overflow: hidden;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 60px rgba(139, 92, 246, 0.15), 0 0 120px rgba(139, 92, 246, 0.05);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.voice-panel-avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.voice-panel-avatar-fallback {
  font-size: 56px;
  color: white;
  font-weight: 700;
}
.voice-panel-ring {
  position: absolute;
  inset: -8px;
  border-radius: 46px;
  border: 2px solid transparent;
  transition: border-color 0.4s, box-shadow 0.4s;
  pointer-events: none;
}
/* Active listening state */
.voice-panel-avatar.listening .voice-panel-avatar-inner {
  border-color: rgba(74, 222, 128, 0.6);
  box-shadow: 0 0 60px rgba(74, 222, 128, 0.3), 0 0 120px rgba(74, 222, 128, 0.1);
}
.voice-panel-avatar.listening .voice-panel-ring {
  border-color: rgba(74, 222, 128, 0.3);
  animation: voicePanelPulse 2s ease-in-out infinite;
}
/* Speaking state */
.voice-panel-avatar.speaking .voice-panel-avatar-inner {
  border-color: rgba(168, 85, 247, 0.8);
  box-shadow: 0 0 60px rgba(168, 85, 247, 0.4), 0 0 120px rgba(168, 85, 247, 0.15);
}
.voice-panel-avatar.speaking .voice-panel-ring {
  border-color: rgba(168, 85, 247, 0.4);
  animation: voicePanelPulse 1.5s ease-in-out infinite;
}
@keyframes voicePanelPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.7; }
}
.voice-panel-status {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 8px;
  transition: color 0.3s;
  min-height: 24px;
}
.voice-panel-status.active {
  color: #4ade80;
}
.voice-panel-controls {
  margin-top: 12px;
}
.voice-panel-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.voice-panel-transcript {
  position: absolute;
  bottom: 40px;
  left: 24px;
  right: 24px;
  max-height: 120px;
  overflow-y: auto;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.8;
}

/* ═══ Dashboard Panels ═══ */
.panel-content {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  animation: panelFadeIn 200ms ease-out;
}
@keyframes panelFadeIn { from { opacity: 0; } to { opacity: 1; } }
.panel-content::-webkit-scrollbar { width: 6px; }
.panel-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Kanban Board ── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  height: calc(100% - 20px);
  padding-bottom: 12px;
}

.kanban-column {
  flex: 0 0 300px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.kanban-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.kanban-column-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

.kanban-column-count {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 150ms ease;
}

.kanban-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.05);
  transform: translateY(-1px);
}

.kanban-card-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
}

.kanban-card-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 10px;
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kanban-card-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.1);
  color: #c4b5fd;
  font-weight: 500;
}

.kanban-card-tag.desk {
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
}

.kanban-card-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-left: auto;
}

.kanban-card-files {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Project detail modal */
.project-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 150ms ease-out;
}

.project-detail-content {
  background: #0d0d14;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
}

.project-detail-content h2 {
  margin: 0 0 4px;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.95);
}

.project-detail-content .meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 20px;
}

.project-detail-section {
  margin-bottom: 20px;
}

.project-detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.project-detail-section pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
}

.project-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
}

.kanban-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.card:hover { border-color: var(--border-active); box-shadow: var(--shadow-sm); }
.card h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.stat-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 150ms ease;
}
.stat-item:hover { border-color: var(--border-active); }
.stat-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-item .value { font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }
.stat-item .value.accent { color: var(--accent); }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: rgba(139, 92, 246, 0.03);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}
.data-table tbody tr:nth-child(odd) { background: rgba(255, 255, 255, 0.015); }
.data-table tr:hover td { color: var(--text-primary); background: rgba(139, 92, 246, 0.05); }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.pill.green { background: #16a34a22; color: var(--success); }
.pill.blue { background: #3b82f622; color: var(--accent); }
.pill.yellow { background: #d9770622; color: var(--warning); }
.pill.red { background: #ef444422; color: var(--error); }
.pill.gray { background: #6b728022; color: var(--text-muted); }

/* Memory items */
.memory-item {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}
.memory-item .content { color: var(--text-secondary); line-height: 1.5; }
.memory-item .meta-row { display: flex; gap: 12px; margin-top: 4px; font-size: 11px; color: var(--text-muted); }

/* Search */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.search-bar input {
  flex: 1; background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.search-bar input:hover { border-color: rgba(139, 92, 246, 0.2); }
.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08); }
.search-bar button { composes: header-btn; }

/* Settings form */
.setting-group { margin-bottom: 20px; }
.setting-group label {
  display: block; font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.setting-group input, .setting-group select {
  width: 100%; background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 9px 12px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.setting-group input:hover, .setting-group select:hover { border-color: rgba(139, 92, 246, 0.2); }
.setting-group input:focus, .setting-group select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08); }
.setting-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; color: var(--text-muted); text-align: center;
  animation: fadeSlideIn 300ms ease-out;
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.45; }
.empty-state p { font-size: 14px; max-width: 320px; line-height: 1.6; }

/* ═══ Mobile Navigation ═══ */
.mobile-header-menu { display: none; }
.mobile-nav { display: none; }
.sidebar-backdrop { display: none; }
.sidebar-close-btn { display: none; }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  /* Hide desktop rail */
  .rail { display: none !important; }

  /* Mobile header hamburger */
  .mobile-header-menu {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text-secondary);
    padding: 0; margin-right: 4px; cursor: pointer; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 8px;
  }
  .mobile-header-menu:hover { background: rgba(255,255,255,0.04); }

  /* Sidebar: off-screen drawer */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 1000; height: 100vh; width: 280px;
    transform: translateX(-100%);
    transition: transform 300ms var(--ease-out-expo);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px; opacity: 1; transform: translateX(-100%); }
  .sidebar.collapsed.mobile-open { transform: translateX(0); }

  /* Close button inside sidebar */
  .sidebar-close-btn {
    display: flex; position: absolute; top: 12px; right: 12px; z-index: 10;
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    width: 28px; height: 28px; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 18px;
  }
  .sidebar-close-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

  /* Backdrop overlay */
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 250ms ease;
  }
  .sidebar-backdrop.visible { display: block; opacity: 1; }

  /* Bottom navigation bar */
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 500;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    background: rgba(6, 6, 12, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(139, 92, 246, 0.08);
    align-items: flex-start; justify-content: space-around;
    padding: 6px 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  }
  .mobile-nav-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px 10px; gap: 3px; border-radius: 10px;
    transition: all 150ms ease; min-width: 48px;
    position: relative;
  }
  .mobile-nav-btn svg { transition: transform 150ms ease; }
  .mobile-nav-btn:hover, .mobile-nav-btn.active { color: var(--accent); }
  .mobile-nav-btn.active svg { transform: scale(1.1); }
  .mobile-nav-btn.active::before {
    content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 2px; border-radius: 1px;
    background: var(--accent);
  }
  .mobile-nav-btn.active.axe-active { color: var(--axe-accent); }
  .mobile-nav-btn.active.axe-active::before { background: var(--axe-accent); }
  .mobile-nav-btn span { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; }
  .mobile-nav-btn.active span { font-weight: 600; }

  /* Content adjustments */
  .main { padding-bottom: 56px; }
  .panel { height: 100% !important; }
  .message { max-width: 95%; }
  .chat-input-area { padding: 8px 12px 12px; }
  .panel-content { padding: 16px; }
  .panel-header h2 { font-size: 14px; }
  .panel-header { padding: 6px 10px; gap: 4px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .header-btn { padding: 4px 8px; font-size: 11px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* Hide less important header items on mobile */
  #chatTitle { display: none !important; }
  #tokenCount { display: none !important; }
  #monthlyCost { display: none !important; }
  .search-toggle-btn { display: none !important; }

  /* Hide cost elements on mobile — they push voice button off screen */
  #dailyCostBadge { display: none !important; }
  #modelBadge { display: none !important; }
  #modeBadge { display: none !important; }
  .spacer { display: none !important; }

  /* Voice: hide header button on mobile — avatar is the voice toggle */
  #voiceModeBtn { display: none !important; }

  /* Axe Trading: stack sidebar above chat on mobile */
  .axe-layout { flex-direction: column; }
  .axe-sidebar {
    width: 100%; min-width: 100%;
    max-height: 180px; border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    overflow-y: auto;
  }
  .pos-detail-panel { width: 100vw; }

  /* Council tiles: single column on mobile */
  .council-grid { grid-template-columns: 1fr !important; }
}

/* ═══ Axe Panel ═══ */
.axe-quick-btn {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.axe-quick-btn:hover { background: rgba(16, 185, 129, 0.15); }
.axe-msg { padding: 10px 0; }
.axe-msg-user { display: flex; justify-content: flex-end; }
.axe-msg-user .axe-bubble { background: rgba(16, 185, 129, 0.12); border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 92%; font-size: 13px; text-align: right; }
.axe-msg-axe { display: flex; gap: 8px; align-items: flex-start; }
.axe-msg-axe .axe-avatar { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #059669, #10b981); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }
.axe-msg-axe .axe-bubble { background: transparent; max-width: 92%; font-size: 13px; line-height: 1.6; }
.axe-tool-card { background: rgba(16, 185, 129, 0.04); border: 1px solid rgba(16, 185, 129, 0.1); border-radius: 8px; padding: 8px 12px; margin: 6px 0; font-size: 12px; color: var(--text-muted); }
.axe-trade-card { background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 14px; border-left: 3px solid var(--warning); margin: 8px 0; white-space: normal; }
.axe-trade-card .axe-trade-actions { display: flex; gap: 8px; margin-top: 10px; }
.axe-trade-card .axe-trade-actions button { padding: 6px 14px; border-radius: 8px; border: 1px solid; cursor: pointer; font-size: 12px; font-family: inherit; font-weight: 500; }

/* ═══ Task Sidebar Widget ═══ */
.task-widget {
  border-top: 1px solid var(--border);
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.task-widget.collapsed { max-height: 32px; }
.task-widget-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; cursor: pointer;
  font-size: 11px; text-transform: uppercase; color: #55556a;
  font-weight: 600; letter-spacing: 0.5px;
}
.task-widget-header:hover { color: var(--text-secondary); }
.task-widget-body {
  overflow-y: auto; max-height: 260px; padding: 0 8px 8px;
}
.task-widget-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px; border-radius: 6px; margin-bottom: 2px;
  font-size: 12px; cursor: default; position: relative;
}
.task-widget-item:hover { background: var(--bg-tertiary); }
.task-widget-item .tw-check {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid #55556a; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.15s; font-size: 10px; color: transparent;
}
.task-widget-item .tw-check:hover { border-color: var(--success); color: var(--success); }
.task-widget-item .tw-check.done { border-color: var(--success); background: rgba(74,222,128,0.15); color: var(--success); }
.task-widget-item .tw-info { flex: 1; min-width: 0; }
.task-widget-item .tw-title { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-widget-item .tw-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-widget-item .tw-meta { font-size: 10px; color: var(--text-muted); display: flex; gap: 6px; margin-top: 1px; }
.task-widget-item .tw-due.overdue { color: var(--error); font-weight: 500; }
.task-widget-item .tw-actions {
  display: none; position: absolute; right: 4px; top: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px; gap: 2px;
}
.task-widget-item:hover .tw-actions { display: flex; }
.tw-action-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 2px 4px; border-radius: 3px;
}
.tw-action-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.task-add-row {
  display: flex; gap: 4px; padding: 4px 8px;
}
.task-add-row input {
  flex: 1; background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 4px 8px; border-radius: 6px;
  font-family: var(--font); font-size: 11px; outline: none;
}
.task-add-row input:focus { border-color: var(--accent); }
.task-add-row button {
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.2);
  color: #c4b5fd; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  font-size: 11px; font-family: var(--font);
}

/* ═══ Image Lightbox ═══ */
.chat-img { cursor: zoom-in; transition: opacity 0.15s; }
.chat-img:hover { opacity: 0.85; }
.user-images { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; justify-content: flex-end; }
.user-chat-img { max-width: 280px; max-height: 240px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.15); object-fit: cover; }
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; animation: lbFadeIn 0.15s ease;
  -webkit-user-select: none; user-select: none;
}
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-overlay img {
  max-width: 92vw; max-height: 85vh; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: opacity 0.2s ease;
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; width: 36px; height: 36px; border-radius: 50%;
  font-size: 18px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background 0.15s; z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; width: 44px; height: 44px; border-radius: 50%;
  font-size: 20px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.15s; z-index: 2;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-nav.disabled { opacity: 0.2; pointer-events: none; }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.6); font-size: 13px; font-family: var(--font);
  background: rgba(0,0,0,0.4); padding: 4px 12px; border-radius: 12px;
}
@media (max-width: 768px) {
  .lightbox-nav { width: 36px; height: 36px; font-size: 16px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
}

/* ═══ Copy Button on Code Blocks ═══ */
.code-block-wrapper { position: relative; }
.code-copy-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.2);
  color: #c4b5fd; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; cursor: pointer; opacity: 0; transition: opacity 0.15s;
  font-family: var(--font);
}
.code-block-wrapper:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(139,92,246,0.25); }

/* ═══ Message Copy Button ═══ */
.msg-copy-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 2px 6px; border-radius: 4px; opacity: 0;
  transition: opacity 0.15s; margin-left: 4px;
}
.message.assistant:hover .msg-copy-btn { opacity: 1; }
.msg-copy-btn:hover { color: var(--accent); background: var(--accent-glow); }

/* ═══ Message Retry Button ═══ */
.msg-retry-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 4px; opacity: 0;
  transition: opacity 0.15s; margin-left: 2px; line-height: 1;
}
.message.assistant:hover .msg-retry-btn { opacity: 1; }
.msg-retry-btn:hover { color: var(--accent); background: var(--accent-glow); }

/* ═══ Header action buttons ═══ */
.search-toggle-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 6px; transition: var(--transition);
  line-height: 1;
}
.search-toggle-btn:hover { color: var(--text-primary); background: var(--glass); }

/* ═══ Cost Alert Indicator ═══ */
.cost-alert-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 12px; cursor: pointer;
  font-family: var(--mono); font-weight: 500; transition: var(--transition);
  white-space: nowrap;
}
.cost-alert-badge.cost-green { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.2); }
.cost-alert-badge.cost-yellow { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.2); }
.cost-alert-badge.cost-red { background: rgba(248,113,113,0.1); color: #f87171; border: 1px solid rgba(248,113,113,0.2); }
.cost-alert-badge.cost-critical { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); animation: costFlash 1s ease-in-out infinite; }
@keyframes costFlash { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ═══ Status Toast ═══ */
/* ═══ Cost Dashboard ═══ */
.cost-dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.cost-stat-card { background: rgba(139,92,246,0.04); border: 1px solid rgba(139,92,246,0.08); border-radius: var(--radius-sm); padding: 14px 16px; }
.cost-stat-card .cost-stat-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.3px; margin-bottom: 4px; }
.cost-stat-card .cost-stat-value { font-size: 22px; font-weight: 600; font-family: var(--mono); }
.cost-bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 100px; padding: 0 2px; }
.cost-bar { flex: 1; min-width: 4px; background: linear-gradient(to top, rgba(139,92,246,0.7), rgba(139,92,246,0.2)); border-radius: 2px 2px 0 0; transition: height 300ms ease, background 200ms; cursor: pointer; position: relative; }
.cost-bar:hover { background: linear-gradient(to top, rgba(167,139,250,0.9), rgba(167,139,250,0.4)); }
.cost-bar-tooltip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--bg-elevated); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 4px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap; z-index: 10; pointer-events: none; }
.cost-bar:hover .cost-bar-tooltip { display: block; }
.cost-model-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cost-model-bar .model-name { width: 140px; font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.cost-model-bar .bar-track { flex: 1; height: 16px; background: rgba(255,255,255,0.03); border-radius: 4px; overflow: hidden; }
.cost-model-bar .bar-fill { height: 100%; background: linear-gradient(90deg, rgba(139,92,246,0.6), rgba(139,92,246,0.3)); border-radius: 4px; transition: width 400ms ease; }
.cost-model-bar .bar-label { font-size: 11px; color: var(--text-muted); font-family: var(--mono); width: 70px; text-align: right; flex-shrink: 0; }
/* ═══ Message Edit ═══ */
.msg-edit-btn { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 4px; transition: var(--transition); margin-left: 6px; }
.msg-edit-btn:hover { color: var(--accent); background: rgba(139,92,246,0.1); }
.message-row.user-row:hover .msg-edit-btn { display: inline-flex; }
.msg-edit-area { width: 100%; margin-top: 8px; }
.msg-edit-area textarea { width: 100%; min-height: 60px; max-height: 200px; background: var(--bg-tertiary); border: 1px solid var(--border-active); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 14px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.msg-edit-area textarea:focus { outline: none; border-color: var(--accent); }
.msg-edit-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.msg-edit-actions button { padding: 5px 14px; border-radius: 8px; border: none; font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; transition: var(--transition); }
.msg-edit-save { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.25) !important; }
.msg-edit-save:hover { background: rgba(74,222,128,0.25); }
.msg-edit-cancel { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.msg-edit-cancel:hover { background: rgba(255,255,255,0.1); }
/* ═══ Keyboard Shortcuts Modal ═══ */
.shortcuts-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10010; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.shortcuts-modal { background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 24px 28px; max-width: 480px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.shortcuts-modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-desc { font-size: 13px; color: var(--text-secondary); }
.shortcut-keys { display: flex; gap: 4px; }
.shortcut-key { background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.2); color: #c4b5fd; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-family: var(--mono); font-weight: 500; }

.status-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 10px 20px; border-radius: 12px; z-index: 9999;
  font-size: 12px; color: var(--text-secondary);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  animation: toastSlideUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══ Thinking Status ═══ */
.thinking-status {
  font-size: 12px; color: #9090a8; margin-left: 4px;
}

/* ═══ Task Edit Modal ═══ */
.task-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10000;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px);
  animation: overlayFadeIn 200ms ease-out;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
.task-modal {
  background: #111118; border: 1px solid rgba(139,92,246,0.15); border-radius: 16px;
  padding: 24px; max-width: 440px; width: 90%;
  animation: modalSlideUp 300ms var(--ease-out-expo);
  box-shadow: var(--shadow-xl);
}
.task-modal h3 { margin: 0 0 16px; font-size: 16px; color: #e4e4ed; }
.task-modal .field { margin-bottom: 12px; }
.task-modal label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.task-modal input, .task-modal select, .task-modal textarea {
  width: 100%; background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 8px 12px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; outline: none; box-sizing: border-box;
}
.task-modal input:focus, .task-modal select:focus, .task-modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08); }
.task-modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ═══ Spinner ═══ */
.spinner { width:20px;height:20px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin 0.6s linear infinite;display:inline-block }
@keyframes spin { to { transform: rotate(360deg) } }

/* ═══ Focus-visible ═══ */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, .rail-btn:focus-visible, .sidebar-item:focus-visible, .header-btn:focus-visible, .mobile-nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ═══ Aisha Private Panel ═══ */
#panel-aisha { display:none; height:100%; }
#panel-aisha.active { display:flex; flex-direction:column; }

/* Gate */
.aisha-gate {
  display:flex; align-items:center; justify-content:center;
  height:100%; background: var(--bg-primary);
}
.aisha-gate-inner {
  display:flex; flex-direction:column; align-items:center; gap:14px;
  padding:40px; max-width:320px;
}
.aisha-gate-avatar {
  width:56px; height:56px; border-radius:16px;
  background:linear-gradient(135deg, #e11d48, #f472b6);
  display:flex; align-items:center; justify-content:center;
  font-size:22px; font-weight:700; color:white;
}
.aisha-gate-title { font-size:18px; font-weight:600; color:var(--text-primary); }
.aisha-gate-subtitle { font-size:13px; color:var(--text-muted); margin-bottom:4px; }
.aisha-gate-input {
  width:100%; padding:10px 14px; box-sizing:border-box;
  background:rgba(255,255,255,0.05); border:1px solid rgba(225,29,72,0.2);
  border-radius:10px; color:var(--text-primary); font-size:14px; outline:none;
  transition:border-color 0.2s;
}
.aisha-gate-input:focus { border-color:rgba(225,29,72,0.5); }
.aisha-gate-error { color:#ef4444; font-size:12px; min-height:16px; }
.aisha-gate-btn {
  padding:10px 32px; border-radius:10px; border:none;
  background:rgba(225,29,72,0.2); color:#fda4af; font-size:14px;
  font-weight:500; cursor:pointer; transition:background 0.2s;
}
.aisha-gate-btn:hover { background:rgba(225,29,72,0.35); }

/* Chat area */
.aisha-chat-area {
  display:flex; flex-direction:row; height:100%;
  background:var(--bg-primary);
}
.aisha-sidebar {
  width:200px; min-width:200px; display:flex; flex-direction:column;
  border-right:1px solid rgba(225,29,72,0.1);
  background:rgba(9,9,15,0.5);
}
.aisha-sidebar-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 12px 10px; font-size:11px; text-transform:uppercase;
  letter-spacing:0.5px; color:#55556a; font-weight:600;
}
.aisha-conv-list { flex:1; overflow-y:auto; padding:0 6px; }
.aisha-conv-item {
  padding:8px 10px; border-radius:8px; cursor:pointer;
  margin-bottom:2px; transition:background 0.15s;
}
.aisha-conv-item:hover { background:rgba(225,29,72,0.08); }
.aisha-conv-item.active { background:rgba(225,29,72,0.15); }
.aisha-conv-title {
  display:block; font-size:13px; color:var(--text-primary);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.aisha-conv-meta {
  display:block; font-size:11px; color:var(--text-muted); margin-top:2px;
}
.aisha-sidebar-footer {
  padding:8px 10px; border-top:1px solid rgba(225,29,72,0.08);
}
.aisha-sidebar-footer .aisha-lock-btn {
  display:flex; align-items:center; gap:6px; width:100%;
  font-size:12px; padding:6px 8px;
}
.aisha-main {
  flex:1; display:flex; flex-direction:column; min-width:0;
}
.aisha-sidebar-toggle {
  background:none; border:none; color:var(--text-muted); cursor:pointer;
  padding:4px; border-radius:6px; transition:all 0.2s; display:none;
}
.aisha-sidebar-toggle:hover { background:rgba(225,29,72,0.1); color:#fda4af; }
@media (max-width: 768px) {
  .aisha-sidebar {
    position:absolute; left:0; top:0; bottom:0; z-index:20;
    transform:translateX(-100%); transition:transform 0.2s ease;
    width:220px; min-width:220px;
    background:rgba(9,9,15,0.95); backdrop-filter:blur(20px);
  }
  .aisha-sidebar.open { transform:translateX(0); }
  .aisha-sidebar-toggle { display:flex; }
}
.aisha-header {
  display:flex; align-items:center; gap:10px;
  padding:12px 20px; border-bottom:1px solid rgba(225,29,72,0.1);
  background:rgba(9,9,15,0.8); backdrop-filter:blur(20px);
}
.aisha-header-avatar {
  width:28px; height:28px; border-radius:8px;
  background:linear-gradient(135deg, #e11d48, #f472b6);
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700; color:white;
}
.aisha-header-name { font-size:14px; font-weight:600; color:#fda4af; }
.aisha-new-chat-btn, .aisha-lock-btn {
  background:none; border:none; color:var(--text-muted); cursor:pointer;
  padding:4px 8px; border-radius:6px; transition:all 0.2s;
}
.aisha-new-chat-btn:hover, .aisha-lock-btn:hover {
  background:rgba(225,29,72,0.1); color:#fda4af;
}
.aisha-new-chat-btn { font-size:18px; }
.aisha-messages {
  flex:1; overflow-y:auto; padding:16px 20px;
  display:flex; flex-direction:column; gap:12px;
}
.aisha-empty-state {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  height:100%; color:var(--text-muted); gap:12px;
}
.aisha-empty-avatar {
  width:48px; height:48px; border-radius:14px;
  background:linear-gradient(135deg, #e11d48, #f472b6);
  display:flex; align-items:center; justify-content:center;
  font-size:20px; font-weight:700; color:white;
}
.aisha-empty-state p { margin:0; font-size:14px; color:#6b6b80; font-style:italic; }
.aisha-input-area {
  display:flex; align-items:flex-end; gap:8px;
  padding:12px 20px; border-top:1px solid rgba(225,29,72,0.1);
  background:rgba(9,9,15,0.6);
}
.aisha-input-area textarea {
  flex:1; resize:none; background:rgba(255,255,255,0.04);
  border:1px solid rgba(225,29,72,0.15); border-radius:12px;
  padding:10px 14px; color:var(--text-primary); font-size:14px;
  font-family:var(--font); outline:none; max-height:120px;
  transition:border-color 0.2s;
}
.aisha-input-area textarea:focus { border-color:rgba(225,29,72,0.4); }
.aisha-send-btn {
  width:36px; height:36px; border-radius:10px; border:none;
  background:rgba(225,29,72,0.2); color:#fda4af;
  font-size:16px; cursor:pointer; transition:background 0.2s;
  display:flex; align-items:center; justify-content:center;
}
.aisha-send-btn:hover { background:rgba(225,29,72,0.4); }

/* Message bubbles */
.aisha-msg { display:flex; gap:8px; max-width:85%; }
.aisha-msg-user { align-self:flex-end; flex-direction:row-reverse; }
.aisha-msg-aisha { align-self:flex-start; }
.aisha-msg .aisha-avatar {
  width:28px; height:28px; min-width:28px; border-radius:8px;
  background:linear-gradient(135deg, #e11d48, #f472b6);
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; color:white;
}
.aisha-msg .aisha-bubble {
  padding:10px 14px; border-radius:14px; font-size:14px;
  line-height:1.5; color:var(--text-primary);
}
.aisha-msg-user .aisha-bubble {
  background:rgba(225,29,72,0.12); border-bottom-right-radius:4px;
}
.aisha-msg-aisha .aisha-bubble {
  background:rgba(255,255,255,0.04); border-bottom-left-radius:4px;
}

/* Rail button active state for Aisha */
#rail-aisha.active { color:#f472b6; background:rgba(225,29,72,0.1); }
#rail-aisha.active::before { background:#e11d48; }

/* ═══ Integration Tile Grid ═══ */
.int-filter-tab.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}
.int-filter-tab:hover:not(.active) {
  color: var(--text-primary) !important;
}
.int-tile {
  position: relative;
}
.int-tile svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ═══ Gallery ═══ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
  padding: 8px;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-tertiary);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.gallery-fav-badge {
  color: #ef4444;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.gallery-tag-count {
  background: rgba(139,92,246,0.8);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
}

.gallery-item-hover {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-item-hover {
  opacity: 1;
}

/* Multi-select */
.gallery-item.gallery-select-mode { cursor: pointer; }
.gallery-item.gallery-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.gallery-item.gallery-selected img { opacity: 0.7; }
.gallery-check {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: all 0.15s ease;
}
.gallery-check.checked {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.gallery-action-bar {
  position: sticky; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  animation: fadeSlideIn 150ms ease-out;
  z-index: 10;
}

.gallery-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-lightbox.visible {
  opacity: 1;
}

.gallery-lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.gallery-lb-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  z-index: 2;
  opacity: 0.7;
}

.gallery-lb-close:hover { opacity: 1; }

.gallery-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 36px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  z-index: 2;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}

.gallery-lb-nav:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}

.gallery-lb-prev { left: -70px; }
.gallery-lb-next { right: -70px; }

.gallery-lb-image-wrap {
  max-height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lb-image-wrap img {
  max-width: 80vw;
  max-height: 65vh;
  border-radius: var(--radius);
  object-fit: contain;
}

.gallery-lb-info {
  width: 100%;
  max-width: 600px;
  margin-top: 16px;
  text-align: center;
}

.gallery-lb-meta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.gallery-lb-prompt {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  max-height: 80px;
  overflow-y: auto;
}

.gallery-lb-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}

.gallery-lb-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.gallery-lb-btn:hover {
  background: rgba(255,255,255,0.2);
}

.gallery-lb-btn-danger:hover {
  background: rgba(239,68,68,0.3);
}

.gallery-lb-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.gallery-tag {
  background: rgba(139,92,246,0.2);
  color: var(--accent);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(139,92,246,0.3);
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 4px;
  }

  .gallery-lb-prev { left: 5px; }
  .gallery-lb-next { right: 5px; }

  .gallery-lb-nav {
    padding: 8px 12px;
    font-size: 28px;
  }

  .gallery-lb-image-wrap img {
    max-width: 95vw;
    max-height: 55vh;
  }

  .gallery-lightbox-content {
    max-width: 98vw;
  }
}

/* ═══ Context Meter ═══ */
.context-meter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 12px;
  transition: var(--transition);
  user-select: none;
}
.context-meter:hover {
  background: rgba(139, 92, 246, 0.08);
}
.context-meter-ring {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.context-meter-fill {
  transition: stroke-dasharray 0.6s ease, stroke 0.4s ease;
}
.context-meter-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-muted);
  min-width: 24px;
}
.context-meter-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  z-index: 10002;
  box-shadow: var(--shadow-lg);
  line-height: 1.6;
  pointer-events: none;
}
.context-meter:hover .context-meter-tooltip {
  display: block;
}
/* Color states */
.context-meter.ctx-green .context-meter-fill { stroke: var(--success); }
.context-meter.ctx-green .context-meter-label { color: var(--success); }
.context-meter.ctx-yellow .context-meter-fill { stroke: var(--warning); }
.context-meter.ctx-yellow .context-meter-label { color: var(--warning); }
.context-meter.ctx-red .context-meter-fill { stroke: var(--error); }
.context-meter.ctx-red .context-meter-label { color: var(--error); }
.context-meter.ctx-red {
  animation: ctx-pulse 2s ease-in-out infinite;
}
@keyframes ctx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ═══ HITL Approval Dialog ═══ */
.hitl-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hitlFadeIn 0.2s ease;
}
@keyframes hitlFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hitl-modal {
  background: var(--surface, #1e1e2e);
  border: 1px solid rgba(255,180,60,0.3);
  border-radius: 16px;
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,180,60,0.1);
}
.hitl-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.hitl-icon {
  font-size: 24px;
}
.hitl-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffb43c;
}
.hitl-description {
  font-size: 14px;
  color: var(--text-primary, #e4e4ed);
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255,180,60,0.06);
  border-radius: 10px;
  border: 1px solid rgba(255,180,60,0.1);
}
.hitl-tool {
  font-size: 12px;
  color: var(--text-secondary, #a0a0b4);
  margin-bottom: 8px;
}
.hitl-tool code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.hitl-args {
  font-size: 12px;
  color: var(--text-secondary, #a0a0b4);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  line-height: 1.6;
}
.hitl-arg-key {
  color: #8b8ba0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.hitl-arg-val {
  color: var(--text-primary, #e4e4ed);
  font-size: 12px;
}
.hitl-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.hitl-timer-icon {
  font-size: 14px;
}
.hitl-timer-text {
  font-size: 12px;
  color: var(--text-secondary, #a0a0b4);
  min-width: 100px;
}
.hitl-timer-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  min-width: 80px;
}
.hitl-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffb43c, #ff8c00);
  border-radius: 2px;
  transition: width 1s linear;
}
.hitl-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}
.hitl-btn {
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s ease;
}
.hitl-approve {
  background: rgba(34,197,94,0.2);
  border: 1px solid rgba(34,197,94,0.3);
  color: #4ade80;
}
.hitl-approve:hover {
  background: rgba(34,197,94,0.3);
}
.hitl-deny {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
}
.hitl-deny:hover {
  background: rgba(239,68,68,0.2);
}

/* ═══ Plan-and-Execute ═══ */
.plan-card {
  background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 12px;
  padding: 16px;
  max-width: 520px;
}
.plan-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.plan-icon { font-size: 1.2em; }
.plan-title {
  font-weight: 600;
  font-size: 14px;
  color: #c8c8d8;
  flex: 1;
}
.plan-est {
  font-size: 11px;
  color: #6b6b80;
  white-space: nowrap;
}
.plan-progress-bar {
  height: 4px;
  background: rgba(139,92,246,0.12);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}
.plan-progress-fill {
  height: 100%;
  background: #7c3aed;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.plan-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.plan-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: #c8c8d8;
  transition: background 0.2s, opacity 0.2s;
}
.plan-step:hover { background: rgba(139,92,246,0.06); }
.plan-step-check {
  flex-shrink: 0;
  margin-top: 1px;
}
.plan-step-check input[type="checkbox"] {
  accent-color: #7c3aed;
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.plan-step-num {
  color: #6b6b80;
  min-width: 18px;
  flex-shrink: 0;
}
.plan-step-desc { flex: 1; line-height: 1.4; }
.plan-step-status {
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}
.plan-status-done { color: #4ade80; }
.plan-status-failed { color: #f87171; }
.plan-status-skipped { color: #6b6b80; }
.plan-step-skipped { opacity: 0.4; text-decoration: line-through; }
.plan-step-running { background: rgba(139,92,246,0.08); }
.plan-step-done { opacity: 0.7; }
.plan-step-failed { background: rgba(239,68,68,0.06); }

.plan-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(139,92,246,0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: plan-spin 0.6s linear infinite;
}
@keyframes plan-spin { to { transform: rotate(360deg); } }

.plan-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.plan-btn {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}
.plan-btn-execute {
  background: #7c3aed;
  color: #fff;
}
.plan-btn-execute:hover { background: #6d28d9; }
.plan-btn-cancel {
  background: rgba(139,92,246,0.1);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.2);
}
.plan-btn-cancel:hover { background: rgba(139,92,246,0.18); }
.plan-status-msg {
  margin-top: 8px;
  font-size: 12px;
  color: #6b6b80;
  min-height: 16px;
}
.plan-status-msg.plan-status-running { color: #a78bfa; }
.plan-status-msg.plan-status-complete { color: #4ade80; }
.plan-status-msg.plan-status-partial { color: #fbbf24; }
.plan-status-msg.plan-status-cancelled { color: #6b6b80; font-style: italic; }
.plan-status-msg.plan-status-failed { color: #f87171; }

/* ═══ Enhanced Code Blocks ═══ */
.code-block-wrapper {
  position: relative;
  margin: 8px 0;
}
.code-block-wrapper pre {
  margin: 0;
  border-radius: 8px;
  overflow-x: auto;
}
.code-block-wrapper pre code {
  display: block;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  font-family: var(--mono);
  tab-size: 2;
}
.code-block-wrapper pre code.hljs {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.code-lang-label {
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  pointer-events: none;
}
.code-line-numbers {
  position: absolute;
  top: 0;
  left: 0;
  padding: 12px 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(139, 92, 246, 0.25);
  user-select: none;
  pointer-events: none;
}
.code-block-wrapper.has-line-numbers pre code {
  padding-left: 42px;
}
.code-block-wrapper.has-line-numbers .code-line-numbers {
  padding: 12px 8px 12px 10px;
  width: 32px;
}
.code-block-wrapper.has-lang-label .code-copy-btn {
  top: 6px;
}
.code-collapse-btn {
  display: block;
  width: 100%;
  padding: 6px 14px;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}
.code-collapse-btn:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* ═══ Clarification Cards ═══ */
.clarification-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 8px;
}
.clarification-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(139, 92, 246, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.clarification-card:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
  transform: translateY(-1px);
}
.clarification-card.selected {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}
.clarification-card.dimmed {
  opacity: 0.35;
  pointer-events: none;
  transform: scale(0.98);
  transition: all 0.3s ease;
}
.clarification-card-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}
.clarification-card-body {
  flex: 1;
  min-width: 0;
}
.clarification-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.clarification-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ═══ Quick Action Pills ═══ */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
}
.quick-action-pill {
  padding: 5px 14px;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(139, 92, 246, 0.04);
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.quick-action-pill:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.1);
}
.quick-action-pill.used {
  opacity: 0.35;
  pointer-events: none;
}

/* ═══ Plan Checklist ═══ */
.plan-checklist {
  margin: 10px 0;
  padding: 0;
  list-style: none;
}
.plan-checklist-progress {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: var(--mono);
}
.plan-checklist-progress .progress-bar {
  display: inline-block;
  width: 80px;
  height: 4px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 2px;
  margin-left: 8px;
  vertical-align: middle;
  overflow: hidden;
}
.plan-checklist-progress .progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.plan-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity 0.2s;
}
.plan-item:hover {
  color: var(--text-primary);
}
.plan-item .plan-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.2s ease;
}
.plan-item.complete .plan-check {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
  color: #4ade80;
}
.plan-item.complete {
  text-decoration: line-through;
  opacity: 0.6;
}

/* ═══ Message Search Bar ═══ */
.message-search-bar {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  animation: searchSlideDown 0.2s ease;
  z-index: 10;
}
@keyframes searchSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
}
.search-bar-inner input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  min-width: 0;
}
.search-bar-inner input::placeholder { color: var(--text-muted); }
.search-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.search-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.1s;
}
.search-nav-btn:hover { color: var(--text-primary); }
.search-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.1s;
}
.search-close-btn:hover { color: var(--text-primary); }
.search-highlight {
  background: rgba(251, 191, 36, 0.3);
  border-radius: 2px;
  padding: 0 1px;
}
.search-current {
  background: rgba(251, 191, 36, 0.6);
  outline: 2px solid rgba(251, 191, 36, 0.4);
}

/* ═══ Command Palette ═══ */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10020;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  backdrop-filter: blur(4px);
}
.command-palette {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.command-palette-input {
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}
.command-palette-input::placeholder { color: var(--text-muted); }
.command-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.command-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--text-secondary);
  font-size: 13px;
}
.command-palette-item:hover,
.command-palette-item.active {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
}
.command-palette-item .cp-icon {
  font-size: 14px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.command-palette-item .cp-shortcut {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ═══ Mobile: UI features ═══ */
@media (max-width: 768px) {
  .clarification-cards { gap: 6px; }
  .clarification-card { padding: 10px 12px; gap: 10px; }
  .quick-actions { gap: 4px; }
  .quick-action-pill { padding: 4px 10px; font-size: 11px; }
  .message-search-bar { padding: 6px 8px; }
  .search-bar-inner { padding: 3px 8px; }
  .command-palette { width: 95%; max-width: none; }
  .command-palette-input { padding: 12px 14px; font-size: 14px; }
}

/* ═══ Reduced Motion ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
