/* ═══════════════════════════════════════════════════════════════
   Cockpit Solaire — Dark Mode Énergétique
   Sol V2 · Dashboard Technique RAG
   Palette : Space Black / Void Blue / Solar Amber / Energy Green / Plasma Cyan
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  /* Fondations */
  --space-black:     #080C16;
  --void-blue:       #0F1525;
  --void-blue-lift:  #151D30;
  --void-blue-card:  #182032;
  --deep-blue:       #1A2340;
  --border-subtle:   #1E2A42;
  --border-medium:   #253352;
  --border-glow:     #334466;

  /* Accents énergétiques */
  --solar-amber:       #F59E0B;
  --solar-amber-dim:   #B45309;
  --solar-amber-glow:  rgba(245, 158, 11, 0.25);
  --solar-amber-soft:  rgba(245, 158, 11, 0.08);
  --solar-amber-light: #FDE68A;
  --energy-green:      #10B981;
  --energy-green-dim:  #047857;
  --energy-green-glow: rgba(16, 185, 129, 0.25);
  --energy-green-soft: rgba(16, 185, 129, 0.08);
  --plasma-cyan:       #06B6D4;
  --plasma-cyan-dim:   #0E7490;
  --plasma-cyan-glow:  rgba(6, 182, 212, 0.2);
  --plasma-cyan-soft:  rgba(6, 182, 212, 0.07);

  /* Texte */
  --text-primary:      #E8ECF2;
  --text-secondary:    #9AA4B8;
  --text-muted:        #5F6A80;
  --text-on-dark:      #CDD4E0;

  /* Surfaces */
  --surface-ground:    var(--space-black);
  --surface-panel:     var(--void-blue);
  --surface-card:      var(--void-blue-card);
  --surface-hover:     var(--void-blue-lift);
  --surface-input:     #0B1120;

  /* Ombres (mode dark = glow plutôt que shadow) */
  --glow-sm:    0 0 8px rgba(0, 0, 0, 0.4);
  --glow-md:    0 0 16px rgba(0, 0, 0, 0.5);
  --glow-lg:    0 0 32px rgba(0, 0, 0, 0.6);
  --glow-amber: 0 0 12px var(--solar-amber-glow), 0 0 24px rgba(245, 158, 11, 0.1);
  --glow-green: 0 0 10px var(--energy-green-glow);
  --glow-cyan:  0 0 10px var(--plasma-cyan-glow);

  /* Layout */
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      20px;
  --sidebar-w:      260px;
  --stats-w:        220px;
  --transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Rack colors */
  --rack-slot:       #111828;
  --rack-border:     #1C2840;
  --rack-hover:      #1A2540;
  --led-green:       #10B981;
  --led-amber:       #F59E0B;
  --led-cyan:        #06B6D4;
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--space-black);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* ─── Scanline subtle overlay (immersion) ─── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.015) 2px,
    rgba(0, 0, 0, 0.015) 4px
  );
}

/* ─── Layout ─── */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--surface-ground);
  position: relative;
}

/* ══════════════════════════════════════
   SIDEBAR — Rack Serveur
   ══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  transition: transform var(--transition);
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-glow);
}

/* ── Sidebar Header ── */
.sidebar-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, transparent 100%);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo svg {
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--solar-amber);
  font-weight: 800;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 100px;
}

.badge-rag {
  background: rgba(16, 185, 129, 0.12);
  color: var(--energy-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
  animation: badgePulse 2.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--energy-green-glow); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* ── Upload Zone ── */
.upload-zone {
  margin: 14px 14px 8px;
  padding: 18px 14px;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-input);
  flex-shrink: 0;
}

.upload-zone:hover {
  border-color: var(--solar-amber);
  background: rgba(245, 158, 11, 0.05);
  box-shadow: var(--glow-amber);
}

.upload-zone.drag-over {
  border-color: var(--solar-amber);
  background: rgba(245, 158, 11, 0.08);
  transform: scale(1.02);
  box-shadow: 0 0 0 4px var(--solar-amber-glow), var(--glow-amber);
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.upload-inner svg {
  color: var(--text-muted);
  transition: color var(--transition);
}

.upload-zone:hover .upload-inner svg,
.upload-zone.drag-over .upload-inner svg {
  color: var(--solar-amber);
}

.upload-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.upload-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   FILE NAV — Style Rack Serveur
   ══════════════════════════════════════ */
.file-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 10px;
}

.nav-section {
  margin-bottom: 3px;
  border: 1px solid var(--rack-border);
  border-radius: var(--radius-sm);
  background: var(--rack-slot);
  overflow: hidden;
  transition: all var(--transition);
}

.nav-section:hover {
  border-color: var(--border-glow);
}

/* Header de rack */
.nav-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  transition: all var(--transition);
  position: relative;
}

.nav-section-header:hover {
  background: var(--rack-hover);
  color: var(--text-primary);
}

.nav-section-header svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition);
}

.nav-section-header:hover svg {
  color: var(--solar-amber);
}

/* LED d'activité sur les racks */
.nav-section-header::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
  background: var(--led-green);
  box-shadow: 0 0 4px var(--led-green), 0 0 8px rgba(16, 185, 129, 0.3);
  animation: ledBlink 4s ease-in-out infinite;
}

.nav-section:nth-child(2) .nav-section-header::after {
  background: var(--led-amber);
  box-shadow: 0 0 4px var(--led-amber), 0 0 8px rgba(245, 158, 11, 0.3);
  animation-delay: 0.8s;
}

.nav-section:nth-child(3) .nav-section-header::after {
  background: var(--led-cyan);
  box-shadow: 0 0 4px var(--led-cyan), 0 0 8px rgba(6, 182, 212, 0.3);
  animation-delay: 1.6s;
}

.nav-section:nth-child(4) .nav-section-header::after {
  background: var(--led-green);
  animation-delay: 2.4s;
}

.nav-section:nth-child(5) .nav-section-header::after {
  background: var(--led-amber);
  animation-delay: 3.2s;
}

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

.nav-count {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 1px 7px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
}

/* Slots de fichiers */
.nav-files {
  list-style: none;
  padding: 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--rack-border);
}

.nav-files li {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
}

.nav-files li:hover {
  background: var(--rack-hover);
  color: var(--text-primary);
  border-left-color: var(--solar-amber);
}

.nav-files li:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.nav-section.collapsed .nav-files {
  display: none;
}

/* Nav section collapsed state */
.nav-section.collapsed {
  opacity: 0.7;
}

/* File type badges */
.file-icon {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.file-icon.pdf  { background: rgba(239, 68, 68, 0.15);  color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.file-icon.doc  { background: rgba(59, 130, 246, 0.15);  color: #3B82F6; border: 1px solid rgba(59, 130, 246, 0.2); }
.file-icon.img  { background: rgba(245, 158, 11, 0.15);  color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.2); }
.file-icon.sheet { background: rgba(16, 185, 129, 0.15); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.2); }

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: linear-gradient(0deg, rgba(245,158,11,0.03) 0%, transparent 100%);
}

.doc-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.counter-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--solar-amber);
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.counter-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   CHAT MAIN
   ══════════════════════════════════════ */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-ground);
}

/* ── Chat Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-panel);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--solar-amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: titleDot 3s ease-in-out infinite;
}

@keyframes titleDot {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.8), 0 0 24px rgba(245, 158, 11, 0.2); }
}

.chat-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 16px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

/* ── Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--border-glow);
}

.message {
  display: flex;
  gap: 12px;
  max-width: 82%;
  animation: msgIn 0.35s ease-out;
}

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

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

/* User message */
.message-user .msg-content {
  background: linear-gradient(135deg, var(--void-blue-lift) 0%, var(--deep-blue) 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

/* Assistant / System message */
.message-assistant .msg-content,
.message-system .msg-content {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

/* System message accent */
.message-system .msg-content {
  border-left: 3px solid var(--solar-amber);
  background: linear-gradient(135deg, rgba(245,158,11,0.04) 0%, var(--surface-panel) 40%);
}

/* Avatar */
.msg-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(245,158,11,0.3) 0%, rgba(245,158,11,0.05) 70%);
  border: 1.5px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

/* Message content */
.msg-content {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--solar-amber);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.msg-text {
  font-size: 0.87rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.msg-text strong {
  color: var(--solar-amber-light);
  font-weight: 600;
}

.msg-list {
  margin: 2px 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-list li {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.msg-list li::marker {
  color: var(--solar-amber);
}

.msg-list li strong {
  color: var(--text-primary);
}

/* Sources */
.msg-sources {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.sources-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.source-chip {
  font-size: 0.67rem;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: 100px;
  font-weight: 500;
  cursor: default;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
}

.source-chip:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--solar-amber);
  border-color: rgba(245, 158, 11, 0.25);
}

/* ══════════════════════════════════════
   INPUT AREA
   ══════════════════════════════════════ */
.chat-input-area {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-panel);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-input);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-row:focus-within {
  border-color: var(--solar-amber);
  box-shadow: 0 0 0 3px var(--solar-amber-glow), 0 0 16px rgba(245, 158, 11, 0.08);
}

.input-wrapper {
  flex: 1;
  min-width: 0;
}

.chat-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.87rem;
  color: var(--text-primary);
  resize: none;
  padding: 6px 0;
  line-height: 1.5;
  max-height: 150px;
}

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

/* ── Mic Button ── */
.btn-mic {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border-medium);
  border-radius: 50%;
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  position: relative;
}

.btn-mic:hover {
  border-color: var(--plasma-cyan);
  color: var(--plasma-cyan);
  background: rgba(6, 182, 212, 0.08);
  box-shadow: var(--glow-cyan);
}

.btn-mic.listening {
  border-color: var(--energy-green);
  color: var(--energy-green);
  background: rgba(16, 185, 129, 0.1);
  animation: micPulseDark 1.5s ease-in-out infinite;
}

@keyframes micPulseDark {
  0%, 100% { box-shadow: 0 0 0 0 var(--energy-green-glow); }
  50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

.btn-mic.listening::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--energy-green);
  opacity: 0;
  animation: micRingDark 1.5s ease-out infinite;
}

@keyframes micRingDark {
  0% { inset: -3px; opacity: 0.5; }
  100% { inset: -14px; opacity: 0; }
}

/* ── Send Button ── */
.btn-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--solar-amber) 0%, var(--solar-amber-dim) 100%);
  color: #080C16;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.btn-send:hover {
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.5), 0 0 32px rgba(245, 158, 11, 0.15);
  transform: scale(1.08);
}

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

.input-hint {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

.hint-key {
  display: inline-block;
  background: var(--surface-input);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  padding: 0px 5px;
  font-family: inherit;
  font-size: 0.62rem;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════
   STATS PANEL — Corona Ring + Compteurs
   ══════════════════════════════════════ */
.stats-panel {
  width: var(--stats-w);
  min-width: var(--stats-w);
  background: var(--surface-panel);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  transition: width var(--transition), min-width var(--transition);
  z-index: 10;
}

.stats-panel::-webkit-scrollbar {
  width: 4px;
}
.stats-panel::-webkit-scrollbar-track {
  background: transparent;
}
.stats-panel::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}

/* Collapsed state */
.stats-panel.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
}

.stats-panel.collapsed .stats-inner {
  opacity: 0;
  pointer-events: none;
}

.stats-panel.collapsed .stats-toggle {
  opacity: 0;
  pointer-events: none;
}

.stats-panel.collapsed .stats-reopen {
  opacity: 1;
  pointer-events: auto;
}

/* Toggle buttons */
.stats-toggle {
  position: absolute;
  top: 12px;
  left: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 5;
}

.stats-toggle:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.stats-reopen {
  position: absolute;
  top: 12px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--solar-amber);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 5;
  box-shadow: 0 0 8px rgba(245,158,11,0.2);
}

.stats-reopen:hover {
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 16px rgba(245,158,11,0.3);
}

/* Stats inner */
.stats-inner {
  padding: 44px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: opacity 0.15s ease;
}

.stats-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

/* ══════════════════════════════════════
   CORONA RING — L'Anneau d'Énergie
   ══════════════════════════════════════ */
.corona-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 0;
}

.corona-ring {
  display: block;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}

/* Fond du ring */
.corona-ring .ring-bg {
  fill: none;
  stroke: var(--border-medium);
  stroke-width: 10;
}

/* Arc principal animé */
.corona-arc {
  fill: none;
  stroke: url(#coronaGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 389.56;
  stroke-dashoffset: 77.9;
  filter: url(#coronaGlow);
  animation: coronaRotate 10s linear infinite, coronaGlowPulse 3s ease-in-out infinite;
  transform-origin: 80px 80px;
}

/* Arc secondaire (plasma) */
.corona-arc-secondary {
  fill: none;
  stroke: url(#coronaGradPlasma);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 200 189.56;
  stroke-dashoffset: 0;
  opacity: 0.7;
  animation: coronaRotateReverse 6s linear infinite;
  transform-origin: 80px 80px;
}

/* Particules orbitales */
.corona-particle {
  fill: var(--solar-amber);
  filter: url(#coronaGlow);
}

.corona-particle-1 {
  animation: coronaOrbit1 4s linear infinite;
  transform-origin: 80px 80px;
}

.corona-particle-2 {
  animation: coronaOrbit2 5s linear infinite;
  transform-origin: 80px 80px;
}

.corona-particle-3 {
  animation: coronaOrbit3 7s linear infinite;
  transform-origin: 80px 80px;
}

@keyframes coronaOrbit1 {
  from { transform: rotate(0deg) translateX(62px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(62px) rotate(-360deg); }
}

@keyframes coronaOrbit2 {
  from { transform: rotate(120deg) translateX(62px) rotate(-120deg); }
  to   { transform: rotate(480deg) translateX(62px) rotate(-480deg); }
}

@keyframes coronaOrbit3 {
  from { transform: rotate(240deg) translateX(62px) rotate(-240deg); }
  to   { transform: rotate(600deg) translateX(62px) rotate(-600deg); }
}

/* Rotation des arcs */
@keyframes coronaRotate {
  from { transform: rotate(-90deg); }
  to   { transform: rotate(270deg); }
}

@keyframes coronaRotateReverse {
  from { transform: rotate(-90deg); }
  to   { transform: rotate(-450deg); }
}

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

/* Valeur centrale */
.corona-value {
  font-size: 1.85rem;
  font-weight: 800;
  fill: var(--text-primary);
  letter-spacing: -0.03em;
}

.corona-unit {
  font-size: 0.72rem;
  font-weight: 600;
  fill: var(--solar-amber);
}

.corona-label {
  font-size: 0.6rem;
  font-weight: 500;
  fill: var(--text-muted);
  letter-spacing: 0.03em;
}

/* Halo de pulse (quand activé) */
.corona-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(circle, rgba(245,158,11,0.08) 0%, transparent 70%);
  animation: coronaHalo 4s ease-in-out infinite;
}

@keyframes coronaHalo {
  0%, 100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.8; }
}

/* Pulse actif (classe ajoutée dynamiquement) */
.corona-pulse.active {
  animation: coronaHaloActive 0.8s ease-out;
}

@keyframes coronaHaloActive {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* ══════════════════════════════════════
   STATS GRID — Compteurs
   ══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  text-align: center;
  transition: all var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--solar-amber), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: var(--glow-amber);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:nth-child(2):hover {
  box-shadow: var(--glow-green);
}
.stat-card:nth-child(2)::before {
  background: linear-gradient(90deg, transparent, var(--energy-green), transparent);
}
.stat-card:nth-child(3):hover {
  box-shadow: var(--glow-cyan);
}
.stat-card:nth-child(3)::before {
  background: linear-gradient(90deg, transparent, var(--plasma-cyan), transparent);
}
.stat-card:nth-child(4):hover {
  box-shadow: var(--glow-green);
}
.stat-card:nth-child(4)::before {
  background: linear-gradient(90deg, transparent, var(--energy-green), transparent);
}

.stat-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card:nth-child(1) .stat-value { color: var(--solar-amber); }
.stat-card:nth-child(2) .stat-value { color: var(--energy-green); }
.stat-card:nth-child(3) .stat-value { color: var(--plasma-cyan); }
.stat-card:nth-child(4) .stat-value { color: var(--solar-amber-light); }

.stat-label {
  display: block;
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

/* ══════════════════════════════════════
   RECENT ACTIVITY
   ══════════════════════════════════════ */
.recent-activity {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.recent-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 6px;
  cursor: default;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.recent-item:hover {
  background: var(--surface-hover);
  border-left-color: var(--solar-amber);
}

.recent-time {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 32px;
}

.recent-query {
  font-size: 0.69rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════
   MOBILE BOTTOM SHEET TOGGLE
   ══════════════════════════════════════ */
.mobile-files-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: linear-gradient(135deg, var(--solar-amber) 0%, var(--solar-amber-dim) 100%);
  color: #080C16;
  border: none;
  border-radius: 100px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  transition: all var(--transition);
}

.mobile-files-toggle:active {
  transform: translateX(-50%) scale(0.96);
}

/* ══════════════════════════════════════
   RESPONSIVE — Tablet (< 960px)
   ══════════════════════════════════════ */
@media (max-width: 960px) {
  .app {
    max-width: 100%;
  }

  .sidebar {
    width: 240px;
    min-width: 240px;
  }

  .stats-panel {
    width: 200px;
    min-width: 200px;
  }

  .message {
    max-width: 92%;
  }
}

/* ══════════════════════════════════════
   RESPONSIVE — Mobile (< 768px)
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

  .app {
    position: relative;
    overflow: hidden;
  }

  /* Sidebar → bottom sheet (dark) */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-height: 65vh;
    border-right: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    overflow-y: auto;
    border-top: 1px solid var(--border-medium);
  }

  .sidebar.sheet-open {
    transform: translateY(0);
  }

  .sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-glow);
    border-radius: 2px;
    margin: 10px auto 4px;
  }

  .mobile-files-toggle {
    display: flex !important;
  }

  /* Overlay */
  .sidebar.sheet-open ~ .chat-main::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    pointer-events: none;
  }

  /* Stats panel → hidden */
  .stats-panel {
    display: none;
  }

  /* Chat full-width */
  .chat-main {
    width: 100%;
  }

  .chat-messages {
    padding: 16px;
    gap: 14px;
  }

  .message {
    max-width: 95%;
  }

  .chat-header {
    padding: 10px 16px;
  }

  .chat-input-area {
    padding: 10px 12px 12px;
  }

  .chat-input-row {
    padding: 4px 6px 4px 8px;
    border-radius: var(--radius-md);
  }

  .btn-mic {
    width: 34px;
    height: 34px;
  }

  .btn-send {
    width: 34px;
    height: 34px;
  }
}

/* ══════════════════════════════════════
   RESPONSIVE — Small Mobile (< 400px)
   ══════════════════════════════════════ */
@media (max-width: 400px) {
  .chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .message {
    max-width: 98%;
  }

  .msg-content {
    padding: 10px 12px;
  }

  .chat-input-area {
    padding: 8px 8px 10px;
  }
}

/* ══════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--solar-amber);
  outline-offset: 2px;
}

/* ══════════════════════════════════════
   PRINT
   ══════════════════════════════════════ */
@media print {
  .sidebar,
  .stats-panel,
  .chat-input-area,
  .mobile-files-toggle {
    display: none !important;
  }

  .chat-messages {
    overflow: visible;
    height: auto;
  }

  body {
    overflow: visible;
    height: auto;
    background: white;
    color: black;
  }

  .app {
    height: auto;
    box-shadow: none;
    background: white;
  }

  body::after {
    display: none;
  }
}

/* ═══ FILE OVERLAY — Prévisualisation documents ═══ */
.file-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.file-overlay-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.file-overlay-content {
  position: relative;
  width: 90vw;
  max-width: 1100px;
  max-height: 90vh;
  background: var(--card-bg, #1A212E);
  border: 1px solid var(--border, #2A3342);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.file-overlay-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg, #12171F);
  border-bottom: 1px solid var(--border, #2A3342);
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #E4E7ED);
}
.file-overlay-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted, #8892A4);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.file-overlay-close:hover {
  color: var(--text, #E4E7ED);
}
.file-overlay-dl {
  color: var(--accent, #F472B6);
  text-decoration: none;
  font-size: 18px;
  padding: 0 6px;
}
.file-overlay-dl:hover {
  color: var(--accent-hover, #F9A8D4);
}
.nav-files li {
  cursor: pointer;
}
.nav-files li:hover {
  background: var(--hover, rgba(244,114,182,0.08));
  border-radius: 4px;
}
