/* ═══════════════════════════════════════════════════════════════════
   NOUS — Premium UI Design System v1.0
   Mobile-first · Zero panel overlays · Tab-based navigation
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:          #0c0c14;
  --bg-card:     #13131f;
  --bg-input:    #1a1a28;
  --bg-hover:    #1f1f30;
  --border:      rgba(255,255,255,0.07);
  --border-hi:   rgba(255,255,255,0.14);

  --accent:      #7c3aed;
  --accent-2:    #a855f7;
  --accent-soft: rgba(124,58,237,0.12);
  --accent-glow: rgba(124,58,237,0.08);

  --text:        #f0f0fa;
  --text-2:      #8b8ba8;
  --text-3:      #55556a;
  --text-1:      #f0f0fa;

  --green:       #22c55e;
  --red:         #ef4444;
  --amber:       #f59e0b;
  --blue:        #3b82f6;

  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.7);

  --tab-h:       60px;          /* bottom tab bar height */
  --top-h:       54px;          /* top header height */
  --sidebar-w:   264px;         /* desktop sidebar width */

  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --mono:        'JetBrains Mono', 'Fira Code', monospace;
}

/* Light theme */
body.light {
  --bg:          #f5f5fa;
  --bg-card:     #ffffff;
  --bg-input:    #f0f0f8;
  --bg-hover:    #e8e8f5;
  --border:      rgba(0,0,0,0.08);
  --border-hi:   rgba(0,0,0,0.15);
  --text:        #1a1a2e;
  --text-2:      #5a5a7a;
  --text-3:      #9090aa;
  --text-1:      #1a1a2e;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.1);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.15);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.18);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Shell ─────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ── Top Header ────────────────────────────────────────────────────── */
.top-bar {
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.server-status {
  font-size: 10px;
  color: var(--text-3);
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(0.93); }

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  background: var(--red);
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  display: none;
}
.notif-badge.visible { display: flex; }

/* ── Layout: Desktop sidebar + main ───────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar (desktop only, hidden on mobile) ──────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: none;           /* hidden on mobile */
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  gap: 6px;
  z-index: 40;
}

/* ── Sidebar sections ──────────────────────────────────────────────── */
.sidebar-section {
  margin-bottom: 4px;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 4px 6px;
}

/* Budget Card */
.budget-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
}
.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.budget-label { font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: 0.6px; text-transform: uppercase; }
.budget-amount { font-size: 14px; font-weight: 700; color: var(--text); }
.budget-bar-bg {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.budget-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.6s ease;
}
.budget-stats {
  display: flex;
  gap: 10px;
}
.budget-stat {
  flex: 1;
  text-align: center;
}
.budget-stat-val { font-size: 14px; font-weight: 700; color: var(--text); }
.budget-stat-lbl { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

/* Language bar */
.lang-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.lang-btn {
  flex: 1;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-2);
}
.lang-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.lang-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }

/* Theme toggle */
.theme-btn {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.theme-btn:hover { border-color: var(--border-hi); color: var(--text); }

/* Stack pills in sidebar */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}
.stack-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 12px;
  color: var(--text-2);
}
.stack-item:hover { background: var(--bg-hover); color: var(--text); }
.stack-item.active { background: var(--accent-soft); color: var(--accent-2); }
.stack-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* Action buttons in sidebar */
.sidebar-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-btn:hover { border-color: var(--border-hi); color: var(--text); background: var(--bg-hover); }

/* Query mode selector */
.mode-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  margin-bottom: 8px;
}
.mode-tab {
  flex: 1;
  padding: 5px 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--bg-card);
  color: var(--accent-2);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* Session health bar */
.context-bar {
  margin-bottom: 8px;
}
.context-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.context-bar-bg {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.context-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

/* ── Main Content Area ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Tab Views ─────────────────────────────────────────────────────── */
.tab-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.tab-view.active { display: flex; }

/* ── Bottom Navigation (mobile only) ──────────────────────────────── */
.bottom-tabs {
  display: flex;
  height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 50;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-3);
  position: relative;
  border: none;
  background: none;
  padding: 8px 0 4px;
}
.tab-btn:active { transform: scale(0.92); }

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transition: transform 0.2s ease;
}
.tab-btn.active::before { transform: translateX(-50%) scaleX(1); }

.tab-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s;
}
.tab-btn:active .tab-icon { transform: scale(0.88); }
.tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.15s;
}
.tab-btn.active { color: var(--accent-2); }

/* ═══════════════════════════════════════════════════════════════════
   TAB 1: CHAT
   ═══════════════════════════════════════════════════════════════════ */

/* Chat scroll area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Empty / welcome state */
.empty-state {
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}
.empty-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 20px rgba(124,58,237,0.35);
  margin-bottom: 4px;
}
.empty-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.empty-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  max-width: 320px;
}
.empty-greeting {
  font-size: 15px;
  color: var(--text-2);
  font-weight: 400;
}

/* Sample prompts */
.sample-prompts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin-top: 4px;
}
.sample-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  line-height: 1.4;
}
.sample-prompt:hover { border-color: var(--accent); color: var(--text); background: var(--accent-glow); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.sample-prompt:active { transform: translateY(0); }

/* Active stacks bar */
.active-stacks-bar {
  padding: 8px 16px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.stack-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-2);
  cursor: default;
}

/* Messages */
.message { padding: 4px 16px; animation: msg-in 0.2s ease; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.msg-user {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 78%;
  margin-left: auto;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
  word-wrap: break-word;
}

.msg-ai {
  max-width: 92%;
}
.msg-ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ai-avatar {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.ai-name { font-size: 12px; font-weight: 600; color: var(--text-2); }

.msg-ai-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  word-wrap: break-word;
}

/* Markdown in AI body */
.msg-ai-body h1,.msg-ai-body h2,.msg-ai-body h3 { font-size: 15px; font-weight: 700; margin: 14px 0 6px; color: var(--text); }
.msg-ai-body h4,.msg-ai-body h5 { font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.msg-ai-body p { margin: 0 0 10px; }
.msg-ai-body p:last-child { margin-bottom: 0; }
.msg-ai-body ul,.msg-ai-body ol { padding-left: 20px; margin: 8px 0; }
.msg-ai-body li { margin-bottom: 4px; }
.msg-ai-body code { font-family: var(--mono); font-size: 12px; background: var(--bg-input); padding: 1px 5px; border-radius: 4px; color: var(--accent-2); }
.msg-ai-body pre { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; margin: 10px 0; }
.msg-ai-body pre code { background: none; padding: 0; color: var(--text-2); font-size: 12px; }
.msg-ai-body strong { font-weight: 600; color: var(--text); }
.msg-ai-body em { color: var(--text-2); }
.msg-ai-body blockquote { border-left: 3px solid var(--accent); padding-left: 10px; margin: 8px 0; color: var(--text-2); }
.msg-ai-body table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0; }
.msg-ai-body th { background: var(--bg-input); padding: 6px 10px; border: 1px solid var(--border); font-weight: 600; text-align: left; }
.msg-ai-body td { padding: 5px 10px; border: 1px solid var(--border); }
.msg-ai-body a { color: var(--accent-2); }

/* Source Zones (Sprint 9) */
.source-zone-stack {
  border-left: 3px solid #22c55e;
  background: rgba(34,197,94,0.08);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 4px 8px 8px 4px;
}
.source-zone-llm {
  border-left: 3px solid #f59e0b;
  background: rgba(251,191,36,0.08);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 4px 8px 8px 4px;
}
.source-zone-cloud {
  border-left: 3px solid #6366f1;
  background: rgba(99,102,241,0.08);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 4px 8px 8px 4px;
}
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--bg-card);
  margin-left: 6px;
  font-weight: 500;
}
.zone-header {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Thinking indicator */
.msg-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-2);
  max-width: 220px;
}
.thinking-dots { display: flex; gap: 3px; }
.thinking-dot {
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-5px); opacity: 1; } }

/* Feedback row under AI message */
.msg-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 0 2px;
  flex-wrap: wrap;
}
.feedback-btn {
  font-size: 11px;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.feedback-btn:hover { color: var(--text); border-color: var(--border-hi); background: var(--bg-hover); }
.cost-badge {
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
}

/* Provenance bars */
.prov-bars { margin-top: 10px; }
.prov-bar-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.prov-tag { font-size: 10px; color: var(--text-3); width: 60px; text-align: right; flex-shrink: 0; }
.prov-bg { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.prov-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; }
.prov-pct { font-size: 10px; color: var(--text-3); width: 28px; flex-shrink: 0; }

/* Routing badge */
.routing-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: var(--bg-input);
  margin-left: 6px;
}

/* Sources panel (inline in chat) */
.sources-panel { padding: 4px 0; }
.sources-panel-title { font-size: 11px; font-weight: 600; color: var(--text-3); margin-bottom: 10px; letter-spacing: 0.4px; }
.source-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.source-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(124,58,237,0.3); color: var(--accent-2); background: var(--accent-glow); flex-shrink: 0; }
.source-bar-wrap { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.source-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; }
.source-pct { font-size: 10px; color: var(--text-3); width: 28px; text-align: right; }

/* Chat input area */
.chat-input-area {
  padding: 10px 14px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Suggestion panel */
.suggestion-panel {
  display: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  gap: 8px;
}
.sug-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sug-label { font-size: 11px; color: var(--text-3); font-weight: 500; flex-shrink: 0; }
.sug-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.sug-pill:hover { border-color: var(--accent); color: var(--accent-2); }
.sug-pill.activated { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.sug-improve-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  margin-left: auto;
  transition: all 0.12s;
}
.sug-improve-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.sug-improved-row { display: none; align-items: flex-start; gap: 8px; margin-top: 6px; }
.sug-improved-text { font-size: 12px; color: var(--text-2); flex: 1; line-height: 1.4; font-style: italic; }
.sug-use-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  cursor: pointer;
  flex-shrink: 0;
}

/* Command palette */
.cmd-palette {
  display: none;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: var(--shadow-md);
}
.cmd-palette.visible { display: flex; }
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.cmd-item:last-child { border-bottom: none; }
.cmd-item:hover, .cmd-item.cmd-active { background: var(--bg-hover); color: var(--text); }
.cmd-icon { font-size: 15px; width: 22px; text-align: center; }
.cmd-name { font-weight: 600; font-size: 13px; }
.cmd-desc { font-size: 11px; color: var(--text-3); margin-left: auto; }

/* Main prompt input wrapper */
.prompt-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.prompt-box {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  padding: 4px 4px 4px 12px;
  gap: 4px;
  transition: border-color 0.15s;
}
.prompt-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

#prompt-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;           /* ≥16px prevents iOS zoom */
  color: var(--text);
  resize: none;
  max-height: 140px;
  min-height: 24px;
  line-height: 1.5;
  padding: 7px 0;
  font-family: var(--font);
  -webkit-overflow-scrolling: touch;
}
#prompt-input::placeholder { color: var(--text-3); }

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.5); }
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.5; transform: none; box-shadow: none; cursor: not-allowed; }

.attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }

/* Input meta row */
.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
}
.input-meta-left { display: flex; align-items: center; gap: 8px; }
.cost-estimate { font-size: 11px; color: var(--text-3); }
.session-tag {
  font-size: 10px;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 20px;
  padding: 1px 7px;
  display: none;
}
.grill-badge, .bias-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-3);
  display: none;
}
.grill-badge.active { display: flex; background: rgba(245,158,11,0.1); border-color: var(--amber); color: var(--amber); }
.bias-badge.active { display: flex; background: rgba(59,130,246,0.1); border-color: var(--blue); color: var(--blue); }
.input-meta-right { font-size: 10px; color: var(--text-3); }

/* Model selector */
.model-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.model-selector::-webkit-scrollbar { display: none; }
.model-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.model-btn:hover { border-color: var(--border-hi); color: var(--text); }
.model-btn.model-btn-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* Doc panel (collapsible) */
.doc-panel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  margin-bottom: 8px;
}
.doc-panel.open { max-height: 300px; }
.doc-panel-inner { padding: 12px; }
.doc-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 13px;
  color: var(--text);
  resize: none;
  height: 80px;
  font-family: var(--font);
  outline: none;
}
.doc-textarea:focus { border-color: var(--accent); }

/* Save-to-brain button */
.save-brain-btn {
  font-size: 12px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  display: none;
}
.save-brain-btn:hover { background: var(--accent); color: #fff; }
.save-brain-btn.visible { display: inline-flex; align-items: center; gap: 6px; }

/* ═══════════════════════════════════════════════════════════════════
   TAB 2: HISTORY
   ═══════════════════════════════════════════════════════════════════ */
.history-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.view-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.view-action-btn {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.view-action-btn:hover { border-color: var(--border-hi); color: var(--text); }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.hist-card:hover { border-color: var(--accent); background: var(--accent-glow); transform: translateY(-1px); }
.hist-card:active { transform: translateY(0); }
.hist-card.active { border-color: var(--accent); background: var(--accent-soft); }
.hist-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hist-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════════
   TAB 3: STACKS
   ═══════════════════════════════════════════════════════════════════ */
.stacks-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.stack-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.stack-filter-bar::-webkit-scrollbar { display: none; }
.stack-filter-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.stack-filter-btn:hover { border-color: var(--border-hi); color: var(--text); }
.stack-filter-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

.stacks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.stack-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.stack-card:hover { border-color: var(--border-hi); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stack-card:active { transform: translateY(0); }
.stack-card.active { border-color: var(--accent); background: var(--accent-glow); }
.stack-card-icon { font-size: 20px; margin-bottom: 6px; }
.stack-card-name { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.stack-card-desc { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.stack-card-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.15s;
}
.stack-card.active .stack-card-toggle { background: var(--accent); border-color: var(--accent); color: #fff; }

.stack-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.stack-action-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.stack-action-btn:hover { border-color: var(--border-hi); color: var(--text); }
.stack-action-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* Custom Knowledge section */
.custom-knowledge-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.custom-knowledge-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ck-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ck-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.ck-preview { font-size: 11px; color: var(--text-3); }
.ck-actions { display: flex; gap: 6px; margin-top: 8px; }
.ck-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.12s;
}
.ck-btn:hover { border-color: var(--border-hi); color: var(--text); }
.ck-btn.danger:hover { border-color: var(--red); color: var(--red); }

.ck-new-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 10px;
}
.ck-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  margin-bottom: 8px;
}
.ck-input:focus { border-color: var(--accent); }
.ck-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 8px;
}
.ck-textarea:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════
   TAB 4: SETTINGS
   ═══════════════════════════════════════════════════════════════════ */
.settings-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* Pref rows */
.pref-row { margin-bottom: 16px; }
.pref-row:last-child { margin-bottom: 0; }
.pref-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.pref-val {
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
}
.pref-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}
.pref-slider {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct,50%), var(--border) var(--pct,50%), var(--border) 100%);
}
.pref-slider::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px rgba(124,58,237,0.5); cursor: pointer; }

/* Segmented controls */
.pref-segments {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--bg-card); border-color: var(--border); color: var(--accent-2); box-shadow: var(--shadow-sm); }

/* Select dropdown */
.pref-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.pref-select:focus { border-color: var(--accent); }

/* Learnings list */
.learnings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.learning-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.learning-fact { font-size: 12px; color: var(--text-2); flex: 1; line-height: 1.5; }
.learning-type { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.learning-delete {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}
.learning-delete:hover { border-color: var(--red); color: var(--red); }

/* Save prefs button */
.save-prefs-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
  margin-top: 4px;
}
.save-prefs-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.5); }
.save-prefs-btn:active { transform: scale(0.98); }
.save-prefs-btn:disabled { opacity: 0.6; transform: none; }
.settings-status { font-size: 12px; text-align: center; margin-top: 8px; height: 16px; }

/* Opinion capture form */
.opinion-form { display: flex; flex-direction: column; gap: 8px; }
.opinion-input, .opinion-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  width: 100%;
}
.opinion-input:focus, .opinion-textarea:focus { border-color: var(--accent); }
.opinion-textarea { resize: vertical; min-height: 60px; }
.opinion-save-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  align-self: flex-start;
}
.opinion-save-btn:hover { background: var(--accent); color: #fff; }
.opinion-status { font-size: 12px; margin-top: 4px; }

/* Brain profile card in settings */
.brain-profile-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.brain-profile-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.brain-profile-sub { font-size: 12px; color: var(--text-3); }
.brain-profile-stats { display: flex; gap: 12px; margin-top: 10px; }
.brain-stat { flex: 1; text-align: center; }
.brain-stat-val { font-size: 18px; font-weight: 700; color: var(--accent-2); }
.brain-stat-lbl { font-size: 10px; color: var(--text-3); letter-spacing: 0.4px; }

/* ═══════════════════════════════════════════════════════════════════
   MODALS (using <dialog>)
   ═══════════════════════════════════════════════════════════════════ */
dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}
dialog:not([open]) { display: none !important; }
dialog[open] { display: flex !important; }
dialog::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }

.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheet-in 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-hi);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.12s;
}
.modal-close:hover { color: var(--text); }

/* Notifications dropdown */
.notif-dropdown {
  position: absolute;
  top: calc(var(--top-h) + 4px);
  right: 12px;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdown-in 0.15s ease;
}
.notif-dropdown.open { display: flex; }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notif-title { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-mark-all { font-size: 11px; color: var(--accent-2); cursor: pointer; background: none; border: none; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--accent-glow); }
.notif-item.unread .notif-item-text { color: var(--text); font-weight: 500; }
.notif-item-time { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.notif-empty { padding: 20px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ── Overlays ───────────────────────────────────────────────────── */
/* Brain not found overlay */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.overlay-icon { font-size: 48px; margin-bottom: 16px; }
.overlay-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.overlay-body { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.overlay-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--mono);
  outline: none;
  margin-bottom: 12px;
  text-align: center;
}
.overlay-input:focus { border-color: var(--accent); }
.overlay-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.overlay-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.5); }

/* Session lock overlay */
#session-lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#session-lock-overlay.active { display: flex; }
.session-lock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.session-lock-icon { font-size: 40px; margin-bottom: 16px; }
.session-lock-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.session-lock-body { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.session-lock-actions { display: flex; flex-direction: column; gap: 8px; }
.session-lock-btn-primary {
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.session-lock-btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.session-lock-btn-secondary {
  padding: 10px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.session-lock-btn-secondary:hover { border-color: var(--border-hi); color: var(--text); }

/* Session evicted overlay */
#session-evicted-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#session-evicted-overlay.active { display: flex; }
.session-evicted-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.session-evicted-icon { font-size: 40px; margin-bottom: 16px; }
.session-evicted-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.session-evicted-body { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }

/* Preseed modal */
#preseed-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 700;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
#preseed-modal.open { display: flex; }
.preseed-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: sheet-in 0.3s ease;
}
.preseed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.preseed-logo { font-size: 28px; }
.preseed-skip { font-size: 12px; color: var(--text-3); cursor: pointer; }
.preseed-skip:hover { color: var(--text-2); }
.preseed-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.preseed-sub { font-size: 14px; color: var(--text-2); margin-bottom: 20px; line-height: 1.5; }
.preseed-q { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.preseed-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.preseed-chip {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.preseed-chip:hover { border-color: var(--accent); color: var(--accent-2); }
.preseed-chip.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.preseed-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  margin-bottom: 16px;
}
.preseed-input:focus { border-color: var(--accent); }
.preseed-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}
.preseed-dot { flex: 1; height: 3px; background: var(--border); border-radius: 2px; transition: background 0.2s; }
.preseed-dot.done { background: var(--accent); }
.preseed-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preseed-next-btn {
  padding: 10px 24px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.preseed-next-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.preseed-back-btn {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.preseed-back-btn:hover { border-color: var(--border-hi); color: var(--text); }

/* Toast */
#toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  pointer-events: none;
  z-index: 800;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Council / Sparring modes ───────────────────────────────────── */
.council-grid { display: flex; flex-direction: column; gap: 10px; }
.council-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.council-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.council-avatar { width: 24px; height: 24px; border-radius: 8px; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.council-name { font-size: 12px; font-weight: 600; color: var(--text-2); }
.council-stance { font-size: 10px; color: var(--text-3); }
.council-body { font-size: 13px; color: var(--text); line-height: 1.55; }
.sparring-card {
  background: var(--bg-card);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px;
}
.sparring-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* ── Error Report ───────────────────────────────────────────────── */
.error-report {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
}
.error-report-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  font-family: var(--font);
  resize: none;
  height: 60px;
  outline: none;
}
.error-submit-btn {
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--red);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Doc indicator ─────────────────────────────────────────────── */
.doc-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--green);
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
}

/* ── Ambient briefing modal content ───────────────────────────── */
.ambient-content {
  padding: 4px 0;
}
#ambient-body { font-size: 14px; color: var(--text-2); line-height: 1.7; }
.ambient-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(124,58,237,0.15);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  display: none;
}
.ambient-badge.dot::before { content: '●'; margin-right: 4px; font-size: 7px; }

/* ── Manual edit modal ─────────────────────────────────────────── */
#manual-content { padding: 4px 0; }
.manual-tabs { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.manual-tab {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.manual-tab:hover { border-color: var(--border-hi); color: var(--text); }
.manual-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.manual-area {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--mono);
  resize: vertical;
  min-height: 200px;
  outline: none;
}
.manual-area:focus { border-color: var(--accent); }

/* ── Financial analysis modal ─────────────────────────────────── */
.fin-modal-content { padding: 4px 0; }
.fin-stages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.fin-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.fin-stage.active { border-color: var(--accent); color: var(--accent-2); background: var(--accent-glow); }
.fin-stage.done { border-color: var(--green); color: var(--green); }
#fin-report { font-size: 13px; color: var(--text-2); line-height: 1.65; }
#fin-report h3 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }

/* ── Cost dashboard (in settings) ─────────────────────────────── */
.cost-dashboard { display: flex; flex-direction: column; gap: 8px; }
.cost-stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cost-stat-label { color: var(--text-2); }
.cost-stat-val { font-weight: 600; color: var(--text); }

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

/* ── Stack Browser Modal (full-screen on mobile) ──────────────── */
#stack-browser-modal {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 400;
  display: none;
  flex-direction: column;
  animation: fade-in 0.2s ease;
}
#stack-browser-modal.open { display: flex; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.sb-title { font-size: 17px; font-weight: 700; color: var(--text); }
.sb-close {
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
}
.sb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.sb-filters { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.sb-filters::-webkit-scrollbar { display: none; }
.sb-filter {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.sb-filter:hover { border-color: var(--border-hi); }
.sb-filter.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.sb-card:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.sb-card.active { border-color: var(--accent); background: var(--accent-glow); }
.sb-icon { font-size: 20px; margin-bottom: 6px; }
.sb-name { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.sb-desc { font-size: 11px; color: var(--text-3); line-height: 1.35; }
.sb-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  transition: all 0.15s;
}
.sb-card.active .sb-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.sb-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  gap: 8px;
}
.sb-footer-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.sb-footer-btn:hover { border-color: var(--border-hi); color: var(--text); }
.sb-footer-btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.sb-footer-btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Preset buttons */
.preset-bar { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.preset-bar::-webkit-scrollbar { display: none; }
.preset-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }

/* ═══════════════════════════════════════════════════════════════════
   DESKTOP BREAKPOINT (≥ 768px)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .sidebar { display: flex; }
  .bottom-tabs { display: none; }

  /* Toast sits at bottom without tab bar offset */
  #toast { bottom: 24px; }

  /* Modal sheets become centered cards on desktop */
  dialog { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius-xl);
    max-height: 80vh;
    animation: modal-in 0.2s ease;
  }
  @keyframes modal-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
  .modal-handle { display: none; }

  /* Stack browser side panel on desktop */
  #stack-browser-modal {
    left: auto;
    right: 0;
    width: 480px;
    border-left: 1px solid var(--border);
    animation: slide-in-right 0.2s ease;
  }
  @keyframes slide-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }

  /* Tabs visible on desktop as horizontal nav in content area */
  .desktop-tab-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    height: 44px;
    flex-shrink: 0;
  }
  .desktop-tab-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.12s;
    position: relative;
  }
  .desktop-tab-btn:hover { color: var(--text); background: var(--bg-hover); }
  .desktop-tab-btn.active { color: var(--accent-2); background: var(--accent-soft); }

  /* Larger fonts on desktop */
  .empty-title { font-size: 26px; }
  .msg-user { font-size: 15px; }
  .msg-ai-body { font-size: 15px; }

  .sample-prompts { grid-template-columns: repeat(4, 1fr); max-width: 100%; }
  .stacks-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .sb-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Wide desktop */
@media (min-width: 1200px) {
  .chat-area { max-width: 900px; margin: 0 auto; padding: 20px 20px; width: 100%; }
  .chat-input-area { max-width: 900px; margin: 0 auto; width: 100%; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-accent { color: var(--accent-2); }
.text-muted { color: var(--text-3); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.w-full { width: 100%; }

/* ── PDF drop zone ───────────────────────────────────────────── */
.pdf-dropzone {
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-3);
  font-size: 13px;
}
.pdf-dropzone:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-glow); }
.pdf-status { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ── Server URL display ──────────────────────────────────────── */
.server-url-display { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

/* ── Nous brain state sidebar card ──────────────────────────── */
.nous-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.nous-card:hover { border-color: var(--border-hi); }
.nous-card-title { font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 6px; }
.nous-stat-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.nous-stat-key { color: var(--text-3); }
.nous-stat-val { color: var(--text); font-weight: 500; }
.nous-dream { font-size: 11px; color: var(--text-3); margin-top: 6px; font-style: italic; line-height: 1.4; }

/* Stack row styling */
.stack-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  color: var(--text-2);
}
.stack-row:hover { background: var(--bg-hover); color: var(--text); }
.stack-row.active-stack { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stack-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.active-stack .stack-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.stack-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stack-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack-source { font-size: 10px; color: var(--text-3); display: none; }
.stack-trust { font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: background 0.15s; }
.stack-trust:hover { background: var(--bg-input); }

/* Stack Info Popup */
.stack-popup {
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  width: 280px;
  z-index: 10000;
}
.stack-popup h4 { margin: 0 0 8px 0; font-size: 14px; font-weight: 600; color: var(--text); }
.stack-popup-close { position: absolute; top: 12px; right: 12px; cursor: pointer; color: var(--text-3); font-size: 16px; line-height: 1; }
.stack-popup-close:hover { color: var(--text); }

/* Welcome Stack Pills */
.welcome-stack-pill {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}

/* Message Source Indicators */
.msg-source-math { border-left: 3px solid #10b981; padding-left: 12px; }
.msg-source-stack { border-left: 3px solid var(--accent); padding-left: 12px; }
.msg-source-brain { border-left: 3px solid #8b5cf6; padding-left: 12px; }
.msg-source-llm { border-left: 3px solid var(--border); padding-left: 12px; }

/* Workspace Switcher */
.workspace-switcher { position: relative; }
.workspace-btn {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--surface-2, rgba(255,255,255,0.08));
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 8px; padding: 0.35rem 0.6rem;
  color: var(--text-1, #e8eaf6); cursor: pointer;
  font-size: 0.85rem; transition: background 0.15s;
}
.workspace-btn:hover { background: var(--surface-3, rgba(255,255,255,0.14)); }
.workspace-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px; background: var(--surface-1, #1e1e2e);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000; overflow: hidden;
}
.workspace-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem; cursor: pointer;
  transition: background 0.15s; font-size: 0.9rem;
}
.workspace-item:hover { background: var(--surface-2, rgba(255,255,255,0.07)); }
.workspace-item.active { background: var(--primary-muted, rgba(99,102,241,0.15)); }
.workspace-active-dot { color: var(--primary, #6366f1); margin-left: auto; font-weight: bold; }
.workspace-dropdown-footer {
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  padding: 0.5rem 0.9rem;
}
.workspace-dropdown-footer button {
  background: none; border: none; color: var(--primary, #6366f1);
  cursor: pointer; font-size: 0.85rem; padding: 0;
}

/* Workspace Manager */
.workspace-manager-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.8rem; border-radius: 8px;
  background: var(--surface-2, rgba(255,255,255,0.05));
  margin-bottom: 0.4rem;
}
.workspace-manager-info { display: flex; align-items: center; gap: 0.5rem; }
.workspace-manager-name { font-size: 0.9rem; }
.workspace-manager-actions { display: flex; gap: 0.4rem; }
.badge { padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.badge-default { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.badge-active { background: rgba(34,197,94,0.2); color: #86efac; }
.workspace-create-form {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 0.8rem; background: var(--surface-2, rgba(255,255,255,0.04));
  border-radius: 8px; margin-top: 0.5rem;
}
.workspace-create-actions { display: flex; gap: 0.5rem; }

/* Private Vault */
.vault-entry-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem; border-radius: 8px;
  background: var(--surface-2, rgba(255,255,255,0.05));
  margin-bottom: 0.4rem;
}
.vault-entry-key { flex: 1; font-size: 0.88rem; }
.vault-entry-meta { font-size: 0.75rem; color: var(--text-3, #888); }
.vault-add-form {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 0.8rem; background: var(--surface-2, rgba(255,255,255,0.04));
  border-radius: 8px; margin-top: 0.5rem;
}
.vault-form-actions { display: flex; gap: 0.5rem; }
.vault-match-badge {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 8px; padding: 0.5rem 0.75rem;
  font-size: 0.83rem; margin-bottom: 0.75rem; color: #c7d2fe;
}

/* Learning controls */
.setting-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 0.75rem 0;
}
.setting-info label { font-weight: 500; font-size: 0.9rem; }
.setting-desc { font-size: 0.8rem; color: var(--text-3, #888); margin-top: 0.2rem; }

/* P2: My Data Dashboard */
.mydata-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 10px 14px;
  background: var(--surface-1, rgba(255,255,255,0.03));
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: center;
  min-height: 88px;
  user-select: none;
}
.mydata-card:hover {
  background: var(--surface-2, rgba(255,255,255,0.07));
}
.mydata-card:active {
  background: var(--surface-3, rgba(255,255,255,0.1));
}
.mydata-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}
.mydata-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-1, #f0f0f0);
  line-height: 1.1;
}
.mydata-lbl {
  font-size: 0.68rem;
  color: var(--text-3, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
}
.md-stack-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(99,102,241,0.13);
  border: 1px solid rgba(99,102,241,0.25);
  color: #c7d2fe;
  cursor: pointer;
  transition: background 0.15s;
}
.md-stack-chip:hover {
  background: rgba(99,102,241,0.22);
}
