/*
 * Reasoning Block - Provider-Branded Minimal Styles
 * Subtle animations with provider-specific theming via CSS custom properties
 */

/* Container */
.reasoning-block {
  margin: 0.5rem 0 0.75rem 0;
  border-radius: 8px;
  background: var(--color-light, #f0f9ff);
  border: 1px solid color-mix(in srgb, var(--color-primary, #0066B3) 20%, transparent);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reasoning-block:hover {
  border-color: color-mix(in srgb, var(--color-primary, #0066B3) 35%, transparent);
}

.reasoning-block.streaming {
  border-color: color-mix(in srgb, var(--color-primary, #0066B3) 40%, transparent);
}

/* Header Button */
.reasoning-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease;
}

.reasoning-header:hover {
  background-color: color-mix(in srgb, var(--color-primary, #0066B3) 5%, transparent);
}

.reasoning-header:focus {
  outline: 2px solid var(--color-primary, #0066B3);
  outline-offset: -2px;
}

.reasoning-header:focus:not(:focus-visible) {
  outline: none;
}

/* Left side content */
.reasoning-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Status dot */
.reasoning-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--color-primary, #0066B3) 50%, transparent);
  transition: all 0.3s ease;
}

.reasoning-dot.active {
  background-color: var(--color-primary, #0066B3);
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

/* Label text */
.reasoning-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text, #0c4a6e);
}

/* Duration time */
.reasoning-time {
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--color-text, #0c4a6e) 70%, transparent);
  font-weight: 400;
  margin-left: 0.25rem;
}

/* Chevron icon */
.reasoning-chevron {
  color: var(--color-text, #0c4a6e);
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.reasoning-chevron.expanded {
  transform: rotate(180deg);
}

.reasoning-header:hover .reasoning-chevron {
  opacity: 0.8;
}

/* Body content area */
.reasoning-body {
  padding: 0 0.75rem 0.75rem 0.75rem;
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reasoning text */
.reasoning-text {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #374151;
  padding: 0.625rem 0.75rem;
  background: white;
  border-radius: 6px;
  border-left: 2px solid var(--color-primary, #0066B3);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Waiting placeholder */
.reasoning-waiting {
  color: color-mix(in srgb, var(--color-text, #0c4a6e) 60%, transparent);
  font-style: italic;
}

/* Progress indicator */
.reasoning-progress {
  margin-top: 0.5rem;
  height: 2px;
  background: color-mix(in srgb, var(--color-primary, #0066B3) 15%, transparent);
  border-radius: 1px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 30%;
  background: var(--color-primary, #0066B3);
  border-radius: 1px;
  animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* Dark mode overrides */
[data-theme="dark"] .reasoning-text {
  background: #1f2937;
  color: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] .reasoning-text {
    background: #1f2937;
    color: #e5e7eb;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .reasoning-header {
    padding: 0.4rem 0.625rem;
  }

  .reasoning-body {
    padding: 0 0.625rem 0.625rem 0.625rem;
  }

  .reasoning-text {
    font-size: 0.75rem;
    padding: 0.5rem 0.625rem;
  }

  .reasoning-label {
    font-size: 0.75rem;
  }
}

/* Print styles */
@media print {
  .reasoning-block {
    border: 1px solid #000;
    break-inside: avoid;
  }

  .reasoning-header {
    display: none;
  }

  .reasoning-body {
    display: block !important;
  }

  .reasoning-progress {
    display: none;
  }
}

/* CSS Custom Properties for theming - matches admin panel */
:root {
  /* Light mode colors (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-muted: #9ca3af;  /* Muted text for icons */
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --accent-color: #0066CC;
  --accent-hover: #0052a3;
  --user-message-bg: #0066CC;
  --user-message-text: #ffffff;
  --assistant-message-bg: #ffffff;
  --assistant-message-border: #e5e7eb;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus-ring: rgba(0, 102, 204, 0.2);
  /* Engineer message styling (admin replies) */
  --engineer-message-bg: #fff7ed;
  --engineer-message-border: #fed7aa;
  --engineer-message-accent: #f97316;
  --engineer-message-text: #7c2d12;
  --engineer-label-color: #c2410c;

  /* Provider accent colors */
  --provider-accent: #1b5276;  /* Default: Austin Hughes blue */
  --provider-accent-light: rgba(27, 82, 118, 0.1);
}

/* Dark mode - matches admin panel */
[data-theme="dark"] {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-tertiary: #9ca3af;
  --text-muted: #9ca3af;  /* Muted text for icons - same gray in dark mode */
  --border-color: #374151;
  --border-light: #4b5563;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --user-message-bg: #3b82f6;
  --user-message-text: #ffffff;
  --assistant-message-bg: #1f2937;
  --assistant-message-border: #374151;
  --input-bg: #1f2937;
  --input-border: #374151;
  --input-focus-ring: rgba(59, 130, 246, 0.3);
  /* Engineer message styling (admin replies) - dark mode */
  --engineer-message-bg: rgba(249, 115, 22, 0.15);
  --engineer-message-border: rgba(249, 115, 22, 0.3);
  --engineer-message-accent: #f97316;
  --engineer-message-text: #fdba74;
  --engineer-label-color: #fb923c;
}

/* System preference support - matches admin panel */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-tertiary: #9ca3af;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --border-light: #4b5563;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --user-message-bg: #3b82f6;
    --user-message-text: #ffffff;
    --assistant-message-bg: #1f2937;
    --assistant-message-border: #374151;
    --input-bg: #1f2937;
    --input-border: #374151;
    --input-focus-ring: rgba(59, 130, 246, 0.3);
    /* Engineer message styling (admin replies) - system dark mode */
    --engineer-message-bg: rgba(249, 115, 22, 0.15);
    --engineer-message-border: rgba(249, 115, 22, 0.3);
    --engineer-message-accent: #f97316;
    --engineer-message-text: #fdba74;
    --engineer-label-color: #fb923c;
  }
}

/* Base styles */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Chat container background */
.chat-container {
  background-color: var(--bg-secondary) !important;
}

/* Override Tailwind bg-gray-50 for dark mode */
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .chat-container {
  background-color: var(--bg-secondary) !important;
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] .bg-gray-50,
  [data-theme="system"] .chat-container {
    background-color: var(--bg-secondary) !important;
  }
}

/* FIXED HEADER - stays at top, offset for slim sidebar */
.chat-header {
  position: fixed;
  top: 0;
  left: 52px;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 6px -1px var(--shadow-color);
  transition: right 0.3s ease, background-color 0.3s ease;
}

[data-theme="dark"] .chat-header {
  background: rgba(17, 24, 39, 0.8);
}

/* Header history button */
.header-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

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

.header-history-btn:active {
  transform: scale(0.95);
}

/* Header model selector */
.model-selector-header {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-model-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.25rem 1.75rem 0.25rem 0.5rem;
  padding-right: 1.75rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
  min-width: 180px;
  max-width: 280px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.header-model-select:hover {
  background: var(--bg-secondary);
}

.header-model-select:focus {
  outline: none;
  background: var(--bg-secondary);
}

.header-model-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.model-select-chevron {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: var(--text-secondary);
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
  width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 3px;
}

/* FIXED FOOTER INPUT - Main sticky fix, offset for slim sidebar */
.chat-footer {
  position: fixed;
  bottom: 0;
  left: 52px;
  right: 0;
  z-index: 50;
  background: transparent;
  border-top: none;
  padding: 0.75rem 1.5rem 0.5rem;
  box-shadow: none;
  transition: right 0.3s ease;
  pointer-events: none;
}

.chat-footer > * {
  pointer-events: auto;
}

/* Responsive padding for wider screens */
@media (min-width: 1024px) {
  .chat-footer {
    padding: 1.25rem 2rem;
  }
}

@media (min-width: 1280px) {
  .chat-footer {
    padding: 1.25rem 3rem;
  }
}

/* Main content area - offset for slim sidebar */
.main-content {
  margin-left: 52px;
}

/* Space for fixed header and footer - prevents content from being hidden */
.chat-container {
  padding-top: 70px;
  padding-bottom: 120px;
}

/* Footer stays fixed - no shift when side panel opens (matches header behavior) */

/* Status indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  color: #0369a1;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.status-indicator .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bae6fd;
  border-top-color: #0369a1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Agent avatar */
.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

/* Thinking mode dropdown */
.thinking-dropdown select {
  appearance: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.thinking-dropdown select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.thinking-dropdown::after {
  content: '▼';
  font-size: 0.625rem;
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-tertiary);
}

.thinking-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Old settings cog & popup styles removed — replaced by inline toolbar */

/* ============================================
   TALK TO ENGINEER BUTTON STYLES
   ============================================ */

.talk-to-engineer-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.talk-to-engineer-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: #3b82f6;
  color: #3b82f6;
}

.talk-to-engineer-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.talk-to-engineer-btn.pending {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}

.talk-to-engineer-btn.connected {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #22c55e;
}

.engineer-pulse {
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

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

.engineer-connected-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

/* New Chat button styling */
.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.new-chat-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================
   ZOOM CONTROLS
   ============================================ */

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 0.25rem;
}

.zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.zoom-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.zoom-level-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.zoom-level-btn:hover {
  background: var(--bg-tertiary);
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 640px) {
  /* Adjust for smaller slim sidebar on mobile */
  .chat-header {
    left: 48px;
  }

  .chat-footer {
    left: 48px;
  }

  .main-content {
    margin-left: 48px;
  }

  /* Hide button text on mobile, show icons only */
  .engineer-btn-text {
    display: none;
  }

  .new-chat-text {
    display: none;
  }

  .talk-to-engineer-btn {
    padding: 0.5rem;
  }

  .new-chat-btn {
    padding: 0.5rem;
  }

  .header-title {
    font-size: 0.875rem;
  }

  .header-model-select {
    font-size: 0.875rem;
    min-width: 140px;
    max-width: 200px;
  }

  /* Compact zoom controls on mobile */
  .zoom-controls {
    padding: 0.125rem;
    gap: 0;
  }

  .zoom-btn {
    width: 28px;
    height: 28px;
  }

  .zoom-level-btn {
    min-width: 40px;
    height: 28px;
    font-size: 0.6875rem;
  }
}

@media (max-width: 480px) {
  .header-left img {
    height: 1.5rem;
  }

  .header-title {
    font-size: 0.8125rem;
  }

  .header-model-select {
    font-size: 0.8125rem;
    min-width: 120px;
    max-width: 160px;
  }

  .header-right {
    gap: 0.25rem !important;
  }
}

/* Font size adjustments based on user preference */
[data-font-size="small"] .message-content {
  font-size: 0.8125rem;
}

[data-font-size="medium"] .message-content {
  font-size: 0.9375rem;
}

[data-font-size="large"] .message-content {
  font-size: 1.0625rem;
}

/* Image styles */
.inline-image {
  margin: 1rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  background: white;
  display: block;
  max-width: 100%;
}

.inline-image img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  object-fit: contain;
}

.inline-image:hover {
  border-color: #0066CC;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
}

.inline-image .img-caption {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

/* Image size classes */
.img-small { max-width: 250px; }
.img-medium { max-width: 500px; }
.img-large { max-width: 700px; }
.img-full { width: 100%; max-width: 100%; }

/* Web source images inline in chat responses */
.web-source-images {
  margin: 0.75rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.web-source-img-wrapper {
  max-width: 200px;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}

.web-source-img-wrapper:hover {
  border-color: #166534;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.15);
}

.web-source-img-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

/* Web images gallery */
.web-images-gallery {
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.gallery-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
}

.gallery-count {
  font-size: 0.75rem;
  color: #6b7280;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
}

.gallery-item {
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  cursor: zoom-in;
  transition: all 0.2s;
}

.gallery-item:hover {
  border-color: #0066CC;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-item-loading {
  min-height: 80px;
  background: #f3f4f6;
}

/* Score badge */
.score-badge {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #166534;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #86efac;
}

/* Source badge */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: #0369a1;
  margin-top: 0.5rem;
}

.source-badge.web-source {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
  color: #166534;
}

/* Web source metadata */
.web-source-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.web-source-meta .favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.web-source-meta .domain {
  font-weight: 500;
  color: #374151;
}

.web-source-meta .separator {
  color: #d1d5db;
}

.web-source-meta .date {
  color: #9ca3af;
}

/* Visit website button */
.visit-website-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #166534;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.visit-website-btn:hover {
  background: #14532d;
}

/* Chunk content */
.chunk-content-box {
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
}

.chunk-image {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: zoom-in;
}

.chunk-image img {
  width: 100%;
  height: auto;
  display: block;
}

.chunk-image:hover {
  border-color: #0066CC;
}

/* Full content section */
.full-content-section {
  margin-top: 1rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.full-content-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s;
}

.full-content-toggle:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.full-content-toggle .toggle-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s;
}

.full-content-toggle .toggle-icon.open {
  transform: rotate(180deg);
}

.full-content-box {
  margin-top: 0.75rem;
  padding: 1rem;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.full-content-warning {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: #92400e;
  margin-bottom: 0.75rem;
}

.full-content-text {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #4b5563;
  max-height: 400px;
  overflow-y: auto;
}

/* Reasoning/Thinking Block Styles */
.thinking-block {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #f9fafb;
  overflow: hidden;
  transition: all 0.3s ease;
}

.thinking-block.thinking-active {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  font-size: 0.875rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.thinking-active .thinking-toggle {
  color: #6366f1;
}

.thinking-toggle:hover {
  background: rgba(0, 0, 0, 0.03);
}

.thinking-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: #9ca3af;
}

.thinking-active .thinking-chevron {
  color: #6366f1;
}

.thinking-chevron.expanded {
  transform: rotate(90deg);
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.thinking-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.thinking-brain-icon {
  animation: pulse-rotate 2s ease-in-out infinite;
  color: #6366f1;
}

@keyframes pulse-rotate {
  0%, 100% { transform: rotate(0deg); opacity: 1; }
  50% { transform: rotate(180deg); opacity: 0.7; }
}

.thinking-label {
  font-weight: 600;
}

.thinking-status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.thinking-dot {
  width: 6px;
  height: 6px;
  background: #6366f1;
  border-radius: 50%;
  animation: thinking-bounce 1.4s ease-in-out infinite;
}

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

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.thinking-content {
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
  max-height: 300px;
  overflow-y: auto;
}

.thinking-active .thinking-content {
  border-top-color: #c7d2fe;
  background: rgba(255, 255, 255, 0.9);
}

.thinking-content pre {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #4b5563;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.thinking-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.thinking-placeholder p {
  margin: 0;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: #6366f1;
  font-weight: 500;
}

.thinking-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 30px;
}

.thinking-wave span {
  display: block;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
}

.thinking-wave span:nth-child(1) { animation-delay: 0s; height: 60%; }
.thinking-wave span:nth-child(2) { animation-delay: 0.1s; height: 80%; }
.thinking-wave span:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.thinking-wave span:nth-child(4) { animation-delay: 0.3s; height: 80%; }
.thinking-wave span:nth-child(5) { animation-delay: 0.4s; height: 60%; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* Engineer message entrance animation */
@keyframes pulse-once {
  0% {
    transform: scale(0.95);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

.animate-pulse-once {
  animation: pulse-once 0.6s ease-out;
}

.thinking-content::-webkit-scrollbar {
  width: 6px;
}

.thinking-content::-webkit-scrollbar-track {
  background: transparent;
}

.thinking-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.thinking-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

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

/* Header specific */
[data-theme="dark"] .chat-header .font-semibold,
[data-theme="dark"] .chat-header span {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .chat-header button {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .chat-header button:hover {
  background-color: var(--bg-tertiary) !important;
}

/* Header model selector in dark mode */
[data-theme="dark"] .header-model-select {
  color: var(--text-primary);
}

[data-theme="dark"] .header-model-select:hover,
[data-theme="dark"] .header-model-select:focus {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .header-model-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Dark mode: Provider-specific header styles */
[data-theme="dark"] .provider-openai .chat-header {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.15) 0%, rgba(17, 24, 39, 0.8) 100%);
  border-bottom: 2px solid #10b981;
}

[data-theme="dark"] .provider-openai .header-model-select {
  color: #34d399;
}

[data-theme="dark"] .provider-openai .header-title {
  color: #34d399;
}

[data-theme="dark"] .provider-anthropic .chat-header {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.15) 0%, rgba(17, 24, 39, 0.8) 100%);
  border-bottom: 2px solid #d97706;
}

[data-theme="dark"] .provider-anthropic .header-model-select {
  color: #fbbf24;
}

[data-theme="dark"] .provider-anthropic .header-title {
  color: #fbbf24;
}

[data-theme="dark"] .provider-google .chat-header {
  background: linear-gradient(90deg, rgba(66, 133, 244, 0.12) 0%, rgba(234, 67, 53, 0.08) 33%, rgba(251, 188, 5, 0.08) 66%, rgba(52, 168, 83, 0.12) 100%);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #4285f4 0%, #4285f4 25%, #ea4335 25%, #ea4335 50%, #fbbc05 50%, #fbbc05 75%, #34a853 75%, #34a853 100%) 1;
}

[data-theme="dark"] .provider-google .header-model-select {
  background: linear-gradient(90deg, #60a5fa, #f87171, #fcd34d, #4ade80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .provider-google .header-title {
  background: linear-gradient(90deg, #60a5fa, #f87171, #fcd34d, #4ade80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .provider-ah .chat-header,
[data-theme="dark"] .provider-bedrock .chat-header {
  background: linear-gradient(180deg, rgba(27, 82, 118, 0.2) 0%, rgba(17, 24, 39, 0.8) 100%);
  border-bottom: 2px solid #2a6d9a;
}

[data-theme="dark"] .provider-ah .header-model-select,
[data-theme="dark"] .provider-bedrock .header-model-select {
  color: #7dc3fc;
}

[data-theme="dark"] .provider-ah .header-title,
[data-theme="dark"] .provider-bedrock .header-title {
  color: #7dc3fc;
}

/* Dark mode: Provider icon adjustments */
[data-theme="dark"] .provider-icon-openai {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.1) 100%);
  color: #34d399;
}

[data-theme="dark"] .provider-icon-anthropic {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(217, 119, 6, 0.1) 100%);
  color: #fbbf24;
}

[data-theme="dark"] .provider-icon-google {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.2) 0%, rgba(234, 67, 53, 0.1) 50%, rgba(52, 168, 83, 0.2) 100%);
}

[data-theme="dark"] .provider-icon-ah {
  background: linear-gradient(135deg, rgba(27, 82, 118, 0.3) 0%, rgba(42, 109, 154, 0.2) 100%);
  color: #7dc3fc;
  border-color: rgba(125, 195, 252, 0.3);
}

/* Footer specific */
[data-theme="dark"] .chat-footer p {
  color: var(--text-tertiary) !important;
}

/* Message bubbles */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .border-gray-200 {
  background-color: var(--assistant-message-bg) !important;
  border-color: var(--assistant-message-border) !important;
}

[data-theme="dark"] .bg-oss-blue {
  background-color: var(--user-message-bg) !important;
}

/* Text colors */
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400 {
  color: var(--text-tertiary) !important;
}

/* Border colors */
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-100 {
  border-color: var(--border-color) !important;
}

/* Input fields */
[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] select {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: var(--text-tertiary) !important;
}

/* Buttons */
[data-theme="dark"] .hover\:bg-gray-100:hover,
[data-theme="dark"] .hover\:bg-gray-200:hover {
  background-color: var(--bg-tertiary) !important;
}

/* Markdown content */
[data-theme="dark"] .markdown-content {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .markdown-content h1,
[data-theme="dark"] .markdown-content h2,
[data-theme="dark"] .markdown-content h3,
[data-theme="dark"] .markdown-content h4 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .markdown-content p,
[data-theme="dark"] .markdown-content li {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .markdown-content code {
  background-color: var(--bg-tertiary) !important;
  color: #f472b6 !important;
}

[data-theme="dark"] .markdown-content pre {
  background-color: #1e293b !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .markdown-content blockquote {
  border-left-color: var(--accent-color) !important;
  background-color: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}

/* Side panel */
[data-theme="dark"] .side-panel {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .side-panel-header {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .side-panel-content {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .chunk-content-box {
  background-color: var(--bg-primary) !important;
}

/* Thinking block - dark mode */
[data-theme="dark"] .thinking-block {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .thinking-block.thinking-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

[data-theme="dark"] .thinking-toggle {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .thinking-toggle:hover {
  background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .thinking-label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .thinking-icon {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .thinking-chevron {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .thinking-content {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .thinking-content pre {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .thinking-status {
  color: var(--text-tertiary) !important;
}

/* Gallery and images */
[data-theme="dark"] .web-images-gallery,
[data-theme="dark"] .gallery-header {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .gallery-title {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .gallery-count {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .gallery-item {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .gallery-item-loading {
  background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .chunk-image {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .chunk-image > div {
  background: var(--bg-tertiary) !important;
  border-top-color: var(--border-color) !important;
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .inline-image {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

/* Full content section */
[data-theme="dark"] .full-content-toggle {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .full-content-box {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .full-content-text {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .full-content-warning {
  background: rgba(251, 191, 36, 0.1) !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] .full-content-warning svg {
  color: #fbbf24 !important;
}

/* Popout window */
[data-theme="dark"] .popout-window {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .popout-header {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
  /* Header specific */
  [data-theme="system"] .chat-header .font-semibold,
  [data-theme="system"] .chat-header span {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .chat-header button {
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .chat-header button:hover {
    background-color: var(--bg-tertiary) !important;
  }

  /* Footer specific */
  [data-theme="system"] .chat-footer p {
    color: var(--text-tertiary) !important;
  }

  [data-theme="system"] .bg-white,
  [data-theme="system"] .border-gray-200 {
    background-color: var(--assistant-message-bg) !important;
    border-color: var(--assistant-message-border) !important;
  }

  [data-theme="system"] .bg-oss-blue {
    background-color: var(--user-message-bg) !important;
  }

  [data-theme="system"] .text-gray-900,
  [data-theme="system"] .text-gray-800 {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .text-gray-700,
  [data-theme="system"] .text-gray-600 {
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .text-gray-500,
  [data-theme="system"] .text-gray-400 {
    color: var(--text-tertiary) !important;
  }

  [data-theme="system"] .border-gray-300,
  [data-theme="system"] .border-gray-200,
  [data-theme="system"] .border-gray-100 {
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] textarea,
  [data-theme="system"] input[type="text"],
  [data-theme="system"] select {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .markdown-content {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .markdown-content code {
    background-color: var(--bg-tertiary) !important;
    color: #f472b6 !important;
  }

  [data-theme="system"] .markdown-content pre {
    background-color: #1e293b !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .side-panel,
  [data-theme="system"] .side-panel-header,
  [data-theme="system"] .chunk-content-box {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .thinking-block {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .thinking-block.thinking-active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
  }

  [data-theme="system"] .thinking-toggle,
  [data-theme="system"] .thinking-label {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .thinking-content {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .thinking-content pre {
    color: var(--text-secondary) !important;
  }

  /* Welcome screen - system dark mode */
  [data-theme="system"] .welcome-title {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .welcome-subtitle {
    color: var(--text-tertiary) !important;
  }

  [data-theme="system"] .welcome-suggestion {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .welcome-suggestion:hover {
    background-color: var(--bg-primary) !important;
  }

  /* Side panel content - system dark mode */
  [data-theme="system"] .chunk-text,
  [data-theme="system"] .chunk-text-segment {
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .side-panel-header .font-semibold {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .source-badge {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
  }

  /* Gallery - system dark mode */
  [data-theme="system"] .web-images-gallery,
  [data-theme="system"] .gallery-header {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .gallery-title {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .gallery-count {
    color: var(--text-tertiary) !important;
  }

  [data-theme="system"] .gallery-item {
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .chunk-image {
    border-color: var(--border-color) !important;
  }

  /* Full content - system dark mode */
  [data-theme="system"] .full-content-toggle {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .full-content-box {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
  }

  [data-theme="system"] .full-content-text {
    color: var(--text-secondary) !important;
  }
}

/* ==========================================
   WELCOME SCREEN STYLES
   ========================================== */

/* Welcome screen - light mode (default) */
.welcome-title {
  color: #111827;
}

.welcome-subtitle {
  color: #6b7280;
}

.welcome-suggestion {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  transition: all 0.2s ease;
}

.welcome-suggestion:hover {
  background-color: #f9fafb;
}

/* Welcome screen - dark mode */
[data-theme="dark"] .welcome-title {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .welcome-subtitle {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .welcome-suggestion {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .welcome-suggestion:hover {
  background-color: var(--bg-primary) !important;
}

/* ============================================
   PROFESSIONAL CHAT INPUT STYLES
   ============================================ */

.chat-input-container {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
}

/* ===== Modern inline input box (like Claude/Gemini/ChatGPT) ===== */

.chat-input-box {
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  background: var(--input-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.chat-input-box:focus-within {
  border-color: var(--provider-accent, #6366f1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--provider-accent, #6366f1) 10%, transparent), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Textarea inside the box — no border of its own */
.chat-textarea {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 16px 4px 16px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  font-family: inherit;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.chat-textarea::-webkit-scrollbar { width: 6px; }
.chat-textarea::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.chat-textarea::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 10px; }
.chat-textarea::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }
.chat-textarea::placeholder { color: var(--text-tertiary); }

/* Bottom toolbar row */
.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px 8px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Generic toolbar button (+ button, etc.) */
.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dropdown trigger buttons (thinking mode, model selector) */
.toolbar-dropdown-wrapper {
  position: relative;
}

.toolbar-dropdown {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toolbar-dropdown:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.toolbar-dropdown.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.toolbar-dropdown:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toolbar-dropdown-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown popup menus - position: fixed so it escapes overflow:hidden on chat-input-box */
.toolbar-menu {
  position: fixed;
  min-width: 160px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 9999;
  padding: 4px;
  animation: toolbar-menu-appear 0.12s ease-out;
}

.toolbar-menu-right {
  left: auto;
  right: 0;
}

@keyframes toolbar-menu-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.toolbar-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s ease;
  text-align: left;
}

.toolbar-menu-item:hover {
  background: var(--bg-tertiary);
}

.toolbar-menu-item.selected {
  color: var(--provider-accent, #6366f1);
  font-weight: 500;
}

.toolbar-menu-check {
  margin-left: auto;
  font-size: 14px;
  color: var(--provider-accent, #6366f1);
}

.toolbar-menu-divider {
  height: 1px;
  background: var(--border-color, #e5e7eb);
  margin: 4px 0;
}

.toolbar-menu-header {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #9ca3af);
  pointer-events: none;
}

/* Send / Stop button */
.toolbar-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: var(--provider-accent, #6366f1);
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toolbar-send-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--provider-accent, #6366f1) 40%, transparent);
}

.toolbar-send-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.5;
}

.toolbar-stop-btn {
  background: #ef4444;
}

.toolbar-stop-btn:hover {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Compact context indicator in toolbar */
.toolbar-context {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toolbar-context:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.toolbar-context:disabled {
  cursor: default;
}

.toolbar-context-track {
  width: 32px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-context-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease, background-color 0.3s ease;
  min-width: 1px;
}

.toolbar-context-text {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: right;
}

.toolbar-context.context-warning .toolbar-context-text { color: #b45309; }
.toolbar-context.context-critical .toolbar-context-text { color: #dc2626; }

/* File preview chips above input */
.file-previews-bar {
  display: flex;
  gap: 8px;
  padding: 8px 4px;
  flex-wrap: wrap;
}

.file-preview-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.file-preview-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

.file-preview-pdf-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fef3c7;
  border-radius: 4px;
  color: #92400e;
}

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

.file-preview-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
  padding: 0;
}

.file-preview-chip-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.file-attachment-inline-error {
  font-size: 12px;
  color: #dc2626;
  padding: 4px 8px;
}

/* ── Message attachment rendering (in user message bubbles) ── */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.message-attachment-img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  cursor: pointer;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: opacity 0.15s;
}

.message-attachment-img:hover {
  opacity: 0.85;
}

.message-attachment-pdf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 12px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.message-attachment-pdf:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Responsive - medium screens */
@media (max-width: 768px) {
  .chat-textarea {
    font-size: 0.875rem;
    padding: 10px 14px 4px 14px;
  }

  .toolbar-send-btn {
    width: 30px;
    height: 30px;
  }

  .toolbar-dropdown-label {
    max-width: 100px;
  }
}

/* Responsive - narrow screens */
@media (max-width: 520px) {
  .chat-footer {
    padding: 0.625rem 0.75rem;
  }

  .chat-textarea {
    font-size: 0.8125rem;
    padding: 8px 12px 4px 12px;
    min-height: 40px !important;
  }

  .chat-toolbar {
    padding: 2px 6px 6px 6px;
    gap: 2px;
  }

  .toolbar-btn {
    width: 28px;
    height: 28px;
  }

  .toolbar-send-btn {
    width: 28px;
    height: 28px;
  }

  .toolbar-dropdown {
    font-size: 12px;
    padding: 3px 6px;
  }

  .toolbar-dropdown-label {
    max-width: 60px;
  }

  .toolbar-context-track {
    width: 20px;
  }

  .toolbar-context-text {
    font-size: 10px;
    min-width: 20px;
  }

  .chat-input-box {
    border-radius: 12px;
  }
}

/* =========================================
   Provider-specific accent styling
   ========================================= */

/* Provider accent indicator - appears as a top border on the chat area */
.provider-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--provider-accent);
  transition: background-color 0.3s ease;
}

/* Provider icon container */
.provider-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.provider-icon-openai {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
  color: #10b981;
}

.provider-icon-anthropic {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15) 0%, rgba(217, 119, 6, 0.05) 100%);
  color: #d97706;
}

.provider-icon-google {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(234, 67, 53, 0.05) 50%, rgba(52, 168, 83, 0.1) 100%);
}

.provider-icon-ah {
  background: linear-gradient(135deg, rgba(27, 82, 118, 0.2) 0%, rgba(42, 109, 154, 0.15) 100%);
  color: #1b5276;
  border: 1px solid rgba(27, 82, 118, 0.2);
}

/* OpenAI - Teal/Green */
.provider-openai {
  --provider-accent: #10b981;
}

.provider-openai .chat-header {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-bottom: 2px solid #10b981;
}

.provider-openai .header-model-select {
  color: #059669;
}

.provider-openai .zoom-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

/* Anthropic - Coral/Orange */
.provider-anthropic {
  --provider-accent: #d97706;
}

.provider-anthropic .chat-header {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.12) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-bottom: 2px solid #d97706;
}

.provider-anthropic .header-model-select {
  color: #b45309;
}

.provider-anthropic .zoom-btn:hover:not(:disabled) {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

/* Google - Multi-color gradient */
.provider-google {
  --provider-accent: #4285f4;
  --google-blue: #4285f4;
  --google-red: #ea4335;
  --google-yellow: #fbbc05;
  --google-green: #34a853;
}

.provider-google .chat-header {
  background: linear-gradient(90deg, rgba(66, 133, 244, 0.1) 0%, rgba(234, 67, 53, 0.08) 33%, rgba(251, 188, 5, 0.08) 66%, rgba(52, 168, 83, 0.1) 100%);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #4285f4 0%, #4285f4 25%, #ea4335 25%, #ea4335 50%, #fbbc05 50%, #fbbc05 75%, #34a853 75%, #34a853 100%) 1;
}

.provider-google .header-model-select {
  background: linear-gradient(90deg, #4285f4, #ea4335, #fbbc05, #34a853);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

.provider-google .zoom-btn:hover:not(:disabled) {
  background: rgba(66, 133, 244, 0.15);
  color: #4285f4;
}

/* Bedrock/Austin Hughes - Default blue */
.provider-bedrock,
.provider-ah {
  --provider-accent: #1b5276;
}

.provider-ah .chat-header {
  background: linear-gradient(180deg, rgba(27, 82, 118, 0.12) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-bottom: 2px solid #1b5276;
}

.provider-ah .header-model-select {
  color: #1b5276;
}

.provider-ah .zoom-btn:hover:not(:disabled) {
  background: rgba(27, 82, 118, 0.15);
  color: #1b5276;
}

/* Old file attachment styles removed — now uses .file-previews-bar and .toolbar-btn in the input toolbar */

/* Old context indicator styles removed — now uses .toolbar-context in the input toolbar */

/* ================================================================
   Model Switch Modal Styles
   ================================================================ */

.model-switch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.model-switch-modal {
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  animation: slideUp 0.2s ease;
}

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

.model-switch-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.model-switch-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.model-switch-close-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.model-switch-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.model-switch-modal-body {
  padding: 20px;
}

.model-switch-warning-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.model-switch-message {
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.model-switch-overflow {
  text-align: center;
  font-size: 13px;
  color: #dc2626;
  font-weight: 500;
  margin-bottom: 16px;
}

.model-switch-options {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.model-switch-options-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.model-switch-options ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.7;
}

.model-switch-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 0 0 12px 12px;
}

.model-switch-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.model-switch-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.model-switch-btn-secondary:hover {
  background: var(--border-color);
}

.model-switch-btn-compact {
  background: #16a34a;
  color: white;
}

.model-switch-btn-compact:hover:not(:disabled) {
  background: #15803d;
}

.model-switch-btn-compact:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.model-switch-btn-primary {
  background: var(--accent-color);
  color: white;
}

.model-switch-btn-primary:hover {
  background: var(--accent-hover);
}

.model-switch-btn-danger {
  background: #dc2626;
  color: white;
}

.model-switch-btn-danger:hover {
  background: #b91c1c;
}

/* Dark mode */
[data-theme="dark"] .model-switch-modal {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .model-switch-overflow {
  color: #f87171;
}

/* ── Compact divider (compacting notice + summary) ── */

.compact-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.compact-divider::before,
.compact-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.compact-divider-clickable {
  cursor: pointer;
}

.compact-divider-clickable:hover .compact-divider-label {
  color: var(--text-secondary);
}

.compact-divider-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  user-select: none;
  transition: color 0.15s ease;
}

.compact-chevron {
  transition: transform 0.2s ease;
}

.compact-chevron.expanded {
  transform: rotate(90deg);
}

.compact-spinner {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--border-color);
  border-top-color: var(--text-tertiary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.compact-summary-body {
  margin: 0 24px 16px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Markdown content styling */
.markdown-content h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.markdown-content h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.markdown-content p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content code:not(pre code) {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.markdown-content pre {
  position: relative;
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  padding-top: 2.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

.markdown-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.markdown-content a {
  color: #0066CC;
  text-decoration: underline;
}

.markdown-content blockquote {
  border-left: 3px solid #0066CC;
  padding-left: 0.75rem;
  color: #6b7280;
  margin: 0.5rem 0;
  background: #f9fafb;
  padding: 0.5rem 0.75rem;
  border-radius: 0 0.25rem 0.25rem 0;
}

/* Code copy button */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: #374151;
  color: #d1d5db;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

.copy-btn:hover {
  background: #4b5563;
  color: #fff;
}

.copy-btn.copied {
  background: #10b981;
  color: #fff;
}

/* Side panel markdown adjustments */
.side-panel-content .markdown-content {
  font-size: 0.875rem;
  line-height: 1.7;
}

.side-panel-content .markdown-content h1,
.side-panel-content .markdown-content h2,
.side-panel-content .markdown-content h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #111827;
}

.side-panel-content .markdown-content h1 {
  font-size: 1.125rem;
}

.side-panel-content .markdown-content h2 {
  font-size: 1rem;
}

.side-panel-content .markdown-content h3 {
  font-size: 0.9375rem;
}

.side-panel-content .markdown-content p {
  margin-bottom: 0.5rem;
}

.side-panel-content .markdown-content ul,
.side-panel-content .markdown-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.side-panel-content .markdown-content li {
  margin-bottom: 0.25rem;
}

.side-panel-content .markdown-content code {
  background: #e5e7eb;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}

/* Side panel table styling */
.side-panel-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8125rem;
}

.side-panel-content th,
.side-panel-content td {
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.side-panel-content th {
  background: #e5e7eb;
  font-weight: 600;
}

.side-panel-content tr:nth-child(even) {
  background: #f9fafb;
}

.side-panel-content tr:hover {
  background: #f3f4f6;
}

/* Chunk text styling */
.chunk-text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
}

.chunk-text-segment {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 0.5rem;
}

/* ==========================================
   DARK MODE - Side Panel & Markdown
   ========================================== */

/* Chunk text dark mode */
[data-theme="dark"] .chunk-text,
[data-theme="dark"] .chunk-text-segment {
  color: var(--text-secondary) !important;
}

/* Side panel markdown content dark mode */
[data-theme="dark"] .side-panel-content .markdown-content {
  color: var(--text-secondary);
}

[data-theme="dark"] .side-panel-content .markdown-content h1,
[data-theme="dark"] .side-panel-content .markdown-content h2,
[data-theme="dark"] .side-panel-content .markdown-content h3 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .side-panel-content .markdown-content p,
[data-theme="dark"] .side-panel-content .markdown-content li {
  color: var(--text-secondary);
}

[data-theme="dark"] .side-panel-content .markdown-content code:not(pre code) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .side-panel-content .markdown-content a {
  color: #60a5fa;
}

[data-theme="dark"] .side-panel-content .markdown-content blockquote {
  background: var(--bg-tertiary);
  border-left-color: #60a5fa;
  color: var(--text-tertiary);
}

/* Side panel table dark mode */
[data-theme="dark"] .side-panel-content th,
[data-theme="dark"] .side-panel-content td {
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .side-panel-content th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .side-panel-content tr:nth-child(even) {
  background: var(--bg-secondary);
}

[data-theme="dark"] .side-panel-content tr:hover {
  background: var(--bg-tertiary);
}

/* General markdown dark mode */
[data-theme="dark"] .markdown-content code:not(pre code) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .markdown-content a {
  color: #60a5fa;
}

[data-theme="dark"] .markdown-content blockquote {
  background: var(--bg-tertiary);
  border-left-color: #60a5fa;
  color: var(--text-tertiary);
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .chunk-text,
  [data-theme="system"] .chunk-text-segment {
    color: var(--text-secondary) !important;
  }

  [data-theme="system"] .side-panel-content .markdown-content {
    color: var(--text-secondary);
  }

  [data-theme="system"] .side-panel-content .markdown-content h1,
  [data-theme="system"] .side-panel-content .markdown-content h2,
  [data-theme="system"] .side-panel-content .markdown-content h3 {
    color: var(--text-primary) !important;
  }

  [data-theme="system"] .side-panel-content .markdown-content p,
  [data-theme="system"] .side-panel-content .markdown-content li {
    color: var(--text-secondary);
  }

  [data-theme="system"] .side-panel-content .markdown-content code:not(pre code) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
  }

  [data-theme="system"] .side-panel-content th,
  [data-theme="system"] .side-panel-content td {
    border-color: var(--border-color);
    color: var(--text-secondary);
  }

  [data-theme="system"] .side-panel-content th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
  }
}

/* Typing indicator animation */
.typing-dot {
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Streaming cursor - disabled */
/* .streaming-cursor::after {
  content: '▊';
  animation: blink 1s infinite;
  color: #0066CC;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
} */

/* Spinner animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Slide in from bottom */
@keyframes slideInBottom {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Pulse animation for loading states */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Inline citation badges */
.inline-citation {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: #0369a1;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  margin: 0.125rem 0.25rem;
  vertical-align: middle;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
}

.inline-citation span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-citation:hover {
  background: #0369a1;
  color: white;
  border-color: #0369a1;
}

.inline-citation:hover .cite-page {
  color: rgba(255, 255, 255, 0.8);
}

.inline-citation .cite-icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.inline-citation .cite-page {
  color: #6b7280;
  margin-left: 0.125rem;
}

.inline-citation.figure-source {
  margin-left: 0.5rem;
}

/* PDF citation styling - blue theme */
.inline-citation.pdf-citation {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border: 1px solid #bae6fd !important;
  color: #0369a1 !important;
}

.inline-citation.pdf-citation:hover {
  background: #0369a1 !important;
  color: white !important;
  border-color: #0369a1 !important;
}

.inline-citation.pdf-citation:hover .cite-page {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Web citation styling - green theme */
.inline-citation.web-citation {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  border: 1px solid #86efac !important;
  color: #166534 !important;
}

.inline-citation.web-citation:hover {
  background: #166534 !important;
  color: white !important;
  border-color: #166534 !important;
}

/* Citation footer */
.citation-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.citation-footer-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.citation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  color: #0369a1;
  cursor: pointer;
  transition: all 0.2s;
}

.citation-chip:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

/* Web citation chip - green theme matching inline web citations */
.citation-chip.web-chip {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.citation-chip.web-chip:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

.citation-chip svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* ==========================================
   DARK MODE - Citation badges
   ========================================== */

[data-theme="dark"] .inline-citation {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .inline-citation.pdf-citation {
  background: rgba(14, 165, 233, 0.15) !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
  color: #7dd3fc !important;
}

[data-theme="dark"] .inline-citation.pdf-citation:hover {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: white !important;
}

[data-theme="dark"] .inline-citation.pdf-citation .cite-page {
  color: #94a3b8 !important;
}

[data-theme="dark"] .inline-citation.pdf-citation:hover .cite-page {
  color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .inline-citation.web-citation {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #86efac !important;
}

[data-theme="dark"] .inline-citation.web-citation:hover {
  background: #16a34a !important;
  border-color: #16a34a !important;
  color: white !important;
}

/* Citation footer dark mode */
[data-theme="dark"] .citation-footer {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .citation-footer-title {
  color: var(--text-tertiary);
}

[data-theme="dark"] .citation-chip {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
  color: #7dd3fc;
}

[data-theme="dark"] .citation-chip:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(14, 165, 233, 0.5);
}

[data-theme="dark"] .citation-chip.web-chip {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

[data-theme="dark"] .citation-chip.web-chip:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .inline-citation.pdf-citation {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
    color: #7dd3fc !important;
  }

  [data-theme="system"] .inline-citation.pdf-citation:hover {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: white !important;
  }

  [data-theme="system"] .inline-citation.web-citation {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #86efac !important;
  }

  [data-theme="system"] .inline-citation.web-citation:hover {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: white !important;
  }

  [data-theme="system"] .citation-footer {
    border-top-color: var(--border-color);
  }

  [data-theme="system"] .citation-footer-title {
    color: var(--text-tertiary);
  }

  [data-theme="system"] .citation-chip {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
  }

  [data-theme="system"] .citation-chip.web-chip {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
  }

  [data-theme="system"] .citation-chip.web-chip:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
  }
}

/* Feedback Modal */
.feedback-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.feedback-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.feedback-modal {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.feedback-modal-overlay.open .feedback-modal {
  transform: scale(1);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.feedback-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.feedback-modal-icon.positive {
  background: #dcfce7;
}

.feedback-modal-icon.negative {
  background: #fee2e2;
}

.feedback-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

.feedback-modal-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
}

.feedback-modal-field {
  margin-bottom: 1rem;
}

.feedback-modal-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}

.feedback-modal-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-modal-input:focus {
  outline: none;
  border-color: #0066CC;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.feedback-modal-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-modal-textarea:focus {
  outline: none;
  border-color: #0066CC;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.feedback-modal-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.feedback-modal-btn {
  flex: 1;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-modal-btn.cancel {
  background: white;
  border: 1px solid #d1d5db;
  color: #374151;
}

.feedback-modal-btn.cancel:hover {
  background: #f3f4f6;
}

.feedback-modal-btn.submit {
  background: #0066CC;
  border: none;
  color: white;
}

.feedback-modal-btn.submit:hover {
  background: #0052a3;
}

.feedback-modal-btn.submit:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Feedback buttons */
.feedback-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.feedback-btn:hover {
  background: #f3f4f6;
}

.feedback-btn.active-positive {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.feedback-btn.active-negative {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.feedback-submitted {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #059669;
  padding: 0.25rem 0;
}

.feedback-submitted svg {
  width: 1rem;
  height: 1rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

/* Settings Modal */
.settings-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

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

.settings-modal {
  background: white;
  border-radius: 1rem;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

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

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.settings-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.settings-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.settings-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.settings-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.settings-sidebar {
  width: 200px;
  border-right: 1px solid #e5e7eb;
  padding: 1rem 0.75rem;
  background: #f9fafb;
  flex-shrink: 0;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.settings-tab:hover {
  background: #e5e7eb;
  color: #111827;
}

.settings-tab.active {
  background: white;
  color: #0066CC;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.settings-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.settings-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1.5rem 0;
}

.settings-option {
  margin-bottom: 1.5rem;
}

.settings-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.75rem;
}

.settings-value {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.settings-description-small {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0.25rem 0 0.75rem 0;
}

.settings-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 1.5rem 0;
}

.settings-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0066CC;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.settings-link-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

/* Theme Selector - EXACT match to admin panel */
.theme-selector-modal {
  display: flex;
  gap: 0.75rem;
}

.theme-card-modal {
  flex: 1;
  padding: 1rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  background: var(--bg-primary, white);
}

.theme-card-modal:hover {
  border-color: var(--text-secondary, #6b7280);
}

.theme-card-modal.selected {
  border-color: var(--provider-accent, #7c3aed);
  background: rgba(124, 58, 237, 0.08);
}

/* Icon styling - Unicode characters */
.theme-card-modal .theme-icon-char {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Label styling */
.theme-card-modal span:last-child {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
}

.theme-card-modal.selected span:last-child {
  color: var(--provider-accent, #7c3aed);
}

/* Legacy theme-option styles (keep for backwards compatibility) */
.theme-selector {
  display: flex;
  gap: 1rem;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 100px;
}

.theme-option:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.theme-option.active {
  border-color: #0066CC;
  background: #eff6ff;
}

.theme-option span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
}

.theme-preview {
  width: 60px;
  height: 40px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.light-preview {
  background: linear-gradient(135deg, #fefefe 0%, #f3f4f6 100%);
  border: 1px solid #e5e7eb;
  color: #f59e0b;
}

.dark-preview {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border: 1px solid #374151;
  color: #fbbf24;
}

.system-preview {
  background: linear-gradient(135deg, #fefefe 0%, #1f2937 100%);
  border: 1px solid #9ca3af;
}

.system-icon {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.system-icon svg:first-child {
  color: #f59e0b;
}

.system-icon svg:last-child {
  color: #fbbf24;
}

/* Account Info Card */
.account-info-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0066CC;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.account-details {
  flex: 1;
  min-width: 0;
}

.account-name {
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.account-email {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0.25rem 0 0 0;
}

.account-email-primary {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .settings-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .settings-content {
    flex-direction: column;
  }

  .settings-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .settings-tab {
    white-space: nowrap;
  }

  .theme-selector {
    flex-wrap: wrap;
  }

  .theme-option {
    min-width: 80px;
  }
}

/* ==========================================
   DARK MODE - MODALS
   ========================================== */

[data-theme="dark"] .settings-modal,
[data-theme="dark"] .feedback-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .settings-header {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .settings-header h2 {
  color: var(--text-primary);
}

[data-theme="dark"] .settings-close-btn {
  color: var(--text-tertiary);
}

[data-theme="dark"] .settings-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .settings-sidebar {
  background: var(--bg-secondary);
  border-right-color: var(--border-color);
}

[data-theme="dark"] .settings-tab {
  color: var(--text-secondary);
}

[data-theme="dark"] .settings-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .settings-tab.active {
  background: var(--bg-primary);
  color: var(--accent-color);
}

[data-theme="dark"] .settings-main {
  background: var(--bg-primary);
}

[data-theme="dark"] .settings-section h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .settings-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .settings-description,
[data-theme="dark"] .settings-description-small {
  color: var(--text-tertiary);
}

[data-theme="dark"] .theme-option {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .theme-option:hover {
  border-color: var(--accent-color);
  background: var(--bg-tertiary);
}

[data-theme="dark"] .theme-option.active {
  border-color: var(--accent-color);
  background: var(--bg-tertiary);
}

[data-theme="dark"] .theme-option span {
  color: var(--text-primary);
}

/* Dark mode for new theme-card-modal - matches admin panel */
[data-theme="dark"] .theme-card-modal {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .theme-card-modal:hover {
  border-color: var(--text-secondary);
}

[data-theme="dark"] .theme-card-modal.selected {
  border-color: var(--provider-accent, #7c3aed);
  background: rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .theme-card-modal span:last-child {
  color: var(--text-secondary);
}

[data-theme="dark"] .theme-card-modal.selected span:last-child {
  color: var(--provider-accent, #7c3aed);
}

[data-theme="dark"] .account-info-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .account-email-primary,
[data-theme="dark"] .account-name {
  color: var(--text-primary);
}

[data-theme="dark"] .account-email {
  color: var(--text-tertiary);
}

[data-theme="dark"] .settings-link-btn {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--accent-color);
}

[data-theme="dark"] .settings-link-btn:hover {
  background: var(--bg-secondary);
}

[data-theme="dark"] .feedback-modal-title {
  color: var(--text-primary);
}

[data-theme="dark"] .feedback-modal-subtitle {
  color: var(--text-tertiary);
}

[data-theme="dark"] .feedback-modal-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .feedback-modal-input,
[data-theme="dark"] .feedback-modal-textarea {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text-primary);
}

[data-theme="dark"] .feedback-modal-btn.cancel {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .feedback-modal-btn.cancel:hover {
  background: var(--bg-secondary);
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .settings-modal,
  [data-theme="system"] .feedback-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
  }

  [data-theme="system"] .settings-header {
    border-bottom-color: var(--border-color);
  }

  [data-theme="system"] .settings-header h2 {
    color: var(--text-primary);
  }

  [data-theme="system"] .settings-sidebar {
    background: var(--bg-secondary);
    border-right-color: var(--border-color);
  }

  [data-theme="system"] .settings-tab {
    color: var(--text-secondary);
  }

  [data-theme="system"] .settings-tab.active {
    background: var(--bg-primary);
    color: var(--accent-color);
  }

  [data-theme="system"] .settings-section h3 {
    color: var(--text-primary);
  }

  [data-theme="system"] .theme-option {
    background: var(--bg-primary);
    border-color: var(--border-color);
  }

  [data-theme="system"] .account-info-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }
}

/* ==========================================
   CITATION SIDE PANEL - OVERLAY DRAWER
   ========================================== */

/* Dark overlay backdrop - offset for slim sidebar */
.side-panel-overlay {
  position: fixed;
  top: 0;
  left: 52px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(2px);
}

.side-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Side panel drawer - slides from right */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-primary);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.side-panel.open {
  transform: translateX(0);
}

/* Header */
.side-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

/* Content area */
.side-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--bg-primary);
}

.side-panel-content::-webkit-scrollbar {
  width: 6px;
}

.side-panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.side-panel-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.side-panel-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* PDF download button */
.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #0066CC;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.pdf-download-btn:hover {
  background: #004499;
}

/* ==========================================
   POPOUT WINDOW
   ========================================== */

.popout-window {
  position: fixed;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow:
    0 32px 64px -12px rgba(0, 0, 0, 0.25),
    0 16px 32px -8px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 350px;
  min-height: 350px;
  animation: popout-appear 0.2s ease-out;
}

@keyframes popout-appear {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.popout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  cursor: move;
  user-select: none;
}

.popout-drag-area {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popout-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popout-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.popout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.popout-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.popout-btn.popout-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.popout-btn:active {
  transform: scale(0.95);
}

.popout-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.popout-body .side-panel-header {
  flex-shrink: 0;
}

.popout-body .side-panel-content {
  flex: 1;
  overflow-y: auto;
}

.popout-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.popout-resize-handle::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--text-tertiary);
  border-bottom: 2px solid var(--text-tertiary);
  border-radius: 0 0 4px 0;
}

.popout-resize-handle:hover {
  opacity: 1;
}

.popout-window:hover .popout-resize-handle {
  opacity: 0.6;
}

/* Cursor overrides for popout */
.popout-window * {
  cursor: default;
}

.popout-header,
.popout-header * {
  cursor: move;
}

.popout-header button,
.popout-header a {
  cursor: pointer;
}

.popout-resize-handle {
  cursor: nwse-resize;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
  .side-panel {
    width: 100%;
    max-width: 100vw;
  }
}

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

[data-theme="dark"] .side-panel {
  background: var(--bg-primary);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .side-panel-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .side-panel-header {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .side-panel-header .text-lg,
[data-theme="dark"] .side-panel-header .text-gray-900,
[data-theme="dark"] .side-panel-header .font-semibold {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .side-panel-header .text-gray-500,
[data-theme="dark"] .side-panel-header .text-gray-400,
[data-theme="dark"] .side-panel-header .text-gray-600 {
  color: var(--text-tertiary) !important;
}

/* Source badge dark mode */
[data-theme="dark"] .source-badge {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .source-badge.web-source {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}

/* Web source meta dark mode */
[data-theme="dark"] .web-source-meta .domain {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .web-source-meta .date {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .web-source-meta .separator {
  color: var(--border-color) !important;
}

[data-theme="dark"] .side-panel-header button:hover {
  background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .side-panel-content {
  background: var(--bg-primary);
}

[data-theme="dark"] .side-panel-content::-webkit-scrollbar-thumb {
  background: var(--border-light);
}

/* Popout window dark mode */
[data-theme="dark"] .popout-window {
  background: var(--bg-primary);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-color);
}

[data-theme="dark"] .popout-header {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .popout-title {
  color: var(--text-primary);
}

[data-theme="dark"] .popout-btn {
  color: var(--text-tertiary);
}

[data-theme="dark"] .popout-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .popout-btn.popout-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

[data-theme="dark"] .popout-body {
  background: var(--bg-primary);
}

[data-theme="dark"] .popout-resize-handle::before {
  border-right-color: var(--text-tertiary);
  border-bottom-color: var(--text-tertiary);
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .side-panel {
    background: var(--bg-primary);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  }

  [data-theme="system"] .side-panel-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  [data-theme="system"] .side-panel-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
  }

  [data-theme="system"] .popout-window {
    background: var(--bg-primary);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-color);
  }

  [data-theme="system"] .popout-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
  }

  [data-theme="system"] .popout-title {
    color: var(--text-primary);
  }

  [data-theme="system"] .popout-btn {
    color: var(--text-tertiary);
  }

  [data-theme="system"] .popout-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
  }
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
  .side-panel-overlay {
    left: 48px;
  }
}

/* ==========================================
   SLIM PERSISTENT SIDEBAR (always 52px)
   ========================================== */

.slim-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 52px;
  height: 100vh;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  z-index: 150 !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.slim-sidebar-top,
.slim-sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.slim-sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
}

.slim-sidebar-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.slim-sidebar-btn:active {
  transform: scale(0.95);
}

/* Inline avatar for settings button */
.slim-user-avatar-inline {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: #0066CC;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
}

.slim-new-chat:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.slim-notifications {
  position: relative;
}

.slim-notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: notification-pulse 2s ease-in-out infinite;
}

@keyframes notification-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(234, 88, 12, 0); }
}

/* ==========================================
   DARK OVERLAY
   ========================================== */

.history-overlay {
  position: fixed;
  top: 0;
  left: 300px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 140;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ==========================================
   UNIFIED SIDEBAR PANEL
   ========================================== */

.unified-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 300px;
  background: var(--bg-primary);
  z-index: 155;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.unified-sidebar.open {
  transform: translateX(0);
}

/* Toolbar zone — compact top area with shared background */
.sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
}

.sidebar-new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-new-chat-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-new-chat-btn:active {
  transform: scale(0.97);
}

.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Search — sits in same bg-secondary zone, one border-bottom at end */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.sidebar-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.sidebar-search-input::placeholder {
  color: var(--text-tertiary);
}

.sidebar-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s ease;
}

.sidebar-search-clear:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Sessions list */
.history-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.history-sessions::-webkit-scrollbar {
  width: 6px;
}

.history-sessions::-webkit-scrollbar-track {
  background: transparent;
}

.history-sessions::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.history-sessions::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Loading state */
.history-loading {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
}

.history-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: #0066CC;
  border-radius: 50%;
  animation: history-spin 0.8s linear infinite;
}

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

.history-loading p {
  margin-top: 12px;
  font-size: 14px;
}

/* Error state */
.history-error {
  padding: 32px 16px;
  text-align: center;
  color: #ef4444;
  font-size: 14px;
}

.history-retry {
  display: block;
  margin: 12px auto 0;
  color: #0066CC;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
}

.history-retry:hover {
  color: #0052a3;
}

/* Empty state */
.history-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

.history-empty-sub {
  margin-top: 4px;
  color: var(--text-light);
  font-size: 13px;
}

/* Session groups */
.history-group {
  padding: 8px 0;
}

.history-group-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Session items */
.history-session-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.history-session-item:hover {
  background: var(--bg-tertiary);
}

.history-session-item.active {
  background: rgba(0, 102, 204, 0.1);
}

.history-session-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #0066CC;
  border-radius: 0 2px 2px 0;
}

.history-session-content {
  flex: 1;
  min-width: 0;
}

.history-session-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

.history-session-item.active .history-session-title {
  color: #0066CC;
  font-weight: 600;
}

.history-session-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 2px 0 0;
}

/* Session actions container */
.history-session-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.history-session-item:hover .history-session-actions {
  opacity: 1;
}

/* Star button */
.history-star-btn {
  padding: 5px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px;
  flex-shrink: 0;
}

.history-star-btn:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.history-star-btn.starred {
  color: #f59e0b;
  opacity: 1;
}

.history-star-btn.starred:hover {
  color: #d97706;
}

/* Always show star button when starred */
.history-session-item .history-star-btn.starred {
  opacity: 1;
}

/* Delete button */
.history-delete-btn {
  padding: 5px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px;
  flex-shrink: 0;
}

.history-delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Favorites section styling */
.history-favorites {
  background: rgba(245, 158, 11, 0.05);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.history-favorites-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d97706;
}

/* Session title row with unread badge */
.history-session-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-session-title-row .history-session-title {
  flex: 1;
  min-width: 0;
}

/* Unread badge */
.unread-badge {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
  animation: unread-pulse 2s ease-in-out infinite;
}

@keyframes unread-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(234, 88, 12, 0); }
}

/* Admin message preview */
.admin-message-preview {
  font-size: 0.6875rem;
  color: #ea580c;
  font-style: italic;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================
   UNIFIED SIDEBAR FOOTER
   ========================================== */

.unified-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.unified-footer-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unified-footer-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: #0066CC;
  color: white;
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.unified-footer-avatar:hover {
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.4);
  transform: scale(1.05);
}

.unified-footer-email {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.sidebar-footer-admin:hover {
  color: var(--text-secondary);
}

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

[data-theme="dark"] .slim-sidebar {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .slim-sidebar-btn:hover {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .history-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .unified-sidebar {
  background: var(--bg-primary);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .sidebar-toolbar,
[data-theme="dark"] .sidebar-search {
  background: var(--bg-secondary);
}

[data-theme="dark"] .history-sessions::-webkit-scrollbar-thumb {
  background: var(--border-light);
}

[data-theme="dark"] .history-session-item:hover {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .history-session-item.active {
  background: rgba(0, 102, 204, 0.15);
}

[data-theme="dark"] .history-favorites {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .admin-message-preview {
  color: #fb923c;
}

/* System dark mode */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .slim-sidebar {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  [data-theme="system"] .slim-sidebar-btn:hover {
    background: var(--bg-tertiary);
  }

  [data-theme="system"] .history-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  [data-theme="system"] .unified-sidebar {
    background: var(--bg-primary);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  [data-theme="system"] .sidebar-toolbar,
  [data-theme="system"] .sidebar-search {
    background: var(--bg-secondary);
  }

  [data-theme="system"] .history-session-item:hover {
    background: var(--bg-tertiary);
  }

  [data-theme="system"] .history-session-item.active {
    background: rgba(0, 102, 204, 0.15);
  }

  [data-theme="system"] .history-favorites {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
  }

  [data-theme="system"] .admin-message-preview {
    color: #fb923c;
  }
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
  .slim-sidebar {
    width: 48px;
    padding: 8px 0;
  }

  .slim-sidebar-btn {
    width: 36px;
    height: 36px;
  }

  .unified-sidebar {
    width: 100vw;
  }

  .history-overlay {
    display: none;
  }
}


/*# sourceMappingURL=styles.b51c5dcb8232be978f9f.css.map*/