/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — STYLE 2ADVANCED FUTURISTE
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:        #060810;
  --bg2:       #0b0e18;
  --bg3:       #10141f;
  --panel:     #0d1020;
  --border:    #1a2040;
  --border2:   #243060;
  --text:      #c8d8f8;
  --text-dim:  #4a5a80;
  --text-muted:#2a3550;
  --accent:    #00e5ff;
  --accent2:   #7c3aed;
  --accent3:   #10b981;
  --accent4:   #f59e0b;
  --danger:    #ef4444;
  --user-bg:   #0f1f3d;
  --ai-bg:     #0a1225;
  --glow:      0 0 20px rgba(0,229,255,.15);
  --glow2:     0 0 30px rgba(124,58,237,.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Scan Lines ── */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.07) 2px,
    rgba(0,0,0,.07) 4px
  );
}

.grid-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(rgba(0,229,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,.025) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── App Shell ── */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  height: 100vh;
  position: relative;
  z-index: 2;
}

/* ══════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); }

/* Brand */
.brand-block {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.2rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(0,229,255,.05), transparent);
}

.brand-logo {
  font-size: 1.8rem;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent));
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,100% { filter: drop-shadow(0 0 6px var(--accent)); }
  50% { filter: drop-shadow(0 0 16px var(--accent)); }
}

.brand-name {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: .9rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 4px;
}

.brand-ver {
  font-size: .6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  font-family: 'Share Tech Mono', monospace;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  font-size: .7rem;
  font-family: 'Share Tech Mono', monospace;
  color: var(--accent3);
  border-bottom: 1px solid var(--border);
  background: rgba(16,185,129,.04);
}

.session-id {
  margin-left: auto;
  color: var(--text-dim);
  font-size: .65rem;
}

/* Dots */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green  { background: #10b981; box-shadow: 0 0 6px #10b981; animation: blink 2s infinite; }
.dot-cyan   { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot-purple { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); }

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

/* Nav */
.side-nav { padding: .5rem 0; border-bottom: 1px solid var(--border); }

.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all .2s;
  border-left: 2px solid transparent;
}

.nav-item:hover, .nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(0,229,255,.05);
}

.nav-icon { font-size: .9rem; }

/* Sidebar sections */
.sidebar-section {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-size: .6rem;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: .6rem;
  text-transform: uppercase;
}

/* Mode buttons */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .3rem;
}

.mode-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: .35rem .4rem;
  font-size: .65rem;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .2s;
  text-transform: uppercase;
}

.mode-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mode-btn.active {
  background: rgba(0,229,255,.1);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(0,229,255,.2);
}

/* Select */
.cyber-select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: .5rem .6rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  border-radius: 2px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2300e5ff' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  transition: border-color .2s;
}

.cyber-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0,229,255,.15);
}

.cyber-select option { background: var(--bg3); }

/* API Keys */
.api-keys-status { display: flex; flex-direction: column; gap: .35rem; }

.key-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .68rem;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-dim);
}

.key-tag {
  margin-left: auto;
  background: var(--border);
  padding: .1rem .4rem;
  border-radius: 2px;
  font-size: .6rem;
  color: var(--accent4);
}

/* Clear btn */
.clear-btn {
  margin: .8rem 1rem;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: .5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .2s;
  text-transform: uppercase;
}

.clear-btn:hover {
  background: rgba(239,68,68,.1);
  box-shadow: 0 0 15px rgba(239,68,68,.2);
}

/* Footer */
.sidebar-footer {
  padding: .8rem 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: .65rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.sidebar-footer span {
  color: var(--accent);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════
   CHAT PANEL
══════════════════════════════════════════════════ */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.chat-header {
  padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(0,229,255,.04), transparent);
  flex-shrink: 0;
}

.chat-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent3);
  box-shadow: 0 0 8px var(--accent3);
  animation: blink 1.5s infinite;
}

.chat-meta {
  display: flex;
  gap: 1rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .65rem;
  color: var(--text-dim);
}

.chat-meta span { color: var(--accent); }

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

/* Welcome message */
.welcome-msg {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(0,229,255,.04), transparent);
}

.welcome-icon {
  font-size: 2rem;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent));
  flex-shrink: 0;
}

.welcome-text {
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.welcome-text strong { color: var(--accent); font-family: 'Orbitron', sans-serif; font-size: .75rem; }

/* Messages */
.msg-wrap {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  animation: msg-in .3s ease-out;
}

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

.msg-wrap.user { align-items: flex-end; }
.msg-wrap.assistant { align-items: flex-start; }

.msg-bubble {
  max-width: 85%;
  padding: .7rem 1rem;
  border-radius: 4px;
  font-size: .88rem;
  line-height: 1.6;
  position: relative;
}

.msg-wrap.user .msg-bubble {
  background: var(--user-bg);
  border: 1px solid rgba(0,229,255,.2);
  border-radius: 4px 4px 0 4px;
  color: var(--text);
}

.msg-wrap.assistant .msg-bubble {
  background: var(--ai-bg);
  border: 1px solid var(--border);
  border-radius: 0 4px 4px 4px;
  border-left: 2px solid var(--accent);
}

.msg-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  color: var(--text-muted);
  padding: 0 .2rem;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: var(--ai-bg);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 4px;
  width: fit-content;
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  color: var(--text-dim);
}

.typing-dots span {
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: dot-bounce .8s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes dot-bounce {
  0%,80%,100% { transform: scale(0.8); opacity:.4; }
  40% { transform: scale(1.2); opacity:1; }
}

/* Input zone */
.input-zone {
  padding: .8rem 1.2rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}

.input-meta {
  display: flex;
  gap: 1rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .62rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
}

.input-row {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
}

#msg-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: .7rem 1rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: .95rem;
  border-radius: 3px;
  resize: none;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.5;
}

#msg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(0,229,255,.1);
}

#msg-input::placeholder { color: var(--text-muted); }

#send-btn {
  background: var(--accent);
  border: none;
  color: var(--bg);
  width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#send-btn:hover {
  background: #33ecff;
  box-shadow: 0 0 20px rgba(0,229,255,.4);
}

#send-btn:disabled {
  background: var(--border2);
  color: var(--text-dim);
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════
   ANALYSIS PANEL
══════════════════════════════════════════════════ */
.analysis-panel {
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.analysis-panel::-webkit-scrollbar { width: 3px; }
.analysis-panel::-webkit-scrollbar-track { background: transparent; }
.analysis-panel::-webkit-scrollbar-thumb { background: var(--border2); }

/* Panel header */
.panel-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(124,58,237,.08), transparent);
  flex-shrink: 0;
}

.panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: .85rem;
  font-weight: 900;
  color: var(--accent2);
  letter-spacing: 3px;
  filter: drop-shadow(0 0 8px var(--accent2));
}

.panel-ver { color: var(--accent4); }

.panel-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-top: .2rem;
}

/* Status */
.analysis-status {
  padding: .5rem 1rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  border-bottom: 1px solid var(--border);
}

.status-idle { color: var(--text-dim); }
.status-processing { color: var(--accent4); animation: blink .8s infinite; }
.status-done { color: var(--accent3); }

/* Analysis blocks */
.analysis-block {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}

.analysis-block.updated {
  animation: block-flash .5s ease-out;
}

@keyframes block-flash {
  from { background: rgba(0,229,255,.07); }
  to   { background: transparent; }
}

.block-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: .65rem;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: .6rem;
  text-transform: uppercase;
}

/* Field rows */
.field-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
  font-size: .78rem;
}

.field-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  min-width: 70px;
}

.field-val {
  color: var(--text);
  font-weight: 500;
}

.field-val.highlight { color: var(--accent); font-family: 'Share Tech Mono', monospace; }

/* Sentiment */
.sentiment-display { display: flex; flex-direction: column; gap: .5rem; }

.sentiment-label {
  font-family: 'Orbitron', sans-serif;
  font-size: .75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.sentiment-bar-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.sentiment-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--danger), var(--accent4), var(--accent3));
  border-radius: 2px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
  flex: 1;
  max-width: calc(100% - 50px);
}

.sentiment-score {
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  color: var(--accent4);
  min-width: 40px;
  text-align: right;
}

.emotions-row { display: flex; gap: .4rem; flex-wrap: wrap; }

.emo-tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: .62rem;
  padding: .15rem .5rem;
  border-radius: 2px;
  background: rgba(0,229,255,.1);
  border: 1px solid rgba(0,229,255,.3);
  color: var(--accent);
  text-transform: uppercase;
}

.emo-tag.secondary {
  background: rgba(124,58,237,.1);
  border-color: rgba(124,58,237,.3);
  color: var(--accent2);
}

/* Style bars */
.style-bars { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }

.sbar-row {
  display: grid;
  grid-template-columns: 70px 1fr 30px;
  align-items: center;
  gap: .5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  color: var(--text-dim);
}

.sbar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.sbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
  width: 0;
}

.sbar-fill.accent2 { background: var(--accent2); }
.sbar-fill.accent3 { background: var(--accent3); }

.sbar-row span:last-child { color: var(--accent); text-align: right; }

/* Struct grid */
.struct-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-bottom: .8rem;
}

.struct-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .5rem .4rem;
  text-align: center;
}

.struct-val {
  font-family: 'Orbitron', sans-serif;
  font-size: .9rem;
  color: var(--accent);
  font-weight: 700;
}

.struct-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .52rem;
  color: var(--text-dim);
  margin-top: .2rem;
  letter-spacing: .5px;
}

/* Tags */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}

.tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  padding: .15rem .5rem;
  border-radius: 2px;
  text-transform: lowercase;
  animation: tag-in .3s ease-out;
}

@keyframes tag-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

.tag-theme {
  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.3);
  color: var(--accent2);
}

.tag-keyword {
  background: rgba(0,229,255,.08);
  border: 1px solid rgba(0,229,255,.25);
  color: var(--accent);
}

.tag-pattern {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25);
  color: var(--accent4);
}

.tag-device {
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.25);
  color: var(--accent3);
}

/* Meta block */
.meta-block { background: rgba(10,18,37,.5); }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: .62rem;
  color: var(--text-dim);
}

.meta-grid div { display: flex; flex-direction: column; gap: .1rem; }
.meta-grid span { color: var(--accent); font-size: .7rem; }

.mt-1 { margin-top: .5rem; }

/* Charts */
canvas { max-width: 100%; }

/* ════════════════════════════════════════════════
   STYLES COMPLÉMENTAIRES POUR PANOPTICON v4.0
════════════════════════════════════════════════ */

/* Stats grid in sidebar */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.stat-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .4rem .5rem; text-align: center; }
.stat-val { display: block; font-family: 'Orbitron', sans-serif; font-size: .85rem; color: var(--accent); font-weight: 700; }
.stat-lbl { font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-dim); letter-spacing: .5px; }

/* Sentiment track with NEG/POS labels */
.sentiment-track { display: flex; align-items: center; gap: .4rem; }
.st-neg { font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--danger); min-width: 28px; }
.st-pos { font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--accent3); }
.sentiment-bar-outer { flex: 1; height: 6px; background: linear-gradient(90deg, var(--danger), var(--warn), var(--accent3)); border-radius: 3px; position: relative; overflow: visible; }
.sentiment-cursor { position: absolute; top: -4px; width: 2px; height: 14px; background: #fff; border-radius: 1px; transition: left .8s cubic-bezier(.4,0,.2,1); transform: translateX(-50%); box-shadow: 0 0 6px #fff; }

/* Emotion tags variants */
.emo-tag.primary { background: rgba(0,229,255,.1); border: 1px solid rgba(0,229,255,.25); color: var(--accent); }
.emo-tag.secondary { background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.25); color: var(--accent2); }
.emo-tag.tertiary { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--accent4); }

/* Big5 labels */
.big5-labels { display: flex; justify-content: space-around; font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-dim); margin-top: .2rem; letter-spacing: 1px; }
.big5-labels span { cursor: help; }

/* Psycho meters and grid */
.psych-meters, .mkt-meters, .socio-meters, .beh-meters { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .5rem; }
.meter-row { display: grid; grid-template-columns: 90px 1fr 30px; align-items: center; gap: .4rem; font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-dim); }
.meter-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 2px; transition: width .9s cubic-bezier(.4,0,.2,1); width: 0; }
.meter-fill.green { background: var(--accent3); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.danger { background: var(--danger); }
.meter-fill.accent { background: var(--accent); }
.meter-fill.purple { background: var(--purple); }

.psycho-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-top: .5rem; }
.pg-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .35rem .45rem; }
.pg-label { display: block; font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-dim); letter-spacing: 1px; }
.pg-val { display: block; font-family: 'Rajdhani', sans-serif; font-size: .75rem; color: var(--text); font-weight: 500; }

/* Marketing persona */
.mkt-persona { background: linear-gradient(135deg, rgba(0,229,255,.06), transparent); border: 1px solid rgba(0,229,255,.15); border-radius: 3px; padding: .5rem .6rem; font-family: 'Orbitron', sans-serif; font-size: .7rem; color: var(--accent); text-align: center; margin-bottom: .5rem; letter-spacing: 1px; }
.mkt-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; font-size: .75rem; }

/* Socio grid */
.socio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .5rem; }
.sg-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .35rem .45rem; }
.sg-label { display: block; font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-dim); letter-spacing: 1px; }
.sg-val { display: block; font-family: 'Rajdhani', sans-serif; font-size: .75rem; color: var(--text); font-weight: 500; }

/* Structure grid 6 */
.struct-grid6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-bottom: .5rem; }
.struct-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .4rem .35rem; text-align: center; }
.struct-val { display: block; font-family: 'Orbitron', sans-serif; font-size: .8rem; color: var(--accent); font-weight: 700; }
.struct-label { font-family: 'Share Tech Mono', monospace; font-size: .5rem; color: var(--text-dim); letter-spacing: .5px; margin-top: .15rem; }

/* Linguistic grid */
.ling-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .5rem; }
.lg-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .35rem .45rem; }
.lg-label { display: block; font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-dim); letter-spacing: 1px; }
.lg-val { display: block; font-family: 'Rajdhani', sans-serif; font-size: .75rem; color: var(--text); font-weight: 500; }

/* Meta grid */
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
.mg-label { font-family: 'Share Tech Mono', monospace; font-size: .55rem; color: var(--text-dim); letter-spacing: 1px; }
.mg-val { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--accent); }

/* Intent badge */
.intent-badge { display: inline-block; background: rgba(0,229,255,.1); border: 1px solid rgba(0,229,255,.3); border-radius: 3px; padding: .25rem .6rem; font-family: 'Orbitron', sans-serif; font-size: .65rem; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; margin-bottom: .4rem; }

/* Tags */
.tags-wrap { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 24px; }
.tag { display: inline-block; background: var(--bg3); border: 1px solid var(--border2); border-radius: 2px; padding: .15rem .45rem; font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-dim); transition: all .2s; animation: tag-in .3s ease-out both; }
.tag:hover { border-color: var(--accent); color: var(--accent); background: rgba(0,229,255,.05); }
@keyframes tag-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Tag variants */
.tag-theme { border-color: rgba(0,229,255,.2); color: var(--accent); }
.tag-keyword { border-color: rgba(124,58,237,.2); color: var(--accent2); }
.tag-pattern { border-color: rgba(245,158,11,.2); color: var(--accent4); }
.tag-device { border-color: rgba(16,185,129,.2); color: var(--accent3); }
.tag-bias { border-color: rgba(239,68,68,.2); color: var(--danger); }
.tag-anomaly { border-color: rgba(255,100,100,.3); color: #ff6b6b; background: rgba(255,100,100,.05); }
.tag-defense { border-color: rgba(139,92,246,.2); color: var(--purple); }
.tag-pain { border-color: rgba(239,68,68,.25); color: var(--danger); }
.tag-desire { border-color: rgba(245,158,11,.25); color: var(--accent4); }
.tag-cult { border-color: rgba(0,229,255,.15); }
.tag-comm { border-color: rgba(16,185,129,.2); }
.tag-need { border-color: rgba(124,58,237,.15); }

.no-data { font-family: 'Share Tech Mono', monospace; font-size: .6rem; color: var(--text-muted); }

/* Navigation items */
.side-nav { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.nav-item { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; color: var(--text-dim); text-decoration: none; font-size: .75rem; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; transition: all .2s; border-left: 2px solid transparent; }
.nav-item:hover, .nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(0,229,255,.05); }
.nav-icon { font-size: .9rem; width: 20px; text-align: center; }

/* Chat time display */
#chat-time { color: var(--text-dim); }

/* Input complexity */
#input-complexity { color: var(--accent4); }

/* ═══════════════════════════════════════════════════
   AETHER v4.0 — SECTIONS NAVIGATION (Ajout)
═══════════════════════════════════════════════════ */

/* Panels sections */
.section-panel { display: none; height: 100%; overflow-y: auto; padding: 1rem; }
.section-panel.active { display: block; }
.section-panel::-webkit-scrollbar { width: 3px; }
.section-panel::-webkit-scrollbar-track { background: transparent; }
.section-panel::-webkit-scrollbar-thumb { background: var(--border2); }

/* Chat panel doit rester flex quand actif */
#section-chat.active { display: flex; flex-direction: column; padding: 0; }

/* Loading / empty states */
.loading-msg, .empty-msg, .error-msg {
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  color: var(--text-dim);
  text-align: center;
  padding: 2rem;
  letter-spacing: 1px;
}
.error-msg { color: var(--danger); }

/* Historique */
.history-row { border: 1px solid var(--border); border-radius: 4px; padding: .7rem .9rem; margin-bottom: .5rem; }
.history-row.user { border-left: 2px solid var(--accent); background: rgba(0,229,255,.03); }
.history-row.assistant { border-left: 2px solid var(--accent2); background: rgba(124,58,237,.03); }
.history-role { font-family: 'Share Tech Mono', monospace; font-size: .6rem; color: var(--text-dim); letter-spacing: 2px; margin-bottom: .3rem; }
.history-content { font-size: .8rem; color: var(--text); line-height: 1.5; margin-bottom: .4rem; word-break: break-word; }
.history-meta { font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-muted); }

/* Big Brother / Analyse Cognitive */
.bb-header {
  font-family: 'Orbitron', sans-serif;
  font-size: .75rem;
  color: var(--danger);
  letter-spacing: 2px;
  text-align: center;
  padding: .75rem;
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 4px;
  margin-bottom: 1rem;
  background: rgba(239,68,68,.04);
  text-shadow: 0 0 20px rgba(239,68,68,.4);
}

.profiles-grid { display: flex; flex-direction: column; gap: .75rem; }

.profile-card {
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: .8rem;
  background: var(--bg3);
  transition: border-color .2s;
}
.profile-card:hover { border-color: var(--accent); }

.profile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.profile-sid { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--accent); letter-spacing: 1px; }
.profile-count { font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-dim); }

.profile-meters { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .5rem; }
.pm-item { display: grid; grid-template-columns: 100px 1fr 30px; gap: .4rem; align-items: center; font-size: .65rem; font-family: 'Share Tech Mono', monospace; color: var(--text-dim); }
.meter-track.sm { height: 4px; background: var(--bg); border-radius: 2px; }

.profile-tags { display: flex; flex-wrap: wrap; gap: .25rem; }

/* Système */
.sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: 1rem; }
.sys-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 3px; padding: .5rem .6rem; }
.sys-label { display: block; font-family: 'Share Tech Mono', monospace; font-size: .55rem; color: var(--text-dim); letter-spacing: 1px; margin-bottom: .2rem; }
.sys-val { font-family: 'Share Tech Mono', monospace; font-size: .7rem; color: var(--accent); }

.sys-keys-status { border: 1px solid var(--border); border-radius: 4px; padding: .6rem; }
.key-row-sys { display: flex; align-items: center; gap: .5rem; font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--text-dim); padding: .2rem 0; letter-spacing: 1px; }
.dot-red { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — LOGIN MODAL
═══════════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(6,8,16,.97);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.login-overlay.hidden { display: none; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 0 60px rgba(0,229,255,.1);
  animation: login-in .4s ease-out;
}
@keyframes login-in { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }

.login-logo { font-size: 2.5rem; color: var(--accent); text-align: center; filter: drop-shadow(0 0 12px var(--accent)); animation: pulse-glow 3s infinite; margin-bottom: .5rem; }
.login-title { font-family: 'Orbitron', sans-serif; font-size: 1.2rem; font-weight: 900; color: var(--accent); text-align: center; letter-spacing: 4px; margin-bottom: .25rem; }
.login-sub { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--text-dim); text-align: center; letter-spacing: 2px; margin-bottom: 2rem; }
.login-label { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--text-dim); letter-spacing: 2px; display: block; margin-bottom: .5rem; }
.login-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); padding: .85rem 1rem; font-family: 'Rajdhani', sans-serif;
  font-size: 1rem; border-radius: 4px; margin-bottom: 1.2rem;
  transition: border-color .2s, box-shadow .2s;
}
.login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 20px rgba(0,229,255,.12); }
.login-btn {
  width: 100%; background: var(--accent); border: none; color: var(--bg);
  padding: .9rem; font-family: 'Orbitron', sans-serif; font-size: .8rem;
  font-weight: 700; letter-spacing: 3px; cursor: pointer; border-radius: 4px;
  transition: all .2s;
}
.login-btn:hover { background: #33ecff; box-shadow: 0 0 30px rgba(0,229,255,.4); }
.login-btn:disabled { background: var(--border2); color: var(--text-dim); cursor: not-allowed; }
.login-error { font-family: 'Share Tech Mono', monospace; font-size: .7rem; color: var(--danger); text-align: center; margin-top: .8rem; min-height: 1em; }
.login-hint { font-family: 'Share Tech Mono', monospace; font-size: .6rem; color: var(--text-muted); text-align: center; margin-top: 1rem; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — USER BADGE SIDEBAR
═══════════════════════════════════════════════════════════ */
.user-badge {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  background: rgba(0,229,255,.03);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif; font-size: .7rem; color: var(--bg); font-weight: 700;
  flex-shrink: 0;
}
.user-email { font-family: 'Share Tech Mono', monospace; font-size: .6rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-since { font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — CHAT SCROLL FIX (CRITIQUE)
═══════════════════════════════════════════════════════════ */
.chat-panel {
  display: flex; flex-direction: column;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  min-height: 0; /* Fix flex child overflow */
  overflow: hidden;
}

#section-chat.active {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; padding: 0;
  height: 100%;
}

.messages-container {
  flex: 1;
  min-height: 0; /* CRITIQUE : permet au flex child de scroll */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  scroll-behavior: smooth;
}

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — SECTION STATES BELLE VERSION
═══════════════════════════════════════════════════════════ */
.section-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60%; gap: 1rem;
}
.section-loading .loading-icon {
  font-size: 2.5rem; color: var(--accent);
  animation: spin-slow 3s linear infinite;
  filter: drop-shadow(0 0 12px var(--accent));
}
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.section-loading .loading-text {
  font-family: 'Share Tech Mono', monospace; font-size: .75rem;
  color: var(--text-dim); letter-spacing: 3px; text-align: center;
}
.loading-dots { display: inline-flex; gap: .3rem; }
.loading-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: dot-bounce .8s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }

/* Section idle state */
.section-idle {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60%; gap: 1.2rem; padding: 2rem;
}
.section-idle-icon { font-size: 3rem; color: var(--border2); filter: drop-shadow(0 0 8px var(--border2)); }
.section-idle-title { font-family: 'Orbitron', sans-serif; font-size: .85rem; color: var(--text-dim); letter-spacing: 3px; text-align: center; }
.section-idle-sub { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--text-muted); letter-spacing: 1px; text-align: center; line-height: 1.8; }

/* Memory context badge */
.memory-badge {
  background: rgba(124,58,237,.08); border: 1px solid rgba(124,58,237,.2);
  border-radius: 4px; padding: .6rem .8rem; margin-bottom: .75rem;
  font-family: 'Share Tech Mono', monospace; font-size: .62rem; color: var(--accent2);
  letter-spacing: 1px;
}
.memory-badge strong { color: var(--accent); display: block; margin-bottom: .2rem; letter-spacing: 2px; }

/* Nouvelle section : Graphiques additionnels */
.charts-section { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.big5-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: .25rem; margin-top: .4rem; }
.big5-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.big5-bar-outer { width: 100%; height: 50px; background: var(--border); border-radius: 2px; position: relative; display: flex; align-items: flex-end; overflow: hidden; }
.big5-bar-fill { width: 100%; background: linear-gradient(0deg, var(--accent2), var(--accent)); border-radius: 2px 2px 0 0; transition: height .9s cubic-bezier(.4,0,.2,1); }
.big5-bar-label { font-family: 'Share Tech Mono', monospace; font-size: .5rem; color: var(--text-dim); text-align: center; letter-spacing: .5px; }
.big5-bar-val { font-family: 'Orbitron', sans-serif; font-size: .6rem; color: var(--accent); }

/* Gauge donut mini */
.gauge-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .5rem; }
.gauge-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: .5rem; text-align: center; }
.gauge-val { font-family: 'Orbitron', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.gauge-label { font-family: 'Share Tech Mono', monospace; font-size: .55rem; color: var(--text-dim); letter-spacing: 1px; margin-top: .2rem; }

/* Section style bars */
.style-meters { display: flex; flex-direction: column; gap: .35rem; }
.style-meter-row { display: grid; grid-template-columns: 60px 1fr 28px; align-items: center; gap: .4rem; font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--text-dim); }
.style-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.style-fill { height: 100%; border-radius: 2px; transition: width .9s cubic-bezier(.4,0,.2,1); width: 0; }
.style-fill.accent  { background: var(--accent); }
.style-fill.purple  { background: var(--accent2); }
.style-fill.green   { background: var(--accent3); }

/* Sentiment track amélioré */
.sentiment-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.sentiment-track { height: 5px; background: linear-gradient(90deg,var(--danger),var(--accent4) 50%,var(--accent3)); border-radius: 3px; margin-bottom: .5rem; position: relative; }
.sentiment-bar { position: absolute; left: 0; top: 0; height: 100%; opacity: .3; background: var(--accent3); border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.emotion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .3rem; }
.emotion-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 2px; padding: .35rem .4rem; }
.emo-label { display: block; font-family: 'Share Tech Mono', monospace; font-size: .52rem; color: var(--text-dim); }
.emo-val { font-family: 'Rajdhani', sans-serif; font-size: .78rem; color: var(--text); font-weight: 500; }

.mt-half { margin-top: .4rem; }
.accent { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — MOBILE RESPONSIVE (< 768px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { overflow: hidden; }

  .app-shell {
    display: flex; flex-direction: column;
    height: 100dvh; /* dynamic viewport height */
    width: 100%;
  }

  /* Sidebar → bottom navigation bar */
  .sidebar {
    order: 3;
    flex-direction: row;
    width: 100%; height: auto;
    border-right: none; border-top: 1px solid var(--border);
    overflow-x: auto; overflow-y: hidden;
    flex-shrink: 0;
    padding: 0;
  }

  .brand-block, .status-bar, .sidebar-section, .clear-btn, .user-badge { display: none; }

  .side-nav {
    display: flex; flex-direction: row; padding: 0;
    border-bottom: none; width: 100%;
  }

  .nav-item {
    flex: 1; flex-direction: column; justify-content: center;
    padding: .5rem .25rem; font-size: .55rem; gap: .2rem;
    border-left: none; border-top: 2px solid transparent; text-align: center;
    min-width: 0;
  }
  .nav-item:hover, .nav-item.active {
    border-left: none; border-top-color: var(--accent);
  }
  .nav-icon { font-size: 1.1rem; width: auto; }

  /* Chat panel → order 1, takes all space */
  .chat-panel { order: 1; flex: 1; min-height: 0; border-right: none; }

  /* Analysis panel → hidden on mobile, shown via toggle */
  .analysis-panel {
    order: 2; flex-shrink: 0;
    height: 0; overflow: hidden; transition: height .3s ease;
    border-left: none; border-top: 1px solid var(--border);
  }
  .analysis-panel.mobile-open { height: 45dvh; overflow-y: auto; }

  /* Mobile toggle button */
  .mobile-nexus-btn {
    position: fixed; bottom: 60px; right: 12px; z-index: 500;
    background: var(--accent2); border: none; border-radius: 50%;
    width: 44px; height: 44px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #fff;
    box-shadow: 0 4px 20px rgba(124,58,237,.5);
    transition: all .2s;
  }
  .mobile-nexus-btn:active { transform: scale(.9); }
  .mobile-nexus-btn.active { background: var(--accent); box-shadow: 0 4px 20px rgba(0,229,255,.5); }

  /* Chat header simplifié */
  .chat-header { padding: .5rem .8rem; }
  .chat-title { font-size: .6rem; }
  .chat-meta { display: none; }

  /* Messages */
  .messages-container { padding: .8rem; gap: .6rem; }
  .msg-bubble { max-width: 92%; font-size: .85rem; }

  /* Input zone */
  .input-zone { padding: .5rem .8rem; }
  .input-meta { display: none; }
  #msg-input { font-size: .9rem; padding: .6rem .8rem; }
  #send-btn { width: 40px; height: 40px; }

  /* Sections scrollable */
  .section-panel { padding: .8rem; }

  /* Analysis blocks dans le panel mobile */
  .analysis-panel .block-title { font-size: .6rem; }
  .meter-row { grid-template-columns: 75px 1fr 24px; font-size: .55rem; }

  /* Login card mobile */
  .login-card { margin: 1rem; padding: 2rem 1.5rem; }
}

@media (max-width: 480px) {
  .msg-bubble { max-width: 98%; font-size: .82rem; }
  .login-card { padding: 1.5rem 1rem; }
  .login-title { font-size: 1rem; letter-spacing: 2px; }
}

/* ═══════════════════════════════════════════════════════════
   AETHER v4.0 — WARN COLOR VAR FIX
═══════════════════════════════════════════════════════════ */
:root {
  --warn:   #f59e0b;
  --purple: #7c3aed;
}
