/* ════════════════════════════════════════════════════════════
   PSY AGENT  –  Design System v2
   Theme: Glassmorphism · Violet/Bleu · Inter
════════════════════════════════════════════════════════════ */

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

/* ─── Design tokens ──────────────────────────────────────── */
:root {
  /* Colors */
  --bg:            #0f0f1a;
  --bg-2:          #12121f;
  --surface:       rgba(255,255,255,0.035);
  --surface-2:     rgba(255,255,255,0.06);
  --surface-3:     rgba(255,255,255,0.10);
  --border:        rgba(255,255,255,0.08);
  --border-2:      rgba(255,255,255,0.13);

  --purple:        #7c3aed;
  --purple-2:      #9f67ff;
  --purple-glow:   rgba(124,58,237,0.35);
  --blue:          #3b82f6;
  --blue-2:        #60a5fa;
  --cyan:          #06b6d4;
  --green:         #10b981;
  --orange:        #f59e0b;
  --red:           #ef4444;

  --text:          #f1f5f9;
  --text-2:        #cbd5e1;
  --muted:         #94a3b8;
  --muted-2:       #64748b;

  --grad-primary:  linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
  --grad-subtle:   linear-gradient(135deg, rgba(124,58,237,0.15), rgba(59,130,246,0.10));

  /* Layout */
  --sidebar-w:     260px;
  --radius:        16px;
  --radius-sm:     10px;
  --radius-xs:     6px;
  --radius-full:   9999px;
  --shadow:        0 4px 32px rgba(0,0,0,0.45);
  --shadow-lg:     0 12px 64px rgba(0,0,0,0.6);

  /* Motion */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --t:             0.2s;
  --t-slow:        0.4s;

  /* Typography */
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ─── Glassmorphism helper ───────────────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
}

/* ─── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Screens ────────────────────────────────────────────── */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ════════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--t) var(--ease);
  outline: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.12);
}
.btn-glow:hover:not(:disabled) {
  box-shadow: 0 0 28px var(--purple-glow), 0 4px 16px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--muted);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--purple-2);
  color: var(--text);
  background: rgba(124,58,237,0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-ghost.active-tool {
  color: var(--purple-2);
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn-full { width: 100%; }
.btn-sm   { padding: 7px 14px; font-size: 13px; }

/* ════════════════════════════════════════════════════════════
   FORMS
════════════════════════════════════════════════════════════ */
.input-group { margin-bottom: 18px; }
.input-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.input-group .opt { color: var(--muted-2); font-weight: 400; }

.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}
.input-wrapper input { padding-left: 42px; }

input[type="text"], input[type="number"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t);
  resize: vertical;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--purple);
  background: rgba(124,58,237,0.06);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Range Slider ───────────────────────────────────────── */
.styled-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  border: none;
  padding: 0;
  outline: none;
  cursor: pointer;
  flex: 1;
}
.styled-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--grad-primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--purple-glow), 0 2px 6px rgba(0,0,0,0.3);
  transition: transform var(--t) var(--ease), box-shadow var(--t);
}
.styled-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px var(--purple-glow);
}
.styled-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--grad-primary);
  border: none;
  cursor: pointer;
}

/* ─── Feedback ───────────────────────────────────────────── */
.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  padding: 10px;
  background: rgba(239,68,68,0.1);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239,68,68,0.2);
}
.inline-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   CRISIS BANNER
════════════════════════════════════════════════════════════ */
.crisis-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 8000;
  background: linear-gradient(135deg, rgba(239,68,68,0.97), rgba(185,28,28,0.97));
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 40px rgba(239,68,68,0.45);
  animation: crisisSlideDown 0.4s var(--ease);
  padding: 14px 20px;
}
@keyframes crisisSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.crisis-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.crisis-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.crisis-text { flex: 1; color: white; }
.crisis-text strong { display: block; font-size: 15px; margin-bottom: 10px; }
.crisis-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.crisis-number {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  text-decoration: none;
  color: white;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t);
}
.crisis-number:hover { background: rgba(255,255,255,0.28); }
.crisis-num-badge {
  background: white;
  color: #dc2626;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-full);
  padding: 2px 10px;
}
.crisis-close {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  flex-shrink: 0;
  transition: background var(--t);
  position: relative;
  z-index: 8001;
}
.crisis-close:hover { background: rgba(255,255,255,0.3); }

/* ════════════════════════════════════════════════════════════
   MARKDOWN DANS LES BULLES
════════════════════════════════════════════════════════════ */
.msg-content.markdown p   { margin-bottom: 10px; }
.msg-content.markdown p:last-child { margin-bottom: 0; }
.msg-content.markdown strong { font-weight: 700; }
.msg-content.markdown em     { font-style: italic; opacity: 0.9; }
.msg-content.markdown ul,
.msg-content.markdown ol  { padding-left: 18px; margin: 8px 0; }
.msg-content.markdown li  { margin-bottom: 5px; }
.msg-content.markdown h1,
.msg-content.markdown h2,
.msg-content.markdown h3  { font-size: 15px; font-weight: 700; margin: 12px 0 6px; }
.msg-content.markdown blockquote {
  border-left: 3px solid rgba(255,255,255,0.3);
  padding-left: 12px;
  margin: 10px 0;
  opacity: 0.85;
  font-style: italic;
}
.msg-content.markdown code {
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 13px;
}
.msg-content.markdown hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.2);
  margin: 12px 0;
}

/* Streaming cursor */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s ease-in-out infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  pointer-events: all;
  transform: translateX(120%);
  opacity: 0;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
  max-width: 340px;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.toast-info    { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* ════════════════════════════════════════════════════════════
   MODAL
════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  border-radius: 20px;
  padding: 32px;
  animation: modalIn 0.3s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}
.modal-icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--grad-subtle);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--purple-2);
}
.modal-header h3 { font-size: 18px; margin-bottom: 4px; }
.modal-header p  { font-size: 14px; color: var(--muted); }

.mood-modal-slider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.mood-modal-emoji { font-size: 40px; transition: transform 0.2s; }
.mood-modal-score {
  font-size: 32px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-denom { font-size: 18px; color: var(--muted); font-weight: 400; -webkit-text-fill-color: var(--muted); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ════════════════════════════════════════════════════════════
   AUTH SCREEN
════════════════════════════════════════════════════════════ */
#auth-screen {
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.orb-1 {
  width: 500px; height: 500px;
  top: -150px; left: -100px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  bottom: -100px; right: -80px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  animation-delay: -3s;
}
.orb-3 {
  width: 300px; height: 300px;
  top: 40%; left: 40%;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  animation-delay: -6s;
  opacity: 0.2;
}
@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 20px) scale(1.08); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.logo-mark {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-title {
  font-size: 24px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-tagline { font-size: 13px; color: var(--muted); margin-top: 2px; }

.auth-tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 28px;
}
.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--t) var(--ease);
}
.tab-btn.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 12px var(--purple-glow);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

/* ════════════════════════════════════════════════════════════
   PROFILE SETUP
════════════════════════════════════════════════════════════ */
#profile-screen {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
}
.profile-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  z-index: 1;
  margin: auto;
}
.setup-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--grad-subtle);
  border: 1px solid rgba(124,58,237,0.3);
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.setup-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.setup-sub   { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

/* ════════════════════════════════════════════════════════════
   APP LAYOUT
════════════════════════════════════════════════════════════ */
#app-screen {
  flex-direction: row;
  overflow: hidden;
}

/* ─── Hamburger (mobile) ────────────────────────────────── */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 300;
  width: 40px; height: 40px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}
.hamburger-btn span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--t) var(--ease);
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(15,15,26,0.8);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 200;
  transition: transform var(--t-slow) var(--ease);
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark-sm {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand {
  font-size: 16px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 10px 6px;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  text-align: left;
  transition: all var(--t) var(--ease);
  position: relative;
}
.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text-2);
}
.nav-btn.active {
  background: var(--grad-subtle);
  color: var(--text);
  border: 1px solid rgba(124,58,237,0.25);
}
.nav-btn.active .nav-icon {
  color: var(--purple-2);
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--t);
}
.nav-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-left: auto;
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.user-card-text { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--muted); }

.logout-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  transition: color var(--t), background var(--t);
}
.logout-icon-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ─── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
}

.view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  animation: viewIn 0.25s var(--ease);
}
.view.active { display: flex; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(15,15,26,0.5);
  backdrop-filter: blur(12px);
}
.view-header h2 { font-size: 20px; font-weight: 700; }
.view-subtitle  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ════════════════════════════════════════════════════════════
   CHAT VIEW
════════════════════════════════════════════════════════════ */
#view-chat { overflow: hidden; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(15,15,26,0.6);
  backdrop-filter: blur(20px);
}
.dr-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dr-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.dr-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(124,58,237,0.4);
  box-shadow: 0 0 20px rgba(124,58,237,0.25);
}
.dr-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 8px var(--green);
}
.dr-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.status-idle    { background: rgba(100,116,139,0.15); color: var(--muted);  border: 1px solid rgba(100,116,139,0.2); }
.status-active  { background: rgba(16,185,129,0.12);  color: #6ee7b7;       border: 1px solid rgba(16,185,129,0.25); }
.status-thinking { background: rgba(245,158,11,0.12); color: #fcd34d;       border: 1px solid rgba(245,158,11,0.25); }

.chat-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Session meta (timer + phase) */
.session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.18);
  border-radius: var(--radius-full);
}

.phase-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}
.phase-checkin {
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-color: rgba(59,130,246,0.25);
}
.phase-travail {
  background: rgba(124,58,237,0.15);
  color: #c4b5fd;
  border-color: rgba(124,58,237,0.25);
}
.phase-cloture {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
  border-color: rgba(245,158,11,0.25);
}

.session-meta-clock {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.session-elapsed  { color: var(--muted); }
.clock-sep        { color: var(--border-2); }
.session-countdown { color: var(--text-2); font-weight: 600; }
.session-countdown.countdown-warning  { color: #fcd34d; }
.session-countdown.countdown-critical { color: #f87171; animation: pulse 1s ease infinite; }

/* Mood area */
.mood-area {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(15,15,26,0.5);
}
.mood-area-card {
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mood-question {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
}
.mood-slider-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.mood-emoji-big {
  font-size: 32px;
  transition: transform 0.2s var(--ease);
  flex-shrink: 0;
}
.mood-score-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.mood-score-display span:first-child {
  font-size: 28px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 28px;
  text-align: right;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  text-align: center;
  padding: 40px;
}
.empty-orb {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--grad-subtle);
  border: 1px solid rgba(124,58,237,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.empty-title { font-size: 18px; font-weight: 600; color: var(--text-2); }
.empty-desc  { font-size: 14px; color: var(--muted); max-width: 340px; line-height: 1.6; }

/* Message bubbles */
.message {
  display: flex;
  gap: 10px;
  max-width: 78%;
  animation: msgIn 0.3s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.message.user      { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 16px;
}
.message.user .msg-avatar {
  background: var(--grad-primary);
  font-size: 14px;
  font-weight: 700;
  color: white;
}
.message.assistant .msg-avatar {
  background: var(--grad-primary);
}

.msg-bubble-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.msg-content {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.user .msg-content {
  background: var(--grad-primary);
  color: white;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}
.message.assistant .msg-content {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 4px 18px 18px 18px;
}

.msg-time {
  font-size: 11px;
  color: var(--muted-2);
  padding: 0 4px;
}
.message.user .msg-time      { text-align: right; }
.message.assistant .msg-time { text-align: left; }

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}
.typing-dot {
  width: 8px; height: 8px;
  background: var(--purple-2);
  border-radius: 50%;
  animation: typingBounce 1s ease-in-out infinite;
  opacity: 0.7;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30%            { transform: translateY(-9px); opacity: 1; }
}

/* Input area */
.input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(15,15,26,0.7);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}
.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.input-field-wrap { flex: 1; }
#message-input {
  width: 100%;
  min-height: 46px;
  max-height: 140px;
  resize: none;
  border-radius: 14px;
  padding: 12px 16px;
  line-height: 1.5;
  overflow-y: auto;
}

.input-btns { display: flex; gap: 8px; align-items: flex-end; }

/* Mic button */
.btn-mic {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t) var(--ease);
  flex-shrink: 0;
  color: var(--muted);
  outline: none;
}
.btn-mic:not(:disabled):hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
}
.btn-mic:disabled { opacity: 0.35; cursor: not-allowed; }

.mic-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stop-svg { position: absolute; }

.mic-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--purple);
  opacity: 0;
  animation: none;
  pointer-events: none;
}
.btn-mic.recording {
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(59,130,246,0.3));
  border-color: var(--purple);
  color: var(--purple-2);
  box-shadow: 0 0 20px var(--purple-glow);
}
.btn-mic.recording .mic-ring {
  animation: micRipple 1.8s ease-out infinite;
}
.btn-mic.recording .mic-ring-1 { width: 46px; height: 46px; animation-delay: 0s; }
.btn-mic.recording .mic-ring-2 { width: 46px; height: 46px; animation-delay: 0.6s; }
.btn-mic.recording .mic-ring-3 { width: 46px; height: 46px; animation-delay: 1.2s; }

@keyframes micRipple {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Send button */
.btn-send {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--grad-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: all var(--t) var(--ease);
  outline: none;
}
.btn-send:not(:disabled):hover {
  box-shadow: 0 0 20px var(--purple-glow);
  transform: scale(1.05);
}
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(239,68,68,0.08);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239,68,68,0.15);
}
.rec-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--red);
  animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.voice-status { font-size: 12px; color: var(--muted); margin-top: 6px; padding: 0 4px; }

/* ════════════════════════════════════════════════════════════
   DASHBOARD
════════════════════════════════════════════════════════════ */
#view-dashboard { overflow: hidden; }

.dashboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--t) var(--ease), box-shadow var(--t);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.stat-icon-bg {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-purple { background: rgba(124,58,237,0.18); color: var(--purple-2); }
.stat-blue   { background: rgba(59,130,246,0.18);  color: var(--blue-2); }
.stat-orange { background: rgba(245,158,11,0.18);  color: #fcd34d; }
.stat-cyan   { background: rgba(6,182,212,0.18);   color: #67e8f9; }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chart-card {
  border-radius: var(--radius);
  padding: 20px;
}
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-card-header h3 { font-size: 14px; font-weight: 600; color: var(--text-2); }
.chart-period-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.chart-wrap { position: relative; height: 220px; }

.last-session-card {
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.8;
}
.last-session-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-2);
}

/* ════════════════════════════════════════════════════════════
   JOURNAL
════════════════════════════════════════════════════════════ */
#view-journal { overflow: hidden; }

.journal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.journal-form-card {
  border-radius: var(--radius);
  padding: 24px;
}
.journal-form-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 20px;
}

.journal-metrics { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.metric-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.metric-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 110px;
  flex-shrink: 0;
}
.metric-emoji { font-size: 18px; }
.metric-label-wrap label { font-size: 13px; font-weight: 500; color: var(--muted); }

.metric-val {
  width: 38px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.journal-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

/* Journal history */
.journal-history { display: flex; flex-direction: column; gap: 10px; }
.journal-history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.journal-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color var(--t);
}
.journal-entry:hover { border-color: var(--border-2); }

.journal-entry-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.journal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}
.journal-entry-trigger {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.journal-entry-notes { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ════════════════════════════════════════════════════════════
   ÉVALUATIONS (PHQ-9 / GAD-7)
════════════════════════════════════════════════════════════ */
#view-evaluations { overflow: hidden; }

.eval-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Tabs PHQ9 / GAD7 */
.eval-tabs {
  display: flex;
  gap: 12px;
}
.eval-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: all var(--t) var(--ease);
  font-family: var(--font);
}
.eval-tab:hover { border-color: var(--border-2); background: var(--surface-2); }
.eval-tab.active {
  border-color: rgba(124,58,237,0.5);
  background: var(--grad-subtle);
  box-shadow: 0 0 20px rgba(124,58,237,0.1);
}
.eval-tab-icon { font-size: 28px; flex-shrink: 0; }
.eval-tab-title { font-size: 16px; font-weight: 700; color: var(--text); }
.eval-tab-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Card questionnaire */
.eval-card {
  border-radius: var(--radius);
  padding: 28px;
}
.eval-intro { margin-bottom: 20px; }
.eval-intro p { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.eval-period-note {
  margin-top: 10px;
  padding: 12px 16px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--blue-2);
}

/* Barre de progression */
.eval-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  margin-bottom: 8px;
  overflow: hidden;
}
.eval-progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 99px;
  transition: width 0.4s var(--ease);
  width: 0%;
}
.eval-progress-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
  text-align: right;
}

/* Questions */
.eval-questions { display: flex; flex-direction: column; gap: 20px; }

.eval-question {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  transition: border-color var(--t);
}
.eval-question.answered { border-color: rgba(124,58,237,0.3); }

.eval-question-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.eval-question-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 14px;
  font-weight: 500;
}
.eval-answers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.eval-answer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--t) var(--ease);
  text-align: center;
}
.eval-answer-btn:hover {
  border-color: var(--purple);
  background: rgba(124,58,237,0.08);
}
.eval-answer-btn.selected {
  background: var(--grad-primary);
  border-color: transparent;
  box-shadow: 0 2px 12px var(--purple-glow);
}
.eval-answer-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.eval-answer-btn.selected .eval-answer-score { color: white; }
.eval-answer-label {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.eval-answer-btn.selected .eval-answer-label { color: rgba(255,255,255,0.85); }

/* Submit row */
.eval-submit-row {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

/* Résultat */
.eval-result {
  margin-top: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  animation: viewIn 0.3s var(--ease);
}
.eval-result-header {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.eval-score-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 28px var(--purple-glow);
}
.eval-score-number { font-size: 26px; font-weight: 800; color: white; line-height: 1; }
.eval-score-max    { font-size: 11px; color: rgba(255,255,255,0.7); }
.eval-result-info  { flex: 1; }
.eval-result-type  { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.eval-result-severite {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.eval-result-interp { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* Severity colors */
.sev-minimale     { color: var(--green); }
.sev-legere       { color: var(--cyan); }
.sev-moderee      { color: var(--orange); }
.sev-mod-severe   { color: #fb923c; }
.sev-severe       { color: var(--red); }

.eval-result-scale {
  padding: 0 28px 20px;
}
.eval-scale-bar {
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.eval-scale-seg { flex: 1; }
.scale-green  { background: var(--green); }
.scale-cyan   { background: var(--cyan); }
.scale-orange { background: var(--orange); }
.scale-red2   { background: #fb923c; }
.scale-red    { background: var(--red); }

.eval-result-actions {
  padding: 16px 28px 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Historique */
.eval-history-section { display: flex; flex-direction: column; gap: 12px; }
.eval-history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.eval-history { display: flex; flex-direction: column; gap: 8px; }

.eval-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t);
}
.eval-history-item:hover { border-color: var(--border-2); }

.eval-hist-type {
  width: 54px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 0;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.eval-hist-type.phq9 { background: rgba(124,58,237,0.15); color: var(--purple-2); }
.eval-hist-type.gad7 { background: rgba(59,130,246,0.15);  color: var(--blue-2); }

.eval-hist-score {
  font-size: 22px;
  font-weight: 800;
  min-width: 40px;
}
.eval-hist-info { flex: 1; }
.eval-hist-severite { font-size: 14px; font-weight: 600; }
.eval-hist-date     { font-size: 12px; color: var(--muted); margin-top: 2px; }

.eval-hist-bar-wrap {
  width: 100px;
  flex-shrink: 0;
}
.eval-hist-bar-bg {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.eval-hist-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--grad-primary);
  transition: width 0.5s var(--ease);
}

/* ════════════════════════════════════════════════════════════
   MEMORY
════════════════════════════════════════════════════════════ */
.memory-list {
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}

.memory-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color var(--t);
}
.memory-card:hover { border-color: var(--border-2); }

.memory-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.memory-period-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.memory-type-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.memory-resume {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 14px;
}
.memory-patterns { display: flex; flex-wrap: wrap; gap: 7px; }
.pattern-tag {
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.2);
  color: #67e8f9;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   PROFILE EDIT
════════════════════════════════════════════════════════════ */
#view-profile-edit { overflow-y: auto; }

.profile-edit-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}
.profile-edit-card {
  max-width: 600px;
  border-radius: var(--radius);
  padding: 28px;
}
.profile-form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   LOADING OVERLAY
════════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.loader-ring {
  display: inline-block;
  position: relative;
  width: 52px; height: 52px;
}
.loader-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 44px; height: 44px;
  margin: 4px;
  border: 3px solid transparent;
  border-top-color: var(--purple-2);
  border-radius: 50%;
  animation: loaderSpin 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
.loader-ring div:nth-child(1) { animation-delay: -0.45s; border-top-color: var(--purple); }
.loader-ring div:nth-child(2) { animation-delay: -0.30s; border-top-color: var(--blue); }
.loader-ring div:nth-child(3) { animation-delay: -0.15s; border-top-color: var(--cyan); }
@keyframes loaderSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   ANALYSE DES SENTIMENTS
═══════════════════════════════════════════════════ */

.analyse-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Empty + loading states */
.analyse-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.analyse-empty-icon { font-size: 48px; line-height: 1; }
.analyse-empty h3 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0; }
.analyse-empty p  { font-size: 14px; margin: 0; max-width: 420px; }
.analyse-empty-note { color: var(--text-muted); font-size: 13px !important; }

.analyse-loading {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 40px 24px;
  color: var(--text-secondary);
}
.analyse-loading-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.analyse-loading-sub   { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Score banner */
.analyse-results { padding: 0 24px 32px; }

.analyse-score-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  border-radius: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.analyse-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.analyse-score-value {
  font-size: 48px;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.analyse-score-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.analyse-score-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}
.analyse-stat-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.analyse-stat-pill strong { color: var(--text-primary); }

.analyse-trend-badge {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}
.trend-amelioration { background: rgba(16,185,129,.15); color: #10b981; }
.trend-degradation  { background: rgba(239,68,68,.15);  color: #ef4444; }
.trend-stable       { background: rgba(245,158,11,.15); color: #f59e0b; }

/* Grid */
.analyse-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.analyse-card {
  border-radius: 16px;
  padding: 20px;
}
.analyse-card-wide { grid-column: 1 / -1; }

.analyse-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Radar */
.analyse-radar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.emotions-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.emotion-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}
.emotion-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.emotion-evolution {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 2px;
}
.evo-amelioration { background: rgba(16,185,129,.2);  color: #10b981; }
.evo-degradation  { background: rgba(239,68,68,.2);   color: #ef4444; }
.evo-stable       { background: rgba(245,158,11,.2);  color: #f59e0b; }

/* Themes */
.themes-list { display: flex; flex-direction: column; gap: 10px; }
.theme-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.theme-emoji { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.theme-body { flex: 1; }
.theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.theme-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.theme-freq { font-size: 11px; color: var(--text-muted); }
.theme-bar-bg {
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.theme-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 3px;
  transition: width .6s ease;
}
.theme-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Patterns */
.patterns-list { display: flex; flex-direction: column; gap: 8px; }
.pattern-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.pattern-bullet {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
  margin-top: 6px;
}

/* Correlations */
.correlations-list { display: flex; flex-direction: column; gap: 10px; }
.correlation-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(59,130,246,.07);
  border: 1px solid rgba(59,130,246,.15);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.correlation-icon { font-size: 16px; flex-shrink: 0; }
.correlation-fiabilite {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.fiabilite-forte   { background: rgba(16,185,129,.15); color: #10b981; }
.fiabilite-moderee { background: rgba(245,158,11,.15); color: #f59e0b; }
.fiabilite-faible  { background: rgba(148,163,184,.15); color: #94a3b8; }

/* Points forts + axes */
.analyse-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.analyse-ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.analyse-ul li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.analyse-ul li::before {
  content: '✓';
  flex-shrink: 0;
  font-weight: 700;
  margin-top: 1px;
}
.analyse-ul.green li::before { color: #10b981; }
.analyse-ul.orange li::before { content: '→'; color: #f59e0b; }

/* Synthèse */
.synthese-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  background: rgba(124,58,237,.06);
  border-left: 3px solid rgba(124,58,237,.4);
  padding: 14px 18px;
  border-radius: 0 12px 12px 0;
  margin-bottom: 12px;
}
.analyse-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Historique des analyses */
.analyse-history-section { margin-top: 24px; }
.analyse-history-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.analyse-history-list { display: flex; gap: 10px; flex-wrap: wrap; }
.analyse-history-item {
  padding: 8px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}
.analyse-history-item:hover { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.3); color: var(--purple); }
.analyse-history-item.active { background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.4); color: var(--purple); font-weight: 600; }

@media (max-width: 768px) {
  .analyse-grid { grid-template-columns: 1fr; }
  .analyse-card-wide { grid-column: 1; }
  .analyse-two-cols { grid-template-columns: 1fr; }
  .analyse-results { padding: 0 16px 28px; }
}

/* ═══════════════════════════════════════════════════
   HISTORY VIEW
═══════════════════════════════════════════════════ */

.history-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  height: calc(100vh - 130px);
  padding: 0 24px 24px;
}

/* List panel */
.history-list-panel {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

.history-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.history-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.history-session-count {
  font-size: 12px;
  color: var(--purple);
  background: rgba(124,58,237,.15);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.history-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Session card in list */
.history-session-item {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.history-session-item:hover {
  background: rgba(255,255,255,0.05);
}

.history-session-item.active {
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.3);
}

.hsi-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hsi-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.hsi-badge {
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.hsi-badge.terminee {
  background: rgba(16,185,129,.15);
  color: #10b981;
}

.hsi-badge.active-session {
  background: rgba(245,158,11,.15);
  color: #f59e0b;
}

.hsi-mood-delta {
  margin-left: auto;
  font-size: 12px;
}

/* Detail panel */
.history-detail-panel {
  border-radius: 16px;
  overflow-y: auto;
  padding: 0;
}

.history-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
}

#history-detail-content {
  padding: 24px;
}

.history-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 20px;
}

.history-detail-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.history-detail-stats {
  display: flex;
  gap: 12px;
}

.hd-stat {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 20px;
}

.history-detail-moods {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hd-mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.hd-mood-emoji {
  font-size: 22px;
}

.hd-mood-label {
  font-size: 10px;
}

/* Resume section */
.history-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 20px;
}

.history-resume-section { margin-bottom: 8px; }

.history-resume-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: rgba(124,58,237,.07);
  border: 1px solid rgba(124,58,237,.15);
  border-radius: 12px;
  padding: 14px 18px;
  white-space: pre-wrap;
}

.history-resume-text p { margin: 0 0 8px; }
.history-resume-text p:last-child { margin-bottom: 0; }

/* Messages in detail */
.hd-messages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.hd-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.hd-msg.user { flex-direction: row-reverse; }

.hd-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.hd-msg.assistant .hd-msg-avatar {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
}

.hd-msg.user .hd-msg-avatar {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.hd-msg-body { max-width: 75%; }

.hd-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

.hd-msg.assistant .hd-msg-bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-top-left-radius: 4px;
}

.hd-msg.user .hd-msg-bubble {
  background: linear-gradient(135deg, rgba(124,58,237,.5), rgba(59,130,246,.4));
  border-top-right-radius: 4px;
  color: #fff;
}

.hd-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.hd-msg.user .hd-msg-time { text-align: right; }

/* ═══════════════════════════════════════════════════
   EXERCISES VIEW
═══════════════════════════════════════════════════ */

.exercises-body {
  padding: 0 24px 32px;
  max-width: 960px;
}

/* Exercise tabs */
.ex-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ex-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.ex-tab:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }

.ex-tab.active {
  background: rgba(124,58,237,.15);
  border-color: rgba(124,58,237,.4);
  color: var(--purple);
}

.ex-tab-icon { font-size: 16px; }

.ex-panel { animation: fadeIn .25s ease; }

/* ── Breathing ── */
.breath-techniques {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breath-tech-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.breath-tech-btn:hover { background: rgba(255,255,255,0.08); }

.breath-tech-btn.active {
  background: rgba(59,130,246,.18);
  border-color: rgba(59,130,246,.4);
  color: var(--blue);
  font-weight: 600;
}

.breath-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.breath-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 260px;
  margin-bottom: 24px;
}

.breath-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124,58,237,.5), rgba(59,130,246,.4));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: transform 0s linear;
  box-shadow: 0 0 40px rgba(124,58,237,.3);
}

.breath-label {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}

.breath-count {
  font-size: 28px;
  font-weight: 800;
  color: rgba(255,255,255,.9);
  min-height: 36px;
  line-height: 1;
}

.breath-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid;
  opacity: 0;
  transition: transform 0s linear, opacity 0s linear;
}

.breath-ring-1 { width: 160px; height: 160px; border-color: rgba(124,58,237,.4); }
.breath-ring-2 { width: 200px; height: 200px; border-color: rgba(59,130,246,.25); }
.breath-ring-3 { width: 240px; height: 240px; border-color: rgba(124,58,237,.12); }

/* JS-driven expand class */
.breath-circle.expanding  { transition: transform var(--breath-dur,4s) ease-in-out; transform: scale(1.45); }
.breath-circle.holding    { transform: scale(1.45); }
.breath-circle.contracting { transition: transform var(--breath-dur,8s) ease-in-out; transform: scale(1); }
.breath-ring-1.expanding  { transition: transform var(--breath-dur,4s) ease-in-out, opacity .5s; transform: scale(1.7); opacity: .7; }
.breath-ring-2.expanding  { transition: transform var(--breath-dur,4s) ease-in-out, opacity .5s; transform: scale(1.6); opacity: .5; }
.breath-ring-3.expanding  { transition: transform var(--breath-dur,4s) ease-in-out, opacity .5s; transform: scale(1.5); opacity: .35; }
.breath-ring-1.contracting { transition: transform var(--breath-dur,8s) ease-in-out, opacity .5s; transform: scale(1); opacity: 0; }
.breath-ring-2.contracting { transition: transform var(--breath-dur,8s) ease-in-out, opacity .5s; transform: scale(1); opacity: 0; }
.breath-ring-3.contracting { transition: transform var(--breath-dur,8s) ease-in-out, opacity .5s; transform: scale(1); opacity: 0; }

.breath-progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.breath-cycles-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.breath-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.breath-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 3px;
  width: 0%;
  transition: width .5s;
}

.breath-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Body scan ── */
.scan-intro {
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.scan-intro p { margin: 0 0 8px; }
.scan-intro p:last-child { margin: 0; }
.scan-duration-note { color: var(--text-muted); font-size: 13px; }

.scan-scene {
  display: flex;
  gap: 24px;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
  min-height: 180px;
  align-items: center;
}

.scan-body-visual {
  width: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-highlight {
  width: 44px;
  height: 12px;
  border-radius: 6px;
  background: rgba(124,58,237,.5);
  box-shadow: 0 0 16px rgba(124,58,237,.5);
  transition: all .8s ease;
}

.scan-text-zone { flex: 1; }

.scan-step-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  transition: all .4s;
}

.scan-step-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
  transition: all .4s;
}

.scan-timer-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.scan-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 2px;
  width: 0%;
}

/* ── Thoughts journal ── */
.thoughts-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

.thoughts-form-card {
  border-radius: 16px;
  padding: 22px;
}

.thoughts-form-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 20px;
}

.thoughts-step {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.thoughts-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(124,58,237,.2);
  border: 1px solid rgba(124,58,237,.4);
  color: var(--purple);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.thoughts-step-body { flex: 1; }

.emotion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.emotion-chip {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}

.emotion-chip:hover { background: rgba(255,255,255,0.09); }

.emotion-chip.selected {
  background: rgba(124,58,237,.2);
  border-color: rgba(124,58,237,.5);
  color: var(--purple);
  font-weight: 600;
}

.intensity-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.intensity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  outline: none;
  cursor: pointer;
}

.intensity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--purple);
  border: 2px solid rgba(255,255,255,.3);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(124,58,237,.5);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.form-select:focus { border-color: rgba(124,58,237,.5); }
.form-select option { background: #1a1a2e; color: var(--text-primary); }

/* Thoughts history column */
.thoughts-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.thoughts-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.thoughts-count {
  font-size: 12px;
  color: var(--purple);
  background: rgba(124,58,237,.12);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.thoughts-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 680px;
  overflow-y: auto;
}

.thought-card {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
  transition: border-color .2s;
}

.thought-card:hover { border-color: rgba(255,255,255,0.14); }

.thought-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.thought-emotion-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(245,158,11,.15);
  color: #f59e0b;
}

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

.thought-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
  transition: color .15s;
}

.thought-delete-btn:hover { color: #ef4444; }

.thought-situation {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-style: italic;
}

.thought-pensee {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.thought-distorsion {
  font-size: 11px;
  color: #ef4444;
  background: rgba(239,68,68,.1);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 8px;
}

.thought-alternative {
  font-size: 13px;
  color: #10b981;
  background: rgba(16,185,129,.07);
  border-left: 2px solid rgba(16,185,129,.4);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  line-height: 1.5;
}

.thought-intensity-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.thought-int-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.thought-int-fill {
  height: 100%;
  border-radius: 2px;
}

.thought-int-before { background: #ef4444; }
.thought-int-after  { background: #10b981; }

@media (max-width: 768px) {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: loaderSpin .7s linear infinite;
  flex-shrink: 0;
}

.history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .view-header { padding: 16px 18px 14px 60px; }

  .chat-header { padding: 14px 16px 14px 60px; }
  .messages-container { padding: 18px 16px; }
  .input-area { padding: 12px 14px; }

  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .dashboard-body  { padding: 16px 16px 28px; }
  .journal-body    { padding: 16px 16px 28px; }
  .memory-list     { padding: 16px 16px 28px; }
  .profile-edit-body { padding: 16px; }
  .history-layout { grid-template-columns: 1fr; height: auto; }
  .history-list-panel { max-height: 280px; }
  .history-detail-panel { min-height: 400px; }
  .thoughts-layout { grid-template-columns: 1fr; }
  .thoughts-history { max-height: 400px; }
  .exercises-body { padding: 0 16px 28px; }

  .auth-card    { padding: 28px 24px; margin: 16px; }
  .profile-card { padding: 28px 20px; margin: 16px auto; }

  .message { max-width: 92%; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dr-name { font-size: 15px; }
  .chat-actions .btn span { display: none; }
}

/* ─────────────────────────────────────────────────────────
   SESSION ACTIVE BANNER
───────────────────────────────────────────────────────── */
.session-active-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: rgba(124, 58, 237, 0.12);
  border-bottom: 1px solid rgba(124, 58, 237, 0.22);
  font-size: 13px;
  color: var(--text-2);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}
.session-dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: dot-pulse-live 1.5s ease-in-out infinite;
}
@keyframes dot-pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}
.session-banner-label { font-weight: 500; color: var(--text-primary); }
.session-banner-sep   { color: var(--muted); }
.session-banner-timer {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.session-banner-resume {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: var(--accent);
  cursor: pointer;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.session-banner-resume:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.65);
}

/* ─────────────────────────────────────────────────────────
   DASHBOARD — SCORES PHQ-9 / GAD-7
───────────────────────────────────────────────────────── */
.scores-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.score-eval-card {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.score-eval-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.score-eval-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.score-eval-max {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}
.score-eval-sev {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  margin-top: 8px;
  display: inline-block;
}
.score-eval-date { font-size: 11px; color: var(--muted); margin-top: 5px; }

.sev-minimale            { background: rgba(34,197,94,0.15);  color: #22c55e; }
.sev-legere              { background: rgba(234,179,8,0.15);   color: #eab308; }
.sev-moderee             { background: rgba(249,115,22,0.15);  color: #f97316; }
.sev-severe              { background: rgba(239,68,68,0.15);   color: #ef4444; }
.sev-moderement-severe   { background: rgba(239,68,68,0.10);   color: #f87171; }

/* ─────────────────────────────────────────────────────────
   DASHBOARD — CARTE ANALYSE RÉCENTE
───────────────────────────────────────────────────────── */
.dash-analyse-card {
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.dash-analyse-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.dash-analyse-score-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
}
.dash-analyse-score-num {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dash-analyse-score-denom { font-size: 18px; color: var(--muted); }
.dash-analyse-title { font-size: 12px; color: var(--muted); margin-top: 2px; }

.dash-emotion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.dash-emotion-name { width: 88px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.dash-emotion-bar-bg {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.dash-emotion-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.dash-emotion-val { font-size: 11px; color: var(--muted); width: 30px; text-align: right; flex-shrink: 0; }

.dash-analyse-synthese {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 12px 0;
  font-style: italic;
}
.dash-analyse-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.dash-analyse-link:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────
   CONTEXTUAL "CONNECTED" SUBTITLE
───────────────────────────────────────────────────────── */
.view-subtitle-connected {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 5px;
}
.view-subtitle-connected::before { content: '✦'; font-size: 8px; }

/* ─────────────────────────────────────────────────────────
   LAST SESSION CARD — mood arrow + duration
───────────────────────────────────────────────────────── */
.session-duration {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 10px;
}
.session-mood-arrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.mood-score-badge { font-weight: 700; font-size: 15px; }
.mood-arrow-icon  { font-size: 16px; }

/* ─────────────────────────────────────────────────────────
   DISTRESS BANNER (orange)
───────────────────────────────────────────────────────── */
.distress-banner {
  background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(234,88,12,0.12));
  border-left: 4px solid var(--orange);
  border-bottom: 1px solid rgba(245,158,11,0.25);
  padding: 14px 20px;
  position: relative;
  z-index: 80;
}
.distress-content {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
}
.distress-icon { color: var(--orange); flex-shrink: 0; margin-top: 2px; }
.distress-text { flex: 1; min-width: 180px; }
.distress-text strong { display: block; color: var(--orange); font-size: 14px; margin-bottom: 3px; }
.distress-text span   { font-size: 13px; color: var(--text-2); }
.distress-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
}
.distress-tool {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-2);
}
.distress-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  flex-shrink: 0;
  transition: color var(--t) var(--ease);
}
.distress-close:hover { color: var(--text); }

/* ─────────────────────────────────────────────────────────
   ALERTES DASHBOARD
───────────────────────────────────────────────────────── */
.dash-alertes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.alerte-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.alerte-info    { background: rgba(59,130,246,0.10); border-left: 3px solid var(--blue); color: var(--text-2); }
.alerte-warn    { background: rgba(245,158,11,0.10); border-left: 3px solid var(--orange); color: var(--text-2); }
.alerte-danger  { background: rgba(239,68,68,0.10);  border-left: 3px solid var(--red);    color: var(--text-2); }
.alerte-icon    { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.alerte-message { flex: 1; }

/* ─────────────────────────────────────────────────────────
   DEVOIRS THÉRAPEUTIQUES
───────────────────────────────────────────────────────── */
.devoirs-section {
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.devoirs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.devoirs-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.devoirs-badge {
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.devoirs-list { display: flex; flex-direction: column; gap: 8px; }
.devoirs-empty { font-size: 13px; color: var(--muted); padding: 4px 0; }

.devoir-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--t) var(--ease), opacity var(--t) var(--ease);
}
.devoir-item:hover { background: var(--surface-3); }
.devoir-done { opacity: 0.55; }
.devoir-done .devoir-titre { text-decoration: line-through; color: var(--muted); }

.devoir-check { display: flex; align-items: flex-start; padding-top: 2px; cursor: pointer; }
.devoir-check input[type=checkbox] { display: none; }
.devoir-check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t) var(--ease);
  flex-shrink: 0;
}
.devoir-check input:checked + .devoir-check-box {
  background: var(--purple);
  border-color: var(--purple);
}
.devoir-check input:checked + .devoir-check-box::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.devoir-body { flex: 1; min-width: 0; }
.devoir-titre { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; }
.devoir-desc  { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.devoir-meta  { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

.devoir-delete-btn {
  background: none;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
  flex-shrink: 0;
}
.devoir-delete-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ─────────────────────────────────────────────────────────
   FICHES PSYCHOÉDUCATIVES
───────────────────────────────────────────────────────── */
.psychoed-section {
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.psychoed-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}
.psychoed-accordion { display: flex; flex-direction: column; gap: 6px; }

.psychoed-accordion details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: background var(--t) var(--ease);
}
.psychoed-accordion details[open] { background: var(--surface-3); border-color: var(--border-2); }

.psychoed-accordion summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.psychoed-accordion summary::-webkit-details-marker { display: none; }
.psychoed-accordion summary::after {
  content: '▸';
  font-size: 11px;
  color: var(--muted);
  transition: transform var(--t) var(--ease), color var(--t) var(--ease);
  flex-shrink: 0;
}
.psychoed-accordion details[open] summary::after {
  transform: rotate(90deg);
  color: var(--purple-2);
}
.psychoed-accordion summary:hover { color: var(--purple-2); }

.psychoed-content {
  padding: 0 16px 14px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.psychoed-content ul { padding-left: 18px; }
.psychoed-content li { margin-bottom: 3px; }
.psychoed-content strong { color: var(--text); }
.psychoed-content em { color: var(--muted); font-style: italic; }

/* ══════════════════════════════════════════════════════════════════
   V5 — Scores cliniques évolution
   ══════════════════════════════════════════════════════════════════ */

.scores-evolution {
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.scores-evolution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.scores-evolution h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.eval-type-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.eval-type-tab {
  padding: 5px 14px;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.eval-type-tab:hover { color: var(--text); background: var(--surface-3); }
.eval-type-tab.active {
  color: var(--text);
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}
.scores-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
}

/* ══════════════════════════════════════════════════════════════════
   V5 — Heatmap calendrier d'humeur
   ══════════════════════════════════════════════════════════════════ */

.heatmap-card {
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.heatmap-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.heatmap-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.heatmap-nav-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: all var(--t) var(--ease);
}
.heatmap-nav-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }

.heatmap-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.heatmap-weekdays span {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.mood-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
  position: relative;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 2; }
.heatmap-cell-empty { background: transparent !important; cursor: default; }
.heatmap-cell-nodata { background: rgba(255,255,255,0.04); }
.heatmap-cell-today { outline: 2px solid var(--purple-2); outline-offset: 1px; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}
.heatmap-legend-label { font-size: 11px; color: var(--muted); }
.heatmap-legend-gradient {
  width: 80px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, rgb(124,58,237), rgb(34,197,94));
}

/* ══════════════════════════════════════════════════════════════════
   V5 — Rapport mensuel
   ══════════════════════════════════════════════════════════════════ */

.monthly-report-card {
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.report-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.report-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex: 1;
}
.report-period {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}
.report-content {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.report-content h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.report-content h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-2);
  margin: 14px 0 6px;
}
.report-content p { margin: 6px 0; }
.report-content ul, .report-content ol {
  padding-left: 20px;
  margin: 6px 0;
}
.report-content li { margin-bottom: 3px; }
.report-content strong { color: var(--text); }
.report-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
}
.report-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

/* ══════════════════════════════════════════════════════════════════
   V5 — Plan thérapeutique
   ══════════════════════════════════════════════════════════════════ */

.plan-section {
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.plan-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.plan-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}
.plan-titre-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-2);
  display: block;
  margin-bottom: 12px;
}
.plan-title-row { margin-bottom: 4px; }
.plan-empty-obj {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 12px 0;
}
.objectifs-list { display: flex; flex-direction: column; gap: 14px; }

.objectif-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color var(--t) var(--ease);
}
.objectif-item:hover { border-color: var(--border-2); }
.objectif-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.objectif-titre {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.objectif-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status-encours   { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.status-atteint   { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.status-abandonne { background: rgba(148,163,184,0.1); color: var(--muted); border: 1px solid var(--border); }

.objectif-mesure {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-style: italic;
}
.objectif-echeance {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.objectif-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.objectif-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.objectif-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--purple), var(--purple-2));
  transition: width .3s ease;
}
.objectif-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-2);
  min-width: 34px;
  text-align: right;
}
.objectif-range {
  width: 100%;
  accent-color: var(--purple);
  cursor: pointer;
  margin-bottom: 8px;
}
.objectif-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.objectif-status-select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

/* Modal générique (plan / objectif) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 460px;
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.btn-xs { padding: 4px 10px; font-size: 11px; }

/* ══════════════════════════════════════════════════════════════════
   Dashboard fixes v5.1
   ══════════════════════════════════════════════════════════════════ */

/* 6 stat cards sur 3 colonnes × 2 rangées */
.stats-grid-6 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .stats-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid-6 { grid-template-columns: 1fr 1fr; }
}

/* Nouvelles couleurs stat */
.stat-green { background: rgba(34,197,94,0.15);  color: #4ade80; }
.stat-rose  { background: rgba(244,63,94,0.15);  color: #fb7185; }

/* Mini-widgets devoirs + plan */
.dash-mini-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .dash-mini-row { grid-template-columns: 1fr; }
}

.dash-mini-card {
  border-radius: var(--radius);
  padding: 16px 18px;
}
.dash-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-mini-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.dash-mini-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-mini-empty {
  font-size: 12px;
  color: var(--muted);
}
.dash-mini-more {
  font-size: 11px;
  color: var(--muted);
  padding-top: 2px;
}

/* Devoir mini-item */
.dash-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-2);
  flex-shrink: 0;
}
.dash-mini-text {
  font-size: 12.5px;
  color: var(--text-2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-mini-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Plan mini-objectif */
.dash-mini-obj { display: flex; flex-direction: column; gap: 4px; }
.dash-mini-obj-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.dash-mini-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-2);
  flex-shrink: 0;
}
.dash-mini-bar-bg {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.dash-mini-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

/* ── Parcours timeline ───────────────────────────── */
.parcours-body { padding: 0 4px; }
.parcours-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.parcours-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.parcours-timeline { display: flex; flex-direction: column; }
.timeline-card {
  position: relative;
  padding: 0 0 24px 32px;
}
.timeline-card::before {
  content: '';
  position: absolute;
  left: 8px; top: 20px;
  width: 2px; bottom: 0;
  background: rgba(255,255,255,0.1);
}
.timeline-card:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 3px; top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent-violet);
  border: 2px solid var(--bg);
}
.timeline-session { padding: 16px; border-radius: 12px; }
.timeline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.timeline-date { font-weight: 600; color: var(--text-1); }
.timeline-duration { font-size: 13px; color: var(--muted); }
.timeline-mood {
  font-size: 12px;
  color: var(--accent-blue);
  font-weight: 600;
}
.badge-checkin {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(59,130,246,0.2);
  color: var(--accent-blue);
  font-weight: 600;
}
.timeline-resume {
  margin: 10px 0 8px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.timeline-devoirs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.timeline-devoir-chip {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: rgba(255,255,255,0.07);
  color: var(--text-2);
}
.timeline-devoir-chip.done {
  background: rgba(16,185,129,0.15);
  color: #10b981;
  text-decoration: line-through;
}
.parcours-sidebar { padding: 20px; }
.objectif-item { margin-bottom: 16px; }
.objectif-titre { font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-1); }
.objectif-bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.objectif-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-blue));
  transition: width 0.6s ease;
}
.moment-cle-item {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.moment-cle-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-violet);
  font-weight: 600;
  flex-shrink: 0;
  padding-top: 2px;
}
.moment-cle-text { color: var(--text-2); line-height: 1.4; }

/* ── Journal Sophie comment ───────────────────────── */
.journal-sophie-comment {
  padding: 16px 20px;
  margin-top: 16px;
  border-radius: 12px;
  border-left: 3px solid var(--accent-violet);
}
.sophie-comment-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-violet);
  margin-bottom: 8px;
  font-weight: 600;
}
.sophie-comment-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ── Session type selector ───────────────────────── */
.session-type-selector {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s, background 0.2s;
  font-size: 14px;
  color: var(--text-2);
}
.type-option:has(input:checked) {
  border-color: var(--accent-violet);
  background: rgba(124,58,237,0.15);
  color: var(--text-1);
}
.type-option input { display: none; }

/* ── Graphique humeur parcours ───────────────────── */
.parcours-mood-chart {
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 24px;
}
.parcours-mood-chart .chart-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
}
.parcours-mood-chart .chart-wrap { height: 180px; }

/* ── Exercice guidé ──────────────────────────────── */
.exercise-card {
  padding: 20px;
  border-radius: 16px;
  margin: 12px 0;
  border-left: 3px solid var(--accent-violet);
  max-width: 480px;
}
.exercise-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.exercise-icon { font-size: 28px; }
.exercise-titre {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-1);
}
.exercise-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.exercise-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.exercise-step-text {
  font-size: 15px;
  color: var(--text-1);
  text-align: center;
  line-height: 1.5;
  min-height: 44px;
}
.exercise-timer-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}
.exercise-ring { width: 80px; height: 80px; }
.exercise-ring circle {
  transition: stroke-dashoffset 0.9s linear;
}
.exercise-timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-violet);
}
.exercise-rep {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}
.exercise-stop {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  align-self: center;
}
.exercise-done {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: #10b981;
  font-size: 14px;
}
.exercise-done-icon {
  font-size: 22px;
  font-weight: 700;
}

/* ── Responsive parcours ─────────────────────────── */
@media (max-width: 768px) {
  .parcours-layout { grid-template-columns: 1fr; }
  .parcours-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════
   Analytics séances
   ══════════════════════════════════════════════════════════════════ */

/* Section header */
.analytics-section-header {
  margin: 8px 0 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.analytics-section-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}
.analytics-section-sub {
  font-size: 13px;
  color: var(--muted);
}

/* Bannière bien-être */
.wellbeing-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 4px 16px;
  padding: 20px 24px;
  border-radius: 14px;
  margin-bottom: 20px;
  border-left: 4px solid #10b981;
  position: relative;
  overflow: hidden;
}
.wb-left {
  display: flex;
  align-items: baseline;
  gap: 4px;
  grid-row: 1 / 3;
  align-self: center;
}
.wb-score {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
}
.wb-max {
  font-size: 22px;
  color: var(--muted);
  font-weight: 400;
}
.wb-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.wb-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}
.wb-trend {
  font-size: 13px;
  font-weight: 500;
}
.wb-up   { color: #10b981; }
.wb-down { color: #ef4444; }
.wb-flat { color: #f59e0b; }
.wb-sub  { font-size: 12px; color: var(--muted); }
.wb-gauge {
  grid-column: 1 / 3;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}
.wb-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

/* Grille analytics double colonne */
.analytics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.analytics-row .chart-card { margin-bottom: 0; }

/* Thèmes récurrents */
.themes-bars {
  padding: 8px 4px;
}
.theme-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.theme-word {
  font-size: 13px;
  color: var(--text-2);
  width: 100px;
  flex-shrink: 0;
  text-align: right;
}
.theme-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  overflow: hidden;
}
.theme-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-blue));
  transition: width 0.6s ease;
}
.theme-count {
  font-size: 12px;
  color: var(--muted);
  width: 28px;
  text-align: right;
}

/* Responsive analytics */
@media (max-width: 768px) {
  .analytics-row { grid-template-columns: 1fr; }
  .wb-score { font-size: 42px; }
}
