/* ═══════════════════════════════════════════════════════════════
   RISHI TERMINAL — Conscious AI
   Theme system: 4 themes ported from PRANA U1 base.css
   ═══════════════════════════════════════════════════════════════ */

/* ── THEME BLOCKS (applied to <html data-theme="...">) ──────── */
html[data-theme="dark-cosmos"] {
  --bg:#0A0806; --bg2:#120C08; --bg3:#1A1008;
  --surface:rgba(250,247,242,0.04); --surface2:rgba(250,247,242,0.07);
  --border:rgba(212,169,106,0.18); --border2:rgba(212,169,106,0.35);
  --text:rgba(250,247,242,0.95); --text2:rgba(250,247,242,0.65);
  --text3:rgba(250,247,242,0.38); --text-label:rgba(250,247,242,0.54);
  --gold:#D4A96A; --gold-l:#F6B344; --gold-d:#A87840;
  --teal:#1A9B8E; --teal-l:#22C4B4; --teal-d:#0d7a6f;
  --saffron:#FF6B35; --sage:#8FBC94; --purple:#9B7CC4; --earth:#D4654F;
  --vata:#9B7CC4; --pitta:#FF6B35; --kapha:#1A9B8E;
  --nav-bg:rgba(10,8,6,0.92); --input-bg:rgba(250,247,242,0.06);
  --yantra-stroke:rgba(212,169,106,0.25); --yantra-fill:rgba(212,169,106,0.04);
  --lotus-color:rgba(155,124,196,0.3); --card-glow:0 0 40px rgba(212,169,106,0.06);
  /* terminal-extra tokens */
  --surface3:rgba(250,247,242,0.11); --border3:rgba(212,169,106,0.55);
  --text4:rgba(250,247,242,0.18); --gold-xl:#F8E5BE;
  --sidebar-bg:#0D0A07;
}
html[data-theme="dark-fire"] {
  --bg:#080504; --bg2:#120808; --bg3:#1A0C08;
  --surface:rgba(255,107,53,0.05); --surface2:rgba(255,107,53,0.09);
  --border:rgba(255,107,53,0.22); --border2:rgba(255,107,53,0.45);
  --text:rgba(250,240,235,0.96); --text2:rgba(250,240,235,0.65);
  --text3:rgba(250,240,235,0.38); --text-label:rgba(250,240,235,0.54);
  --gold:#F6B344; --gold-l:#FFD080; --gold-d:#C48830;
  --teal:#FF8C55; --teal-l:#FFA070; --teal-d:#E05020;
  --saffron:#FF4500; --sage:#FF9A6C; --purple:#FF6B35; --earth:#C44430;
  --vata:#FF9A6C; --pitta:#FF4500; --kapha:#FF6B35;
  --nav-bg:rgba(8,5,4,0.94); --input-bg:rgba(255,107,53,0.08);
  --yantra-stroke:rgba(255,107,53,0.3); --yantra-fill:rgba(255,107,53,0.05);
  --lotus-color:rgba(255,107,53,0.35); --card-glow:0 0 40px rgba(255,107,53,0.08);
  /* terminal-extra tokens */
  --surface3:rgba(255,107,53,0.14); --border3:rgba(255,107,53,0.65);
  --text4:rgba(250,240,235,0.18); --gold-xl:#FFE8B8;
  --sidebar-bg:#060404;
}
html[data-theme="dark-ocean"] {
  --bg:#030810; --bg2:#050D1A; --bg3:#081220;
  --surface:rgba(26,155,142,0.06); --surface2:rgba(26,155,142,0.11);
  --border:rgba(26,155,142,0.25); --border2:rgba(26,155,142,0.5);
  --text:rgba(235,248,250,0.96); --text2:rgba(235,248,250,0.65);
  --text3:rgba(235,248,250,0.38); --text-label:rgba(235,248,250,0.54);
  --gold:#22C4B4; --gold-l:#44E8D8; --gold-d:#0d9a8c;
  --teal:#1A9B8E; --teal-l:#22C4B4; --teal-d:#0d7a6f;
  --saffron:#44E8D8; --sage:#6BCCC0; --purple:#22C4B4; --earth:#1A9B8E;
  --vata:#22C4B4; --pitta:#44E8D8; --kapha:#1A9B8E;
  --nav-bg:rgba(3,8,16,0.94); --input-bg:rgba(26,155,142,0.1);
  --yantra-stroke:rgba(26,155,142,0.3); --yantra-fill:rgba(26,155,142,0.05);
  --lotus-color:rgba(26,155,142,0.35); --card-glow:0 0 40px rgba(26,155,142,0.08);
  /* terminal-extra tokens */
  --surface3:rgba(26,155,142,0.18); --border3:rgba(26,155,142,0.70);
  --text4:rgba(235,248,250,0.18); --gold-xl:#B8F5F0;
  --sidebar-bg:#020609;
}
html[data-theme="midnight-purple"] {
  --bg:#070510; --bg2:#0E0A1C; --bg3:#151028;
  --surface:rgba(155,124,196,0.06); --surface2:rgba(155,124,196,0.11);
  --border:rgba(155,124,196,0.25); --border2:rgba(155,124,196,0.5);
  --text:rgba(242,238,250,0.96); --text2:rgba(242,238,250,0.65);
  --text3:rgba(242,238,250,0.38); --text-label:rgba(242,238,250,0.54);
  --gold:#B99BE0; --gold-l:#D4BCF4; --gold-d:#8A66C4;
  --teal:#9B7CC4; --teal-l:#B99BE0; --teal-d:#6A4E9E;
  --saffron:#D4BCF4; --sage:#A98CD4; --purple:#9B7CC4; --earth:#8A66C4;
  --vata:#B99BE0; --pitta:#D4BCF4; --kapha:#9B7CC4;
  --nav-bg:rgba(7,5,16,0.94); --input-bg:rgba(155,124,196,0.1);
  --yantra-stroke:rgba(155,124,196,0.3); --yantra-fill:rgba(155,124,196,0.05);
  --lotus-color:rgba(155,124,196,0.35); --card-glow:0 0 40px rgba(155,124,196,0.08);
  /* terminal-extra tokens */
  --surface3:rgba(155,124,196,0.18); --border3:rgba(155,124,196,0.70);
  --text4:rgba(242,238,250,0.18); --gold-xl:#E8DCFA;
  --sidebar-bg:#05040C;
}
html[data-theme="light-vedic"] {
  --bg:#FAF7F0; --bg2:#F5F0E8; --bg3:#EDE6D8;
  --surface:rgba(44,28,8,0.04); --surface2:rgba(44,28,8,0.08);
  --border:rgba(168,120,60,0.22); --border2:rgba(168,120,60,0.45);
  --text:rgba(28,18,8,0.92); --text2:rgba(28,18,8,0.62);
  --text3:rgba(28,18,8,0.38); --text-label:rgba(28,18,8,0.58);
  --gold:#A87840; --gold-l:#C49050; --gold-d:#7A5428;
  --teal:#0d7a6f; --teal-l:#1A9B8E; --teal-d:#085a50;
  --saffron:#D45520; --sage:#4A8A50; --purple:#6040A0; --earth:#B04030;
  --vata:#6040A0; --pitta:#D45520; --kapha:#0d7a6f;
  --nav-bg:rgba(245,240,232,0.96); --input-bg:rgba(44,28,8,0.06);
  --yantra-stroke:rgba(168,120,60,0.35); --yantra-fill:rgba(168,120,60,0.06);
  --lotus-color:rgba(96,64,160,0.25); --card-glow:0 4px 24px rgba(168,120,60,0.12);
  /* terminal-extra tokens */
  --surface3:rgba(44,28,8,0.13); --border3:rgba(168,120,60,0.65);
  --text4:rgba(28,18,8,0.22); --gold-xl:#5A3A10;
  --sidebar-bg:#EDE6D8;
}

/* ── NON-COLOR TOKENS (layout, type, spacing — shared all themes) */
:root {
  /* Sidebar */
  --sidebar-w:  260px;
  --sidebar-collapsed-w: 56px;
  /* Source panel */
  --panel-w: 320px;
  --panel-w-min: 260px;
  --panel-w-max: 520px;
  /* Source rail (legacy, kept for fallback) */
  --rail-w: 300px;
  /* Type */
  --fs-micro:   0.6875rem;
  --fs-caption: 0.75rem;
  --fs-sm:      0.875rem;
  --fs-body:    1rem;
  --fs-lead:    1.125rem;
  /* Font stacks */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  letter-spacing: 0.01em;
  height: 100%;
  overflow: hidden;
  min-width: 768px;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── FOCUS ──────────────────────────────────────────────────── */
:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── APP SHELL ──────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   LEFT SIDEBAR
   ══════════════════════════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.25s ease, min-width 0.25s ease;
}

/* Collapse toggle button in brand row */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.15s, color 0.15s, opacity 0.25s;
}
.sidebar-collapse-btn:hover { background: var(--surface2); color: var(--text2); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; }

/* ── COLLAPSED SIDEBAR (class-based, single source of truth) ── */
#sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  min-width: var(--sidebar-collapsed-w);
}

#sidebar.collapsed .sidebar-wordmark,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .nav-badge,
#sidebar.collapsed .soon-chip,
#sidebar.collapsed .recent-section,
#sidebar.collapsed .credits-text,
#sidebar.collapsed .user-meta { display: none !important; }

#sidebar.collapsed .sidebar-brand { justify-content: center; padding: 16px 0; }
#sidebar.collapsed .sidebar-logo { margin: 0; }
#sidebar.collapsed .sidebar-collapse-btn { margin: 0; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .nav-icon { margin: 0; }
#sidebar.collapsed .sidebar-divider { display: none; }
#sidebar.collapsed .credits-card { padding: 10px 0; justify-content: center; }
#sidebar.collapsed .credits-icon { margin: 0; }
#sidebar.collapsed .user-row { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .user-avatar { margin: 0; }
#sidebar.collapsed .sidebar-bottom { padding: 8px 0; }
#sidebar.collapsed .section-header { display: none; }
#sidebar.collapsed .horizon-item { justify-content: center; padding: 10px 0; overflow: hidden; }
#sidebar.collapsed .horizon-icon { margin: 0; }
#sidebar.collapsed .horizon-label { display: none !important; }

/* When collapsed, collapse button icon flips to chevron-right */
#sidebar.collapsed .sidebar-collapse-btn .ic-collapse-icon {
  transform: rotate(180deg);
}

/* icon-rail mode at < 1100px — JS adds .collapsed; keep media as fallback */
@media (max-width: 1099px) {
  #sidebar:not(.collapsed) {
    /* JS will add .collapsed at this breakpoint, but as safety fallback: */
  }
  .theme-popover { left: 8px; }
}

/* Brand header */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  color: var(--gold);
  flex-shrink: 0;
}

.sidebar-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.sidebar-wordmark-main {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.sidebar-wordmark-sub {
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Scrollable middle */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

/* Nav items */
.nav-section {
  padding: 4px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 6px;
  color: var(--text2);
  font-size: var(--fs-sm);
  position: relative;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  border: none;
  background: none;
  width: calc(100% - 12px);
  text-align: left;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  color: var(--gold);
  background: rgba(212,169,106,0.08);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 60%;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  background: rgba(212,169,106,0.12);
  color: var(--gold-d);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 20px;
  letter-spacing: 0;
}

/* Divider */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 14px;
}

/* Section header */
.section-header {
  font-size: var(--fs-micro);
  letter-spacing: 0.15em;
  color: var(--text4);
  text-transform: uppercase;
  padding: 10px 20px 4px;
  font-family: var(--font-mono);
}

/* Horizon items (soon) */
.horizon-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: default;
  border-radius: 8px;
  margin: 1px 6px;
  color: var(--text4);
  font-size: var(--fs-sm);
  opacity: 0.7;
}

.horizon-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text4);
}

.horizon-label {
  flex: 1;
}

.soon-chip {
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  color: var(--text4);
  border: 1px solid rgba(250,247,242,0.12);
  padding: 1px 5px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

/* Recent history */
.recent-section {
  padding: 4px 0 8px;
}

.recent-item {
  display: block;
  padding: 6px 20px;
  font-size: var(--fs-caption);
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.recent-item:hover { color: var(--text2); }

/* Bottom pinned */
.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.credits-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
}

.credits-icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
  flex-shrink: 0;
}

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

.credits-amount {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--gold);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.credits-bar-wrap {
  height: 3px;
  background: var(--surface3);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.credits-bar {
  height: 100%;
  width: 62%;
  background: linear-gradient(90deg, var(--gold-d), var(--gold-l));
  border-radius: 2px;
}

.credits-topup {
  font-size: var(--fs-micro);
  color: var(--text3);
  text-decoration: underline;
  text-decoration-color: var(--border);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin-top: 3px;
  display: block;
  transition: color 0.15s;
}

.credits-topup:hover { color: var(--gold); }

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}

.user-row:hover { background: var(--surface); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-d), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tier {
  font-size: var(--fs-micro);
  color: var(--gold-d);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

/* ══════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════ */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Radial gold glow top-center */
#main::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(212,169,106,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Status strip */
#status-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 24px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-caption);
  color: var(--text3);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.status-strip-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.status-divider {
  width: 1px;
  height: 12px;
  background: var(--border);
}

.omni-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  color: var(--text3);
  letter-spacing: 0.06em;
}

kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text2);
}

/* ── VIEW CONTAINER ─────────────────────────────────────────── */
#view-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════════
   VIEW A — HOME
   ══════════════════════════════════════════════════════════════ */
#view-home {
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.home-center {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Mandala ring decoration */
.mandala-ring {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px dotted rgba(212,169,106,0.06);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: mandala-spin 120s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.mandala-ring-inner {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 1px dotted rgba(212,169,106,0.04);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: mandala-spin 80s linear infinite reverse;
  pointer-events: none;
  z-index: 0;
}

@keyframes mandala-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .mandala-ring, .mandala-ring-inner { animation: none; }
}

.home-wordmark-wrap {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 18px;
}

.home-devanagari {
  font-size: 1.1rem;
  color: var(--text3);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  display: block;
}

.home-wordmark {
  font-size: clamp(3.5rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  background: linear-gradient(135deg, var(--gold-d) 0%, var(--gold-l) 50%, var(--gold-xl) 80%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  display: block;
}

.home-tagline {
  font-size: var(--fs-sm);
  color: var(--text3);
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

/* ── OMNIBOX ─────────────────────────────────────────────────── */
.omnibox {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 14px 14px 10px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  z-index: 1;
}

.omnibox:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,169,106,0.12);
}

.omnibox.council-mode {
  border-color: rgba(155,124,196,0.5);
}

.omnibox.council-mode:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(155,124,196,0.12);
}

.omnibox-textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: var(--fs-body);
  font-family: var(--font-sans);
  line-height: 1.5;
  resize: none;
  min-height: 56px;
  max-height: 160px;
  overflow-y: auto;
  padding: 0 0 8px;
}

.omnibox-textarea::placeholder {
  color: var(--text3);
}

/* Controls row */
.omnibox-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.mode-pills {
  display: flex;
  gap: 4px;
}

.mode-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  font-size: var(--fs-caption);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.mode-pill svg { width: 13px; height: 13px; }

.mode-pill:hover {
  border-color: var(--border2);
  color: var(--text2);
  background: var(--surface2);
}

.mode-pill.active {
  border-color: var(--border2);
  color: var(--gold);
  background: rgba(212,169,106,0.08);
}

.mode-pill.active.council-active {
  color: var(--purple);
  border-color: rgba(155,124,196,0.4);
  background: rgba(155,124,196,0.08);
}

.controls-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Depth selector */
.depth-selector {
  position: relative;
}

.depth-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text2);
  font-size: var(--fs-caption);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.depth-btn svg { width: 13px; height: 13px; }

.depth-btn:hover {
  border-color: var(--border2);
  background: var(--surface2);
}

.depth-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 6px;
  display: none;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.6);
}

.depth-popover.open { display: block; }

.depth-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.depth-option:hover { background: var(--surface2); }

.depth-option.active { background: rgba(212,169,106,0.06); }

.depth-option-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  display: block;
}

.depth-option-desc {
  font-size: var(--fs-caption);
  color: var(--text3);
  display: block;
  margin-top: 1px;
}

.depth-option-engine {
  font-size: var(--fs-micro);
  color: var(--text4);
  font-family: var(--font-mono);
  display: block;
  margin-top: 2px;
}

.depth-option-cost {
  font-size: var(--fs-caption);
  color: var(--gold-d);
  font-family: var(--font-mono);
  margin-left: auto;
  flex-shrink: 0;
  padding-top: 2px;
}

.depth-check {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--gold);
  display: none;
}

.depth-option.active .depth-check { display: block; }

/* Send button */
.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--gold-l);
  transform: scale(1.05);
}

.send-btn:active { transform: scale(0.97); }

.send-btn svg {
  width: 16px;
  height: 16px;
  color: var(--bg);
}

/* Suggestion chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  z-index: 1;
  position: relative;
}

.suggestion-chip {
  font-size: var(--fs-caption);
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  cursor: pointer;
  background: none;
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.suggestion-chip:hover {
  border-color: var(--border2);
  color: var(--text2);
  background: var(--surface);
}

/* Footnote */
.omni-footnote {
  font-size: var(--fs-micro);
  color: var(--text4);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* @-mention popover */
.mention-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 6px;
  display: none;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
}

.mention-popover.open { display: block; }

.mention-header {
  font-size: var(--fs-micro);
  color: var(--text4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px 6px;
  font-family: var(--font-mono);
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}

.mention-item:hover { background: var(--surface2); }

.mention-sage {
  font-size: var(--fs-sm);
  color: var(--text);
}

.mention-stream {
  font-size: var(--fs-caption);
  color: var(--text3);
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════
   VIEW B — SITTING
   ══════════════════════════════════════════════════════════════ */
#view-sitting {
  flex-direction: row;
  overflow: hidden;
}

.sitting-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.sitting-header {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-caption);
  color: var(--text3);
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  font-family: var(--font-sans);
}

.back-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.back-btn svg { width: 14px; height: 14px; }

/* Conversation column */
.convo-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
}

.convo-inner {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* User bubble */
.user-bubble {
  align-self: flex-end;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  max-width: 80%;
  font-size: var(--fs-sm);
  color: var(--text);
}

/* Sage answer block */
.sage-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sage-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sage-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(212,169,106,0.12);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--gold);
  flex-shrink: 0;
}

.sage-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

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

.sage-chip {
  font-size: var(--fs-micro);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.chip-stream {
  background: rgba(212,169,106,0.08);
  border: 1px solid var(--border);
  color: var(--gold-d);
}

.chip-depth {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
}

.sage-body {
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.75;
  padding-left: 42px;
}

.sage-body p + p { margin-top: 10px; }

.cite-sup {
  font-size: 0.65em;
  vertical-align: super;
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-mono);
  margin-left: 1px;
}

/* Typing cursor */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .typing-cursor { animation: none; }
}

/* Citations */
.citations-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 42px;
  align-items: center;
}

.cite-chip {
  font-size: var(--fs-micro);
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  color: var(--gold-d);
  background: rgba(212,169,106,0.05);
  font-family: var(--font-mono);
  cursor: pointer;
}

.cite-chip:hover { border-color: var(--gold); color: var(--gold); }

.epistemic-chip {
  font-size: var(--fs-micro);
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid rgba(26,155,142,0.4);
  color: var(--teal-l);
  background: rgba(26,155,142,0.06);
  font-family: var(--font-mono);
}

.confidence-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 42px;
}

.confidence-label {
  font-size: var(--fs-micro);
  color: var(--text4);
  font-family: var(--font-mono);
}

.confidence-bar-wrap {
  flex: 1;
  max-width: 120px;
  height: 3px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-l));
  border-radius: 2px;
}

/* Council header */
.council-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 42px 0;
}

.council-title {
  font-size: var(--fs-caption);
  letter-spacing: 0.15em;
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 600;
}

.council-avatars {
  display: flex;
  gap: 4px;
}

.council-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(212,169,106,0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--gold-d);
}

.council-sage-take {
  padding: 10px 14px;
  background: var(--surface);
  border-left: 2px solid var(--border2);
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
}

.council-sage-label {
  font-size: var(--fs-micro);
  color: var(--gold-d);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.council-sage-text {
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.65;
}

.council-synthesis {
  background: rgba(212,169,106,0.06);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 14px 16px;
}

.synthesis-label {
  font-size: var(--fs-micro);
  letter-spacing: 0.15em;
  color: var(--gold);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.synthesis-text {
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.7;
}

/* Compact composer */
.compact-composer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.compact-omnibox {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.compact-omnibox:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212,169,106,0.1);
}

.compact-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: var(--fs-sm);
  color: var(--text);
  font-family: var(--font-sans);
}

.compact-input::placeholder { color: var(--text4); }

/* ── SOURCES TOGGLE BUTTON (in sitting header) ──────────────── */
.sources-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: none;
  color: var(--text2);
  font-size: var(--fs-caption);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.sources-toggle-btn svg { width: 14px; height: 14px; }
.sources-toggle-btn:hover { background: var(--surface2); border-color: var(--gold); color: var(--gold); }
.sources-toggle-btn[aria-pressed="true"] {
  background: rgba(212,169,106,0.08);
  border-color: var(--gold);
  color: var(--gold);
}
.sources-toggle-badge {
  background: var(--gold);
  color: var(--bg);
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 10px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
  line-height: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── SOURCES PANEL (right, on-demand, tabbed, resizable) ─────── */
#sources-panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  border-left: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  /* slide-in transition */
  transform: translateX(0);
  transition: transform 0.25s ease, width 0.25s ease, min-width 0.25s ease;
}

#sources-panel[hidden] {
  display: none !important;
}

/* On narrow screens (<1250px) overlay the convo instead of squeezing it */
@media (max-width: 1249px) {
  #sources-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 500;
    box-shadow: -4px 0 32px rgba(0,0,0,0.5);
  }
}

/* Drag handle on left edge */
.panel-drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.15s;
}
.panel-drag-handle:hover,
.panel-drag-handle.dragging {
  background: var(--gold);
  opacity: 0.4;
}

/* Panel header (tabs + close) */
.panel-header {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 8px 0 12px;
  gap: 4px;
}

.panel-tabs {
  display: flex;
  flex: 1;
  gap: 2px;
  overflow: hidden;
}

.panel-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 10px;
  font-size: var(--fs-caption);
  color: var(--text3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.panel-tab:hover { color: var(--text2); }

.panel-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.panel-tab-count {
  font-size: 0.6rem;
  background: var(--surface3);
  color: var(--text3);
  border-radius: 10px;
  padding: 0 5px;
  font-family: var(--font-mono);
  min-width: 14px;
  text-align: center;
}

.panel-tab.active .panel-tab-count {
  background: rgba(212,169,106,0.15);
  color: var(--gold);
}

.panel-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  transition: background 0.15s, color 0.15s;
}
.panel-close-btn:hover { background: var(--surface2); color: var(--text2); }
.panel-close-btn svg { width: 14px; height: 14px; }

/* Panel body / panes */
.panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-pane[hidden] { display: none; }

/* Empty state in panes */
.panel-empty {
  font-size: var(--fs-caption);
  color: var(--text4);
  text-align: center;
  padding: 32px 16px;
  line-height: 1.6;
  font-style: italic;
}

/* Source card num badge */
.source-card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(212,169,106,0.12);
  border: 1px solid var(--border);
  color: var(--gold);
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 6px;
}

/* Source card highlight (cite-chip click) */
.source-card.highlight-pulse {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212,169,106,0.25);
  transition: border-color 0.15s, box-shadow 0.15s;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes source-pulse {
    0%   { box-shadow: 0 0 0 0px rgba(212,169,106,0.6); }
    50%  { box-shadow: 0 0 0 4px rgba(212,169,106,0.2); }
    100% { box-shadow: 0 0 0 0px rgba(212,169,106,0); }
  }
  .source-card.highlight-pulse {
    animation: source-pulse 0.8s ease;
  }
}

/* Legacy rail-scroll / rail-header (kept for backward compat) */
.rail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rail-header {
  font-size: var(--fs-micro);
  letter-spacing: 0.15em;
  color: var(--text4);
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
}

.source-card-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.source-card-stream {
  font-size: var(--fs-micro);
  color: var(--gold-d);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.source-card-excerpt {
  font-size: var(--fs-caption);
  color: var(--text3);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-card-link {
  display: inline-block;
  font-size: var(--fs-micro);
  color: var(--gold-d);
  margin-top: 7px;
  cursor: pointer;
  transition: color 0.15s;
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font-sans);
}

.source-card-link:hover { color: var(--gold); }

.grounding-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
}

.grounding-label {
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  color: var(--text4);
  font-family: var(--font-mono);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.grounding-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-size: var(--fs-caption);
}

.grounding-key { color: var(--text3); }

.grounding-val {
  color: var(--teal-l);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}

.grounding-note {
  font-size: var(--fs-micro);
  color: var(--text4);
  border-top: 1px solid var(--border);
  padding-top: 7px;
  margin-top: 7px;
  font-style: italic;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   AUTH MODAL
   ══════════════════════════════════════════════════════════════ */
.auth-modal {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
}

.auth-modal[hidden] { display: none; }

.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-lotus {
  width: 36px;
  height: 36px;
  color: var(--gold);
  flex-shrink: 0;
}

.auth-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.auth-sub {
  font-size: var(--fs-caption);
  color: var(--text3);
  margin-top: 2px;
}

.auth-label {
  display: block;
  font-size: var(--fs-caption);
  color: var(--text3);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.auth-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  margin-bottom: 12px;
}

.auth-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212,169,106,0.12);
}

.auth-input::placeholder { color: var(--text4); }

.auth-btn {
  width: 100%;
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 11px 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s;
  letter-spacing: 0.04em;
}

.auth-btn:hover { background: var(--gold-l); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-btn-ghost {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 0;
  color: var(--text3);
  font-size: var(--fs-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  margin-top: 8px;
  transition: border-color 0.15s, color 0.15s;
}

.auth-btn-ghost:hover { border-color: var(--border2); color: var(--text2); }

.auth-note {
  font-size: var(--fs-caption);
  color: var(--text3);
  margin-top: 10px;
  line-height: 1.4;
  min-height: 1.4em;
}

.auth-note.error { color: var(--saffron); }
.auth-note.success { color: var(--sage); }

/* ══════════════════════════════════════════════════════════════
   USER SIGN-OUT MENU
   ══════════════════════════════════════════════════════════════ */
.user-menu {
  position: fixed;
  bottom: 90px;
  left: 10px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 4px;
  z-index: 8000;
  min-width: 140px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.user-menu[hidden] { display: none; }

.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text2);
  font-size: var(--fs-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.12s, color 0.12s;
}

.user-menu-item:hover { background: var(--surface2); color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   SIGNED-OUT OMNIBOX STATE
   ══════════════════════════════════════════════════════════════ */
.omnibox.signed-out {
  opacity: 0.55;
  cursor: pointer;
}

.omnibox.signed-out .omnibox-textarea {
  cursor: pointer;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   SAGE @MENTION CHIP (pending summon)
   ══════════════════════════════════════════════════════════════ */
.mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212,169,106,0.1);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  margin-bottom: 6px;
  font-size: var(--fs-caption);
  color: var(--gold);
  font-family: var(--font-mono);
}

.mention-chip[hidden] { display: none; }

.mention-chip-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: color 0.12s;
}

.mention-chip-dismiss:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   COUNCIL PULSE (loading state)
   ══════════════════════════════════════════════════════════════ */
.council-pulse {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 42px;
  color: var(--text3);
  font-size: var(--fs-sm);
  font-style: italic;
}

.council-pulse-dots {
  display: flex;
  gap: 4px;
}

.council-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-d);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.council-pulse-dot:nth-child(2) { animation-delay: 0.2s; }
.council-pulse-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

@media (prefers-reduced-motion: reduce) {
  .council-pulse-dot { animation: none; opacity: 0.6; }
}

/* ══════════════════════════════════════════════════════════════
   DEPTH NOTICE (depth downgrade)
   ══════════════════════════════════════════════════════════════ */
.depth-notice {
  font-size: var(--fs-caption);
  color: var(--gold-d);
  padding: 6px 42px;
  font-style: italic;
  opacity: 0.8;
}

/* ══════════════════════════════════════════════════════════════
   FOLLOWUP CHIPS (model-generated related questions)
   ══════════════════════════════════════════════════════════════ */
.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 42px;
  margin-top: 4px;
}

.followup-chip {
  font-size: var(--fs-caption);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text3);
  background: none;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.followup-chip:hover {
  border-color: var(--border2);
  color: var(--text2);
  background: var(--surface);
}

/* ══════════════════════════════════════════════════════════════
   COUNCIL GATED NOTICE
   ══════════════════════════════════════════════════════════════ */
.council-gated-notice {
  background: rgba(155,124,196,0.08);
  border: 1px solid rgba(155,124,196,0.3);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--text2);
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin: 0 42px;
}

/* ══════════════════════════════════════════════════════════════
   STREAMED SAGE BODY (live appending)
   ══════════════════════════════════════════════════════════════ */
.sage-body-stream {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════
   COSMIC CANVAS — home view background
   ══════════════════════════════════════════════════════════════ */
#cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  /* stays inside view-home via DOM; hidden automatically when view-home loses .active */
}

/* Cosmos hidden on light-vedic */
htmlhtml[data-theme="light-vedic"] #cosmos {
  display: none;
}

/* Home content sits above canvas */
#view-home .home-center {
  position: relative;
  z-index: 1;
}

/* Slightly reduce mandala ring opacity since cosmos adds depth */
.mandala-ring {
  border-color: rgba(212,169,106,0.04) !important;
}
.mandala-ring-inner {
  border-color: rgba(212,169,106,0.03) !important;
}

/* ══════════════════════════════════════════════════════════════
   THEME PICKER
   ══════════════════════════════════════════════════════════════ */
.theme-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  margin: 0 auto 6px;
}

.theme-picker-btn:hover {
  background: var(--surface2);
  color: var(--text2);
}

.theme-picker-btn svg {
  width: 16px;
  height: 16px;
}

.theme-popover {
  position: fixed;
  bottom: 90px;
  left: 10px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 6px;
  z-index: 8500;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: none;
}

.theme-popover.open { display: block; }

.theme-popover-header {
  font-size: var(--fs-micro);
  color: var(--text4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  padding: 4px 8px 6px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
  font-family: var(--font-sans);
}

.theme-option:hover { background: var(--surface2); }
.theme-option.active { background: var(--surface); }

.theme-option-name {
  font-size: var(--fs-sm);
  color: var(--text);
  flex: 1;
}

.theme-dots {
  display: flex;
  gap: 3px;
}

.theme-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ══════════════════════════════════════════════════════════════
   FORMATTED ANSWER ELEMENTS (RishiFmt output)
   ══════════════════════════════════════════════════════════════ */

/* Remove streaming pre-wrap once formatted */
.sage-body p {
  margin-bottom: 8px;
  line-height: 1.75;
}

.sage-body p.rmlead {
  font-size: var(--fs-lead);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* Headers */
.sage-body h3 {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: 14px 0 6px;
  text-transform: uppercase;
}

.sage-body h4 {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--gold-d);
  margin: 10px 0 4px;
}

/* Bold / italic */
.sage-body b { color: var(--text); font-weight: 700; }
.sage-body em { font-style: italic; color: var(--text2); }
.sage-body em.rishi-em-line { display: block; font-style: italic; color: var(--text3); margin: 4px 0; }

/* Lists */
.sage-body ol.rmol,
.sage-body ul.rmul {
  margin: 8px 0 8px 0;
  padding: 0;
  list-style: none;
}

.sage-body ol.rmol { counter-reset: rmol; }

.sage-body ol.rmol > li,
.sage-body ul.rmul > li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.65;
}

.sage-body ol.rmol > li::before {
  counter-increment: rmol;
  content: counter(rmol);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
  background: rgba(212,169,106,0.10);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sage-body ul.rmul > li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  margin-top: 0.55em;
}

/* Superscript citation pills */
.sage-body sup.rcjump {
  font-size: 0.62em;
  vertical-align: super;
  color: var(--gold);
  background: rgba(212,169,106,0.12);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  cursor: pointer;
  margin-left: 1px;
  line-height: 1;
}

/* Mantra box */
.sage-body .rmantra-box {
  text-align: center;
  border-left: 3px solid var(--gold-d);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 12px 0;
}

.sage-body .rmantra-skt {
  font-size: var(--fs-lead);
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* Rishi card (▸/✦ blocks) */
.sage-body .rishi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0;
}

.sage-body .rishi-card-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.sage-body .rishi-card-body {
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.6;
}

/* Callout (> blockquote) */
.sage-body .rcallout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 11px 14px;
  margin: 10px 0;
  font-size: var(--fs-sm);
  color: var(--text2);
  line-height: 1.6;
}

.sage-body .rcallout-sparkle {
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 1px;
}

/* Markdown table */
.sage-body .rmtable-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sage-body .rmtable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-caption);
}

.sage-body .rmtable th {
  background: var(--surface2);
  color: var(--gold);
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border2);
}

.sage-body .rmtable td {
  padding: 7px 12px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.sage-body .rmtable tr:last-child td {
  border-bottom: none;
}

/* council formatted text elements */
.council-sage-text h3,
.council-sage-text h4,
.synthesis-text h3,
.synthesis-text h4 {
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--gold);
  margin: 8px 0 4px;
}

.council-sage-text b,
.synthesis-text b { color: var(--text); }

.council-sage-text em,
.synthesis-text em { font-style: italic; color: var(--text2); }

.council-sage-text sup.rcjump,
.synthesis-text sup.rcjump {
  font-size: 0.62em;
  vertical-align: super;
  color: var(--gold);
  font-family: var(--font-mono);
}

.council-sage-text ul.rmul,
.council-sage-text ol.rmol,
.synthesis-text ul.rmul,
.synthesis-text ol.rmol {
  list-style: none;
  margin: 6px 0;
  padding: 0;
}

.council-sage-text ul.rmul > li,
.council-sage-text ol.rmol > li,
.synthesis-text ul.rmul > li,
.synthesis-text ol.rmol > li {
  display: flex;
  gap: 6px;
  padding: 2px 0;
  font-size: var(--fs-sm);
  color: var(--text2);
}

.council-sage-text ul.rmul > li::before,
.synthesis-text ul.rmul > li::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-d);
  flex-shrink: 0;
  margin-top: 0.6em;
}


/* user-menu: theme section */
.user-menu { min-width: 210px; }
.user-menu-header {
  font-size: 0.625rem; letter-spacing: 0.2em; color: var(--text3);
  padding: 8px 14px 4px; font-weight: 600;
}
.user-menu-divider { height: 1px; background: var(--border); margin: 6px 8px; }
.user-menu .theme-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 7px 14px; background: none; border: none;
  border-radius: 7px; cursor: pointer; color: var(--text2); font-size: 0.8125rem;
}
.user-menu .theme-option:hover { background: var(--surface2); color: var(--text); }
.user-menu .theme-option.active { color: var(--gold-l); }
.user-menu .theme-option.active .theme-option-name::before { content: "\2713\00a0"; }
.user-menu .theme-dots { display: inline-flex; gap: 4px; }
.user-menu .theme-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* composer dock hosts the full omnibox in sitting view */
#sittingComposer { max-width: 840px; width: 100%; margin: 0 auto; padding: 10px 20px 16px; }
#sittingComposer .omnibox { width: 100%; }
#sittingComposer .suggestion-anchor { display: none; }
/* popovers open upward from the dock — already the default; keep dock unclipped */
.compact-composer { overflow: visible; }
