/* ============================================
   PT Chat - Design System Implementation
   Aesthetic: KPMG × Westside LA spa × FAANG
   ============================================ */

/* === CSS Variables (Design Tokens) === */
/* Visual Refresh: "Oatmilk Slate" — Session 12 */
:root {
  /* Colors - Primary Neutrals (Updated) */
  --ivory: #F5F3EE;           /* Oatmilk-slate bg */
  --pearl: #FAFAF9;           /* stone-50 - lighter panels */
  --sand: #E7E5E4;            /* stone-200 - borders */
  --warm-gray: #78716C;       /* stone-500 - muted text */
  --charcoal: #292524;        /* stone-800 - primary text */
  --espresso: #1C1917;        /* stone-900 - darkest */

  /* Colors - Stone Scale (New) */
  --stone-50: #FAFAF9;
  --stone-100: #F5F5F4;
  --stone-200: #E7E5E4;
  --stone-300: #D6D3D1;
  --stone-400: #A8A29E;
  --stone-500: #78716C;
  --stone-600: #57534E;
  --stone-700: #44403C;
  --stone-800: #292524;
  --stone-900: #1C1917;

  /* Colors - Accents (use sparingly) */
  --terracotta: #C4A484;
  --rose-taupe: #B8A99A;
  --dusty-rose: #D4B5A0;

  /* Colors - Glass Effects */
  --bg-glass: rgba(255, 255, 255, 0.5);
  --bg-glass-strong: rgba(255, 255, 255, 0.7);
  --border-glass: rgba(231, 229, 228, 0.6);

  /* Typography */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 48px;
  --space-xl: 80px;

  /* Border Radius (New) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Shadows (Updated) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html {
  font-size: 17px;  /* Bumped from 16px for better readability */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--charcoal);
  background: var(--ivory);
  line-height: 1.6;
  min-height: 100vh;
}

/* === App Layout === */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;           /* Fixed viewport height - prevents overflow */
  max-height: 100vh;       /* Hard cap */
  max-width: 1400px;
  margin: 0 auto;
  overflow: hidden;        /* Contain children */
}

/* === Header === */
.app-header {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-glass);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--stone-800);
}

.brand-subtitle {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-400);
}

.user-section {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--warm-gray);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sand);
  transition: background var(--transition-normal);
}

.status-dot.connected {
  background: #7CB97C;
}

.status-dot.disconnected {
  background: var(--terracotta);
}

.btn-subtle {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--warm-gray);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 2px;
  transition: color var(--transition-fast);
}

.btn-subtle:hover {
  color: var(--charcoal);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--stone-500);
}

.theme-toggle:hover {
  background: var(--stone-200);
  color: var(--stone-700);
}

.theme-icon-dark {
  display: none;
}

/* Dark mode: show moon, hide sun */
[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--charcoal);
  background: var(--pearl);
  border: 1px solid var(--sand);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.btn-new-chat:hover {
  background: var(--charcoal);
  color: var(--ivory);
  border-color: var(--charcoal);
}

.btn-new-chat svg {
  transition: transform var(--transition-fast);
}

.btn-new-chat:hover svg {
  transform: rotate(90deg);
}

/* === Main Content === */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 0;
  overflow: hidden;
  min-height: 0;           /* Critical: allows flex child to shrink below content size */
}

/* === Sidebar === */
.sidebar {
  width: 288px;
  min-width: 288px;
  background: var(--bg-glass-strong);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  overflow: hidden;
  min-height: 0;           /* Allow shrinking in flex context */
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
}

.sidebar-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stone-400);
}

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

/* Full-width New Chat Button */
.btn-new-chat-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: var(--stone-800);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-new-chat-sidebar:hover {
  background: var(--stone-900);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--stone-400);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--stone-100);
  color: var(--stone-600);
}

/* Search with Icon */
.sidebar-search {
  padding: 0 var(--space-sm) var(--space-sm);
}

.search-container {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--stone-400);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--stone-700);
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--stone-300);
  background: white;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.1);
}

.search-input::placeholder {
  color: var(--stone-400);
}

.sidebar-conversations {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs);
}

.sidebar-empty {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  color: var(--warm-gray);
}

.sidebar-empty p {
  font-size: 0.875rem;
}

.sidebar-empty-hint {
  font-size: 0.75rem;
  margin-top: var(--space-xs);
  opacity: 0.7;
}

/* Conversation Item */
.conversation-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.conversation-item:hover {
  background: rgba(255, 255, 255, 0.6);
}

.conversation-item.active {
  background: white;
  box-shadow: var(--shadow-sm);
}

.conversation-icon {
  color: var(--stone-400);
  flex-shrink: 0;
  margin-top: 2px;
}

.conversation-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.conversation-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.conversation-preview {
  font-size: 0.75rem;
  color: var(--stone-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.conversation-time {
  font-size: 0.65rem;
  color: var(--stone-400);
}

/* Colored Assistant Badges */
.conversation-bot {
  font-size: 0.625rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid;
}

.conversation-bot[data-bot="claude"] {
  background: var(--stone-100);
  color: var(--stone-600);
  border-color: var(--stone-200);
}

.conversation-bot[data-bot="tia2"],
.conversation-bot[data-bot="tiaviz"] {
  background: #F5F5F4;
  color: var(--stone-600);
  border-color: var(--stone-200);
}

.conversation-bot[data-bot="fetch"] {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}

.conversation-bot[data-bot="burnbook"] {
  background: #FFFBEB;
  color: #B45309;
  border-color: #FDE68A;
}

.conversation-actions {
  display: none;
  gap: 4px;
}

.conversation-item:hover .conversation-actions {
  display: flex;
}

.conversation-action {
  background: none;
  border: none;
  padding: 4px;
  color: var(--warm-gray);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.conversation-action:hover {
  background: var(--sand);
  color: var(--charcoal);
}

.conversation-pin {
  color: var(--terracotta);
}

/* Pinned section */
.conversations-section {
  margin-bottom: var(--space-sm);
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warm-gray);
  padding: var(--space-xs) 12px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-sm);
  border-top: 1px solid var(--sand);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--warm-gray);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warm-gray);
}

.sync-dot.synced {
  background: #48bb78;
}

.sync-dot.syncing {
  background: var(--terracotta);
  animation: pulse 1s infinite;
}

.sync-dot.offline {
  background: #c53030;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Sidebar Open Button (shown when collapsed) */
.sidebar-open-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  background: var(--charcoal);
  border: none;
  border-radius: 0 8px 8px 0;
  color: white;
  cursor: pointer;
  position: fixed;
  left: 0;
  top: 120px;
  z-index: 50;
  transition: all var(--transition-fast);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-open-btn svg {
  transform: rotate(90deg);
}

.sidebar-open-btn:hover {
  background: var(--espresso);
  padding-right: 18px;
}

.sidebar.collapsed ~ .sidebar-open-btn {
  display: flex;
}

/* Main content area (right of sidebar) */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  gap: var(--space-sm);
  overflow: hidden;
  min-height: 0;           /* Allow shrinking in flex context */
  min-width: 0;            /* Prevent horizontal overflow */
}

/* === Bot Selector === */
.bot-selector {
  padding-bottom: var(--space-sm);
  flex-shrink: 0;          /* Don't shrink bot selector */
}

.selector-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone-400);
  margin-bottom: var(--space-sm);
}

.bot-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.bot-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-sm);
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 140px;
  max-width: 160px;
  flex: 1;
}

.bot-option:hover {
  border-color: var(--stone-300);
  box-shadow: var(--shadow-sm);
}

.bot-option.active {
  background: var(--stone-700);
  border-color: var(--stone-600);
  box-shadow: var(--shadow-md);
}

.bot-option.active .bot-icon,
.bot-option.active .bot-name,
.bot-option.active .bot-desc {
  color: white;
}

/* Icon Container */
.bot-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--stone-100);
  border-radius: var(--radius-md);
  color: var(--stone-500);
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

.bot-option.active .bot-icon {
  background: var(--stone-600);
  color: white;
}

.bot-name {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stone-800);
  transition: color var(--transition-fast);
}

.bot-desc {
  font-size: 0.75rem;
  color: var(--stone-500);
  margin-top: 2px;
  transition: color var(--transition-fast);
}

.bot-option.active .bot-desc {
  color: var(--stone-400);
}

/* === Compact Mode (conversation active) === */
.content-area.has-conversation .bot-selector {
  padding-bottom: 0;
  transition: padding 0.3s ease;
}

.content-area.has-conversation .selector-label {
  display: none;
}

.content-area.has-conversation .bot-options {
  gap: 8px;
  transition: gap 0.3s ease;
}

.content-area.has-conversation .bot-option {
  flex-direction: row;
  align-items: center;
  padding: 6px 12px;
  min-width: auto;
  max-width: none;
  flex: 0 0 auto;
  gap: 8px;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
}

.content-area.has-conversation .bot-option .bot-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.content-area.has-conversation .bot-option .bot-icon svg {
  width: 16px;
  height: 16px;
}

.content-area.has-conversation .bot-option .bot-name {
  font-size: 0.8125rem;
  transition: font-size 0.3s ease;
}

.content-area.has-conversation .bot-option .bot-desc {
  /* Hide in compact mode */
  display: none;
}

.content-area.has-conversation .bot-option {
  position: relative;
}

/* Tooltip using data-tooltip attribute */
.content-area.has-conversation .bot-option::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--stone-800);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  max-width: 260px;
  white-space: normal;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.content-area.has-conversation .bot-option::before {
  /* Tooltip arrow */
  content: '';
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--stone-800);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1001;
}

.content-area.has-conversation .bot-option:hover::after,
.content-area.has-conversation .bot-option:hover::before {
  opacity: 1;
  visibility: visible;
}

.content-area.has-conversation .bot-option.active .bot-icon {
  background: var(--stone-600);
}

/* Compact bot options panel */
.content-area.has-conversation .bot-options-panel {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  margin-top: 8px;
  transition: all 0.3s ease;
}

.content-area.has-conversation .option-label {
  display: none;
}

/* Compact selector row - merge into single line */
.content-area.has-conversation .bot-selector,
.content-area.has-conversation .bot-options-panel {
  display: inline-flex;
  vertical-align: middle;
}

.content-area.has-conversation .bot-selector {
  flex-wrap: nowrap;
}

/* Compact mode wrapper for inline layout */
.content-area.has-conversation {
  --compact-bar-height: auto;
}

/* Create compact bar container effect */
.content-area.has-conversation > .bot-selector {
  background: var(--stone-100);
  padding: 6px 8px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.content-area.has-conversation > .bot-options-panel {
  background: var(--stone-100);
  margin-top: 0;
  margin-left: 8px;
}

/* Model pills compact */
.content-area.has-conversation .model-pills {
  gap: 6px;
}

.content-area.has-conversation .model-pill {
  padding: 4px 10px;
  gap: 6px;
  border-radius: var(--radius-full);
}

.content-area.has-conversation .model-pill-icon {
  font-size: 0.875rem;
}

.content-area.has-conversation .model-pill-name {
  font-size: 0.75rem;
}

.content-area.has-conversation .model-pill-tag {
  font-size: 0.625rem;
  padding: 1px 4px;
}

/* Checkbox group compact */
.content-area.has-conversation .checkbox-group {
  gap: 6px;
}

.content-area.has-conversation .checkbox-item {
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.content-area.has-conversation .checkbox-text {
  font-size: 0.75rem;
}

.content-area.has-conversation .checkbox-icon {
  font-size: 0.875rem;
}

/* === Chat Container === */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 0;           /* Allow flex shrinking - fills remaining space */
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 0;           /* Allow flex shrinking */
}

/* Empty state: center welcome message */
.chat-messages:has(.welcome-message) {
  justify-content: center;
  padding-bottom: 80px;    /* Optical center - push slightly above true center */
}

/* === Welcome Message === */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-md);
  max-width: 520px;
  margin: 0 auto;
  flex-shrink: 0;          /* Don't shrink welcome content */
}

.welcome-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--stone-100) 0%, var(--stone-50) 100%);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.welcome-icon svg {
  color: var(--stone-400);
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--stone-800);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.welcome-subtitle {
  font-size: 0.9375rem;
  color: var(--stone-400);
  margin-bottom: var(--space-md);
}

/* Quick Prompt Pills - OpenAI style */
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: var(--space-xs);
}

.quick-prompt-pill {
  padding: 10px 18px;
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-600);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-prompt-pill:hover {
  border-color: var(--stone-300);
  background: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* === Chat Messages === */
.message {
  max-width: 75%;
  animation: messageIn var(--transition-slow) ease-out;
}

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

.message.user {
  align-self: flex-end;
}

.message.assistant {
  max-width: 95%; /* Wider for rich structured responses */
  align-self: flex-start;
}

.message-content {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.message.user .message-content {
  background: var(--stone-800);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}

.message.assistant .message-content {
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  color: var(--stone-700);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--stone-400);
}

.message.user .message-meta {
  justify-content: flex-end;
}

/* === Thinking Bubble === */
.thinking-bubble {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
  animation: messageIn var(--transition-slow) ease-out;
}

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

.thinking-dot {
  width: 6px;
  height: 6px;
  background: var(--terracotta);
  border-radius: 50%;
  animation: thinking 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.thinking-text {
  font-size: 0.85rem;
  color: var(--warm-gray);
  font-style: italic;
}

/* === Input Area === */
.chat-input-area {
  padding: var(--space-md);
  background: var(--stone-50);
  border-top: 1px solid var(--stone-200);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-2xl);
  padding: 6px 8px 6px 6px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.input-container:focus-within {
  border-color: var(--stone-300);
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.1);
}

/* Attach Button */
.attach-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  color: var(--stone-400);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.attach-button:hover {
  background: var(--stone-50);
  border-color: var(--stone-300);
  color: var(--stone-600);
}

.attach-button.hidden {
  display: none;
}

.message-input {
  flex: 1;
  padding: 10px 8px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--stone-700);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  max-height: 150px;
  line-height: 1.6;
}

.message-input::placeholder {
  color: var(--stone-400);
}

/* Gradient Send Button */
.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
  flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.send-button:active:not(:disabled) {
  transform: scale(0.98);
}

.send-button:disabled {
  background: var(--stone-200);
  color: var(--stone-400);
  cursor: not-allowed;
  box-shadow: none;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--stone-400);
  margin-top: var(--space-xs);
  text-align: center;
}

.current-bot {
  font-weight: 600;
  color: var(--stone-600);
}

/* === File Preview === */
.file-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  color: var(--stone-600);
}

.file-chip-icon {
  font-size: 1rem;
}

.file-chip-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 2px;
  background: var(--stone-200);
  border: none;
  border-radius: 50%;
  color: var(--stone-500);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

.file-chip-remove:hover {
  background: var(--stone-300);
  color: var(--stone-700);
}

/* Dark mode file preview */
[data-theme="dark"] .file-chip {
  background: #292524;
  border-color: #44403C;
  color: #D6D3D1;
}

[data-theme="dark"] .file-chip-remove {
  background: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .file-chip-remove:hover {
  background: #57534E;
  color: #FAFAF9;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--ivory);
  padding: var(--space-lg);
  border-radius: 2px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--warm-gray);
  margin-bottom: var(--space-md);
}

.btn-primary {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ivory);
  background: var(--charcoal);
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.btn-primary:hover {
  background: var(--espresso);
  transform: translateY(-1px);
}

.modal-hint {
  font-size: 0.75rem;
  color: var(--warm-gray);
  margin-top: var(--space-sm);
}

.password-input {
  width: 100%;
  padding: var(--space-sm);
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--charcoal);
  background: var(--pearl);
  border: 1px solid var(--sand);
  border-radius: 2px;
  margin-bottom: var(--space-md);
  outline: none;
  text-align: center;
  letter-spacing: 0.1em;
}

.password-input:focus {
  border-color: var(--terracotta);
}

.password-input::placeholder {
  color: var(--warm-gray);
  letter-spacing: normal;
}

/* === Login Page === */
.login-page {
  position: fixed;
  inset: 0;
  background: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-page[style*="display: none"] {
  display: none !important;
}

.login-container {
  width: 100%;
  max-width: 440px;
  padding: var(--space-md);
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--stone-200);
  padding: var(--space-lg) var(--space-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--stone-100) 0%, var(--stone-50) 100%);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-xl);
  margin: 0 auto var(--space-md);
  box-shadow: var(--shadow-sm);
}

.login-logo svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
  color: var(--stone-400);
}

.login-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 500;
  color: var(--stone-800);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.login-tagline {
  font-size: 1rem;
  color: var(--stone-500);
  margin-bottom: var(--space-lg);
}

.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  text-align: left;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--charcoal);
}

.feature-icon {
  font-size: 1.125rem;
}

.login-button {
  width: 100%;
  padding: 14px var(--space-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--stone-800);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.login-button:hover {
  background: var(--stone-900);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.login-button:active {
  transform: translateY(0);
}

.login-error {
  font-size: 0.875rem;
  color: #c53030;
  margin-top: var(--space-sm);
  display: none;
}

.login-error:not(:empty) {
  display: block;
}

.login-footer {
  font-size: 0.75rem;
  color: var(--warm-gray);
  margin-top: var(--space-md);
}

/* === User Display in Header === */
.user-email {
  font-size: 0.8rem;
  color: var(--warm-gray);
  margin-right: var(--space-sm);
}

/* === Error State === */
.message.error .message-content {
  background: #FDF6F4;
  border-color: var(--terracotta);
  color: var(--charcoal);
}

/* === Responsive === */
@media (max-width: 768px) {
  .app-header {
    padding: var(--space-sm) var(--space-md);
  }

  /* Sidebar hidden by default on mobile */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
  }

  .sidebar:not(.collapsed) {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  /* Overlay when sidebar is open */
  .sidebar:not(.collapsed)::after {
    content: '';
    position: fixed;
    left: 288px;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
  }

  .content-area {
    padding: var(--space-md);
  }

  .bot-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
  }

  .bot-option {
    min-width: auto;
    max-width: none;
    padding: 12px;
  }

  .bot-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
  }

  .bot-desc {
    display: none;
  }

  .message {
    max-width: 90%;
  }

  .chat-messages {
    padding: var(--space-md);
  }

  .quick-prompts {
    flex-direction: column;
  }

  .quick-prompt-pill {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .brand-subtitle {
    display: none;
  }

  .bot-options {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .bot-option {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
  }

  .bot-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
  }

  .bot-icon svg {
    width: 14px;
    height: 14px;
  }

  .bot-name {
    font-size: 0.65rem;
    text-align: center;
  }
}

/* === Scrollbar Styling === */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--sand);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--warm-gray);
}

/* === Code Blocks (for assistant responses) === */
.message-content pre {
  background: var(--pearl);
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: var(--space-sm);
  overflow-x: auto;
  margin: var(--space-sm) 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.85rem;
}

.message-content code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.85em;
  background: var(--pearl);
  padding: 2px 6px;
  border-radius: 2px;
}

.message-content pre code {
  background: transparent;
  padding: 0;
}

/* === Links in messages === */
.message-content a {
  color: var(--terracotta);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.message-content a:hover {
  border-bottom-color: var(--terracotta);
}

/* === Lists in messages === */
.message-content ul,
.message-content ol {
  margin: var(--space-sm) 0;
  padding-left: var(--space-md);
}

.message-content li {
  margin-bottom: var(--space-xs);
}


/* === Bot Options Panel === */
.bot-options-panel {
  padding: var(--space-sm) var(--space-md);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stone-200);
  flex-shrink: 0;          /* Don't shrink options panel */
}

.option-group {
  margin-bottom: 0;
}

.option-group:last-child {
  margin-bottom: 0;
}

.option-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone-400);
  margin-bottom: 10px;
}

/* Checkbox group for platforms (Burn Book) */
.checkbox-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.checkbox-item:hover {
  border-color: var(--stone-300);
  background: white;
}

.checkbox-item:has(input:checked) {
  background: var(--stone-800);
  border-color: var(--stone-700);
}

.checkbox-item:has(input:checked) .checkbox-text {
  color: white;
}

.checkbox-item input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--stone-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-item:has(input:checked) input[type="checkbox"] {
  background: white;
  border-color: white;
}

.checkbox-item input[type="checkbox"]:checked {
  position: relative;
}

.checkbox-item input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: -1px;
  left: 2px;
  color: var(--stone-800);
  font-size: 11px;
  font-weight: 700;
}

.checkbox-icon {
  font-size: 1.125rem;
}

.checkbox-text {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-700);
}

/* Disabled checkbox state */
.checkbox-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.checkbox-item.disabled:hover {
  border-color: var(--stone-200);
  background: var(--stone-50);
}

.coming-soon {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stone-400);
  background: var(--stone-100);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

/* Model select dropdown (Fetch) */
.model-select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--stone-700);
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
  box-shadow: var(--shadow-sm);
}

.model-select:hover {
  border-color: var(--stone-300);
  box-shadow: var(--shadow-md);
}

.model-select:focus {
  outline: none;
  border-color: var(--stone-400);
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.15);
}

/* Model Pills (Fetch) */
.model-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.model-pill:hover {
  border-color: var(--stone-300);
  background: white;
}

.model-pill.active {
  background: var(--stone-800);
  border-color: var(--stone-700);
}

.model-pill-icon {
  font-size: 1rem;
}

.model-pill-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-700);
}

.model-pill.active .model-pill-name {
  color: white;
}

.model-pill-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  background: var(--stone-200);
  color: var(--stone-500);
  border-radius: var(--radius-sm);
}

.model-pill.active .model-pill-tag {
  background: var(--stone-600);
  color: var(--stone-200);
}

@media (max-width: 480px) {
  .checkbox-group {
    flex-direction: column;
  }

  .checkbox-item {
    width: 100%;
  }
}

/* === Streaming Response Styles === */

/* Blinking cursor during streaming */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--terracotta);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s step-end infinite;
}

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

/* Streaming message container */
.message.streaming .message-content {
  min-height: 1.5em;
}

/* Progress phases */
.streaming-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--ivory);
  border: 1px solid var(--sand);
  border-radius: 2px;
  margin-bottom: var(--space-sm);
  font-size: 0.85rem;
  color: var(--warm-gray);
}

.streaming-progress .phase-icon {
  width: 16px;
  height: 16px;
  border: 2px solid var(--terracotta);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.streaming-progress .phase-text {
  font-style: italic;
}

/* Enhanced markdown rendering */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: var(--space-md) 0 var(--space-sm) 0;
  color: var(--charcoal);
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.3rem; }
.message-content h3 { font-size: 1.15rem; }
.message-content h4 { font-size: 1rem; }

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
  margin-top: 0;
}

.message-content p {
  margin: var(--space-sm) 0;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content blockquote {
  border-left: 3px solid var(--terracotta);
  padding-left: var(--space-md);
  margin: var(--space-sm) 0;
  color: var(--warm-gray);
  font-style: italic;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--sand);
  margin: var(--space-md) 0;
}

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-sm) 0;
  font-size: 0.9rem;
}

.message-content th,
.message-content td {
  border: 1px solid var(--sand);
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
}

.message-content th {
  background: var(--pearl);
  font-weight: 500;
}

.message-content tr:nth-child(even) {
  background: var(--pearl);
}

/* Syntax highlighting adjustments for our theme */
.message-content pre {
  position: relative;
  background: #f6f8fa;
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-sm) 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.message-content pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* Language label on code blocks */
.message-content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--warm-gray);
  background: var(--pearl);
  border-bottom-left-radius: 2px;
}

/* Copy button for code blocks */
.code-block-wrapper {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-family: var(--font-sans);
  color: var(--warm-gray);
  background: var(--pearl);
  border: 1px solid var(--sand);
  border-radius: 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.code-block-wrapper:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: var(--charcoal);
  color: var(--ivory);
  border-color: var(--charcoal);
}

.code-copy-btn.copied {
  background: #7CB97C;
  color: white;
  border-color: #7CB97C;
}

/* Task lists (checkboxes in markdown) */
.message-content ul.task-list {
  list-style: none;
  padding-left: 0;
}

.message-content .task-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
}

.message-content .task-list-item input[type="checkbox"] {
  margin-top: 4px;
}

/* =============================================================================
   TIA RESPONSE COMPONENTS
   FAANG-polished analytics UI with D3 charts
   Added: 2025-12-12 (Session 9)
   ============================================================================= */

/* Response Container */
.tia-response {
  --tia-primary: #C4A484;
  --tia-secondary: #D4A574;
  --tia-success: #4A7C59;
  --tia-danger: #B85450;
  --tia-muted: #9B8B7D;
  --tia-border: #E8E4DE;
  --tia-bg-card: #FFFFFF;
  --tia-radius: 12px;

  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

/* Header Section */
.tia-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--tia-border);
}

.tia-header-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--tia-primary) 0%, var(--tia-secondary) 100%);
  border-radius: 10px;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.tia-header-text {
  flex: 1;
}

.tia-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: 0 0 2px 0;
}

.tia-subtitle {
  font-size: 0.8rem;
  color: var(--tia-muted);
  margin: 0;
}

/* Summary */
.tia-summary {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--charcoal);
  padding: var(--space-sm) var(--space-md);
  background: var(--pearl);
  border-radius: var(--tia-radius);
  border-left: 3px solid var(--tia-primary);
}

/* Metric Cards Grid */
.tia-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.tia-metric-card {
  background: var(--tia-bg-card);
  border: 1px solid var(--tia-border);
  border-radius: var(--tia-radius);
  padding: var(--space-md);
  text-align: center;
  transition: all var(--transition-fast);
}

.tia-metric-card:hover {
  border-color: var(--tia-primary);
  box-shadow: 0 4px 12px rgba(196, 164, 132, 0.15);
}

.tia-metric-card.highlight {
  border-color: var(--tia-primary);
  background: linear-gradient(135deg, #FDFBF7 0%, #F8F4EE 100%);
}

.tia-metric-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.2;
}

.tia-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tia-muted);
  margin-top: 4px;
}

.tia-metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 12px;
}

.tia-metric-trend.up {
  color: var(--tia-success);
  background: rgba(74, 124, 89, 0.1);
}

.tia-metric-trend.down {
  color: var(--tia-danger);
  background: rgba(184, 84, 80, 0.1);
}

.tia-metric-trend.flat {
  color: var(--tia-muted);
  background: rgba(155, 139, 125, 0.1);
}

.tia-metric-context {
  font-size: 0.7rem;
  color: var(--tia-muted);
  margin-top: 4px;
}

.tia-metric-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  background: var(--tia-primary);
  color: white;
  border-radius: 4px;
  margin-top: 6px;
}

.tia-metric-sparkline {
  height: 24px;
  margin-top: 8px;
}

/* Content Card (Post Preview) */
.tia-content-card {
  background: var(--tia-bg-card);
  border: 1px solid var(--tia-border);
  border-radius: var(--tia-radius);
  overflow: hidden;
}

.tia-content-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--tia-border);
}

.tia-content-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  background: var(--pearl);
  border-radius: 4px;
  color: var(--tia-muted);
}

.tia-content-title {
  flex: 1;
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.95rem;
}

.tia-content-date {
  font-size: 0.75rem;
  color: var(--tia-muted);
}

.tia-content-body {
  padding: var(--space-md);
}

.tia-content-preview {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--warm-gray);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tia-content-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  color: var(--tia-primary);
  text-decoration: none;
  font-weight: 500;
}

.tia-content-link:hover {
  text-decoration: underline;
}

/* Charts Section */
.tia-charts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tia-chart-container {
  background: var(--tia-bg-card);
  border: 1px solid var(--tia-border);
  border-radius: var(--tia-radius);
  padding: var(--space-md);
}

.tia-chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}

.tia-chart-subtitle {
  font-size: 0.75rem;
  color: var(--tia-muted);
  margin-bottom: var(--space-md);
}

.tia-chart-canvas {
  width: 100%;
  min-height: 200px;
}

.tia-chart-canvas.size-small {
  min-height: 60px;
}

.tia-chart-canvas.size-large {
  min-height: 300px;
}

.tia-chart-canvas.size-full {
  min-height: 400px;
}

/* Insights Section */
.tia-insights {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tia-insights-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--tia-border);
}

.tia-insight {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.tia-insight-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 14px;
}

.tia-insight-icon.success {
  background: rgba(74, 124, 89, 0.1);
  color: var(--tia-success);
}

.tia-insight-icon.primary {
  background: rgba(196, 164, 132, 0.15);
  color: var(--tia-primary);
}

.tia-insight-icon.warning {
  background: rgba(212, 165, 116, 0.15);
  color: var(--tia-secondary);
}

.tia-insight-content {
  flex: 1;
}

.tia-insight-headline {
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.tia-insight-detail {
  font-size: 0.85rem;
  color: var(--warm-gray);
  line-height: 1.5;
}

/* Follow-up Questions */
.tia-followups {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--tia-border);
}

.tia-followup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--pearl);
  border: 1px solid var(--tia-border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--charcoal);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tia-followup:hover {
  background: var(--tia-primary);
  border-color: var(--tia-primary);
  color: white;
}

.tia-followup-icon {
  font-size: 12px;
  opacity: 0.7;
}

/* Data Table */
.tia-data-table-container {
  border: 1px solid var(--tia-border);
  border-radius: var(--tia-radius);
  overflow: hidden;
}

.tia-data-table-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--pearl);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.tia-data-table-toggle:hover {
  background: var(--sand);
}

.tia-data-table-toggle-text {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--charcoal);
}

.tia-data-table-toggle-icon {
  font-size: 12px;
  transition: transform var(--transition-fast);
}

.tia-data-table-toggle.expanded .tia-data-table-toggle-icon {
  transform: rotate(180deg);
}

.tia-data-table-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.tia-data-table-content.expanded {
  max-height: 500px;
  overflow: auto; /* Both x and y scroll */
}

.tia-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tia-data-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  background: var(--ivory);
  font-weight: 600;
  color: var(--charcoal);
  border-bottom: 1px solid var(--tia-border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tia-data-table th.align-right {
  text-align: right;
}

.tia-data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--tia-border);
  color: var(--warm-gray);
  white-space: nowrap;
}

/* Text columns can wrap */
.tia-data-table td.text-col {
  white-space: normal;
  max-width: 250px;
  line-height: 1.4;
}

.tia-data-table td.align-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tia-data-table tr:last-child td {
  border-bottom: none;
}

.tia-data-table tr:hover td {
  background: var(--pearl);
}

.tia-data-table .positive {
  color: var(--tia-success);
}

.tia-data-table .negative {
  color: var(--tia-danger);
}

.tia-data-table-footer {
  padding: var(--space-sm) var(--space-md);
  background: var(--pearl);
  font-size: 0.75rem;
  color: var(--tia-muted);
  font-style: italic;
}

/* Export Actions */
.tia-export {
  display: flex;
  gap: var(--space-xs);
  padding-top: var(--space-sm);
}

.tia-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--tia-border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--tia-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tia-export-btn:hover {
  border-color: var(--tia-primary);
  color: var(--tia-primary);
}

.tia-export-btn.copied {
  border-color: var(--tia-success);
  color: var(--tia-success);
}

/* Meta Info */
.tia-meta {
  display: flex;
  gap: var(--space-md);
  font-size: 0.7rem;
  color: var(--tia-muted);
  padding-top: var(--space-xs);
}

.tia-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Responsive */
@media (max-width: 600px) {
  .tia-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .tia-metric-value {
    font-size: 1.4rem;
  }

  .tia-followups {
    flex-direction: column;
  }

  .tia-followup {
    justify-content: center;
  }

  .tia-chart-canvas {
    min-height: 180px;
  }
}

/* D3 Chart Overrides */
.tia-sparkline {
  display: block;
}

.tia-line-chart,
.tia-bar-chart,
.tia-donut-chart,
.tia-radar-chart {
  display: block;
  width: 100%;
}

.tia-line-chart .x-axis .domain,
.tia-bar-chart .x-axis .domain {
  stroke: var(--tia-border);
}

.tia-line-chart .tick text,
.tia-bar-chart .tick text {
  fill: var(--tia-muted);
}

/* =============================================================================
   BURN BOOK RESPONSE COMPONENTS
   Social intelligence styled post cards
   ============================================================================= */

/* Variables */
.bb-response {
  --bb-reddit: #FF4500;
  --bb-tiktok: #000000;
  --bb-instagram: #E1306C;
  --bb-radius: 8px;
  --bb-border: #E8E4DE;
}

/* Header */
.bb-header {
  margin-bottom: var(--space-md);
}

.bb-header-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bb-header-icon {
  font-size: 1.1em;
}

.bb-header-query {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--charcoal);
  margin: var(--space-xs) 0;
}

.bb-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.bb-result-count {
  font-size: 0.85rem;
  color: var(--warm-gray);
  font-weight: 500;
}

.bb-platform-tags {
  display: flex;
  gap: var(--space-xs);
}

.bb-platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Posts Container */
.bb-posts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Post Card */
.bb-post-card {
  background: white;
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius);
  padding: var(--space-md);
  transition: box-shadow 0.2s ease;
}

.bb-post-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.bb-post-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-left: var(--space-sm);
  border-left: 3px solid;
  margin-bottom: var(--space-sm);
}

.bb-post-platform {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.bb-subreddit {
  font-size: 0.75rem;
  color: var(--warm-gray);
  background: var(--pearl);
  padding: 2px 6px;
  border-radius: 4px;
}

.bb-post-title {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--terracotta);
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: var(--space-xs);
}

.bb-post-title:hover {
  text-decoration: underline;
}

.bb-post-author {
  font-size: 0.8rem;
  color: var(--warm-gray);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.bb-post-content {
  font-size: 0.9rem;
  color: var(--warm-gray);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  /* Clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Engagement Pills */
.bb-post-engagement {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.bb-engagement-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--pearl);
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--charcoal);
}

/* Score Bars */
.bb-post-scores {
  display: flex;
  gap: var(--space-md);
}

.bb-score {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.bb-score-label {
  font-size: 0.7rem;
  color: var(--warm-gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 70px;
}

.bb-score-bar {
  flex: 1;
  height: 6px;
  background: var(--pearl);
  border-radius: 3px;
  overflow: hidden;
}

.bb-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

.bb-score-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--charcoal);
  min-width: 24px;
  text-align: right;
}

/* Summary Bar */
.bb-summary-bar {
  background: var(--pearl);
  border-radius: var(--bb-radius);
  padding: var(--space-md);
  margin-top: var(--space-md);
}

.bb-summary-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}

.bb-summary-themes {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.bb-theme-tag {
  display: inline-block;
  padding: 4px 10px;
  background: white;
  border: 1px solid var(--bb-border);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--charcoal);
}

.bb-summary-stat {
  font-size: 0.8rem;
  color: var(--warm-gray);
  margin-top: var(--space-xs);
}

/* Follow-ups */
.bb-follow-ups {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--bb-border);
}

.bb-follow-up-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--bb-border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bb-follow-up-chip:hover {
  background: var(--pearl);
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.bb-follow-up-icon {
  font-size: 1em;
}

/* Responsive */
@media (max-width: 600px) {
  .bb-post-scores {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .bb-score-label {
    min-width: 60px;
  }

  .bb-header-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .bb-follow-ups {
    flex-direction: column;
  }

  .bb-follow-up-chip {
    justify-content: center;
  }
}

/* =============================================================================
   FETCH RESPONSE COMPONENTS
   ============================================================================= */

/* Fetch Response Container */
.fetch-response {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Fetch Header */
.fetch-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color, #E8E4DE);
}

.fetch-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fetch-header-icon {
  font-size: 20px;
}

.fetch-header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #2D2926);
}

.fetch-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 12px;
  border: 1px solid;
}

.fetch-header-query {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-style: italic;
  color: var(--text-muted, #9B8B7D);
  line-height: 1.5;
}

.fetch-fallback-notice {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: #D4A574;
  background: #FFF8F0;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #D4A574;
}

/* Fetch Answer */
.fetch-answer {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary, #2D2926);
}

.fetch-answer h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 14px 0;
  color: var(--text-primary, #2D2926);
}

.fetch-answer h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px 0;
  color: var(--text-primary, #2D2926);
}

.fetch-answer ul,
.fetch-answer ol {
  margin: 14px 0;
  padding-left: 24px;
}

.fetch-answer li {
  margin: 10px 0;
  line-height: 1.7;
}

.fetch-answer p {
  margin: 14px 0;
}

.fetch-answer strong {
  font-weight: 600;
  color: var(--text-primary, #2D2926);
}

/* Citation Links in Answer */
.fetch-citation-link {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #20B2AA;
  background: #20B2AA15;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
  vertical-align: super;
}

.fetch-citation-link:hover {
  background: #20B2AA25;
  color: #1A9A94;
}

/* Citations Section */
.fetch-citations {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.fetch-citations-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fetch-citations-title {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #2D2926);
}

/* Citation Cards Grid */
.fetch-citations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* Citation Card */
.fetch-citation-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary, #FDFBF7);
  border: 1px solid var(--border-color, #E8E4DE);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.fetch-citation-card:hover {
  background: #FFFFFF;
  border-color: #20B2AA;
  box-shadow: 0 2px 8px rgba(32, 178, 170, 0.1);
  transform: translateY(-1px);
}

.fetch-citation-number {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #20B2AA;
  background: #20B2AA15;
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
  flex-shrink: 0;
}

.fetch-citation-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fetch-citation-domain {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: var(--text-muted, #9B8B7D);
  text-transform: lowercase;
}

.fetch-citation-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #2D2926);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.fetch-citation-snippet {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: var(--text-muted, #9B8B7D);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Follow-ups */
.fetch-follow-ups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fetch-follow-up-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary, #FDFBF7);
  border: 1px solid var(--border-color, #E8E4DE);
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--text-primary, #2D2926);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fetch-follow-up-chip:hover {
  background: #20B2AA10;
  border-color: #20B2AA;
  color: #20B2AA;
}

.fetch-follow-up-icon {
  font-size: 14px;
}

/* Meta Info */
.fetch-meta {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #E8E4DE);
}

.fetch-meta-item {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: var(--text-muted, #9B8B7D);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .fetch-header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .fetch-citations-grid {
    grid-template-columns: 1fr;
  }

  .fetch-citation-card {
    padding: 10px 12px;
  }

  .fetch-follow-ups {
    flex-direction: column;
  }

  .fetch-follow-up-chip {
    justify-content: center;
  }
}

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] {
  /* Override color variables for dark mode */
  --ivory: #1C1917;
  --pearl: #292524;
  --sand: #44403C;
  --warm-gray: #A8A29E;
  --charcoal: #FAFAF9;
  --espresso: #FAFAF9;

  --stone-50: #1C1917;
  --stone-100: #292524;
  --stone-200: #44403C;
  --stone-300: #57534E;
  --stone-400: #78716C;
  --stone-500: #A8A29E;
  --stone-600: #D6D3D1;
  --stone-700: #E7E5E4;
  --stone-800: #F5F5F4;
  --stone-900: #FAFAF9;

  --bg-glass: rgba(28, 25, 23, 0.7);
  --bg-glass-strong: rgba(28, 25, 23, 0.85);
  --border-glass: rgba(68, 64, 60, 0.6);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Dark mode specific overrides */
[data-theme="dark"] body {
  background: #1C1917;
}

[data-theme="dark"] .chat-container {
  background: #292524;
}

[data-theme="dark"] .message.assistant .message-content {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .message.user .message-content {
  background: #57534E;
}

[data-theme="dark"] .bot-option {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .bot-option .bot-name {
  color: #FAFAF9;
}

[data-theme="dark"] .bot-option .bot-desc {
  color: #A8A29E;
}

[data-theme="dark"] .bot-option .bot-icon {
  color: #A8A29E;
}

[data-theme="dark"] .bot-option:hover {
  border-color: #57534E;
}

[data-theme="dark"] .bot-option.active {
  background: #F5F5F4;
  border-color: #E7E5E4;
}

[data-theme="dark"] .bot-option.active .bot-name,
[data-theme="dark"] .bot-option.active .bot-desc {
  color: #1C1917;
}

[data-theme="dark"] .bot-option.active .bot-icon {
  background: #E7E5E4;
  color: #1C1917;
}

[data-theme="dark"] .welcome-icon {
  background: linear-gradient(135deg, #292524 0%, #1C1917 100%);
  border-color: #44403C;
}

/* Dark mode tooltip (compact bot pills) */
[data-theme="dark"] .content-area.has-conversation .bot-option::after {
  background: #F5F5F4;
  color: #1C1917;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .content-area.has-conversation .bot-option::before {
  border-bottom-color: #F5F5F4;
}

[data-theme="dark"] .quick-prompt-pill {
  background: #292524;
  border-color: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .quick-prompt-pill:hover {
  background: #44403C;
  border-color: #57534E;
}

/* Dark mode TIA Response */
[data-theme="dark"] .tia-response {
  --tia-bg-card: #292524;
  --tia-border: #44403C;
  --tia-muted: #A8A29E;
}

[data-theme="dark"] .tia-metric-value {
  color: #FAFAF9;
}

[data-theme="dark"] .tia-metric-card.highlight {
  background: linear-gradient(135deg, #292524 0%, #1C1917 100%);
  border-color: var(--tia-primary);
}

[data-theme="dark"] .tia-header-title {
  color: #FAFAF9;
}

[data-theme="dark"] .tia-summary {
  background: #1C1917;
  color: #E7E5E4;
}

[data-theme="dark"] .tia-insight-text {
  color: #E7E5E4;
}

[data-theme="dark"] .tia-content-title {
  color: #FAFAF9;
}

[data-theme="dark"] .tia-content-caption {
  color: #D6D3D1;
}

[data-theme="dark"] .tia-table th {
  background: #1C1917;
  color: #A8A29E;
  border-color: #44403C;
}

[data-theme="dark"] .tia-table td {
  background: #292524;
  color: #E7E5E4;
  border-color: #44403C;
}

[data-theme="dark"] .tia-table tr:hover td {
  background: #44403C;
}

[data-theme="dark"] .tia-followup-chip {
  background: #292524;
  border-color: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .tia-followup-chip:hover {
  background: #44403C;
  border-color: #57534E;
  color: #FAFAF9;
}

/* Dark mode Burn Book Response */
[data-theme="dark"] .bb-response {
  --bb-border: #44403C;
}

[data-theme="dark"] .bb-header-title {
  color: #FAFAF9;
}

[data-theme="dark"] .bb-header-query {
  color: #E7E5E4;
}

[data-theme="dark"] .bb-result-count {
  color: #A8A29E;
}

[data-theme="dark"] .bb-post-card {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .bb-post-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bb-subreddit {
  background: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .bb-post-title {
  color: #D4A574;
}

[data-theme="dark"] .bb-post-author {
  color: #A8A29E;
}

[data-theme="dark"] .bb-post-content {
  color: #D6D3D1;
}

[data-theme="dark"] .bb-engagement-pill {
  background: #44403C;
  color: #E7E5E4;
}

[data-theme="dark"] .bb-score-label {
  color: #A8A29E;
}

[data-theme="dark"] .bb-score-bar {
  background: #44403C;
}

[data-theme="dark"] .bb-score-value {
  color: #FAFAF9;
}

[data-theme="dark"] .bb-summary-bar {
  background: #1C1917;
}

[data-theme="dark"] .bb-summary-title {
  color: #FAFAF9;
}

[data-theme="dark"] .bb-theme-tag {
  background: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .bb-summary-stat {
  color: #A8A29E;
}

[data-theme="dark"] .bb-follow-up-chip {
  background: #292524;
  border-color: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .bb-follow-up-chip:hover {
  background: #44403C;
  border-color: #57534E;
  color: #FAFAF9;
}

/* Dark mode Fetch Response */
[data-theme="dark"] .fetch-header {
  border-color: #44403C;
}

[data-theme="dark"] .fetch-header-title {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-header-query {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-fallback-notice {
  background: #292524;
  border-color: #D4A574;
}

[data-theme="dark"] .fetch-answer {
  color: #E7E5E4;
}

[data-theme="dark"] .fetch-answer h2,
[data-theme="dark"] .fetch-answer h3 {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-answer strong {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-citations-title {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-citation-card {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .fetch-citation-card:hover {
  background: #44403C;
  box-shadow: 0 2px 8px rgba(32, 178, 170, 0.2);
}

[data-theme="dark"] .fetch-citation-title {
  color: #E7E5E4;
}

[data-theme="dark"] .fetch-citation-domain {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-citation-snippet {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-follow-up-chip {
  background: #292524;
  border-color: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .fetch-follow-up-chip:hover {
  background: #44403C;
  border-color: #57534E;
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-meta {
  color: #78716C;
}

[data-theme="dark"] .message-input {
  background: #292524;
  border-color: #44403C;
  color: #FAFAF9;
}

[data-theme="dark"] .message-input::placeholder {
  color: #78716C;
}

[data-theme="dark"] .theme-toggle {
  background: #292524;
  border-color: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .theme-toggle:hover {
  background: #44403C;
  color: #FAFAF9;
}

[data-theme="dark"] .bot-options-panel {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .model-pill {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .model-pill:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .model-pill.active {
  background: #F5F5F4;
  border-color: #E7E5E4;
}

[data-theme="dark"] .model-pill.active .model-pill-name {
  color: #1C1917;
}

[data-theme="dark"] .model-pill.active .model-pill-tag {
  background: #D6D3D1;
  color: #44403C;
}

[data-theme="dark"] .checkbox-item {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .checkbox-item:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .checkbox-item:has(input:checked) {
  background: #F5F5F4;
  border-color: #E7E5E4;
}

[data-theme="dark"] .checkbox-item:has(input:checked) .checkbox-text {
  color: #1C1917;
}

[data-theme="dark"] .login-card {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .login-page {
  background: #1C1917;
}

[data-theme="dark"] .login-button {
  background: #F5F5F4;
  color: #1C1917;
}

[data-theme="dark"] .login-button:hover {
  background: #FAFAF9;
}

[data-theme="dark"] .chat-input-area {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .input-container {
  background: #1C1917;
  border-color: #44403C;
}

[data-theme="dark"] .input-container:focus-within {
  border-color: #57534E;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.05);
}

[data-theme="dark"] .attach-button {
  border-color: #44403C;
  color: #78716C;
}

[data-theme="dark"] .attach-button:hover {
  background: #292524;
  border-color: #57534E;
  color: #A8A29E;
}

[data-theme="dark"] .message-input {
  color: #FAFAF9;
}

[data-theme="dark"] .message-input::placeholder {
  color: #78716C;
}

[data-theme="dark"] .send-button:disabled {
  background: #44403C;
  color: #78716C;
}

[data-theme="dark"] .sidebar {
  background: rgba(28, 25, 23, 0.85);
}

[data-theme="dark"] .btn-new-chat-sidebar {
  background: #F5F5F4;
  color: #1C1917;
}

[data-theme="dark"] .btn-new-chat-sidebar:hover {
  background: #FAFAF9;
}

[data-theme="dark"] .search-input {
  background: #292524;
  border-color: #44403C;
  color: #FAFAF9;
}

[data-theme="dark"] .search-input::placeholder {
  color: #78716C;
}

[data-theme="dark"] .conversation-item:hover {
  background: rgba(68, 64, 60, 0.5);
}

[data-theme="dark"] .conversation-item.active {
  background: #292524;
}

/* === Bot Switch Confirmation Modal === */
.bot-switch-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bot-switch-modal-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

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

.bot-switch-modal-content h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--stone-800);
  margin-bottom: 8px;
}

.bot-switch-modal-content p {
  font-size: 0.9375rem;
  color: var(--stone-500);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.bot-switch-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.bot-switch-cancel {
  padding: 10px 20px;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-600);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bot-switch-cancel:hover {
  background: var(--stone-200);
}

.bot-switch-confirm {
  padding: 10px 20px;
  background: var(--stone-800);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bot-switch-confirm:hover {
  background: var(--stone-900);
}

/* Dark mode */
[data-theme="dark"] .bot-switch-modal-content {
  background: #292524;
}

[data-theme="dark"] .bot-switch-modal-content h3 {
  color: #FAFAF9;
}

[data-theme="dark"] .bot-switch-modal-content p {
  color: #A8A29E;
}

[data-theme="dark"] .bot-switch-cancel {
  background: #44403C;
  border-color: #57534E;
  color: #D6D3D1;
}

[data-theme="dark"] .bot-switch-cancel:hover {
  background: #57534E;
}

[data-theme="dark"] .bot-switch-confirm {
  background: #F5F5F4;
  color: #1C1917;
}

[data-theme="dark"] .bot-switch-confirm:hover {
  background: #FAFAF9;
}

/* === Dark Mode: Compact Mode Overrides === */
[data-theme="dark"] .content-area.has-conversation > .bot-selector {
  background: #292524;
}

[data-theme="dark"] .content-area.has-conversation > .bot-options-panel {
  background: #292524;
}

[data-theme="dark"] .content-area.has-conversation .bot-option {
  background: transparent;
  border-color: #44403C;
}

[data-theme="dark"] .content-area.has-conversation .bot-option .bot-name {
  color: #D6D3D1;
}

[data-theme="dark"] .content-area.has-conversation .bot-option .bot-icon {
  color: #A8A29E;
}

[data-theme="dark"] .content-area.has-conversation .bot-option:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .content-area.has-conversation .bot-option.active {
  background: #F5F5F4;
  border-color: #E7E5E4;
}

[data-theme="dark"] .content-area.has-conversation .bot-option.active .bot-icon,
[data-theme="dark"] .content-area.has-conversation .bot-option.active .bot-name {
  color: #1C1917;
}

[data-theme="dark"] .content-area.has-conversation .bot-option.active .bot-icon {
  background: #E7E5E4;
}

/* Dark mode: Model pills in compact mode */
[data-theme="dark"] .content-area.has-conversation .model-pill {
  background: transparent;
  border-color: #44403C;
}

[data-theme="dark"] .content-area.has-conversation .model-pill .model-pill-name {
  color: #D6D3D1;
}

[data-theme="dark"] .content-area.has-conversation .model-pill .model-pill-tag {
  background: #44403C;
  color: #A8A29E;
}

[data-theme="dark"] .content-area.has-conversation .model-pill:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .content-area.has-conversation .model-pill.active {
  background: #F5F5F4;
  border-color: #E7E5E4;
}

[data-theme="dark"] .content-area.has-conversation .model-pill.active .model-pill-name {
  color: #1C1917;
}

[data-theme="dark"] .content-area.has-conversation .model-pill.active .model-pill-tag {
  background: #E7E5E4;
  color: #57534E;
}

/* === Dark Mode: Fetch Response === */
[data-theme="dark"] .fetch-response {
  color: #E7E5E4;
}

[data-theme="dark"] .fetch-answer {
  color: #D6D3D1;
}

[data-theme="dark"] .fetch-answer h2,
[data-theme="dark"] .fetch-answer h3 {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-answer strong {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-header-title {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-header-query {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-citations-title {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-citation-card {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .fetch-citation-card:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .fetch-citation-title {
  color: #FAFAF9;
}

[data-theme="dark"] .fetch-citation-domain {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-citation-snippet {
  color: #A8A29E;
}

[data-theme="dark"] .fetch-follow-up-chip {
  background: #292524;
  border-color: #44403C;
  color: #D6D3D1;
}

[data-theme="dark"] .fetch-follow-up-chip:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .fetch-meta {
  color: #78716C;
}

/* === Dark Mode: Sidebar Open Button === */
[data-theme="dark"] .sidebar-open-btn {
  background: #F5F5F4;
  color: #1C1917;
}

[data-theme="dark"] .sidebar-open-btn:hover {
  background: #FAFAF9;
}

/* =============================================================================
   MYTIA COMPONENTS (Sprint 3)
   Personal AI Workspace - Sage accent (#9CAF88)
============================================================================= */

/* --- MyTia Bot Pill Accent --- */
.bot-option.mytia-bot.active {
  background: #9CAF88;
  border-color: #8A9E7A;
}

.bot-option.mytia-bot.active .bot-icon {
  background: #8A9E7A;
  color: white;
}

.bot-option.mytia-bot.active .bot-name,
.bot-option.mytia-bot.active .bot-desc {
  color: #2D3A28;
}

[data-theme="dark"] .bot-option.mytia-bot.active .bot-name,
[data-theme="dark"] .bot-option.mytia-bot.active .bot-desc {
  color: #1C1917;
}

/* --- Project Selector Panel --- */
.mytia-options {
  padding: var(--space-md);
}

.mytia-project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.mytia-create-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #9CAF88;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mytia-create-btn:hover {
  background: #8A9E7A;
}

/* --- Projects Grid --- */
.mytia-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-sm);
}

.mytia-project-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: white;
  border: 2px solid var(--stone-200);
  border-left: 4px solid var(--project-color, #9CAF88);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.mytia-project-card:hover {
  border-color: var(--stone-300);
  box-shadow: var(--shadow-sm);
}

.mytia-project-card.active {
  border-color: var(--project-color, #9CAF88);
  background: linear-gradient(to right, rgba(156, 175, 136, 0.05), transparent);
}

.mytia-project-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.mytia-project-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--stone-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mytia-project-meta {
  font-size: 0.75rem;
  color: var(--stone-500);
}

.mytia-project-settings-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--stone-400);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.mytia-project-card:hover .mytia-project-settings-btn {
  opacity: 1;
}

.mytia-project-settings-btn:hover {
  color: var(--stone-700);
}

/* --- Empty State --- */
.mytia-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-lg);
  color: var(--stone-500);
}

.mytia-empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.mytia-empty-hint {
  font-size: 0.8125rem;
  color: var(--stone-400);
}

/* --- Loading State --- */
.mytia-project-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  color: var(--stone-500);
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--stone-200);
  border-top-color: #9CAF88;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================================================
   MYTIA MODAL (Create Project)
============================================================================= */

.mytia-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  padding: var(--space-md);
}

.mytia-modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mytia-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--stone-200);
}

.mytia-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--stone-800);
}

.mytia-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--stone-400);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.mytia-modal-close:hover {
  color: var(--stone-700);
}

/* --- Form Styles --- */
.mytia-form {
  padding: var(--space-md);
}

.mytia-form-group {
  margin-bottom: var(--space-md);
}

.mytia-form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stone-700);
  margin-bottom: 6px;
}

.mytia-form-group .optional {
  font-weight: 400;
  color: var(--stone-400);
}

.mytia-form-group input,
.mytia-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.mytia-form-group input:focus,
.mytia-form-group textarea:focus {
  outline: none;
  border-color: #9CAF88;
  box-shadow: 0 0 0 3px rgba(156, 175, 136, 0.1);
}

.mytia-form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.mytia-form-hint {
  font-size: 0.75rem;
  color: var(--stone-400);
  margin-top: 4px;
}

.mytia-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* --- Icon/Color Pickers --- */
.mytia-icon-picker,
.mytia-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mytia-icon-option,
.mytia-color-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone-100);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.125rem;
  transition: all var(--transition-fast);
}

.mytia-icon-option:hover,
.mytia-color-option:hover {
  background: var(--stone-200);
}

.mytia-icon-option.active {
  border-color: #9CAF88;
  background: rgba(156, 175, 136, 0.1);
}

.mytia-color-option {
  background: var(--color);
}

.mytia-color-option.active {
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--color);
}

/* --- Modal Actions --- */
.mytia-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--stone-100);
}

.mytia-btn-primary,
.mytia-btn-secondary,
.mytia-btn-danger {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mytia-btn-primary {
  background: #9CAF88;
  color: white;
  border: none;
}

.mytia-btn-primary:hover {
  background: #8A9E7A;
}

.mytia-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mytia-btn-secondary {
  background: white;
  color: var(--stone-700);
  border: 1px solid var(--stone-200);
}

.mytia-btn-secondary:hover {
  background: var(--stone-50);
  border-color: var(--stone-300);
}

.mytia-btn-danger {
  background: #EF4444;
  color: white;
  border: none;
}

.mytia-btn-danger:hover {
  background: #DC2626;
}

.mytia-btn-sm {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

/* =============================================================================
   MYTIA DRAWER (Settings)
============================================================================= */

.mytia-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 1000;
}

.mytia-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
}

.mytia-drawer-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.mytia-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--stone-200);
}

.mytia-drawer-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--stone-800);
}

.mytia-drawer-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--stone-400);
  cursor: pointer;
}

.mytia-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.mytia-settings-section {
  margin-bottom: var(--space-lg);
}

.mytia-settings-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stone-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

/* --- File Dropzone --- */
.mytia-file-dropzone {
  border: 2px dashed var(--stone-300);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mytia-file-dropzone:hover,
.mytia-file-dropzone.dragover {
  border-color: #9CAF88;
  background: rgba(156, 175, 136, 0.05);
}

.dropzone-content svg {
  color: var(--stone-400);
  margin-bottom: var(--space-sm);
}

.dropzone-content p {
  margin: 0;
  color: var(--stone-600);
}

.dropzone-link {
  color: #9CAF88;
  font-weight: 500;
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--stone-400);
  margin-top: 4px;
}

/* --- Files List --- */
.mytia-files-list {
  margin-top: var(--space-md);
}

.mytia-files-empty {
  font-size: 0.875rem;
  color: var(--stone-400);
  text-align: center;
  padding: var(--space-md);
}

.mytia-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--stone-50);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.mytia-file-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.mytia-file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mytia-file-meta {
  font-size: 0.75rem;
  color: var(--stone-500);
}

.mytia-file-meta .processing {
  color: #9CAF88;
  font-weight: 500;
}

.mytia-file-delete {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--stone-400);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.mytia-file-delete:hover {
  color: #EF4444;
}

/* --- Danger Zone --- */
.mytia-danger-zone {
  border-top: 1px solid var(--stone-200);
  padding-top: var(--space-md);
}

.mytia-danger-zone h4 {
  color: #EF4444;
}

.mytia-danger-zone p {
  font-size: 0.875rem;
  color: var(--stone-500);
  margin-bottom: var(--space-sm);
}

/* =============================================================================
   MYTIA DARK MODE
============================================================================= */

[data-theme="dark"] .mytia-project-card {
  background: #292524;
  border-color: #44403C;
}

[data-theme="dark"] .mytia-project-card:hover {
  border-color: #57534E;
}

[data-theme="dark"] .mytia-project-card.active {
  background: linear-gradient(to right, rgba(156, 175, 136, 0.15), transparent);
}

[data-theme="dark"] .mytia-project-name {
  color: #F5F5F4;
}

[data-theme="dark"] .mytia-project-meta {
  color: #A8A29E;
}

[data-theme="dark"] .mytia-project-settings-btn {
  color: #78716C;
}

[data-theme="dark"] .mytia-project-settings-btn:hover {
  color: #D6D3D1;
}

[data-theme="dark"] .mytia-empty-state,
[data-theme="dark"] .mytia-project-loading {
  color: #A8A29E;
}

[data-theme="dark"] .mytia-modal-content,
[data-theme="dark"] .mytia-drawer-content {
  background: #1C1917;
}

[data-theme="dark"] .mytia-modal-header,
[data-theme="dark"] .mytia-drawer-header {
  border-color: #44403C;
}

[data-theme="dark"] .mytia-modal-header h3,
[data-theme="dark"] .mytia-drawer-header h3 {
  color: #F5F5F4;
}

[data-theme="dark"] .mytia-form-group label {
  color: #D6D3D1;
}

[data-theme="dark"] .mytia-form-group input,
[data-theme="dark"] .mytia-form-group textarea {
  background: #292524;
  border-color: #44403C;
  color: #F5F5F4;
}

[data-theme="dark"] .mytia-form-group input:focus,
[data-theme="dark"] .mytia-form-group textarea:focus {
  border-color: #9CAF88;
}

[data-theme="dark"] .mytia-icon-option {
  background: #292524;
}

[data-theme="dark"] .mytia-icon-option:hover {
  background: #44403C;
}

[data-theme="dark"] .mytia-modal-actions {
  border-color: #44403C;
}

[data-theme="dark"] .mytia-btn-secondary {
  background: #292524;
  border-color: #44403C;
  color: #D6D3D1;
}

[data-theme="dark"] .mytia-btn-secondary:hover {
  background: #44403C;
  border-color: #57534E;
}

[data-theme="dark"] .mytia-settings-section h4 {
  color: #A8A29E;
}

[data-theme="dark"] .mytia-file-dropzone {
  border-color: #44403C;
}

[data-theme="dark"] .mytia-file-dropzone:hover,
[data-theme="dark"] .mytia-file-dropzone.dragover {
  border-color: #9CAF88;
  background: rgba(156, 175, 136, 0.1);
}

[data-theme="dark"] .dropzone-content p {
  color: #D6D3D1;
}

[data-theme="dark"] .mytia-file-item {
  background: #292524;
}

[data-theme="dark"] .mytia-file-name {
  color: #F5F5F4;
}

[data-theme="dark"] .mytia-file-meta {
  color: #78716C;
}

[data-theme="dark"] .mytia-danger-zone {
  border-color: #44403C;
}

/* Compact mode adjustments for MyTia */
.content-area.has-conversation .mytia-options {
  padding: 6px 12px;
}

.content-area.has-conversation .mytia-projects-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.content-area.has-conversation .mytia-project-card {
  padding: 6px 8px;
}

.content-area.has-conversation .mytia-project-icon {
  font-size: 1rem;
}

.content-area.has-conversation .mytia-project-name {
  font-size: 0.8125rem;
}

.content-area.has-conversation .mytia-project-meta {
  display: none;
}

/* =============================================================================
   MYTIA CITATIONS (RAG Response)
============================================================================= */

.mytia-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--stone-100);
}

.mytia-citation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(156, 175, 136, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #9CAF88;
}

.mytia-citation-icon {
  font-size: 0.875rem;
}

[data-theme="dark"] .mytia-citations {
  border-color: #44403C;
}

[data-theme="dark"] .mytia-citation {
  background: rgba(156, 175, 136, 0.2);
  color: #B5C9AD;
}

/* =============================================================================
   MYTIA RESPONSE STYLES
============================================================================= */

.mytia-response {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.mytia-response-content {
  line-height: 1.7;
}

.mytia-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--stone-500);
  padding-top: var(--space-xs);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--stone-100);
}

.mytia-meta-icon {
  font-size: 0.875rem;
}

[data-theme="dark"] .mytia-meta {
  color: #78716C;
  border-color: #44403C;
}

/* =============================================================================
   MYTIA CREATE MODAL FILES LIST
============================================================================= */

.mytia-create-dropzone {
  padding: var(--space-md);
}

.mytia-create-files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-sm);
}

.mytia-create-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--stone-50);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.mytia-create-file-icon {
  font-size: 1rem;
}

.mytia-create-file-name {
  flex: 1;
  color: var(--stone-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mytia-create-file-size {
  color: var(--stone-400);
  font-size: 0.75rem;
}

.mytia-create-file-remove {
  background: none;
  border: none;
  color: var(--stone-400);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.mytia-create-file-remove:hover {
  color: #EF4444;
}

[data-theme="dark"] .mytia-create-file-item {
  background: #292524;
}

[data-theme="dark"] .mytia-create-file-name {
  color: #D6D3D1;
}

[data-theme="dark"] .mytia-create-file-size {
  color: #78716C;
}
