/* ═══════════════════════════════════════════════════════════════════════════
   RudraX Web UI — Rudraksh Theme Design System v4.1.0
   🔱 Build · Break · Deploy · Orchestrate
   Inspired by Lord Shiva's Rudraksha — sacred, powerful, grounding
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ─── Rudraksh Design Tokens ───────────────────────────────────────────── */

:root {
  --rudraksh-900: #1a0e07;
  --rudraksh-800: #2d1a0e;
  --rudraksh-700: #3d2617;
  --rudraksh-600: #4a3222;
  --rudraksh-500: #5c4233;
  --rudraksh-400: #7a5e4a;
  --rudraksh-300: #9a7d6b;
  --rudraksh-200: #c4a88a;
  --rudraksh-100: #e8d5be;

  --gold-bright: #f0c850;
  --gold-primary: #d4a843;
  --gold-warm: #c99a2e;
  --gold-deep: #a67c00;
  --gold-glow: rgba(212, 168, 67, 0.15);
  --gold-glow-strong: rgba(212, 168, 67, 0.25);

  --sacred-red: #c0392b;
  --sacred-red-bright: #e74c3c;
  --sacred-red-deep: #8b1a1a;
  --sacred-red-glow: rgba(192, 57, 43, 0.15);

  --saffron: #ff8c00;
  --saffron-light: #ffa940;
  --saffron-deep: #cc7000;

  --void-950: #070504;
  --void-900: #0d0a08;
  --void-800: #151210;
  --void-700: #1e1a16;
  --void-600: #292420;
  --void-500: #352f29;
  --void-400: #443d35;
  --void-300: #5a534a;
  --void-200: #7a7269;
  --void-100: #9e978f;

  --brand-primary: var(--gold-primary);
  --brand-primary-hover: var(--gold-warm);
  --brand-primary-glow: var(--gold-glow);
  --brand-accent: var(--saffron);
  --brand-dark: var(--void-950);
  --brand-success: #27ae60;
  --brand-error: var(--sacred-red);
  --brand-warning: #f39c12;

  --bg-primary: var(--void-950);
  --bg-secondary: var(--void-900);
  --bg-tertiary: var(--void-800);
  --bg-input: var(--void-800);
  --bg-input-focus: var(--void-700);
  --bg-message-user: #1a2a3d;
  --bg-message-agent: var(--void-800);
  --bg-message-tool: #1a2e1a;
  --bg-message-error: #3a1a1a;
  --bg-hover: rgba(212, 168, 67, 0.05);
  --bg-active: rgba(212, 168, 67, 0.08);
  --bg-streaming: rgba(212, 168, 67, 0.03);
  --bg-terminal: #0a0a0a;

  --text-primary: #f5f0eb;
  --text-secondary: #b8a99a;
  --text-muted: #6d6158;
  --text-user: #c4ddff;
  --text-agent: var(--rudraksh-200);
  --text-gold: var(--gold-primary);
  --text-code: var(--saffron-light);

  --border-primary: var(--void-500);
  --border-secondary: var(--void-600);
  --border-focus: var(--gold-deep);
  --border-gold: rgba(212, 168, 67, 0.3);

  --scrollbar-track: var(--void-900);
  --scrollbar-thumb: var(--void-400);

  --sp-xxs: 2px; --sp-xs: 4px; --sp-sm: 8px; --sp-md: 12px;
  --sp-lg: 16px; --sp-xl: 24px; --sp-xxl: 32px;

  --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px;
  --fs-lg: 16px; --fs-xl: 20px; --fs-xxl: 28px; --fs-hero: 42px;

  --sidebar-width: 280px;
  --orchestrator-width: 320px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-xs: 4px;
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px var(--gold-glow);
  --shadow-gold: 0 0 40px var(--gold-glow-strong);

  --cat-engineering: #4fc3f7;
  --cat-marketing: #66bb6a;
  --cat-design: #ce93d8;
  --cat-specialized: #ffb74d;
  --cat-game-development: #ef5350;
  --cat-testing: #26a69a;
  --cat-sales: #ffa726;
  --cat-strategy: #26c6da;
  --cat-paid-media: #ec407a;
  --cat-support: #29b6f6;
  --cat-spatial-computing: #7e57c2;
  --cat-project-management: #8d6e63;
  --cat-product: #ffca28;
  --cat-finance: #66bb6a;
  --cat-academic: #78909c;
}

/* .dark-mode is the default — styles are dark by design.
   .light-mode overrides in the next block. */
.dark-mode { color-scheme: dark; }

.light-mode {
  color-scheme: light;
  --bg-primary: #faf6f1;
  --bg-secondary: #f0ebe4;
  --bg-tertiary: #e8e0d7;
  --bg-input: #ffffff;
  --bg-input-focus: #fdfaf7;
  --bg-message-user: #e8effa;
  --bg-message-agent: #ffffff;
  --bg-message-tool: #e8f5e9;
  --bg-message-error: #ffebee;
  --bg-hover: rgba(212, 168, 67, 0.06);
  --bg-active: rgba(212, 168, 67, 0.1);
  --bg-streaming: rgba(212, 168, 67, 0.03);
  --bg-terminal: #f5f0eb;
  --text-primary: #1a0e07;
  --text-secondary: #5c4233;
  --text-muted: #8a7a6d;
  --text-user: #0d47a1;
  --text-agent: #3d2617;
  --border-primary: #d4c4b0;
  --border-secondary: #e0d5c8;
  --border-focus: var(--gold-deep);
  --scrollbar-track: #f0ebe4;
  --scrollbar-thumb: #c4a88a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.15);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden; font-family: var(--font-main);
  font-size: var(--fs-base); background: var(--bg-primary); color: var(--text-primary);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--gold-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--gold-primary); color: var(--rudraksh-900); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

/* ─── Animations ───────────────────────────────────────────────────────── */

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes goldPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--gold-glow); } 50% { box-shadow: 0 0 20px var(--gold-glow-strong); } }
@keyframes typingDot { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes terminalFadeIn { from { opacity: 0; transform: translateY(1px); } to { opacity: 1; transform: translateY(0); } }
@keyframes statusGlow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.4); } }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.container { display: flex; height: 100vh; overflow: hidden; background: var(--bg-primary); }
.panel { display: flex; flex-direction: column; height: 100%; }

/* ─── Left Sidebar ─────────────────────────────────────────────────────── */

#left-panel {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  background: var(--bg-secondary); border-right: 1px solid var(--border-secondary);
  display: flex; flex-direction: column;
  transition: transform var(--transition-slow), margin var(--transition-slow);
  z-index: 100; overflow: hidden;
}
#left-panel.hidden {
  transform: translateX(-100%); margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--border-gold);
  min-height: 56px; background: linear-gradient(180deg, var(--void-900), var(--void-800));
}
.sidebar-logo { display: flex; align-items: center; gap: var(--sp-sm); }
.logo-icon { font-size: 28px; filter: drop-shadow(0 0 8px var(--gold-glow-strong)); }
.logo-text {
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--gold-bright), var(--saffron), var(--gold-deep));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.logo-subtitle {
  font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400;
  letter-spacing: 1.5px; text-transform: uppercase;
}

/* ─── Sidebar Tabs ───────────────────────────────────────────────────────── */

.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border-secondary); padding: 0 var(--sp-xs);
  background: var(--void-900);
}
.sidebar-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: var(--sp-sm) var(--sp-xs); background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer; font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--transition); font-family: var(--font-main);
}
.sidebar-tab:hover { color: var(--gold-primary); background: var(--bg-hover); }
.sidebar-tab.active { color: var(--gold-primary); border-bottom-color: var(--gold-primary); }

.sidebar-tab-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-tab-content.active { display: flex; }

/* ─── Sidebar Search ─────────────────────────────────────────────────────── */

.sidebar-search { padding: var(--sp-sm) var(--sp-md); }
.sidebar-search input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius-sm); color: var(--text-primary); font-size: var(--fs-sm);
  padding: var(--sp-sm) var(--sp-md); outline: none; transition: all var(--transition);
  font-family: var(--font-main);
}
.sidebar-search input:focus {
  border-color: var(--gold-primary); box-shadow: 0 0 0 3px var(--gold-glow);
}
.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-actions { padding: var(--sp-xs) var(--sp-md); }
.btn-new-chat {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--sp-sm);
  padding: var(--sp-md); background: linear-gradient(135deg, var(--gold-primary), var(--saffron-deep));
  border: none; border-radius: var(--border-radius-sm);
  color: var(--rudraksh-900); font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
  transition: all var(--transition); text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-new-chat:hover {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-primary));
  box-shadow: var(--shadow-gold); transform: translateY(-1px);
}

.sidebar-section { flex: 1; overflow-y: auto; padding: var(--sp-xs) 0; }

/* ─── Chat List ──────────────────────────────────────────────────────────── */

.chats-list { display: flex; flex-direction: column; gap: 1px; padding: 0 var(--sp-xs); }
.chat-item {
  display: flex; align-items: center; padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--border-radius-sm);
  cursor: pointer; transition: all var(--transition); gap: var(--sp-sm); position: relative;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active {
  background: var(--bg-active);
  border-left: 2px solid var(--gold-primary);
}
.chat-item-icon { font-size: 16px; flex-shrink: 0; }
.chat-item-name { flex: 1; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.chat-item.active .chat-item-name { color: var(--text-primary); }
.chat-item-delete {
  opacity: 0; background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; border-radius: 4px; transition: all var(--transition);
}
.chat-item:hover .chat-item-delete { opacity: 1; }
.chat-item-delete:hover { background: var(--sacred-red-glow); color: var(--sacred-red-bright); }

/* ─── Agent List ──────────────────────────────────────────────────────────── */

.agent-category-filter {
  display: flex; flex-wrap: wrap; gap: 4px; padding: var(--sp-xs) var(--sp-md);
}
.agent-cat-chip {
  padding: 2px 8px; border-radius: 10px; font-size: var(--fs-xs); cursor: pointer;
  background: var(--void-800); color: var(--text-muted); border: 1px solid var(--border-secondary);
  transition: all var(--transition); font-family: var(--font-main);
}
.agent-cat-chip:hover, .agent-cat-chip.active {
  border-color: var(--gold-primary); color: var(--gold-primary);
  background: var(--gold-glow);
}

.agents-list { display: flex; flex-direction: column; gap: 1px; padding: 0 var(--sp-xs); }

.agent-item {
  display: flex; align-items: flex-start; padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--border-radius-sm); cursor: pointer; transition: all var(--transition);
  gap: var(--sp-sm); border: 1px solid transparent;
}
.agent-item:hover {
  background: var(--bg-hover); border-color: var(--border-secondary);
}
.agent-item.active {
  background: var(--bg-active); border-color: var(--gold-primary);
  box-shadow: inset 0 0 0 1px var(--gold-glow);
}

.agent-item-emoji {
  font-size: 18px; width: 30px; height: 30px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 8px; background: var(--void-700);
  transition: all var(--transition);
}
.agent-item:hover .agent-item-emoji { background: var(--gold-glow); }

.agent-item-info { flex: 1; min-width: 0; }
.agent-item-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.agent-item-desc {
  font-size: var(--fs-xs); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px;
}
.agent-item-category { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.empty-state {
  text-align: center; padding: var(--sp-xxl) var(--sp-lg);
  color: var(--text-muted); font-size: var(--fs-sm);
}

/* ─── Squad Cards ─────────────────────────────────────────────────────────── */

.squads-list {
  display: grid; grid-template-columns: 1fr; gap: var(--sp-sm); padding: var(--sp-xs) var(--sp-md);
}
.squad-card {
  padding: var(--sp-md); border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-secondary); background: var(--void-800);
  cursor: pointer; transition: all var(--transition);
}
.squad-card:hover {
  border-color: var(--gold-primary);
  background: var(--bg-hover);
  box-shadow: var(--shadow-glow);
}
.squad-card.active {
  border-color: var(--gold-primary);
  background: var(--bg-active);
  box-shadow: var(--shadow-gold);
}
.squad-card-header {
  display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-xs);
}
.squad-card-emoji { font-size: 18px; }
.squad-card-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); flex: 1; }
.squad-card-count { font-size: var(--fs-xs); color: var(--gold-primary); font-weight: 600; }
.squad-card-desc { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; margin-bottom: var(--sp-sm); }
.squad-card-agents { display: flex; flex-wrap: wrap; gap: 4px; }
.squad-agent-chip {
  padding: 1px 6px; border-radius: 8px; font-size: 10px;
  background: var(--void-700); color: var(--text-secondary); border: 1px solid var(--border-secondary);
}

/* ─── Memory Panel ──────────────────────────────────────────────────────── */

.mem-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border-secondary);
}
.mem-project-name { display: flex; align-items: center; gap: var(--sp-sm); }
.mem-project-name span { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.mem-status-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.mem-status-badge.active { background: rgba(39, 174, 96, 0.15); color: #27ae60; border: 1px solid rgba(39, 174, 96, 0.3); }
.mem-status-badge.paused { background: rgba(241, 196, 15, 0.15); color: #f1c40f; border: 1px solid rgba(241, 196, 15, 0.3); }
.mem-status-badge.completed { background: rgba(52, 152, 219, 0.15); color: #3498db; border: 1px solid rgba(52, 152, 219, 0.3); }
.mem-section {
  border-bottom: 1px solid var(--border-secondary); overflow: hidden;
}
.mem-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md); cursor: pointer;
  background: var(--void-800); transition: background var(--transition);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
}
.mem-section-header:hover { background: var(--bg-hover); }
.mem-section-header .badge {
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: var(--void-600); color: var(--text-secondary);
}
.mem-section-header .badge.danger { background: var(--sacred-red-glow); color: var(--sacred-red-bright); }
.mem-section-body {
  padding: var(--sp-sm) var(--sp-md); max-height: 200px; overflow-y: auto;
  transition: max-height var(--transition-slow);
}
.mem-section.collapsed .mem-section-body { max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.mem-section-header .collapse-icon {
  transition: transform var(--transition); font-size: 10px; color: var(--text-muted);
}
.mem-section.collapsed .mem-section-header .collapse-icon { transform: rotate(-90deg); }
.mem-overview-text {
  font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.5;
  padding: var(--sp-xs) 0;
}
.mem-task-row {
  display: flex; align-items: flex-start; gap: var(--sp-sm); padding: var(--sp-xs) 0;
  border-bottom: 1px solid var(--void-800);
}
.mem-task-row:last-child { border-bottom: none; }
.mem-task-icon { flex-shrink: 0; font-size: 14px; }
.mem-task-info { flex: 1; min-width: 0; }
.mem-task-id { font-size: var(--fs-xs); font-weight: 600; color: var(--gold-primary); }
.mem-task-desc { font-size: var(--fs-xs); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-task-agent { font-size: 10px; color: var(--text-muted); }
.mem-log-entry {
  display: flex; align-items: flex-start; gap: var(--sp-xs); padding: var(--sp-xs) 0;
  font-size: var(--fs-xs); border-bottom: 1px solid var(--void-800);
}
.mem-log-entry:last-child { border-bottom: none; }
.mem-log-entry.task_result { border-left: 2px solid var(--gold-primary); padding-left: var(--sp-sm); }
.mem-log-entry.decision { border-left: 2px solid #27ae60; padding-left: var(--sp-sm); }
.mem-log-entry.handoff { border-left: 2px solid #3498db; padding-left: var(--sp-sm); }
.mem-log-entry.blocker { border-left: 2px solid var(--sacred-red); padding-left: var(--sp-sm); }
.mem-log-entry.note { border-left: 2px solid var(--text-muted); padding-left: var(--sp-sm); }
.mem-log-agent { color: var(--gold-primary); font-weight: 600; white-space: nowrap; }
.mem-log-type {
  font-size: 9px; padding: 1px 4px; border-radius: 4px;
  background: var(--void-700); color: var(--text-muted); text-transform: uppercase;
}
.mem-log-content { color: var(--text-secondary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-entry { font-size: var(--fs-xs); color: var(--text-secondary); padding: var(--sp-xs) 0; line-height: 1.4; }
.mem-entry-agent { color: var(--gold-primary); }
.mem-file-row { font-size: var(--fs-xs); color: var(--text-secondary); font-family: var(--font-code); padding: 2px 0; }

/* ─── Main Panel ─────────────────────────────────────────────────────────── */

#main-panel {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-primary);
}

/* Header */
#main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-lg); border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, var(--void-900) 0%, var(--void-800) 100%);
  min-height: 50px;
}
.header-left { display: flex; align-items: center; gap: var(--sp-md); }
.header-right { display: flex; align-items: center; gap: var(--sp-sm); }
#chat-title {
  font-weight: 700; font-size: var(--fs-md); color: var(--text-primary);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-success); display: inline-block;
  animation: pulse 2s infinite;
}
.status-dot.disconnected { background: var(--sacred-red-bright); animation: none; }
.status-dot.connecting { background: var(--saffron); }

/* Version Badge */
.version-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--gold-glow); border: 1px solid var(--border-gold);
  color: var(--gold-primary); font-weight: 700; letter-spacing: 0.5px;
}

/* Agent/Squad Badges */
#active-agent-badge, #squad-badge {
  display: none; align-items: center; gap: var(--sp-xs);
  padding: 2px var(--sp-sm); border-radius: 12px;
  background: var(--gold-glow); border: 1px solid var(--border-gold);
  cursor: pointer; transition: all var(--transition); font-size: var(--fs-xs);
}
#active-agent-badge:hover, #squad-badge:hover { background: var(--gold-glow-strong); box-shadow: var(--shadow-glow); }
.badge-text { color: var(--gold-primary); font-weight: 600; }
.badge-close { color: var(--text-muted); cursor: pointer; margin-left: 4px; }
.badge-close:hover { color: var(--sacred-red-bright); }

/* ═══ Top Status Bar — Shows current running task ═══ */
#top-status-bar {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-lg);
  background: var(--void-800);
  border-bottom: 1px solid var(--border-secondary);
  font-size: var(--fs-xs); color: var(--text-secondary);
  min-height: 28px;
  transition: background var(--transition);
}
#top-status-bar.running {
  background: linear-gradient(90deg, var(--void-800), var(--gold-glow), var(--void-800));
  background-size: 200% 100%;
  animation: shimmer 3s ease infinite;
  border-bottom-color: var(--border-gold);
}
#top-status-bar.error {
  background: var(--sacred-red-glow);
  border-bottom-color: var(--sacred-red);
}
#top-status-icon { flex-shrink: 0; }
#top-status-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══ Status Indicator Bar ═══ */
#status-indicator-bar {
  display: flex; align-items: center;
  padding: 2px var(--sp-lg);
  background: var(--void-900);
  border-bottom: 1px solid var(--void-700);
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  min-height: 22px;
  gap: 6px;
}
.status-indicator-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  transition: all var(--transition);
}
#status-indicator-bar.idle .status-indicator-dot { background: var(--text-muted); }
#status-indicator-bar.idle #status-label { color: var(--text-muted); }
#status-indicator-bar.working .status-indicator-dot { background: var(--gold-primary); animation: pulse 1s infinite; }
#status-indicator-bar.working #status-label { color: var(--gold-primary); }
#status-indicator-bar.error-state .status-indicator-dot { background: var(--sacred-red-bright); animation: statusGlow 1s infinite; }
#status-indicator-bar.error-state #status-label { color: var(--sacred-red-bright); }
#status-indicator-bar.completed .status-indicator-dot { background: var(--brand-success); }
#status-indicator-bar.completed #status-label { color: var(--brand-success); }
#status-ist-clock { color: var(--text-muted); font-weight: 400; letter-spacing: 0; margin-left: auto; }

/* ─── Chat Area ─────────────────────────────────────────────────────────── */

#welcome-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: var(--sp-xxl) var(--sp-lg); text-align: center;
}
.welcome-icon { font-size: 72px; margin-bottom: var(--sp-lg); filter: drop-shadow(0 0 20px var(--gold-glow-strong)); }
.welcome-title {
  font-size: var(--fs-xxl); font-weight: 800; margin-bottom: var(--sp-sm);
  background: linear-gradient(135deg, var(--gold-bright), var(--saffron), var(--gold-deep));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.welcome-subtitle { color: var(--text-muted); font-size: var(--fs-md); margin-bottom: var(--sp-xs); }
.welcome-version { color: var(--text-muted); font-size: var(--fs-xs); margin-bottom: var(--sp-xl); opacity: 0.6; }
.welcome-shortcuts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-sm); max-width: 600px; width: 100%;
}
.welcome-shortcut {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-md); border-radius: var(--border-radius-sm);
  background: var(--void-800); border: 1px solid var(--border-secondary);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
  font-size: var(--fs-sm); text-align: left;
}
.welcome-shortcut:hover {
  border-color: var(--gold-primary); color: var(--text-primary);
  background: var(--bg-hover); box-shadow: var(--shadow-glow);
}
.welcome-shortcut-icon { font-size: 20px; }

#chat-history {
  flex: 1; overflow-y: auto; padding: var(--sp-md) var(--sp-lg);
  scroll-behavior: smooth;
}

/* ─── Messages ──────────────────────────────────────────────────────────── */

.message {
  display: flex; gap: var(--sp-sm); padding: var(--sp-sm) 0;
  animation: fadeIn 0.15s ease; max-width: 85%;
  transition: opacity 0.1s ease;
  will-change: transform;
}
.message.user {
  flex-direction: row-reverse; margin-left: auto; margin-right: var(--sp-sm);
}
.message.agent, .message.response, .message.error {
  margin-right: auto; margin-left: var(--sp-sm);
}

.message-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 16px; background: var(--void-700); border: 1px solid var(--border-secondary);
}
.message.response .message-avatar {
  background: linear-gradient(135deg, var(--gold-primary), var(--saffron-deep));
  border-color: var(--gold-deep);
}

.message-content { flex: 1; min-width: 0; }
.message-meta {
  display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: 2px;
}
.message-sender { font-size: var(--fs-xs); font-weight: 600; color: var(--gold-primary); }
.message-time { font-size: 10px; color: var(--text-muted); }
.message-heading { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--sp-xs); }

.message-text {
  font-size: var(--fs-base); line-height: 1.65; color: var(--text-agent);
  word-break: break-word; overflow-wrap: break-word;
  transition: none; /* No transition on text to avoid flicker */
}
.message.user .message-text {
  background: var(--bg-message-user); border-radius: var(--border-radius) var(--border-radius-xs) var(--border-radius-xs) var(--border-radius);
  padding: var(--sp-sm) var(--sp-md); color: var(--text-user);
}
.message.response .message-text {
  background: var(--bg-message-agent); border-radius: var(--border-radius-xs) var(--border-radius) var(--border-radius) var(--border-radius-xs);
  padding: var(--sp-sm) var(--sp-md); border: 1px solid var(--border-secondary);
}

/* Streaming message — smooth incremental */
.message.streaming .message-text {
  background: var(--bg-message-agent);
  border-radius: var(--border-radius-xs) var(--border-radius) var(--border-radius) var(--border-radius-xs);
  padding: var(--sp-sm) var(--sp-md); border: 1px solid var(--border-secondary);
  position: relative;
}
.message.streaming .message-text::after {
  content: '▍'; color: var(--gold-primary); animation: pulse 1s infinite;
  margin-left: 1px; vertical-align: middle;
}

.message.error .message-text {
  background: var(--bg-message-error); border-radius: var(--border-radius);
  padding: var(--sp-sm) var(--sp-md); color: var(--sacred-red-bright);
  border: 1px solid rgba(192, 57, 43, 0.3);
}

/* Tool steps */
.message.tool .message-content,
.message.tool_result .message-content { width: 100%; }
.tool-step {
  border: 1px solid var(--border-secondary); border-radius: var(--border-radius-sm);
  background: var(--void-800); overflow: hidden;
}
.tool-step-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md); cursor: pointer;
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--transition);
  list-style: none;
}
.tool-step-header:hover { background: var(--bg-hover); }
.tool-step-header::marker { display: none; }
.tool-step-body {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  border-top: 1px solid var(--border-secondary);
}
details[open] .tool-step-body { max-height: 500px; }
.tool-step-body pre {
  margin: 0; padding: var(--sp-md); font-size: var(--fs-xs);
  color: var(--text-code); font-family: var(--font-code);
  line-height: 1.5; overflow-x: auto; max-height: 300px;
  background: var(--void-900);
}

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 4px; padding: var(--sp-sm);
}
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold-primary);
  animation: typingDot 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ═══ Agent Activity Terminal — Permanent above prompt ═══ */

#agent-activity-terminal {
  border-top: 2px solid var(--border-gold);
  background: var(--bg-terminal);
  display: flex; flex-direction: column;
  overflow: hidden;
  max-height: 220px;
  transition: max-height var(--transition-slow);
}
#agent-activity-terminal.minimized {
  max-height: 32px;
}
#agent-activity-terminal.expanded {
  max-height: 500px;
}

.activity-terminal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-xs) var(--sp-md);
  background: linear-gradient(180deg, var(--void-800), var(--void-900));
  border-bottom: 1px solid var(--border-gold);
  min-height: 32px;
  flex-shrink: 0;
}
.activity-terminal-title {
  font-size: var(--fs-xs); font-weight: 700; color: var(--gold-primary);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: var(--sp-sm);
}
.activity-terminal-title .blink { animation: pulse 1s infinite; color: var(--brand-success); }
.activity-terminal-actions { display: flex; gap: var(--sp-xs); }

.agent-activity-terminal-body {
  flex: 1; overflow-y: auto; padding: var(--sp-xs) var(--sp-md);
  font-family: var(--font-code); font-size: 11px;
  line-height: 1.6; color: var(--text-secondary);
  background: var(--bg-terminal);
}
.agent-activity-terminal-body .activity-line {
  padding: 1px 0;
  animation: terminalFadeIn 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-activity-terminal-body .activity-line .ts { color: var(--void-300); margin-right: 8px; }
.agent-activity-terminal-body .activity-line .agent-tag { color: var(--gold-primary); font-weight: 600; }
.agent-activity-terminal-body .activity-line .action-tag { color: var(--saffron-light); }
.agent-activity-terminal-body .activity-line .content-txt { color: var(--text-secondary); }
.agent-activity-terminal-body .activity-line.tool { border-left: 2px solid var(--gold-primary); padding-left: 6px; }
.agent-activity-terminal-body .activity-line.error { border-left: 2px solid var(--sacred-red-bright); padding-left: 6px; }
.agent-activity-terminal-body .activity-line.error .action-tag { color: var(--sacred-red-bright); }
.agent-activity-terminal-body .activity-line.completed { border-left: 2px solid var(--brand-success); padding-left: 6px; }
.agent-activity-terminal-body .activity-line.completed .action-tag { color: var(--brand-success); }
.agent-activity-terminal-body .activity-line.user-message .agent-tag { color: var(--saffron); }

/* Prompt symbol for agent activity (terminal feel) */
.agent-activity-terminal-body .activity-line::before {
  content: '❯ ';
  color: var(--void-400);
  margin-right: 4px;
}

/* ═══ File Upload ──────────────────────────────────────────────────────── */

#file-drop-zone {
  position: absolute; inset: 0; z-index: 500;
  background: rgba(7, 5, 4, 0.9);
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--gold-primary);
  margin: var(--sp-lg);
  border-radius: var(--border-radius);
  pointer-events: all;
}
#file-drop-zone .drop-zone-content {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-sm);
  color: var(--gold-primary); font-size: var(--fs-lg);
  text-align: center;
}

#attached-files { display: flex; flex-wrap: wrap; gap: 4px; }
.attached-file-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px;
  background: var(--void-700); border: 1px solid var(--border-gold);
  font-size: var(--fs-xs); color: var(--text-secondary);
}
.attached-file-chip .remove-file {
  cursor: pointer; color: var(--text-muted); margin-left: 4px;
}
.attached-file-chip .remove-file:hover { color: var(--sacred-red-bright); }

.upload-count-badge {
  font-size: var(--fs-xs); color: var(--gold-primary); font-weight: 600;
  padding: 2px 8px; background: var(--gold-glow);
  border-radius: 10px; border: 1px solid var(--border-gold);
}
.upload-count-badge.hidden { display: none; }

/* Steer Panel */
#steer-panel {
  position: absolute; bottom: 100%; left: var(--sp-lg); right: var(--sp-lg);
  background: var(--void-900); border: 1px solid var(--border-gold);
  border-radius: var(--border-radius-sm); box-shadow: var(--shadow-lg);
  z-index: 100; margin-bottom: var(--sp-sm);
  animation: fadeIn 0.2s ease;
}
.steer-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border-secondary);
  font-size: var(--fs-sm); font-weight: 600; color: var(--gold-primary);
}
.steer-options {
  display: flex; gap: var(--sp-sm); padding: var(--sp-md);
}
.steer-option {
  flex: 1; padding: var(--sp-sm); border-radius: var(--border-radius-sm);
  background: var(--void-800); border: 1px solid var(--border-secondary);
  color: var(--text-secondary); cursor: pointer; text-align: center;
  transition: all var(--transition); font-family: var(--font-main);
  font-size: var(--fs-sm);
}
.steer-option:hover { border-color: var(--gold-primary); background: var(--bg-hover); }
.steer-option small { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ─── Input Area ─────────────────────────────────────────────────────────── */

#input-area {
  border-top: 1px solid var(--border-gold); padding: var(--sp-md) var(--sp-lg);
  background: linear-gradient(180deg, var(--void-800) 0%, var(--void-900) 100%);
  position: relative;
}
#chat-input {
  width: 100%; min-height: 44px; max-height: 200px; resize: none;
  background: var(--bg-input); border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius); color: var(--text-primary);
  font-size: var(--fs-base); padding: var(--sp-md) var(--sp-lg);
  outline: none; transition: all var(--transition); font-family: var(--font-main);
  line-height: 1.5;
}
#chat-input:focus {
  border-color: var(--gold-primary); box-shadow: 0 0 0 3px var(--gold-glow);
}
#chat-input::placeholder { color: var(--text-muted); }
#chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

#input-controls { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-sm); }
.input-left { display: flex; align-items: center; gap: var(--sp-sm); }
.input-right { display: flex; align-items: center; gap: var(--sp-sm); }

#send-button {
  background: linear-gradient(135deg, var(--gold-primary), var(--saffron-deep));
  border: none; border-radius: var(--border-radius-sm);
  color: var(--rudraksh-900); font-weight: 700; font-size: var(--fs-sm);
  padding: var(--sp-sm) var(--sp-lg); cursor: pointer;
  transition: all var(--transition); text-transform: uppercase; letter-spacing: 0.5px;
  font-family: var(--font-main);
}
#send-button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-primary));
  box-shadow: var(--shadow-gold); transform: translateY(-1px);
}
#send-button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Command suggestions */
#command-suggestions {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: var(--void-800); border: 1px solid var(--border-gold);
  border-radius: var(--border-radius-sm); max-height: 300px;
  overflow-y: auto; z-index: 100; box-shadow: var(--shadow-lg);
}
#command-suggestions.hidden { display: none; }
.cmd-suggestion {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md); cursor: pointer;
  transition: background var(--transition); font-size: var(--fs-sm);
}
.cmd-suggestion:hover { background: var(--gold-glow); }
.cmd-suggestion-icon { font-size: 16px; width: 20px; text-align: center; }
.cmd-suggestion-name { font-weight: 600; color: var(--gold-primary); }
.cmd-suggestion-desc { color: var(--text-muted); }

/* ─── Orchestrator Panel — Permanent right side ──────────────────────────── */

#orchestrator-panel {
  border-left: 1px solid var(--border-gold);
  background: var(--bg-secondary); width: var(--orchestrator-width); min-width: var(--orchestrator-width);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
}
#orchestrator-panel.minimized { width: 36px; min-width: 36px; }
#orchestrator-panel.minimized .orch-header { writing-mode: vertical-lr; padding: var(--sp-sm) var(--sp-xs); justify-content: center; cursor: pointer; }
#orchestrator-panel.minimized .orch-title { font-size: 10px; }
#orchestrator-panel.minimized .orch-close { display: none; }
#orchestrator-panel.minimized .orch-body, #orchestrator-panel.minimized #orch-minimized-bar { display: none; }

.orch-header {
  padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, var(--void-900), var(--void-800));
  display: flex; align-items: center; justify-content: space-between;
  min-height: 50px;
}
.orch-title { font-weight: 700; color: var(--gold-primary); font-size: var(--fs-md); display: flex; align-items: center; gap: var(--sp-sm); }
.orch-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 18px; padding: 0 var(--sp-xs); line-height: 1;
}
.orch-close:hover { color: var(--gold-primary); }

.orch-body { flex: 1; overflow-y: auto; padding: var(--sp-sm); }

.orch-section { margin-bottom: var(--sp-md); }
.orch-section-title {
  font-size: var(--fs-xs); font-weight: 700; color: var(--gold-primary);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: var(--sp-sm);
  padding: 0 var(--sp-sm);
}

.orch-mode-toggle {
  display: flex; gap: var(--sp-xs); margin-bottom: var(--sp-md);
}
.orch-mode-btn {
  flex: 1; padding: var(--sp-sm); border-radius: var(--border-radius-sm);
  background: var(--void-800); border: 1px solid var(--border-secondary);
  color: var(--text-secondary); cursor: pointer; font-size: var(--fs-sm);
  font-weight: 600; transition: all var(--transition); text-align: center;
  font-family: var(--font-main);
}
.orch-mode-btn.active {
  border-color: var(--gold-primary); color: var(--gold-primary);
  background: var(--gold-glow);
}
.orch-mode-btn:hover { border-color: var(--gold-primary); }

.orch-input-group { margin-bottom: var(--sp-md); }
.orch-textarea {
  width: 100%; min-height: 60px; max-height: 120px; resize: vertical;
  background: var(--bg-input); border: 1px solid var(--border-secondary); border-radius: var(--border-radius-sm);
  color: var(--text-primary); font-size: var(--fs-sm); padding: var(--sp-sm);
  font-family: var(--font-main); line-height: 1.5;
}
.orch-textarea:focus { border-color: var(--gold-primary); box-shadow: 0 0 0 2px var(--gold-glow); outline: none; }
.orch-textarea::placeholder { color: var(--text-muted); }

.orch-btn {
  width: 100%; padding: var(--sp-sm); border-radius: var(--border-radius-sm);
  font-weight: 700; font-size: var(--fs-sm); cursor: pointer;
  transition: all var(--transition); text-transform: uppercase; letter-spacing: 0.5px;
  font-family: var(--font-main);
}
.orch-btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--saffron-deep));
  border: none; color: var(--rudraksh-900);
}
.orch-btn-primary:hover { box-shadow: var(--shadow-gold); transform: translateY(-1px); }
.orch-btn-danger {
  background: transparent; border: 1px solid var(--sacred-red); color: var(--sacred-red-bright);
}
.orch-btn-danger:hover { background: var(--sacred-red-glow); }
.orch-btn-secondary {
  background: var(--void-700); border: 1px solid var(--border-secondary); color: var(--text-secondary);
}
.orch-btn-secondary:hover { border-color: var(--gold-primary); color: var(--gold-primary); }

.orch-plan-status {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
}
.orch-plan-status.running { background: rgba(39, 174, 96, 0.15); color: #27ae60; }
.orch-plan-status.completed { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.orch-plan-status.stopped { background: var(--sacred-red-glow); color: var(--sacred-red-bright); }
.orch-plan-status.planning { background: var(--gold-glow); color: var(--gold-primary); }

.orch-lanes { display: flex; flex-direction: column; gap: var(--sp-sm); }
.orch-lane {
  border: 1px solid var(--border-secondary); border-radius: var(--border-radius-sm);
  background: var(--void-800); overflow: hidden;
}
.orch-lane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-xs) var(--sp-sm); background: var(--void-700);
  font-size: var(--fs-xs); font-weight: 600;
}
.orch-lane-name { color: var(--text-primary); }
.orch-lane-status { color: var(--text-muted); font-size: 10px; }
.orch-tasks { padding: var(--sp-xs); }
.orch-task-card {
  display: flex; align-items: center; gap: var(--sp-xs); padding: var(--sp-xs) var(--sp-sm);
  font-size: var(--fs-xs); color: var(--text-secondary);
  transition: all var(--transition);
}
.orch-task-status {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.orch-task-status.pending { background: var(--text-muted); }
.orch-task-status.running { background: var(--gold-primary); animation: pulse 1.5s infinite; }
.orch-task-status.completed { background: #27ae60; }
.orch-task-status.failed { background: var(--sacred-red-bright); }
.orch-task-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orch-task-agent { color: var(--gold-primary); font-weight: 600; }

.orch-agent-card {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-sm); border-radius: var(--border-radius-sm);
  background: var(--void-700); border: 1px solid var(--border-gold);
}
.orch-agent-emoji { font-size: 20px; }
.orch-agent-name { font-weight: 600; color: var(--gold-primary); font-size: var(--fs-sm); }

.orch-log { max-height: 150px; overflow-y: auto; }
.orch-log-entry {
  display: flex; gap: var(--sp-sm); padding: var(--sp-xs) var(--sp-sm);
  font-size: var(--fs-xs); color: var(--text-secondary);
  border-bottom: 1px solid var(--void-800);
}
.orch-log-entry.success { color: #27ae60; }
.orch-log-entry.error { color: var(--sacred-red-bright); }

/* ─── Terminal Panel ─────────────────────────────────────────────────────── */

#terminal-panel {
  border-top: 2px solid var(--border-gold);
  background: var(--void-950); height: 250px; min-height: 100px;
  display: flex; flex-direction: column;
  transition: height var(--transition-slow);
}
#terminal-panel.hidden { height: 0; min-height: 0; border-top: none; overflow: hidden; }

.terminal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-xs) var(--sp-md);
  background: linear-gradient(180deg, var(--void-800), var(--void-900));
  border-bottom: 1px solid var(--border-gold); min-height: 32px;
}
.terminal-title {
  font-size: var(--fs-xs); font-weight: 700; color: var(--gold-primary);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: var(--sp-sm);
}
.terminal-actions { display: flex; gap: var(--sp-xs); }
.terminal-btn {
  background: none; border: 1px solid var(--border-secondary); color: var(--text-muted);
  padding: 2px var(--sp-sm); border-radius: var(--border-radius-xs); cursor: pointer;
  font-size: var(--fs-xs); transition: all var(--transition); font-family: var(--font-main);
}
.terminal-btn:hover { border-color: var(--gold-primary); color: var(--gold-primary); }

#terminal-container {
  flex: 1; overflow: hidden; background: var(--void-950);
}
.xterm { padding: 4px; }

/* ─── Progress Bar ──────────────────────────────────────────────────────── */

#progress-bar {
  height: 2px; background: var(--void-700); overflow: hidden;
  transition: height var(--transition);
  position: relative;
}
#progress-bar.hidden { height: 0; }
#progress-bar .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--saffron), var(--gold-primary));
  background-size: 200% 100%;
  animation: shimmer 2s ease infinite;
  width: 30%;
  transition: width var(--transition-slow);
}
.unstick-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 10px;
  font-size: 11px;
  background: var(--void-800);
  color: var(--gold-primary);
  border: 1px solid var(--gold-primary);
  border-radius: 4px;
  cursor: pointer;
  z-index: 10;
  transition: background var(--transition), opacity var(--transition);
}
.unstick-btn:hover {
  background: var(--gold-primary);
  color: var(--void-900);
}
.unstick-btn.hidden { display: none; }

/* ─── Settings Modal ────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--void-900); border: 1px solid var(--border-gold);
  border-radius: var(--border-radius); max-width: 500px; width: 90%;
  max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: fadeIn 0.2s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, var(--void-800), var(--void-900));
}
.modal-header span { font-weight: 700; color: var(--gold-primary); }
.btn-icon-sm {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 4px; border-radius: 4px;
}
.btn-icon-sm:hover { color: var(--gold-primary); background: var(--gold-glow); }
.modal-body { padding: var(--sp-lg); }
.modal-body label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--sp-xs); }
.modal-body select, .modal-body input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius-sm); color: var(--text-primary); padding: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-sm); margin-bottom: var(--sp-md); font-family: var(--font-main);
}
.modal-body select:focus, .modal-body input:focus {
  border-color: var(--gold-primary); box-shadow: 0 0 0 2px var(--gold-glow); outline: none;
}

.modal-memory-raw .modal-body pre {
  font-family: var(--font-code); font-size: var(--fs-xs); line-height: 1.5;
  color: var(--text-secondary); white-space: pre-wrap; word-break: break-word;
}

/* ─── Sidebar Overlay (Mobile) ──────────────────────────────────────────── */

#sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99; backdrop-filter: blur(2px);
}
#sidebar-overlay.visible { display: block; }

/* ─── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  #orchestrator-panel { width: 280px; min-width: 280px; }
}
@media (max-width: 1024px) {
  #orchestrator-panel { display: none; }
}
@media (max-width: 768px) {
  #left-panel {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
    width: 280px; transform: translateX(-100%);
  }
  #left-panel:not(.hidden) { transform: translateX(0); }
  .message { max-width: 95%; }
}

/* ─── Markdown in Chat ──────────────────────────────────────────────────── */

.message-text h1, .message-text h2, .message-text h3 {
  color: var(--gold-primary); margin: var(--sp-sm) 0 var(--sp-xs); font-weight: 700;
}
.message-text h1 { font-size: var(--fs-xl); }
.message-text h2 { font-size: var(--fs-lg); }
.message-text h3 { font-size: var(--fs-md); }
.message-text p { margin: var(--sp-xs) 0; }
.message-text code {
  font-family: var(--font-code); background: var(--void-700);
  padding: 1px 5px; border-radius: 3px; font-size: 0.9em;
  color: var(--text-code);
}
.message-text pre {
  background: var(--void-900); border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius-sm); padding: var(--sp-md);
  overflow-x: auto; margin: var(--sp-sm) 0; font-size: var(--fs-xs);
  color: var(--text-code); line-height: 1.5;
}
.message-text pre code {
  background: none; padding: 0; border-radius: 0;
}
.message-text ul, .message-text ol {
  margin: var(--sp-xs) 0; padding-left: var(--sp-lg);
}
.message-text li { margin: 2px 0; }
.message-text blockquote {
  border-left: 3px solid var(--gold-primary); padding: var(--sp-sm) var(--sp-md);
  background: var(--gold-glow); margin: var(--sp-sm) 0;
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}
.message-text a { color: var(--saffron-light); }
.message-text a:hover { color: var(--gold-bright); }
.message-text strong { color: var(--text-primary); font-weight: 600; }
.message-text em { color: var(--text-secondary); }
.message-text table {
  border-collapse: collapse; width: 100%; margin: var(--sp-sm) 0;
  font-size: var(--fs-sm);
}
.message-text th, .message-text td {
  border: 1px solid var(--border-secondary); padding: var(--sp-xs) var(--sp-sm);
  text-align: left;
}
.message-text th { background: var(--void-700); color: var(--gold-primary); font-weight: 600; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 24px; right: 24px; padding: var(--sp-md) var(--sp-xl);
  border-radius: var(--border-radius); font-size: var(--fs-sm); z-index: 9999;
  box-shadow: var(--shadow-lg); animation: fadeInUp 0.3s ease;
  border: 1px solid transparent;
}
.toast.info { background: var(--void-800); color: var(--text-primary); border-color: var(--border-gold); }
.toast.success { background: rgba(39, 174, 96, 0.15); color: #27ae60; border-color: rgba(39, 174, 96, 0.3); }
.toast.error { background: var(--sacred-red-glow); color: var(--sacred-red-bright); border-color: rgba(192, 57, 43, 0.3); }
.toast.warning { background: rgba(243, 156, 18, 0.15); color: var(--brand-warning); border-color: rgba(243, 156, 18, 0.3); }

/* ─── Misc & Utility ────────────────────────────────────────────────────── */

.btn-icon {
  background: none; border: 1px solid var(--border-secondary); color: var(--text-secondary);
  padding: var(--sp-xs) var(--sp-sm); border-radius: var(--border-radius-xs); cursor: pointer;
  font-size: var(--fs-sm); transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-main);
}
.btn-icon:hover { border-color: var(--gold-primary); color: var(--gold-primary); background: var(--gold-glow); }
.btn-icon.icon-only { padding: var(--sp-xs); border-color: transparent; min-width: 32px; justify-content: center; }
.btn-icon.icon-only:hover { border-color: var(--border-secondary); }

.hidden { display: none !important; }

.sidebar-footer {
  padding: var(--sp-sm) var(--sp-md); border-top: 1px solid var(--border-secondary);
  text-align: center; font-size: var(--fs-xs); color: var(--text-muted);
}

.font-size-control { display: flex; align-items: center; gap: var(--sp-sm); }
.font-size-control button {
  background: var(--void-700); border: 1px solid var(--border-secondary); color: var(--text-secondary);
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: var(--fs-sm);
  transition: all var(--transition); display: flex; align-items: center; justify-content: center;
}
.font-size-control button:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
#font-size-value { color: var(--text-muted); font-size: var(--fs-xs); min-width: 30px; text-align: center; }

/* ═══ Login Overlay ═════════════════════════════════════════════════════════ */

#login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1225 0%, #0a0812 70%);
  font-family: var(--font-main);
}
#login-overlay::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px, rgba(212,175,55,.03) 2px, rgba(212,175,55,.03) 4px
  );
  pointer-events: none;
}

.login-panel {
  position: relative; z-index: 1;
  background: var(--void-800);
  border: 1px solid var(--border-gold);
  border-radius: var(--border-radius-lg);
  padding: var(--sp-2xl);
  width: 400px; max-width: 92vw;
  box-shadow: 0 0 60px rgba(212,175,55,.08), 0 4px 24px rgba(0,0,0,.5);
  animation: loginSlideIn .5s ease-out;
}
@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header { text-align: center; margin-bottom: var(--sp-xl); }
.login-logo { font-size: 48px; margin-bottom: var(--sp-sm); animation: logoPulse 2s ease-in-out infinite; }
@keyframes logoPulse {
  0%,100% { transform: scale(1); opacity: .9; }
  50%     { transform: scale(1.08); opacity: 1; }
}
.login-title {
  font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, var(--gold-primary), #f0d070);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-subtitle { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.login-version {
  font-size: 10px; color: var(--gold-primary); margin-top: 6px;
  font-family: var(--font-mono); letter-spacing: 1px;
}

.login-form { display: flex; flex-direction: column; gap: var(--sp-md); }
.login-field { display: flex; flex-direction: column; gap: 4px; }
.login-field label {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px;
}
.login-field input {
  background: var(--void-900); border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-size: var(--fs-base); font-family: var(--font-main);
  transition: border-color var(--transition); outline: none;
}
.login-field input:focus { border-color: var(--gold-primary); box-shadow: 0 0 0 3px rgba(212,175,55,.1); }
.login-field input::placeholder { color: var(--text-muted); }

.login-error, .password-error {
  color: var(--error); font-size: var(--fs-xs); padding: var(--sp-sm);
  background: rgba(239,68,68,.1); border-radius: var(--border-radius-xs);
  border-left: 2px solid var(--error);
}
.password-success {
  color: #22c55e; font-size: var(--fs-xs); padding: var(--sp-sm);
  background: rgba(34,197,94,.1); border-radius: var(--border-radius-xs);
  border-left: 2px solid #22c55e;
}

.login-btn {
  background: linear-gradient(135deg, var(--gold-primary), #c8922b);
  border: none; border-radius: var(--border-radius-sm);
  padding: 12px; color: #0a0812; font-weight: 700; font-size: var(--fs-base);
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-main);
  letter-spacing: .3px;
}
.login-btn:hover { box-shadow: 0 4px 20px rgba(212,175,55,.3); transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.login-spinner {
  width: 18px; height: 18px; border: 2px solid transparent;
  border-top-color: #0a0812; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-footer {
  margin-top: var(--sp-lg); text-align: center; font-size: var(--fs-xs);
  color: var(--text-muted); display: flex; flex-direction: column; gap: 2px;
}

/* ═════════════════════════════════════════════════════════════════════════
   RudraX Brand v4.1.0 — Om Namah Shivay 🔱
   ═════════════════════════════════════════════════════════════════════════ */