/* ============================================================
   ALEPHIA — Design system dark-first premium
   Deux thèmes sombres via [data-theme] sur <html> (pattern CRM) :
   - 'dark' (défaut)  : TOUT OR
   - 'nocturne'       : TOUT BLEU
   Aucune couleur d'accent en dur dans les composants :
   tout passe par var(--accent*) et color-mix.
   Style : Stripe / Linear / Vercel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* --- Thème OR par défaut (répliqué dans [data-theme='dark']) --- */
  --bg-primary:    #0A0A0C;
  --bg-secondary:  #100F13;
  --bg-card:       #16151B;
  --bg-card-hover: #1F1D26;
  --bg-elevated:   #1A1820;

  --text-primary:   #F4F3F6;
  --text-secondary: #A8A6B0;
  --text-muted:     #6E6C77;

  --accent:        #D4AF37;
  --accent-strong: #E3C566;
  --accent-soft:   rgba(212, 175, 55, 0.14);
  --accent-glow:   rgba(212, 175, 55, 0.34);
  --accent-grad:   linear-gradient(90deg, #F0DFA0 0%, #B68A2C 25%, #D4AF37 50%, #F0DFA0 75%, #B68A2C 100%);
  /* Texte posé sur un fond accent (nav active, bouton accent) */
  --on-accent:     #0A0A0C;

  /* --- Bordures --- */
  --border:        rgba(212, 175, 55, 0.10);
  --border-strong: rgba(212, 175, 55, 0.22);

  /* --- Sémantiques --- */
  --success: #10B981; --success-soft: rgba(16, 185, 129, 0.12);
  --warn:    #F59E0B; --warn-soft:    rgba(245, 158, 11, 0.14);
  --error:   #EF4444; --error-soft:   rgba(239, 68, 68, 0.12);

  /* --- Ombres --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);

  /* --- Transitions --- */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 380ms cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Rayons / layout --- */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --container-max: 1240px;

  /* --- Typo --- */
  --font-primary: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  /* --- Alias legacy (utilisés par le JS inline et styles inline des templates) --- */
  --bg: var(--bg-primary);
  --bg-sub: var(--bg-card);
  --bg-elev: var(--bg-card-hover);
  --bg-elev-2: var(--bg-elevated);
  --fg: var(--text-primary);
  --fg-muted: var(--text-secondary);
  --fg-dim: var(--text-muted);
  --accent-hover: var(--accent-strong);
  --green: var(--success);
  --red:   var(--error);
  --amber: var(--warn);
  --blue:  var(--accent);
  --shadow: var(--shadow-md);
}

/* ===== Thème OR (défaut) ===== */
[data-theme='dark'] {
  --bg-primary:    #0A0A0C;
  --bg-secondary:  #100F13;
  --bg-card:       #16151B;
  --bg-card-hover: #1F1D26;
  --bg-elevated:   #1A1820;

  --text-primary:   #F4F3F6;
  --text-secondary: #A8A6B0;
  --text-muted:     #6E6C77;

  --accent:        #D4AF37;
  --accent-strong: #E3C566;
  --accent-soft:   rgba(212, 175, 55, 0.14);
  --accent-glow:   rgba(212, 175, 55, 0.34);
  --accent-grad:   linear-gradient(90deg, #F0DFA0 0%, #B68A2C 25%, #D4AF37 50%, #F0DFA0 75%, #B68A2C 100%);
  --on-accent:     #0A0A0C;

  --border:        rgba(212, 175, 55, 0.10);
  --border-strong: rgba(212, 175, 55, 0.22);
}

/* ===== Thème BLEU nocturne ===== */
[data-theme='nocturne'] {
  --bg-primary:    #070A14;
  --bg-secondary:  #0C1220;
  --bg-card:       #101A2E;
  --bg-card-hover: #18233C;
  --bg-elevated:   #14203A;

  --text-primary:   #EAF0FA;
  --text-secondary: #9FACC4;
  --text-muted:     #6A7488;

  --accent:        #3B82F6;
  --accent-strong: #60A5FA;
  --accent-soft:   rgba(59, 130, 246, 0.14);
  --accent-glow:   rgba(59, 130, 246, 0.34);
  --accent-grad:   linear-gradient(90deg, #38BDF8 0%, #2563EB 25%, #3B82F6 50%, #38BDF8 75%, #2563EB 100%);
  --on-accent:     #FFFFFF;

  --border:        rgba(59, 130, 246, 0.12);
  --border-strong: rgba(59, 130, 246, 0.26);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100%;
}

::selection { background: var(--accent-soft); color: var(--text-primary); }

/* ============================================================
   FOND À VAGUES — canvas fixe derrière tout le contenu
   ============================================================ */
#glowy-waves {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   UTILITAIRES (subset mini-Tailwind conservé pour les templates)
   ============================================================ */
.h-full { height: 100%; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-2\.5 { gap: 10px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.w-60 { width: 240px; }
.w-full { width: 100%; }
.overflow-y-auto { overflow-y: auto; }
.sticky { position: sticky; } .top-0 { top: 0; } .z-10 { z-index: 10; }
.backdrop-blur { backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.border { border: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-border { border-color: var(--border); }
.bg-bg { background: var(--bg-primary); }
.bg-bg-sub { background: var(--bg-card); }
.bg-bg-sub\/40 { background: color-mix(in srgb, var(--bg-primary) 85%, transparent); }
.bg-bg-elev { background: var(--bg-card-hover); }
.text-fg { color: var(--text-primary); }
.text-fg-muted { color: var(--text-secondary); }
.text-fg-dim { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-\[11px\] { font-size: 11px; }
.text-\[12px\] { font-size: 12px; }
.text-\[13px\] { font-size: 13px; }
.text-\[14px\] { font-size: 14px; }
.text-\[15px\] { font-size: 15px; }
.text-\[22px\] { font-size: 22px; }
.font-semibold { font-weight: 500; }
.font-medium { font-weight: 500; }
.tracking-tight { letter-spacing: -0.01em; }
.tracking-wider { letter-spacing: 0.16em; }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.antialiased { -webkit-font-smoothing: antialiased; }
.space-y-0\.5 > * + * { margin-top: 2px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.space-y-8 > * + * { margin-top: 32px; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-10 { padding-left: 40px; padding-right: 40px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-5 { padding-top: 20px; padding-bottom: 20px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.pt-4 { padding-top: 16px; }
.pt-8 { padding-top: 32px; }
.pb-6 { padding-bottom: 24px; }
.pb-3 { padding-bottom: 12px; }
.pt-2 { padding-top: 8px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.relative { position: relative; }
.absolute { position: absolute; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all var(--t-fast); }

/* ============================================================
   TOPBAR — sticky, backdrop blur, brand + nav pills
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0.85rem 2rem;
  background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.brand .logo {
  width: 38px;
  height: 38px;
  color: var(--text-primary);
  flex-shrink: 0;
}
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-name {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.18em;
}
.brand .brand-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* --- Navigation pills --- */
.nav {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.nav a:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.nav a.is-active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.nav a .ico { width: 14px; height: 14px; }

.ico {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* --- Nav verticale (liste de fichiers des prompts) --- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 0 0 2px 0;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.nav-item.is-active {
  background: var(--accent);
  color: var(--on-accent);
}
.nav-item.is-active .ico { color: var(--on-accent); }

/* ============================================================
   CONTENEUR + TITRE DE PAGE (centré, ligne dégradé animée)
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  flex: 1;
}

.page-head { margin-bottom: 2.2rem; }

.page-title {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 auto 0.4rem;
  text-align: center;
  position: relative;
  padding-bottom: 1.05rem;
  width: max-content;
  max-width: 100%;
}
.page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-grad);
  background-size: 300% 100%;
  animation: gradient-shift 4s ease-in-out infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.page-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 300;
  text-align: center;
  margin: 0 auto;
  max-width: 640px;
}
.page-sub a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
.page-sub a:hover { color: var(--accent-strong); }

/* Label de section (majuscules espacées) */
.text-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================================
   STATUS PILL (pulse-dot vert animé pour "en cours")
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.status-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-pill.is-on {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background: var(--success-soft);
}
.status-pill.is-on::before {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
  animation: pulse-ring 2s infinite;
}
.status-pill.is-off { color: var(--text-muted); }
.status-pill.is-warn { color: var(--warn); border-color: rgba(245, 158, 11, 0.3); background: var(--warn-soft); }
.status-pill.is-warn::before { background: var(--warn); }
.status-pill.is-error { color: var(--error); border-color: rgba(239, 68, 68, 0.3); background: var(--error-soft); }
.status-pill.is-error::before { background: var(--error); }

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pulse-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-ring 2s infinite;
}
.pulse-dot.off { background: var(--text-muted); animation: none; }

/* ============================================================
   CARTES — halo doré signature (::before radial en haut à droite)
   ============================================================ */
.card, .card-glow, .kpi, .fieldset {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card, .card-glow { padding: 1.5rem; }
.card::before, .card-glow::before, .kpi::before, .fieldset::before {
  content: '';
  position: absolute;
  top: -45%;
  right: -25%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  opacity: 0.45;
  transition: opacity var(--t-slow), transform var(--t-slow);
  pointer-events: none;
  z-index: 0;
}
.card > *, .card-glow > *, .kpi > *, .fieldset > * { position: relative; z-index: 1; }
.card:hover, .card-glow:hover, .kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card:hover::before, .card-glow:hover::before, .kpi:hover::before {
  opacity: 0.85;
  transform: scale(1.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.card-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.card-subtitle {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: none;
  letter-spacing: normal;
}

/* ============================================================
   KPI / METRIC CARDS
   ============================================================ */
.kpi {
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
}
.kpi::before { width: 260px; height: 260px; top: -60%; right: -15%; opacity: 0.35; }
.kpi:hover::before { opacity: 0.75; }
.kpi-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}
.kpi-value {
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  font-weight: 200;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text-primary);
}
.kpi-value.text-accent { color: var(--accent); }
.kpi-delta {
  font-size: 11px;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 7px;
}

/* ============================================================
   BOUTONS — pills, primary monochrome contraste
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: opacity var(--t-fast), transform var(--t-fast),
              box-shadow var(--t-base), background var(--t-fast),
              border-color var(--t-fast), color var(--t-fast);
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-primary);
  transform: translateY(-1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--error);
}
.btn-danger:hover {
  background: var(--error-soft);
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-ghost.is-active, .btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.7rem; font-size: 0.9rem; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.form-hint {
  font-size: 11px;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 5px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-card);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.select option, .select optgroup { background: var(--bg-secondary); color: var(--text-primary); }
.textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  min-height: 200px;
}
.input-code { font-family: var(--font-mono); font-size: 12px; }

input[type="checkbox"] { accent-color: var(--accent); }
input[type="number"].input { font-family: var(--font-mono); }

.fieldset {
  padding: 1.5rem 1.6rem;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.fieldset:hover { transform: none; }
.fieldset-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.fieldset-desc {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ============================================================
   TABLES — lisibilité maximale, pas de halo par ligne
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 300;
  transition: background var(--t-fast);
}
.table tr:hover td { background: var(--bg-card-hover); }
.table tr:last-child td { border-bottom: none; }

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  background: var(--bg-secondary);
}

/* ============================================================
   BADGES — pills statuts (couleurs sémantiques préservées)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}
.badge-pending { color: var(--text-secondary); }
.badge-calling { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.badge-qualified { color: var(--success); border-color: rgba(16, 185, 129, 0.3); background: var(--success-soft); }
.badge-interested { color: var(--warn); border-color: rgba(245, 158, 11, 0.3); background: var(--warn-soft); }
.badge-not_interested { color: var(--text-muted); }
.badge-do_not_call { color: var(--error); border-color: rgba(239, 68, 68, 0.3); background: var(--error-soft); }
.badge-failed { color: var(--error); border-color: rgba(239, 68, 68, 0.3); }
.badge-done { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.badge-accent, .badge.accent { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.badge-scheduled { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.badge-missed { color: var(--warn); border-color: rgba(245, 158, 11, 0.3); background: var(--warn-soft); }
.badge-cancelled { color: var(--text-muted); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 300;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  animation: fadeInUp 0.4s ease-out;
}
.flash-success { border-color: rgba(16, 185, 129, 0.3); background: var(--success-soft); color: var(--success); }
.flash-error { border-color: rgba(239, 68, 68, 0.3); background: var(--error-soft); color: var(--error); }
.flash-info { border-color: var(--border-strong); background: var(--accent-soft); color: var(--accent); }

/* ============================================================
   DAY PILLS (jours d'appel — dashboard Contrôle)
   ============================================================ */
.day-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.day-pill:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.day-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--accent);
}

/* ============================================================
   TRANSCRIPT (chat)
   ============================================================ */
.transcript {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  background: var(--bg-secondary);
}
.msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.55;
}
.msg-agent { background: var(--accent-soft); color: var(--text-primary); }
.msg-lead { background: var(--bg-card-hover); color: var(--text-primary); }
.msg-speaker {
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.msg-agent .msg-speaker { color: var(--accent); }

/* ============================================================
   DROPZONE
   ============================================================ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.dropzone-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

/* ============================================================
   LOG VIEWER
   ============================================================ */
.log-output {
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 16px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 70vh;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  margin: 0;
}

/* ============================================================
   AUDIO PLAYER
   ============================================================ */
audio { width: 100%; border-radius: var(--radius-full); }
audio::-webkit-media-controls-panel { background-color: var(--bg-card-hover); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease-out forwards; opacity: 0; }
.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 60ms; }
.animate-in:nth-child(3) { animation-delay: 120ms; }
.animate-in:nth-child(4) { animation-delay: 180ms; }
.animate-in:nth-child(5) { animation-delay: 240ms; }
.animate-in:nth-child(6) { animation-delay: 300ms; }
.animate-in:nth-child(7) { animation-delay: 360ms; }
.animate-in:nth-child(8) { animation-delay: 420ms; }

@media (prefers-reduced-motion: reduce) {
  .animate-in { animation: none; opacity: 1; }
  .page-title::after { animation: none; }
  .status-pill.is-on::before, .pulse-dot { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 999px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; padding: 0.75rem 1rem; }
  .topbar .nav { order: 3; width: 100%; }
  .container { padding: 1.6rem 1rem 3rem; }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .px-10 { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   TOPBAR ACTIONS + BOUTON THÈME (pattern CRM .icon-btn)
   ============================================================ */
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-full);
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  transition: filter var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { filter: brightness(1.25); background: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; }

/* ============================================================
   BANDEAU DE FILTRE (liste des appels)
   ============================================================ */
.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--text-secondary);
}
.filter-banner strong { color: var(--accent); font-weight: 500; }

/* ============================================================
   BADGE CATÉGORIE D'APPEL — pastille colorée + texte neutre
   (couleurs dataviz validées, fournies via --cat-color inline)
   ============================================================ */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-secondary);
  border: 1px solid color-mix(in srgb, var(--cat-color) 45%, transparent);
  background: color-mix(in srgb, var(--cat-color) 12%, transparent);
}
.cat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat-color); flex-shrink: 0; }

/* ============================================================
   GRAPHIQUE ACTIVITÉ — barres empilées quotidiennes (serveur)
   ============================================================ */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 16px; }
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
}
.chart-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
/* Légende cliquable : chaque pastille filtre la liste des appels (14 jours) */
.chart-legend-link {
  text-decoration: none;
  padding: 3px 8px;
  margin: -3px -8px;
  border-radius: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.chart-legend-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.chart-legend-count { color: var(--text-primary); font-weight: 600; }
.chart-legend-pct { color: var(--text-muted); font-weight: 400; }

.chart { display: flex; gap: 10px; }
.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  width: 26px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.chart-body { flex: 1; min-width: 0; }
.chart-plot { position: relative; border-bottom: 1px solid var(--border-strong); }
.chart-grid i {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}
.chart-grid i:nth-child(1) { top: 25%; }
.chart-grid i:nth-child(2) { top: 50%; }
.chart-grid i:nth-child(3) { top: 75%; }
.chart-bars { position: relative; display: flex; height: 100%; }
.chart-day {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 100%;
}
.chart-bar {
  width: 60%;
  max-width: 36px; /* barres fines */
  display: flex;
  flex-direction: column-reverse; /* 1er segment (vert) en bas */
  justify-content: flex-start;
  gap: 2px; /* écart : laisse voir le fond de carte entre les segments */
}
.chart-seg {
  display: block;
  width: 100%;
  position: relative;
  text-decoration: none;
  transition: filter var(--t-fast);
}
.chart-seg:last-child { border-radius: 4px 4px 0 0; } /* sommet arrondi */
.chart-seg:hover { filter: brightness(1.2); z-index: 40; } /* passe devant les barres voisines pour le tooltip */
/* Tooltip CSS custom (en plus du title natif) */
.chart-seg::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  /* --tip-shift : décalage posé en JS pour que le tooltip ne soit jamais
     coupé par le bord de la carte (overflow:hidden du halo doré). */
  transform: translateX(calc(-50% + var(--tip-shift, 0px)));
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
  box-shadow: var(--shadow-md);
  z-index: 41;
}
.chart-seg:hover::after { opacity: 1; }
.chart-labels { display: flex; margin-top: 6px; }
.chart-day-label { flex: 1; text-align: center; font-size: 0.6rem; }

/* ============================================================
   AGENDA — vue semaine type Outlook (pattern CRM .wk*)
   ============================================================ */
.agenda-head { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.agenda-nav { display: flex; align-items: center; gap: 0.5rem; }
.agenda-range { font-size: 0.9rem; color: var(--text-secondary); min-width: 210px; text-align: center; }

.wk { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-card); }
.wk-days { display: grid; grid-template-columns: 52px repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.wk-day-head { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0.5rem 0; border-left: 1px solid var(--border); }
.wk-day-name { font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.wk-day-num { font-size: 1rem; color: var(--text-primary); }
.wk-day-head.is-today .wk-day-num {
  color: var(--on-accent);
  background: var(--accent);
  font-weight: 600;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.wk-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); max-height: 66vh; overflow-y: auto; position: relative; }
.wk-gutter { position: relative; }
.wk-hour {
  font-size: 0.64rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 0.4rem;
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}
.wk-col { position: relative; border-left: 1px solid var(--border); }
.wk-col.is-today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.wk-slot { border-top: 1px solid var(--border); box-sizing: border-box; }
/* Ligne de la demi-heure : pointillée, plus discrète que la ligne pleine */
.wk-slot.is-half { border-top-style: dashed; border-top-color: color-mix(in srgb, var(--border) 50%, transparent); }
.wk-event {
  position: absolute;
  left: 3px;
  right: 3px;
  width: auto;
  margin: 0;
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
  font-family: inherit;
  transition: background var(--t-fast);
}
.wk-event:hover { background: color-mix(in srgb, var(--accent) 30%, var(--bg-card)); }
.wk-event.is-dimmed { opacity: 0.45; } /* rappels done / missed */
.wk-event-h { font-size: 0.62rem; color: var(--accent); font-weight: 600; }
.wk-event-t { font-size: 0.72rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wk-event-v { font-size: 0.62rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ============================================================
   PANNEAU LATÉRAL (détail rappel + transcript)
   ============================================================ */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 90; }
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 92vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s ease-out;
}
.side-panel[hidden], .panel-backdrop[hidden] { display: none; }
.side-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.side-panel-body { padding: 18px; overflow-y: auto; flex: 1; }
@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .side-panel { animation: none; }
}

/* --- Horaires d'appel : menus deroulants --- */
.calling-selects {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.calling-select-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: opacity var(--t-base);
}
.select-hour { width: 100%; }
@media (max-width: 768px) {
  .calling-selects { grid-template-columns: repeat(2, 1fr); }
}

