/* ============================================================
   B.O.B Terminal Web — Complete Stylesheet
   All features matching the desktop app: themes, vault, HUD, orb,
   brain panel, color picker, animations, and more.
============================================================ */

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

:root {
  --font-family: "Orbitron", "IBM Plex Mono", monospace;
  --font-mono: "Orbitron", "IBM Plex Mono", monospace;
  --font-sans: "IBM Plex Sans", -apple-system, sans-serif;
  --font-brand: "Orbitron", "IBM Plex Mono", monospace;

  /* Default dark phosphor amber */
  --bg: #0a0b0d;
  --bg-primary: #08090b;
  --bg-secondary: #0e1014;
  --panel-bg: rgba(20, 18, 14, 0.55);
  --bg-card: #12141a;
  --bg-input: #181b22;
  --bg-hover: #1e2128;
  --border-color: rgba(255, 176, 0, 0.14);
  --border: #1e2128;
  --border-focus: #00e09a;
  --text-primary: #f3ead9;
  --text-secondary: rgba(243, 234, 217, 0.55);
  --text-muted: #555a63;
  --accent: #649712;
  --accent-secondary: #ff7a1a;
  --accent-dim: rgba(0, 224, 154, 0.15);
  --accent-glow: rgba(0, 224, 154, 0.3);
  --msg-user: #1c1712;
  --msg-bot: #141210;
  --shadow: rgba(0, 0, 0, 0.6);
  --sidebar-bg: #0d0c0a;
  --danger: #ff3b3b;
  --danger-dim: rgba(255, 71, 87, 0.15);
  --warning: #ffa502;
  --success: #00e09a;
  --glow: rgba(255, 176, 0, 0.35);
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-width: 280px;
  --topbar-height: 52px;
  --glow-level: 1;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg: #f4efe4;
  --bg-primary: #f4efe4;
  --bg-secondary: #ece5d5;
  --panel-bg: rgba(255, 253, 248, 0.85);
  --bg-card: #ffffff;
  --bg-input: #f0ebe0;
  --bg-hover: #e8e2d4;
  --border-color: rgba(120, 80, 0, 0.16);
  --border: rgba(120, 80, 0, 0.2);
  --border-focus: #b8790a;
  --text-primary: #1c1a16;
  --text-secondary: rgba(28, 26, 22, 0.6);
  --text-muted: #8a8678;
  --accent: #b8790a;
  --accent-secondary: #d9540a;
  --accent-dim: rgba(184, 121, 10, 0.12);
  --accent-glow: rgba(184, 121, 10, 0.2);
  --msg-user: #ece3d1;
  --msg-bot: #ffffff;
  --shadow: rgba(0, 0, 0, 0.12);
  --sidebar-bg: #ece5d5;
  --danger: #c81e1e;
  --danger-dim: rgba(200, 30, 30, 0.12);
  --glow: rgba(184, 121, 10, 0.22);
}

/* ---------- Theme Presets ---------- */
html[data-preset="matrix"] {
  --bg: #020f06;
  --bg-primary: #020f06;
  --bg-secondary: #03140a;
  --panel-bg: rgba(2, 18, 8, 0.6);
  --bg-card: #04130b;
  --bg-input: #051a0e;
  --bg-hover: #062010;
  --border-color: rgba(0, 255, 102, 0.22);
  --border: rgba(0, 255, 102, 0.18);
  --border-focus: #00ff66;
  --text-primary: #d8ffe6;
  --text-secondary: rgba(216, 255, 230, 0.55);
  --text-muted: rgba(216, 255, 230, 0.35);
  --accent: #00ff66;
  --accent-secondary: #00cc99;
  --accent-dim: rgba(0, 255, 102, 0.12);
  --accent-glow: rgba(0, 255, 102, 0.25);
  --msg-user: #03140a;
  --msg-bot: #04130b;
  --shadow: rgba(0, 0, 0, 0.7);
  --sidebar-bg: #011106;
  --danger: #ff5555;
  --danger-dim: rgba(255, 85, 85, 0.12);
  --glow: rgba(0, 255, 102, 0.4);
}

html[data-preset="neon"] {
  --bg: #0a0014;
  --bg-primary: #0a0014;
  --bg-secondary: #12021a;
  --panel-bg: rgba(26, 4, 40, 0.6);
  --bg-card: #12021a;
  --bg-input: #1a0328;
  --bg-hover: #220433;
  --border-color: rgba(232, 68, 255, 0.28);
  --border: rgba(232, 68, 255, 0.22);
  --border-focus: #ff2ec4;
  --text-primary: #ffe9fa;
  --text-secondary: rgba(255, 233, 250, 0.55);
  --text-muted: rgba(255, 233, 250, 0.35);
  --accent: #ff2ec4;
  --accent-secondary: #29e6ff;
  --accent-dim: rgba(255, 46, 196, 0.12);
  --accent-glow: rgba(255, 46, 196, 0.25);
  --msg-user: #1d0526;
  --msg-bot: #12021a;
  --shadow: rgba(0, 0, 0, 0.7);
  --sidebar-bg: #0d0116;
  --danger: #ff4d6d;
  --danger-dim: rgba(255, 77, 109, 0.12);
  --glow: rgba(255, 46, 196, 0.45);
}

html[data-preset="ocean"] {
  --bg: #030d1c;
  --bg-primary: #030d1c;
  --bg-secondary: #051a2e;
  --panel-bg: rgba(6, 20, 38, 0.6);
  --bg-card: #051a2e;
  --bg-input: #072238;
  --bg-hover: #0a2a44;
  --border-color: rgba(56, 189, 248, 0.22);
  --border: rgba(56, 189, 248, 0.18);
  --border-focus: #38bdf8;
  --text-primary: #e2f3ff;
  --text-secondary: rgba(226, 243, 255, 0.55);
  --text-muted: rgba(226, 243, 255, 0.35);
  --accent: #38bdf8;
  --accent-secondary: #818cf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-glow: rgba(56, 189, 248, 0.25);
  --msg-user: #041526;
  --msg-bot: #051a2e;
  --shadow: rgba(0, 0, 0, 0.7);
  --sidebar-bg: #020d1a;
  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.12);
  --glow: rgba(56, 189, 248, 0.4);
}

html[data-preset="solarized"] {
  --bg: #fdf6e3;
  --bg-primary: #fdf6e3;
  --bg-secondary: #f5eed0;
  --panel-bg: rgba(253, 246, 227, 0.9);
  --bg-card: #fdf6e3;
  --bg-input: #eee8d5;
  --bg-hover: #e8dfc8;
  --border-color: rgba(101, 123, 131, 0.25);
  --border: rgba(101, 123, 131, 0.3);
  --border-focus: #b58900;
  --text-primary: #073642;
  --text-secondary: rgba(7, 54, 66, 0.6);
  --text-muted: rgba(7, 54, 66, 0.4);
  --accent: #b58900;
  --accent-secondary: #cb4b16;
  --accent-dim: rgba(181, 137, 0, 0.12);
  --accent-glow: rgba(181, 137, 0, 0.2);
  --msg-user: #eee8d5;
  --msg-bot: #fdf6e3;
  --shadow: rgba(101, 123, 131, 0.2);
  --sidebar-bg: #f5eed0;
  --danger: #dc322f;
  --danger-dim: rgba(220, 50, 47, 0.12);
  --glow: rgba(181, 137, 0, 0.3);
  --font-family: "IBM Plex Mono", "IBM Plex Sans", monospace;
  --font-mono: "IBM Plex Mono", "IBM Plex Sans", monospace;
  --font-brand: "IBM Plex Mono", "IBM Plex Sans", monospace;
}

html[data-preset="crimson"] {
  --bg: #160507;
  --bg-primary: #160507;
  --bg-secondary: #190607;
  --panel-bg: rgba(28, 8, 10, 0.6);
  --bg-card: #190607;
  --bg-input: #220909;
  --bg-hover: #2a0c0c;
  --border-color: rgba(255, 77, 77, 0.25);
  --border: rgba(255, 77, 77, 0.2);
  --border-focus: #ff4d4d;
  --text-primary: #ffe9e9;
  --text-secondary: rgba(255, 233, 233, 0.55);
  --text-muted: rgba(255, 233, 233, 0.35);
  --accent: #ff4d4d;
  --accent-secondary: #ff7a2a;
  --accent-dim: rgba(255, 77, 77, 0.12);
  --accent-glow: rgba(255, 77, 77, 0.25);
  --msg-user: #220909;
  --msg-bot: #190607;
  --shadow: rgba(0, 0, 0, 0.7);
  --sidebar-bg: #140405;
  --danger: #ff5252;
  --danger-dim: rgba(255, 82, 82, 0.12);
  --glow: rgba(255, 77, 77, 0.4);
}

/* ---------- Vault Mode ---------- */
html.vault-mode {
  --accent: #d946ef !important;
  --accent-secondary: #7c3aed !important;
  --accent-dim: rgba(217, 70, 239, 0.12) !important;
  --accent-glow: rgba(217, 70, 239, 0.25) !important;
  --border-color: rgba(217, 70, 239, 0.24) !important;
  --border: rgba(217, 70, 239, 0.2) !important;
  --border-focus: #d946ef !important;
  --glow: rgba(217, 70, 239, 0.45) !important;
  --msg-user: #1d0526 !important;
  --msg-bot: #12021a !important;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* --- Titlebar hidden in web version --- */

/* ---------- CRT Scanline Effect ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* Vault flash effect */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: var(--accent);
  opacity: 0;
}

html.vault-mode body::after {
  animation: vaultFlash 0.6s ease;
}

@keyframes vaultFlash {
  0% { opacity: 0.32; }
  100% { opacity: 0; }
}

/* Screen wrapper */
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }

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

/* ---------- Boot Splash ---------- */
.boot-splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease;
}
.boot-splash.fade-out { opacity: 0; pointer-events: none; }
.boot-splash-inner { text-align: center; }
.boot-orb {
  width: 60px; height: 60px; margin: 0 auto 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 0 60px var(--glow), 0 0 80px var(--accent-dim);
  animation: orbPulse 2s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}
.boot-brand {
  font-family: var(--font-brand);
  font-size: 28px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 6px;
  text-shadow: 0 0 20px var(--glow);
}
.boot-lines { margin-top: 24px; }
.boot-splash-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
  animation: bootLine 0.3s forwards;
}
.boot-splash-line:nth-child(1) { animation-delay: 0.3s; }
.boot-splash-line:nth-child(2) { animation-delay: 0.7s; }
.boot-splash-line:nth-child(3) { animation-delay: 1.1s; }
.boot-splash-final { color: var(--accent); animation-delay: 1.5s; }
@keyframes bootLine { to { opacity: 1; } }
.boot-progress {
  width: 200px; height: 3px; margin: 20px auto 0;
  background: var(--border-color); border-radius: 2px; overflow: hidden;
}
.boot-progress-fill {
  width: 0; height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* ---------- Login Screen ---------- */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, var(--bg-primary) 0%, var(--bg) 100%);
  backdrop-filter: blur(15px);
}
.login-card {
  width: 400px; max-width: 90vw;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 50px var(--shadow);
  position: relative;
}
.login-header { text-align: center; margin-bottom: 28px; }
.lock-icon { font-size: 32px; display: block; margin-bottom: 8px; filter: drop-shadow(0 0 12px var(--glow)); }
.login-header h2 {
  font-family: var(--font-brand);
  font-size: 20px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  margin: 12px 0 6px;
}
.login-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%; padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.login-card input::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.5px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px var(--glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); }

.error-text {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 16px;
  margin-top: 4px;
}
.signup-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
  font-family: var(--font-mono);
}
.login-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.btn-link:hover { color: var(--accent); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
}
.btn-icon:hover { color: var(--accent); background: var(--border-color); }
.btn-icon-sm { padding: 4px; font-size: 12px; width: auto; height: auto; }
.btn-icon.is-locked { color: var(--accent-secondary); }

/* Header badge (for admin signup count) */
.header-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  line-height: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ---------- App Screen ---------- */
.app-screen {
  display: flex;
  height: 100vh;
}

/* ---------- HUD Frame Corners ---------- */
.hud-frame {
  position: relative;
}
.hud-frame .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  opacity: 0.8;
}
.hud-frame .corner.tl { top: -4px; left: -4px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.hud-frame .corner.tr { top: -4px; right: -4px; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.hud-frame .corner.bl { bottom: -4px; left: -4px; border-bottom: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.hud-frame .corner.br { bottom: -4px; right: -4px; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  z-index: 20;
}
.sidebar.closed { margin-left: calc(-1 * var(--sidebar-width)); }
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-header h3 {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
}
.sidebar-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: var(--accent);
  opacity: 0.75;
}
.sidebar-actions {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-sidebar {
  width: 100%; padding: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.btn-sidebar:hover { border-color: var(--accent); color: var(--accent); }

.sidebar-actions input {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.sidebar-actions input:focus { border-color: var(--accent); }

/* Sidebar tools (Export, Import, Select) */
.sidebar-tools {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
}
.sidebar-tool-btn {
  flex: 1;
  padding: 6px 4px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
}
.sidebar-tool-btn:hover { color: var(--accent); border-color: var(--accent); }
.sidebar-tool-btn.danger { border-color: var(--danger); color: var(--danger); }

/* Bulk actions row */
.bulk-actions-row {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
}

/* Chat list */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.chat-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s;
  position: relative;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.chat-item-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.chat-item-select {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.sidebar-empty {
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

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

/* ---------- Top Bar ---------- */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
  animation: statusPulse 2.2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
.status-dot.offline { background: var(--danger); box-shadow: 0 0 6px rgba(255,71,87,0.3); animation: none; }
.brand-wordmark {
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.guest-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(255, 176, 0, 0.08);
  border: 1px solid rgba(255, 176, 0, 0.3);
}
.guest-pill b { color: var(--accent); }

/* More menu button */
.more-menu-btn {
  position: relative;
}
.more-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  min-width: 180px;
  z-index: 50;
  box-shadow: 0 8px 24px var(--shadow);
  display: none;
}
.more-menu-dropdown.open { display: block; }
.more-menu-item {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  transition: background 0.12s;
  text-align: left;
}
.more-menu-item:hover { background: var(--bg-hover); color: var(--accent); }
.more-menu-item i { width: 16px; text-align: center; font-size: 0.85rem; }


/* ---------- Status Strip ---------- */
.status-strip {
  flex-shrink: 0;
  padding: 5px 20px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  background: var(--panel-bg);
}
.status-text { display: none; }
.status-standard { display: inline; }
html.vault-mode .status-standard { display: none; }
html.vault-mode .status-text.status-vault {
  display: inline;
  color: var(--accent);
  animation: vaultTextFlicker 2.4s ease-in-out infinite;
}
@keyframes vaultTextFlicker {
  0%, 92%, 100% { opacity: 1; }
  94% { opacity: 0.5; }
  96% { opacity: 1; }
}

/* ---------- Read-Only Banner ---------- */
.read-only-banner {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
}
.read-only-banner.visible { display: flex; }
.read-only-banner i { font-size: 0.8rem; animation: statusPulse 2.2s ease-in-out infinite; }
.read-only-action-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.read-only-action-btn:hover { background: var(--accent-dim); }

/* ---------- Broadcast Banner ---------- */
.broadcast-banner {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--warning);
  background: rgba(255, 165, 2, 0.08);
  border-bottom: 1px solid rgba(255, 165, 2, 0.2);
}
.broadcast-banner.visible { display: flex; }
.broadcast-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--warning);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.broadcast-dismiss:hover { background: rgba(255, 165, 2, 0.15); }

/* ---------- Chat Area ---------- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* ---------- Greeting ---------- */
.greeting-area {
  text-align: center;
  padding: 60px 20px 30px;
}
.greeting-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 10px;
}
.greeting-title {
  font-family: var(--font-brand);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 8px;
  letter-spacing: -0.5px;
}
.greeting-subtitle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
}

/* Fade-in animation for greeting */
.greeting-area .fade-in-text {
  animation: fadeInText 0.8s ease forwards;
}
@keyframes fadeInText {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Orb Wrapper ---------- */
.orb-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 36px auto;
  z-index: 4;
  position: relative;
  width: 220px;
  height: 220px;
}
.orb-wrapper .orb {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 0 60px var(--glow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.4s ease;
  position: relative;
  z-index: 2;
}
.orb-wrapper .orb:active { transform: scale(0.95); }
.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.35;
  pointer-events: none;
}
.orb-ring.ring-1 {
  width: 168px; height: 168px;
  animation: ringBreathe 3.2s ease-in-out infinite;
}
.orb-ring.ring-2 {
  width: 200px; height: 200px;
  animation: ringBreathe 3.2s ease-in-out infinite 0.6s;
}
@keyframes ringBreathe {
  0%, 100% { transform: scale(0.94); opacity: 0.28; }
  50% { transform: scale(1.02); opacity: 0.5; }
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Message Bubbles ---------- */
.message {
  display: flex;
  gap: 12px;
  animation: msgIn 0.25s ease;
  max-width: 85%;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

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

.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.message.user .message-avatar { background: var(--msg-user); color: var(--accent-secondary); border: 1px solid var(--accent-secondary); }
.message.assistant .message-avatar { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }

.message-body {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Bubble styling */
.message.user .message-body {
  background: var(--msg-user);
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 3px;
  border-right: 2px solid var(--accent-secondary);
  padding: 14px 18px;
  border-radius: 14px;
}
.message.assistant .message-body {
  background: var(--msg-bot);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 3px;
  border-left: 2px solid var(--accent);
  padding: 14px 18px;
  border-radius: 14px;
}

.message-sender {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
  opacity: 0.8;
}
.message.user .message-sender { color: var(--accent-secondary); text-align: right; }
.message.assistant .message-sender { color: var(--accent); }

.message-content {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.message-content code {
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 4px 0 8px 20px; }
.message-content a { color: var(--accent); text-decoration: underline; }

/* Message actions (copy, regen, pdf) */
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.message:hover .message-actions { opacity: 1; }
.msg-action-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.msg-action-btn:hover { background: rgba(0, 0, 0, 0.32); color: var(--accent); }
.msg-action-btn.copied { color: var(--accent); }

/* Code blocks with header */
.code-block {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #0b0b10;
  border: 1px solid var(--border-color);
}
[data-theme="light"] .code-block { background: #1e1e1e; }
.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border-color);
}
.code-lang {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.code-copy-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--accent); }
.code-copy-btn.copied { color: var(--accent); }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.code-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e8e8e8;
  white-space: pre;
  line-height: 1.5;
  background: none;
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-indicator span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typeDot 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typeDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* ---------- Input Area ---------- */
.input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg);
  flex-shrink: 0;
}
.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 800px;
  margin: 0 auto;
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 150px;
  line-height: 1.5;
}
#messageInput::placeholder { color: var(--text-muted); }
.input-actions { display: flex; gap: 2px; align-items: center; }
.btn-send {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
  position: relative;
  flex-shrink: 0;
}
.btn-send:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--glow); }
.btn-send:disabled { background: var(--border-color); color: var(--text-secondary); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-send.stop-mode { background: var(--danger); color: #fff; }
.btn-stop { background: var(--danger) !important; color: #fff !important; }


.input-status {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Brain Panel (System Prompt) ---------- */
.brain-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0, 0, 0, 0.6);
  display: none;
}
.brain-overlay.open { display: block; }
.brain-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 500px);
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  z-index: 96;
  box-shadow: 0 20px 50px var(--shadow);
  display: none;
  max-height: 80vh;
  overflow-y: auto;
}
.brain-panel.open { display: block; }
.brain-panel h4 {
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.brain-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.brain-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.brain-preset-btn {
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.brain-preset-btn:hover, .brain-preset-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.brain-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  outline: none;
}
.brain-textarea:focus { border-color: var(--accent); }
.brain-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}
.brain-hint code {
  background: var(--bg-input);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--accent);
}
.brain-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  gap: 8px;
}
.brain-save-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.brain-save-btn:hover { opacity: 0.85; }
.color-reset-btn {
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.color-reset-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Color Picker Panel ---------- */
.color-picker-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0, 0, 0, 0.6);
  display: none;
}
.color-picker-overlay.open { display: block; }
.color-picker-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 420px);
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  z-index: 96;
  box-shadow: 0 20px 50px var(--shadow);
  display: none;
  max-height: 80vh;
  overflow-y: auto;
}
.color-picker-panel.open { display: block; }
.color-picker-panel h4 {
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--sw);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 8px var(--sw); }
.color-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.color-custom-row input[type="color"] {
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
}
.color-custom-row label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.color-section-title {
  font-family: var(--font-brand);
  font-size: 12px;
  color: var(--text-secondary);
  margin: 16px 0 10px;
  letter-spacing: 1px;
}
.theme-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.theme-preset-btn {
  padding: 5px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.theme-preset-btn:hover, .theme-preset-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- Chat Search Overlay ---------- */
.chat-search-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  backdrop-filter: blur(4px);
}
.chat-search-overlay.open { display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.chat-search-panel {
  position: fixed;
  top: 12vh; left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 560px);
  max-height: 70vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  z-index: 251;
  box-shadow: 0 24px 60px var(--shadow), 0 0 0 1px var(--border-color);
  display: none;
  overflow: hidden;
  flex-direction: column;
}
.chat-search-panel.open { display: flex; }
.chat-search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.chat-search-header i {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.chat-search-header input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
}
.chat-search-header input::placeholder { color: var(--text-muted); }
.chat-search-header kbd {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.chat-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.chat-search-empty {
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.chat-search-count {
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.chat-search-result {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.chat-search-result:hover,
.chat-search-result.selected {
  background: var(--bg-hover);
}
.chat-search-result.selected {
  box-shadow: inset 3px 0 0 var(--accent);
}
.chat-search-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.chat-search-result-chat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-search-result-role {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.chat-search-result-role.role-user {
  color: var(--accent-secondary);
  background: rgba(255, 122, 26, 0.12);
}
.chat-search-result-role.role-bot {
  color: var(--accent);
  background: var(--accent-dim);
}
.chat-search-result-snippet {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-search-highlight {
  background: var(--accent);
  color: var(--bg);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}

/* ---------- Stats Modal ---------- */
.stats-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
}
.stats-overlay.open { display: flex; }
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 50px var(--shadow);
}
.stats-card h3 {
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 1px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.stat-value {
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ---------- Secure Prompt ---------- */
.secure-prompt-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}
.secure-prompt-overlay.open { display: flex; }
.secure-prompt-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 380px);
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 50px var(--shadow);
  display: none;
  z-index: 201;
}
.secure-prompt-panel.open { display: block; }
.secure-prompt-panel h4 {
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.secure-prompt-message {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.secure-prompt-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.secure-prompt-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}
.secure-prompt-input:focus { border-color: var(--accent); }
.secure-prompt-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.secure-prompt-toggle:hover { color: var(--accent); border-color: var(--accent); }
.secure-prompt-error {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 16px;
  margin-top: 6px;
}
.secure-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- Chat Lock Banner ---------- */
.chat-lock-banner {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
}
.chat-lock-banner.visible { display: flex; }

/* ---------- Admin Panel ---------- */
.admin-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-panel {
  width: 900px;
  max-width: 95vw;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.admin-header h2 {
  font-family: var(--font-brand);
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1px;
}
.admin-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.admin-stat {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.admin-stat-value {
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.admin-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 4px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th, .admin-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 12px;
}
.admin-table th {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.admin-table td { color: var(--text-primary); }
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.admin-badge.admin { background: var(--accent-dim); color: var(--accent); }
.admin-badge.user { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.admin-btn-row { display: flex; gap: 4px; }
.admin-btn-sm {
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.12s;
}
.admin-btn-sm:hover { color: var(--accent); border-color: var(--accent); }
.admin-btn-sm.danger:hover { color: var(--danger); border-color: var(--danger); }
.admin-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.admin-input-row input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.admin-input-row input:focus { border-color: var(--accent); }
.admin-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  outline: none;
}
.admin-textarea:focus { border-color: var(--accent); }
.admin-section-title {
  font-family: var(--font-brand);
  font-size: 13px;
  color: var(--text-secondary);
  margin: 16px 0 8px;
  letter-spacing: 1px;
}
.admin-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  width: 380px;
  max-width: 90vw;
}
.modal-card h3 {
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 1px;
}
.modal-card input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  margin-bottom: 10px;
}
.modal-card input:focus { border-color: var(--accent); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: toastIn 0.25s ease;
  max-width: 350px;
}
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .sidebar { position: absolute; top: 0; left: 0; bottom: 0; z-index: 30; }
  .sidebar.closed { margin-left: 0; transform: translateX(-100%); }
  .message { max-width: 95%; }
}
