/* ============================================
   BryanTheBrain - style.css
   Dark purple neural AI theme
   ============================================ */

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

:root {
  --bg-primary: #0d0d14;
  --bg-secondary: #12121e;
  --bg-tertiary: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #1e1e32;
  --bg-hover: #252542;

  --accent-primary: #7c3aed;
  --accent-secondary: #a78bfa;
  --accent-light: #c4b5fd;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --accent-pink: #e879f9;
  --accent-cyan: #22d3ee;

  --text-primary: #f1f0ff;
  --text-secondary: #a5b4fc;
  --text-muted: #6b7280;
  --text-code: #e2e8f0;

  --border-subtle: rgba(167, 139, 250, 0.12);
  --border-medium: rgba(167, 139, 250, 0.25);
  --border-strong: rgba(167, 139, 250, 0.4);

  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  --sidebar-width: 300px;
  --header-height: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(124,58,237,0.2);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d0d14;
  color: #f1f0ff;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* ----- Neural Canvas Background ----- */
.background-canvas {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#neuralCanvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.45;
}

/* ----- App Layout ----- */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ----- Sidebar ----- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  min-height: 0;
  background: linear-gradient(180deg, #0f0f1e 0%, #12122a 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  backdrop-filter: blur(20px);
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
}

/* Sidebar Header */
.sidebar-header {
  position: relative;
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  contain: paint;
}

.brain-logo {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.brain-svg {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 0 12px rgba(167,139,250,0.5));
}

.pulse-dot {
  animation: pulseDot 2s ease-in-out infinite;
}

.pulse-dot:nth-child(2) { animation-delay: 0.3s; }
.pulse-dot:nth-child(3) { animation-delay: 0.6s; }
.pulse-dot:nth-child(4) { animation-delay: 0.9s; }
.pulse-dot:nth-child(5) { animation-delay: 1.2s; }

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; r: 3; }
  50% { opacity: 1; r: 4.5; }
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-accent {
  color: var(--accent-secondary);
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* Model Section */
.model-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.model-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.model-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border var(--transition);
  border: 1px solid transparent;
}

.model-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.model-option.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--accent-primary);
}

.model-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.model-info {
  flex: 1;
  min-width: 0;
}

.model-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.model-desc {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.model-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.model-status.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.model-status.disconnected { background: var(--error); }
.model-status.checking { background: var(--warning); animation: blink 1s ease-in-out infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Ollama Config */
.ollama-config {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.transformers-config .transformers-config-hint {
  margin: 0 0 8px;
  line-height: 1.4;
}

.transformers-preload-card {
  flex-shrink: 0;
  margin: 12px 20px 8px;
  padding: 16px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  max-width: 640px;
  width: 100%;
  align-self: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.tpc-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-secondary);
  margin: 0 0 4px;
}

.tpc-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.tpc-body,
.tpc-hint,
.tpc-model-line {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 8px;
}

.tpc-model-line {
  color: var(--accent-light);
  font-weight: 500;
}

.tpc-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.tpc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tpc-actions .connect-btn {
  width: auto;
  flex: 1 1 140px;
  margin-top: 0;
}

.config-group {
  margin-bottom: 10px;
}

.config-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.config-input,
.config-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.config-input:focus,
.config-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.config-select option {
  background: var(--bg-tertiary);
}

.connect-btn {
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.connect-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.connect-btn:active { transform: translateY(0); }

/* Chat History */
.chat-history-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.new-chat-btn {
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.new-chat-btn:hover {
  background: #6d28d9;
  transform: rotate(90deg);
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-history::-webkit-scrollbar {
  width: 3px;
}
.chat-history::-webkit-scrollbar-track { background: transparent; }
.chat-history::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 2px;
}

.history-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition);
  border: 1px solid transparent;
}

.history-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.history-item.active {
  background: rgba(124,58,237,0.1);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.github-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.github-link:hover { color: var(--accent-secondary); }

.github-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ----- Main Content ----- */
/* Two-row main: header + workspace (chat + about overlay) */
.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr);
  overflow: hidden;
  background: #0d0d14;
  background: var(--bg-primary);
}

.main-workspace {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.main-chat-layer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.main-chat-layer .messages-container {
  flex: 1;
  min-height: 0;
}

/* Chat Header */
.chat-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13,13,20,0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.chat-title-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  background: rgba(124,58,237,0.15);
  border: 1px solid var(--accent-primary);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-secondary);
}

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

.header-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.header-btn svg {
  width: 15px;
  height: 15px;
}

.header-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ----- Messages Container ----- */
.messages-container {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

/* Welcome Screen */
.welcome-daily-greeting {
  font-size: 15px;
  color: var(--accent-secondary);
  margin: 0 0 12px;
  max-width: 480px;
  line-height: 1.5;
}

.bryan-greeting-starters-host:empty { display: none; }
.bryan-greeting-starters-host {
  margin-top: 12px;
  width: 100%;
  max-width: 560px;
}
.bryan-greeting-starters-host .greeting-starters {
  margin-top: 0;
}

/* Optional companion “echo” (enable with ?bryan=echo) */
.bryan-echo {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: 0.72;
  max-width: 520px;
  margin: 0 auto 12px;
  min-height: 1.2em;
  letter-spacing: 0.02em;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  min-height: auto;
  padding: 32px 20px 24px;
  text-align: center;
}

.welcome-brain {
  margin-bottom: 20px;
  animation: floatBrain 3s ease-in-out infinite;
}

.welcome-brain-svg {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 0 20px rgba(124,58,237,0.5));
}

@keyframes floatBrain {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: #f0eeff;
  margin-bottom: 10px;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .welcome-title {
    background: linear-gradient(135deg, #f1f0ff, var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 28px;
}

.welcome-features {
  display: flex;
  gap: 12px;
  margin-bottom: 36px;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--accent-primary);
  background: rgba(124,58,237,0.1);
}

.feature-icon {
  font-size: 16px;
}

.starter-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 560px;
}

.starter-btn {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  line-height: 1.4;
}

.starter-btn:hover {
  background: rgba(124,58,237,0.1);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ----- Messages List ----- */
.messages-list {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  flex: 0 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: slideIn 0.3s ease-out;
}

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

.message.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
}

.message.user .msg-avatar {
  background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
  color: white;
  font-size: 13px;
}

.message.assistant .msg-avatar {
  background: linear-gradient(135deg, #1e1e38, #2a2a4a);
  border: 1px solid var(--border-medium);
}

.msg-avatar .brain-mini {
  width: 20px;
  height: 20px;
}

.msg-content {
  flex: 1 1 auto;
  max-width: 75%;
  min-width: 0;
}

.message.user .msg-content {
  flex: 0 1 auto;
  max-width: min(75%, 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.message.assistant .msg-bubble {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.msg-bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-light);
}

.msg-bubble pre {
  background: #0a0a14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.msg-bubble pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
}

.code-block-wrap {
  position: relative;
  margin: 10px 0;
}

.code-block-wrap pre {
  margin: 0;
}

.message.user .code-block-wrap .code-copy-btn {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
}

.message.user .code-block-wrap .code-copy-btn:hover {
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-medium);
  background: rgba(17, 17, 30, 0.95);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--accent-primary);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding: 0 4px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all var(--transition);
  opacity: 0;
}

.message:hover .msg-copy-btn { opacity: 1; }
.msg-copy-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }

/* Streaming cursor */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--accent-secondary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.7s ease-in-out infinite;
}

/* ----- Input Area ----- */
.input-area {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(13,13,20,0.9);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.input-wrapper {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.thinking-dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-secondary);
  border-radius: 50%;
  animation: thinkDot 1.2s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.thinking-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

.attach-btn,
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.attach-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

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

.attach-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

.send-btn {
  background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
  border: none;
  color: white;
}

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

.send-btn:hover {
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: scale(1.05);
}

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

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-btn .stop-icon { display: none; }
.send-btn.is-stop .send-icon { display: none; }
.send-btn.is-stop .stop-icon { display: block; }
.send-btn.is-stop {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}
.send-btn.is-stop:hover {
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

.message-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
  padding: 6px 0;
}

.message-input::placeholder {
  color: var(--text-muted);
}

.message-input::-webkit-scrollbar { width: 3px; }
.message-input::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 6px 18px 10px;
}

.input-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
}

.input-hint-help {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: help;
  line-height: 1;
}

.input-hint-help:hover {
  border-color: var(--border-medium);
  color: var(--accent-secondary);
}

.input-footer-mid {
  flex: 0 0 auto;
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.char-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ----- Toast Notifications ----- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease-out;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-width: 360px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { background: #052e16; border: 1px solid var(--success); color: #4ade80; }
.toast.error { background: #1c0a0a; border: 1px solid var(--error); color: #f87171; }
.toast.info { background: #0c0c2a; border: 1px solid var(--accent-primary); color: var(--accent-secondary); }
.toast.warning { background: #1a1200; border: 1px solid var(--warning); color: #fcd34d; }

/* ----- Markdown Styles in Messages ----- */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  color: var(--accent-light);
  margin: 12px 0 6px;
  font-weight: 600;
}

.msg-bubble h1 { font-size: 18px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 14px; }

.msg-bubble p { margin: 6px 0; }

.msg-bubble ul, .msg-bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}

.msg-bubble li { margin: 3px 0; }

.msg-bubble strong { color: var(--text-primary); font-weight: 600; }
.msg-bubble em { color: var(--accent-light); font-style: italic; }

.msg-bubble blockquote {
  border-left: 3px solid var(--accent-primary);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-style: italic;
}

.msg-bubble hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 10px 0;
}

.msg-bubble a {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.message.user .msg-bubble a {
  color: #fef3c7;
}

.message.user .msg-bubble a:hover {
  color: #fff;
}

.msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.msg-bubble th,
.msg-bubble td {
  border: 1px solid var(--border-medium);
  padding: 6px 10px;
  text-align: left;
}

.msg-bubble th {
  background: rgba(124, 58, 237, 0.12);
  color: var(--text-secondary);
  font-weight: 600;
}

.msg-bubble tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.12);
}

/* System prompt */
.system-prompt-block {
  margin: 0 16px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  padding: 0 10px 10px;
}

.system-prompt-summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  list-style: none;
  padding: 10px 0 4px;
}

.system-prompt-summary::-webkit-details-marker { display: none; }

.system-prompt-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.system-prompt-textarea {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  resize: vertical;
  outline: none;
}

.system-prompt-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.session-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.session-search:focus {
  border-color: var(--accent-primary);
}

.connect-btn-secondary {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border-medium) !important;
  margin-top: 0 !important;
  margin-bottom: 8px;
}

.connect-btn-secondary:hover {
  background: var(--bg-hover) !important;
  box-shadow: none !important;
  transform: none;
}

.pull-progress {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.mini-progress {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mini-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #6d28d9);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.file-input-hidden { display: none; }

.file-chip-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 8px 20px;
  font-size: 12px;
  color: var(--accent-light);
}

.file-chip {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid var(--border-medium);
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}

.mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all var(--transition);
}

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

.mic-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

.mic-btn.is-recording {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05); }
}

.msg-action-btn,
.regen-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition);
}

.message:hover .msg-action-btn { opacity: 1; }
.msg-action-btn:hover, .regen-btn:hover { background: var(--bg-hover); color: var(--accent-secondary); }

.model-load-msg .msg-avatar { font-size: 14px; }

.model-load-bubble {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(17, 17, 30, 0.9)) !important;
  border: 1px solid var(--border-medium) !important;
}

.model-load-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 6px;
}

.model-load-line { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

.model-load-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}

.model-load-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.model-load-bar-inner,
#modelLoadBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #7c3aed);
  border-radius: 3px;
  transition: width 0.15s ease;
}

.message.system { opacity: 0.95; }

.input-hint kbd {
  display: inline-block;
  font-size: 9px;
  font-family: inherit;
  padding: 1px 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  vertical-align: middle;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    position: absolute;
    z-index: 100;
    height: 100%;
    box-shadow: var(--shadow-lg);
  }

  .prompts-grid {
    grid-template-columns: 1fr;
  }

  .welcome-features {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ----- Scrollbar Global ----- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

/* ----- Selection ----- */
::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

/* ----- Bryan "soul" layer: mood, memory, TTS, reactions, session summary ----- */
.mood-header-glow {
  position: absolute;
  left: 16px;
  top: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  transition: box-shadow 0.45s ease, opacity 0.35s ease;
  opacity: 0.75;
  filter: blur(0.5px);
}

.mood--neutral {
  box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.35);
  animation: none;
}

.mood--frustrated {
  box-shadow: 0 0 16px 2px rgba(248, 113, 113, 0.35);
  animation: moodPulseR 2.2s ease-in-out infinite;
}

.mood--excited {
  box-shadow: 0 0 16px 2px rgba(74, 222, 128, 0.3);
  animation: moodPulseG 1.8s ease-in-out infinite;
}

.mood--confused {
  box-shadow: 0 0 16px 2px rgba(250, 204, 21, 0.3);
  animation: moodPulseY 2s ease-in-out infinite;
}

@keyframes moodPulseR {
  0%, 100% { box-shadow: 0 0 10px 2px rgba(248, 113, 113, 0.22); }
  50% { box-shadow: 0 0 18px 4px rgba(248, 113, 113, 0.38); }
}

@keyframes moodPulseG {
  0%, 100% { box-shadow: 0 0 10px 2px rgba(74, 222, 128, 0.2); }
  50% { box-shadow: 0 0 18px 4px rgba(74, 222, 128, 0.35); }
}

@keyframes moodPulseY {
  0%, 100% { box-shadow: 0 0 10px 2px rgba(250, 204, 21, 0.2); }
  50% { box-shadow: 0 0 18px 4px rgba(250, 204, 21, 0.35); }
}

#headerBrain.bryan-wake {
  animation: bryanWake 1.5s ease-out 1;
}

@keyframes bryanWake {
  0% { filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.4)) scale(1); }
  35% { filter: drop-shadow(0 0 28px rgba(167, 139, 250, 0.95)) scale(1.04); }
  100% { filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.5)) scale(1); }
}

.bryan-memory-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  flex: 0 0 auto;
}

.bryan-memory-section .memory-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0 0 8px;
  line-height: 1.4;
}

.bryan-memory-list {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bryan-memory-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  line-height: 1.35;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.bryan-memory-text {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  word-break: break-word;
}

.bryan-memory-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.bryan-memory-del:hover {
  background: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.memory-clear-btn {
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 0;
  cursor: pointer;
  font-weight: 500;
  justify-content: center;
}

.memory-clear-btn:hover {
  color: #fca5a5;
  background: transparent;
}

.bryan-memory-empty {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 6px;
  font-style: italic;
}

.auto-read-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  user-select: none;
}

/* Hide native checkbox — custom switch */
.auto-read-row input#autoReadToggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.auto-read-row:has(input#autoReadToggle) {
  position: relative;
  padding-left: 44px;
  cursor: pointer;
  min-height: 22px;
}

.auto-read-row:has(input#autoReadToggle)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition), border-color var(--transition);
}

.auto-read-row:has(input#autoReadToggle)::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  margin-top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: left 0.2s ease, background var(--transition);
}

.auto-read-row:has(input#autoReadToggle:checked)::before {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--accent-primary);
}

.auto-read-row:has(input#autoReadToggle:checked)::after {
  left: 19px;
  background: var(--accent-secondary);
}

.greeting-starters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.bryan-memory-starter {
  text-align: left;
  width: 100%;
}

.remember-btn {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent-light);
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.remember-btn--footer {
  text-transform: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.remember-btn:hover {
  background: rgba(124, 58, 237, 0.22);
  border-color: var(--accent-primary);
}

.thinking-text.thinking-flip {
  animation: thinkFlip 0.35s ease;
}

@keyframes thinkFlip {
  0% { opacity: 0.35; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

.msg-speak-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px 0 4px;
  line-height: 1;
  vertical-align: middle;
  opacity: 0;
  transition: color var(--transition), opacity var(--transition);
}

.message:hover .msg-speak-btn,
.msg-speak-btn:hover {
  opacity: 1;
  color: var(--accent-light);
}

.reaction-bar {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  padding-left: 2px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.2s ease;
}

.message:hover .reaction-bar,
.message:focus-within .reaction-bar {
  opacity: 1;
  max-height: 32px;
}

.reaction-pick {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  padding: 1px 4px;
  cursor: pointer;
  opacity: 0.75;
  transition: transform 0.12s, background var(--transition);
}

.reaction-pick:hover {
  opacity: 1;
  transform: scale(1.15);
  background: var(--bg-hover);
}

.reaction-badges {
  font-size: 14px;
  min-height: 16px;
  margin-top: 2px;
  color: var(--text-muted);
}

.msg-bubble--bryan-error,
.message--bryan-error .msg-bubble {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.5), rgba(30, 20, 20, 0.95)) !important;
  border: 1px solid rgba(248, 113, 113, 0.45) !important;
  color: #fecaca;
}

.message--bryan-error .msg-avatar { opacity: 0.9; }

.session-summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 4, 12, 0.72);
  backdrop-filter: blur(8px);
}

.session-summary-card {
  max-width: 400px;
  width: 100%;
  background: linear-gradient(165deg, #1a1230, #0f0f1e);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(167, 139, 250, 0.08) inset;
}

.summary-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-light);
  letter-spacing: 0.02em;
}

.summary-body {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.summary-line {
  margin: 0 0 8px;
}

.summary-emoji { margin-right: 4px; }

/* --- Audit pass: error card, file banner, jump, onboarding, history empty, msg time, reduced motion, sidebar resize --- */
.bryan-error-card {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  max-width: 360px;
  background: linear-gradient(165deg, #1e1035, #1a0f1e);
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 12px;
  padding: 12px 32px 12px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: none;
}

.bryan-error-card__inner p {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.bryan-error-card__title { font-weight: 600; color: #fecaca !important; }
.bryan-error-card__hint { font-size: 10px !important; color: var(--text-muted) !important; }
.bryan-error-card__dismiss {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.file-protocol-banner {
  position: relative;
  z-index: 50;
  padding: 8px 16px;
  background: rgba(120, 53, 15, 0.35);
  border-bottom: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 11px;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-protocol-banner p { margin: 0; line-height: 1.4; }
.file-protocol-banner code { font-size: 10px; color: #fff; }

.messages-container { position: relative; }

.jump-latest-btn {
  position: absolute;
  bottom: 12px;
  right: 20px;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #f5f3ff;
  background: linear-gradient(135deg, var(--accent-primary), #5b21b6);
  border: 1px solid rgba(167, 139, 250, 0.5);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.jump-latest-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 2, 10, 0.82);
  backdrop-filter: blur(10px);
}

.onboarding-card {
  max-width: 420px;
  width: 100%;
  background: linear-gradient(180deg, #1b1530, #0f0f1e);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 16px;
  padding: 24px 22px 20px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.onboarding-title {
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--accent-light);
}

.onboarding-body {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.onboarding-body a { color: #a5b4fc; }
.onboard-brain { font-size: 48px; text-align: center; margin: 8px 0; }
.onboarding-status { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.chat-history-empty {
  padding: 12px 2px 8px;
  text-align: center;
}

.chat-history-empty-text {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.chat-history-empty-hint {
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
}

.msg-time { opacity: 0.9; }

.setup-guide-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: #a5b4fc;
  font-size: 10px;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
  padding: 0;
}
.setup-guide-link:hover { color: #c4b5fd; }

.sidebar {
  position: relative;
}
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
}
.sidebar-resize-handle:hover {
  background: rgba(167, 139, 250, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .thinking-dots span,
  .pulse-dot,
  .mood--frustrated,
  .mood--excited,
  .mood--confused,
  #headerBrain.bryan-wake,
  .thinking-text.thinking-flip {
    animation: none !important;
  }
  #neuralCanvas {
    opacity: 0.18 !important;
  }
}

/* ----- About Bryan panel ----- */
.about-view {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 32px;
  background: linear-gradient(180deg, rgba(13, 13, 20, 0.98), var(--bg-primary));
  border-top: 1px solid var(--border-subtle);
}

.about-view[hidden] {
  display: none !important;
}

.about-view:not([hidden]) {
  display: block;
}

.about-hero {
  text-align: center;
  margin-bottom: 28px;
}

.about-hero-svg {
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
  filter: drop-shadow(0 0 28px rgba(167, 139, 250, 0.8));
  animation: floatBrain 3s ease-in-out infinite;
}

.about-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.about-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.about-repo {
  display: inline-block;
  font-size: 12px;
  color: #a5b4fc;
  text-decoration: none;
}
.about-repo:hover { text-decoration: underline; }

.about-section {
  margin-bottom: 22px;
}

.about-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.about-timeline {
  border-left: 2px solid rgba(124, 58, 237, 0.4);
  padding-left: 14px;
  margin: 0;
  list-style: none;
}

.about-timeline li {
  position: relative;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.about-timeline li::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

.about-tldate {
  font-size: 10px;
  color: var(--accent-light);
  display: block;
  margin-bottom: 2px;
}

.about-filetree {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;
}

.about-design-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.about-design-list li { margin-bottom: 6px; }

.about-narrative {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.about-close-row {
  margin-top: 24px;
  text-align: center;
}

.sidebar-about-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent-light);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-about-btn:hover {
  background: rgba(124, 58, 237, 0.22);
}

.sidebar-intel-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: var(--radius-sm);
  color: var(--accent-light);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-intel-btn:hover {
  background: rgba(167, 139, 250, 0.22);
}

.idle-learning-status {
  font-size: 11px;
  color: var(--accent-light);
  margin: 6px 0 0;
  line-height: 1.35;
}

.research-mode-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.research-proxy-input {
  font-size: 11px !important;
}

.thinking-indicator {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.thinking-confidence {
  display: flex;
  gap: 4px;
  align-items: center;
}
.conf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.conf-dot.on {
  background: #a78bfa;
  box-shadow: 0 0 6px #7c3aed;
}

.msg-kb-panel {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.kb-frag-btn {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.45);
  color: #e9d5ff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: help;
  max-width: 100%;
}
.kb-frag-pop {
  display: none;
  position: absolute;
  z-index: 20;
  max-width: 320px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  white-space: pre-wrap;
}
.msg-kb-wrap { position: relative; }

.msg-feedback-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding-left: 2px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, max-height 0.2s ease;
}
.message.assistant:hover .msg-feedback-bar,
.message.assistant:focus-within .msg-feedback-bar {
  opacity: 1;
  max-height: 220px;
}
.msg-feedback-up,
.msg-feedback-down {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.msg-feedback-up:hover { border-color: #86efac; }
.msg-feedback-down:hover { border-color: #f87171; }
.msg-feedback-reasons {
  display: none;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}
.msg-feedback-reasons.open { display: flex; }
.msg-feedback-reasons button {
  text-align: left;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.bryan-daily-growth {
  text-align: center;
  color: #a78bfa;
  font-size: 13px;
  margin: 8px 0 0;
}

.brain-logo.bryan-kb-pulse {
  animation: bryanKbPulse 0.5s ease-out;
}
@keyframes bryanKbPulse {
  0% { filter: drop-shadow(0 0 0 rgba(124, 58, 237, 0)); }
  40% { filter: drop-shadow(0 0 16px rgba(167, 139, 250, 0.95)); }
  100% { filter: drop-shadow(0 0 0 rgba(124, 58, 237, 0)); }
}


.shared-chat-notice {
     display: flex; align-items: center; justify-content: space-between;
     gap: 12px; border: 1px solid rgba(124,58,237,.4); border-radius: 10px;
     padding: 10px 16px; margin: 0 0 16px; font-size: 13px; color: #c4b5fd;
}
