/* ========================================================================
   Styles spécifiques admin (dashboard, leads-list, forms, etc.)
   À compléter au fil des pages.
   ======================================================================== */

/* --- Login page --- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  background: var(--bg-app);
  position: relative;
}
.login-shell.has-backdrop {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--indigo-700) 100%);
}
.login-backdrop {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.4;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 24px 60px rgba(15, 23, 42, 0.12);
  padding: var(--space-8) var(--space-6);
}
/* Matières DiWallet sur le formulaire de connexion */
.login-card .input { border-radius: 14px; padding: 11px 14px; }
.login-card .btn { border-radius: var(--radius-full); }
.login-card h1 {
  font-size: var(--text-2xl);
  text-align: center;
  margin-bottom: var(--space-1);
}
.login-card p {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}
.login-brand {
  display: flex; justify-content: center;
  margin-bottom: var(--space-4);
}
.login-brand-logo { max-height: 48px; max-width: 200px; object-fit: contain; }
.login-brand-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-lg);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
/* Fond login uploadé : overlay léger pour garder la lisibilité de la card */
body.has-login-bg .login-shell {
  background: transparent;
}
body.has-login-bg .login-shell::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, rgba(15, 23, 42, 0.55) 100%);
  pointer-events: none;
}
body.has-login-bg .login-card {
  backdrop-filter: blur(8px);
  background: color-mix(in oklch, var(--bg-card) 92%, transparent);
}

/* --- Couleur du bouton login (réglage "loginButtonColor") --- */
.login-card .btn-primary {
  background: var(--login-btn, var(--primary));
  border-color: var(--login-btn, var(--primary));
}
.login-card .btn-primary:hover {
  background: color-mix(in oklch, var(--login-btn, var(--primary)) 85%, black);
  border-color: color-mix(in oklch, var(--login-btn, var(--primary)) 85%, black);
}

/* --- Mises en page login (réglage "loginLayout" → body[data-login-layout]) ---
   classic : card centrée (défaut ci-dessus). */

/* SPLIT : image sur la moitié gauche, card sur fond neutre à droite.
   L'image vit sur le ::before en background-size: cover → ratio préservé,
   recadrage centré propre (jamais étirée/écrasée). */
body[data-login-layout="split"].has-login-bg {
  background-image: none !important;
  background-color: var(--bg-app);
}
body[data-login-layout="split"]:not(.has-login-bg) .login-shell {
  background:
    linear-gradient(160deg, var(--primary) 0%, color-mix(in oklch, var(--primary) 55%, black) 100%) left top / 50vw 100vh no-repeat,
    var(--bg-app);
}
/* La card est CENTRÉE dans la moitié droite : le padding-left réserve le
   panneau image (50vw), le justify-content: center du shell centre la card
   dans l'espace restant. (Avant : margin-left = collée au bord du panneau.) */
body[data-login-layout="split"] .login-shell {
  justify-content: center;
  padding-left: calc(50vw + var(--space-4));
}
body[data-login-layout="split"] .login-card {
  backdrop-filter: none;
  background: var(--bg-card);
}
body[data-login-layout="split"].has-login-bg .login-shell::before {
  /* panneau image : cover (ratio préservé) + léger voile pour la lisibilité */
  inset: 0 auto 0 0; width: 50vw;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.35) 100%),
    var(--login-bg) center / cover no-repeat;
}
@media (max-width: 860px) {
  body[data-login-layout="split"] .login-shell { padding-left: var(--space-4); }
  body[data-login-layout="split"].has-login-bg .login-shell::before {
    inset: 0; width: auto;
    background:
      linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, rgba(15, 23, 42, 0.55) 100%),
      var(--login-bg) center / cover no-repeat;
  }
}

/* IMMERSIVE : backdrop plein écran, card en verre dépoli */
body[data-login-layout="immersive"]:not(.has-login-bg) .login-shell {
  background: linear-gradient(135deg, var(--slate-900) 0%, color-mix(in oklch, var(--primary) 60%, black) 100%);
}
body[data-login-layout="immersive"] .login-card {
  backdrop-filter: blur(16px) saturate(1.2);
  background: color-mix(in oklch, var(--bg-card) 70%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
}

/* CINEMATIC : image pleine + overlay dégradé sombre, card ancrée à gauche en thème dark */
body[data-login-layout="cinematic"] .login-shell { justify-content: flex-start; padding-left: max(8vw, 32px); }
body[data-login-layout="cinematic"]:not(.has-login-bg) .login-shell {
  background: linear-gradient(120deg, var(--slate-900), var(--slate-950, #020617));
}
body[data-login-layout="cinematic"].has-login-bg .login-shell::before {
  background: linear-gradient(80deg, rgba(2, 6, 23, 0.88) 0%, rgba(2, 6, 23, 0.55) 45%, rgba(2, 6, 23, 0.12) 100%);
}
body[data-login-layout="cinematic"] .login-card {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.6);
}
body[data-login-layout="cinematic"] .login-card h1,
body[data-login-layout="cinematic"] .login-card .login-brand-name { color: #fff; }
body[data-login-layout="cinematic"] .login-card p { color: rgba(255, 255, 255, 0.65); }
body[data-login-layout="cinematic"] .login-card .label { color: rgba(255, 255, 255, 0.8); }
body[data-login-layout="cinematic"] .login-card .input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
body[data-login-layout="cinematic"] .login-card .input:focus {
  border-color: color-mix(in oklch, var(--login-btn, var(--primary)) 70%, white);
}
@media (max-width: 640px) {
  body[data-login-layout="cinematic"] .login-shell { justify-content: center; padding-left: var(--space-4); }
}

/* --- Login MOBILE (09/10) : carte ancrée EN BAS, la photo 9:16 occupe le haut.
   Valable pour les 4 styles (classic / split / immersive / cinematic). Avant,
   la carte était centrée verticalement comme sur desktop. --- */
@media (max-width: 768px) {
  .login-shell,
  body[data-login-layout="split"] .login-shell,
  body[data-login-layout="cinematic"] .login-shell {
    min-height: 100dvh;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }
  .login-card {
    max-width: none;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: var(--space-6) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }
  /* Sans image de fond : on garde une carte centrée (rien à montrer au-dessus) */
  body:not(.has-login-bg) .login-shell { align-items: center; padding: var(--space-8) var(--space-4); }
  body:not(.has-login-bg) .login-card { max-width: 400px; border-radius: 24px; padding: var(--space-8) var(--space-6); }
  /* Voile du bas plus marqué pour la lisibilité de la jonction image / carte */
  body.has-login-bg .login-shell::before {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.45) 100%) !important;
  }
  body[data-login-layout="split"].has-login-bg .login-shell::before {
    background:
      linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.45) 100%),
      var(--login-bg) center / cover no-repeat !important;
  }
  /* Image MOBILE 9:16 (data-login-bg="mobile") : pleine largeur, calée en haut,
     fond sombre sous l'image si l'écran est plus haut que l'image. */
  body[data-login-bg="mobile"][data-login-layout="split"].has-login-bg .login-shell::before {
    background:
      linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.45) 100%),
      var(--login-bg) top center / 100% auto no-repeat,
      #0f172a !important;
  }
}

/* --- Facture --- */
.invoice-page { background: var(--bg-app); min-height: 100vh; padding: 32px 16px; }
.invoice-sheet {
  max-width: 720px; margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
}
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 32px; }
.invoice-parties {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  padding: 16px 0 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 14px;
}
.invoice-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 4px;
}
.invoice-table-wrap { overflow-x: auto; }   /* filet : gros montants = scroll interne, jamais de crop */
.invoice-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.invoice-table .right { white-space: nowrap; } /* un montant ne se coupe jamais en deux lignes */
.invoice-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); padding: 10px 8px; border-bottom: 2px solid var(--border);
}
.invoice-table td { padding: 12px 8px; border-bottom: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; }
.invoice-table .right { text-align: right; }
.invoice-table tfoot td { border-bottom: 0; padding-top: 16px; }
.invoice-footnote { font-size: 12px; color: var(--text-muted); margin-top: 24px; }
.invoice-actions { margin-top: 24px; text-align: center; }
/* Mobile : padding réduit, blocs empilés, tableau compact — plus de débordement */
@media (max-width: 640px) {
  .invoice-sheet { padding: 20px 14px; border-radius: 12px; }
  .invoice-head { flex-wrap: wrap; }
  .invoice-parties { grid-template-columns: 1fr; gap: 12px; }
  .invoice-table { font-size: 12.5px; }
  .invoice-table th { padding: 8px 5px; }
  .invoice-table td { padding: 10px 5px; }
}
@media print {
  .invoice-page { background: #fff; padding: 0; }
  .invoice-sheet { border: 0; box-shadow: none; max-width: none; padding: 0; }
  .no-print { display: none !important; }
}

/* --- Install wizard --- */
.install-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-4);
}
.install-card {
  width: 100%; max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8) var(--space-6);
}
.install-card h1 { text-align: center; font-size: var(--text-3xl); margin-bottom: var(--space-2); }
.install-card > p { text-align: center; color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-6); }

/* --- Leads list --- */
/* Bandeau "À rappeler aujourd'hui" — file de phoning du jour */
.leads-due-banner {
  background: color-mix(in oklch, #d97706 6%, var(--bg-card));
  border: 1px solid color-mix(in oklch, #d97706 25%, var(--border));
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.leads-due-head {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: #b45309;
  margin-bottom: var(--space-2);
}
.leads-due-head svg { width: 16px; height: 16px; }
.leads-due-count {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-full);
  background: #d97706; color: #fff;
  font-size: 11px; font-weight: var(--weight-semibold);
  display: inline-flex; align-items: center; justify-content: center;
}
.leads-due-list { display: flex; flex-direction: column; }
.leads-due-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 5px 0;
  border-top: 1px solid color-mix(in oklch, #d97706 12%, transparent);
  font-size: var(--text-sm);
}
.leads-due-time {
  font-variant-numeric: tabular-nums; font-weight: var(--weight-medium);
  color: var(--text-secondary); flex-shrink: 0; width: 68px;
}
.leads-due-time.is-overdue { color: var(--red-600, #dc2626); font-weight: var(--weight-semibold); }
.leads-due-name {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.leads-due-name:hover { text-decoration: underline; }
.leads-due-call {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-full);
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); flex-shrink: 0;
}
.leads-due-call:hover { color: var(--primary); border-color: var(--primary); }
.leads-due-call svg { width: 12px; height: 12px; }
.leads-due-note {
  font-size: var(--text-xs); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 320px;
}
.leads-due-assignee {
  margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0;
}
.leads-due-done { flex-shrink: 0; margin-left: auto; }
.leads-due-row:has(.leads-due-assignee) .leads-due-done { margin-left: 0; }

/* Numéro cliquable (click-to-call SIP) dans la table leads */
.lead-row-call {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 13px; color: var(--text-muted);
  transition: color var(--transition-fast);
}
.lead-row-call:hover { color: var(--primary); text-decoration: underline; }
.lead-row-call svg { width: 12px; height: 12px; }

/* Bulle 💬 commentaires de la ligne lead — grisée à 0, teintée dès 1 */
.lead-row-comments {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 4px 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-muted); opacity: 0.55;
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), opacity var(--transition-fast), background var(--transition-fast);
}
.lead-row-comments svg { width: 15px; height: 15px; }
.lead-row-comments.has-comments { color: var(--primary); opacity: 1; }
.lead-row-comments:hover { opacity: 1; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }

.leads-toolbar {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.leads-toolbar .search {
  flex: 0 1 260px; min-width: 180px;
}
.leads-filters {
  display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
}
/* Filtre par date d'ajout (deux bornes, l'une ou l'autre optionnelle) */
.leads-date-filter {
  display: flex; align-items: center; gap: 4px;
  color: var(--text-muted); font-size: 12px;
}
.leads-date-filter svg { width: 14px; height: 14px; flex-shrink: 0; }
.leads-date-filter .input { max-width: 140px; padding: 6px 8px; font-size: 13px; }
/* Performance : rafraîchissement silencieux au changement de filtre — le
   contenu reste en place, juste estompé, pendant le chargement */
.perf-refreshing { opacity: 0.55; pointer-events: none; transition: opacity 0.15s ease; }

/* Compteur de résultats au-dessus de la liste — teinté primary quand des
   filtres sont actifs pour signaler qu'on regarde un sous-ensemble */
.leads-result-count {
  display: inline-flex; align-items: center; gap: 6px;
  margin: -8px 2px 12px;
  font-size: 13px; color: var(--text-muted);
}
.leads-result-count svg { width: 14px; height: 14px; }
.leads-result-count strong { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.leads-result-count.is-filtered {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  margin-left: 0;
}
.leads-result-count.is-filtered strong { color: var(--primary); }

.leads-avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--slate-100);        /* fallback si aucun style inline (avatarHtml applique bg coloré + fg blanc) */
  color: var(--slate-700);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);  /* léger relief sur les fonds colorés */
}

/* --- Dashboard --- */
.leaderboard-row td {
  padding: var(--space-3) var(--space-4);
}
.leaderboard-medal {
  font-size: var(--text-lg);
  width: 32px; text-align: center;
}

/* --- Leads : onglets Attribution / Customers --- */
.leads-page-tabs { margin-bottom: var(--space-4); }
.leads-tab-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.lead-tab.is-active .leads-tab-count {
  background: color-mix(in oklch, var(--primary) 12%, var(--bg-card));
  color: var(--primary);
}

/* --- Leads : selects inline dans les lignes (statut / campagne / vendeur) --- */
.lead-row-select {
  font-size: 12px;
  padding: 4px 26px 4px 8px;
  max-width: 150px;
  min-width: 0;
  background-position: right 6px center;
}

/* --- Leads : barre de sélection pour attribution --- */
.leads-selectbar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  background: color-mix(in oklch, var(--primary) 6%, var(--bg-card));
  border: 1px solid color-mix(in oklch, var(--primary) 25%, var(--border));
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.leads-select-cell { cursor: default; }
.leads-select-cell input[type="checkbox"] { cursor: pointer; width: 15px; height: 15px; }

/* --- Offres de rachat : chips % rapides --- */
.offer-pct-chip {
  flex-direction: column;
  gap: 0;
  padding: 6px 12px;
  line-height: 1.25;
}
.offer-pct-chip .offer-pct-amount {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.offer-pct-chip.is-active {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 10%, var(--bg-card));
  color: var(--primary);
}
.offer-pct-chip.is-active .offer-pct-amount { color: var(--primary); }
.offer-pct-chip.is-negative { color: #b45309; }
.offer-pct-chip.is-negative.is-active {
  border-color: #d97706;
  background: color-mix(in oklch, #d97706 10%, var(--bg-card));
  color: #b45309;
}

/* --- Modal attribution leads --- */
.assign-seller-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.assign-count-input { width: 84px; text-align: center; font-variant-numeric: tabular-nums; }
.assign-summary {
  margin-top: var(--space-3);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.assign-summary.is-ok { color: #059669; }
.assign-summary.is-over { color: #dc2626; }

/* --- Performance : badge "au téléphone" temps réel --- */
.live-call-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, #22c55e 10%, var(--bg-card));
  border: 1px solid color-mix(in oklch, #22c55e 35%, var(--border));
  color: #15803d;
  font-size: 11px; font-weight: 500;
}
.live-call-badge.is-ringing {
  background: color-mix(in oklch, #f59e0b 10%, var(--bg-card));
  border-color: color-mix(in oklch, #f59e0b 40%, var(--border));
  color: #b45309;
}
.live-call-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; flex-shrink: 0;
  animation: live-call-pulse 1.4s ease-in-out infinite;
}
.live-call-badge.is-ringing .live-call-dot { background: #f59e0b; }
.live-call-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding-left: 5px;
  border-left: 1px solid color-mix(in oklch, #22c55e 35%, var(--border));
}
/* 22/10 : le badge se pose PAR-DESSUS la ligne de l'e-mail (place fixe, hors
   du calcul de largeur) — avant, il élargissait la colonne Vendeur et tout le
   tableau glissait de ~200 px à chaque début / fin d'appel. */
.perf-seller-sub {
  position: relative;
  min-height: 20px;
  font-size: 12px; color: var(--text-muted);
}
.perf-seller-sub .live-call-badge {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  max-width: 100%; overflow: hidden; white-space: nowrap;
}
.perf-seller-sub .live-call-badge > span:not(.live-call-dot):not(.live-call-timer) {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.perf-seller-sub .live-call-timer { flex-shrink: 0; }
@keyframes live-call-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* --- Agenda : chips vendeurs (filtre planning) --- */
.agenda-sellers {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.agenda-seller-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.agenda-seller-chip:hover { opacity: 0.8; }
.agenda-seller-chip.is-active {
  opacity: 1;
  color: var(--text-primary);
  border-color: color-mix(in oklch, var(--chip, var(--primary)) 45%, var(--border));
  background: color-mix(in oklch, var(--chip, var(--primary)) 7%, var(--bg-card));
}
.agenda-seller-chip svg { width: 13px; height: 13px; color: var(--chip, var(--primary)); }

/* --- Dashboard : filtres de période + graphe encaissé --- */
.dash-filters {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.dash-custom {
  display: flex; align-items: center; gap: var(--space-2);
  margin-left: auto;
  font-size: var(--text-xs); color: var(--text-muted);
}
.dash-date-input {
  width: auto;
  padding: 4px var(--space-2);
  font-size: var(--text-xs);
}

.dash-chart-wrap { position: relative; }
.dash-chart { display: block; width: 100%; height: auto; }
.dash-chart .chart-grid { stroke: var(--border-subtle); stroke-width: 1; }
.dash-chart .chart-baseline { stroke: var(--border); stroke-width: 1; }
.dash-chart .chart-tick,
.dash-chart .chart-month {
  fill: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.dash-chart .chart-bar { fill: var(--primary); transition: filter var(--transition-fast); }
.dash-chart .chart-bar.is-dimmed { fill: var(--slate-400); }
.dash-chart .chart-col:hover .chart-bar { filter: brightness(1.15); }
.dash-chart .chart-bar-label { fill: var(--text-secondary); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-chart .chart-hit { fill: transparent; }
.dash-chart .chart-vendor-name { fill: var(--text-secondary); font-size: 11px; }
.dash-chart .chart-vendor-share { fill: var(--text-muted); font-weight: 400; }

.chart-tooltip {
  position: absolute; display: none; pointer-events: none; z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.chart-tooltip strong { display: block; font-size: var(--text-sm); }
.chart-tooltip .tt-sub { color: var(--text-muted); margin-top: 2px; }

.chart-table { margin-top: var(--space-3); }
.chart-table summary {
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.chart-table summary:hover { color: var(--text-secondary); }

/* --- Recent leads list --- */
.recent-leads {
  display: flex; flex-direction: column;
  margin: 0 calc(-1 * var(--space-2));
}
.recent-lead {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}
.recent-lead:hover { background: var(--bg-hover); }
.recent-lead + .recent-lead { border-top: 1px solid var(--border); }

/* --- Lead detail — hero card + tabs pill + sidebar structurée --- */
.lead-hero {
  --lead-accent: var(--primary);
  position: relative;
  background: linear-gradient(160deg, color-mix(in oklch, var(--lead-accent) 10%, var(--bg-card)) 0%, var(--bg-card) 85%);
  border: 1px solid var(--border);
  border-top: 4px solid var(--lead-accent);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.lead-hero-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
}
.lead-hero-actions {
  display: flex; align-items: center; gap: var(--space-2);
}
.lead-hero-body {
  display: flex; align-items: flex-start; gap: var(--space-4);
  flex-wrap: wrap;
}
.lead-hero-avatar {
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--lead-accent) 15%, transparent), var(--shadow-sm);
}
.lead-hero-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-3);
}
.lead-hero-titles {
  display: flex; flex-direction: column; gap: var(--space-2);
}
.lead-hero-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0;
}
.lead-hero-badges {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.lead-hero-id {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px var(--space-2);
  background: var(--bg-muted);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}
.lead-hero-contacts {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.lead-hero-access {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  margin-left: auto; align-self: flex-start;
}
.lead-hero-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px var(--space-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
/* Numéro de téléphone du hero : gros bouton vert cliquable (appel SIP) —
   le petit chip gris se perdait, le numéro est LA donnée de travail du vendeur */
.lead-hero-call {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.28);
}
.lead-hero-call svg { width: 17px; height: 17px; }

.lead-hero-chip:hover {
  color: var(--lead-accent);
  border-color: color-mix(in oklch, var(--lead-accent) 40%, var(--border-subtle));
  background: color-mix(in oklch, var(--lead-accent) 10%, var(--bg-card));
}
.lead-hero-chip svg { width: 12px; height: 12px; flex-shrink: 0; }

/* Dispositions rapides après appel (Répondeur / Pas intéressé / Rappel / RDV) */
.lead-hero-dispo {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: var(--space-2);
}
.lead-hero-dispo-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
}
.lead-dispo-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.lead-dispo-btn:hover {
  color: var(--lead-accent);
  border-color: color-mix(in oklch, var(--lead-accent) 45%, var(--border));
  border-style: solid;
  background: color-mix(in oklch, var(--lead-accent) 6%, transparent);
}
.lead-dispo-btn svg { width: 12px; height: 12px; flex-shrink: 0; }

.lead-hero-stats {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.lead-stat { display: flex; flex-direction: column; gap: 2px; }
.lead-stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: var(--weight-medium);
}
.lead-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (min-width: 1024px) {
  .lead-layout { grid-template-columns: minmax(0, 2.7fr) minmax(320px, 1fr); }
}
/* La fiche lead respire : plus large que les autres pages (onglets libellés) */
.page:has(.lead-layout) { max-width: 1800px; }
.lead-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.lead-side { display: flex; flex-direction: column; gap: var(--space-4); }

.lead-tabs-wrap { min-width: 0; }
.lead-tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
/* Chaque onglet est un vrai bouton avec son intitulé TOUJOURS visible :
   les boutons se partagent la largeur et passent sur 2 lignes si besoin. */
.lead-tab {
  flex: 1 1 auto;
  justify-content: center;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}
.lead-tab:hover { color: var(--text-primary); }
.lead-tab svg { width: 14px; height: 14px; }
.lead-tab.is-active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--border);
}

/* Toggle Table / Kanban dans la toolbar leads */
.leads-view-toggle {
  display: flex; gap: 2px;
  margin-left: auto;
  padding: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  align-self: center;
}
.leads-view-toggle button {
  display: grid; place-items: center;
  width: 30px; height: 26px;
  border: 0; background: transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  cursor: pointer;
}
.leads-view-toggle button svg { width: 15px; height: 15px; }
.leads-view-toggle button.is-active-view {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* Kanban pipeline leads — une colonne par statut, drag & drop */
.kanban-board {
  display: flex; gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 264px; width: 264px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.kanban-col.drag-over {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 6%, var(--bg-subtle));
}
.kanban-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  font-size: 12px; font-weight: var(--weight-semibold);
  border-bottom: 1px solid var(--border-subtle);
}
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-count { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.kanban-cards {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px;
  min-height: 48px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
}
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.45; }
.kanban-card-name { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kanban-card-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11px; color: var(--text-muted);
}

/* Présence : point vert "client connecté" accroché à l'avatar (liste leads) */
.presence-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.presence-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.55);
  display: none;
}
.presence-wrap.is-online .presence-dot { display: block; }

/* 28/10 : orange = absent (staff, onglet masqué > 3 min) */
.presence-wrap.is-away .presence-dot {
  display: block;
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}
/* Variante « duo » (chat interne) : pastille TOUJOURS visible —
   gris = hors ligne (rouge jusqu'au 28/10), vert = en ligne, orange = absent.
   La version par défaut (leads) reste verte-seulement. */
.presence-wrap.presence-duo .presence-dot {
  display: block;
  background: #94a3b8;
  box-shadow: none;
}
.presence-wrap.presence-duo.is-online .presence-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.55);
}
.presence-wrap.presence-duo.is-away .presence-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

/* Sections colorées du formulaire fiche (Identité / Contact / Commercial) */
.lead-form-section { margin-bottom: var(--space-5); }
.lead-form-section-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: var(--weight-semibold);
  padding-bottom: 8px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.lfs-icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: color-mix(in oklch, var(--lfs, var(--primary)) 12%, transparent);
  color: var(--lfs, var(--primary));
  flex-shrink: 0;
}
.lfs-icon svg { width: 14px; height: 14px; }
.lead-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .lead-form-grid { grid-template-columns: 1fr; }
}

.lead-side-card { overflow: visible; }
/* Commentaires en bulles teintées — fini le blanc sur blanc illisible */
.lead-comments-list { display: flex; flex-direction: column; gap: 10px; }
.lead-comment {
  display: flex; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.lead-comment p {
  font-size: 13.5px; line-height: 1.5;
  margin-top: 3px;
  white-space: pre-wrap; word-break: break-word;
}
.lead-side-header {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.lead-side-header svg {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lead-side-header .card-title { font-size: var(--text-sm); }
.lead-side-card .card-content { padding: var(--space-4) var(--space-5); }

.lead-danger-card {
  background: color-mix(in oklch, #dc2626 3%, var(--bg-card));
  border-color: color-mix(in oklch, #dc2626 20%, var(--border));
}
.lead-danger-card .lead-side-header svg,
.lead-danger-card .card-title { color: #dc2626; }
.lead-danger-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

/* Bouton "Supprimer ce lead" discret en pied de fiche */
.lead-footer-delete {
  display: flex; justify-content: flex-end;
  padding: var(--space-3) var(--space-6);
  margin-top: var(--space-4);
}
.lead-delete-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.lead-delete-link svg { width: 12px; height: 12px; }
.lead-delete-link:hover {
  color: #dc2626;
  background: color-mix(in oklch, #dc2626 8%, transparent);
}

/* Variante quand le shell fiche vit dans un modal */
.lead-modal-shell {
  display: flex; flex-direction: column;
  height: min(94vh, 1040px);
}
.lead-hero-modal {
  border-radius: 0;                          /* le modal gère ses coins */
  border-left: 0; border-right: 0;
  border-top: 4px solid var(--lead-accent);  /* liseré accent conservé en modal */
  margin: 0;
  box-shadow: none;
  /* Compact : le contenu remonte, moins d'air perdu en haut */
  padding: var(--space-4) var(--space-6);
  gap: var(--space-3);
}
.lead-hero-modal .lead-hero-top { justify-content: flex-end; }
/* Desktop : la rangée d'actions (Rappel/Popup/Aperçu/Fermer) flotte dans le
   coin haut-droit au lieu d'occuper une ligne entière vide — le bloc
   avatar/nom/onglets remonte d'autant. */
@media (min-width: 900px) {
  .lead-hero-modal .lead-hero-top {
    position: absolute;
    top: 12px; right: 16px;
    z-index: 2;
  }
  .lead-hero-modal .lead-hero-access { margin-top: 42px; }
}
.lead-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  overflow-y: auto;
  flex: 1;
  background: var(--bg-app);                 /* canvas teinté pour distinguer du hero */
}
@media (min-width: 900px) {
  .lead-modal-body {
    /* Sidebar commentaires cappée : la largeur gagnée va aux onglets */
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    /* Pas de scroll global : chaque colonne gère le sien en interne */
    overflow: hidden;
  }
  .lead-modal-body .lead-main { min-height: 0; }
  .lead-modal-body .lead-main > .card {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .lead-modal-body .lead-main > .card > .card-content {
    flex: 1; min-height: 0;
    overflow-y: auto;
  }
  .lead-modal-body .lead-side { min-height: 0; }
  .lead-modal-body .lead-side .lead-side-card {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .lead-modal-body .lead-side .lead-side-card > .card-content {
    flex: 1; min-height: 0;
    overflow-y: auto;
  }
}

/* --- ProductCategory : éditeur des characteristics (form) --- */
.pc-chars-editor {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-height: 340px; overflow-y: auto;
}
.pc-char-row {
  display: grid;
  grid-template-columns: 40px 1fr 48px;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}
.pc-char-row.is-fixed { border-color: color-mix(in oklch, var(--primary) 30%, var(--border-subtle)); background: color-mix(in oklch, var(--primary) 3%, var(--bg-card)); }
.pc-char-drag { display: flex; flex-direction: column; gap: 2px; }
.pc-char-drag .btn { padding: 2px; min-height: 20px; width: 100%; }
.pc-char-drag .btn svg { width: 12px; height: 12px; }
.pc-char-fields { min-width: 0; }
.pc-char-label {
  display: block;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: var(--weight-medium);
  margin-bottom: 2px;
}
.pc-char-actions { display: flex; align-items: flex-start; justify-content: flex-end; }

/* --- Campaigns : bandeau "meilleure performance" (highlight sous les KPIs) --- */
.campaigns-highlight {
  display: flex; align-items: center; gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, color-mix(in oklch, #10b981 8%, var(--bg-card)) 0%, var(--bg-card) 60%);
  border: 1px solid color-mix(in oklch, #10b981 30%, var(--border));
  border-left: 4px solid #10b981;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.campaigns-highlight-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: color-mix(in oklch, #10b981 18%, var(--bg-card));
  color: #059669;
  flex-shrink: 0;
}
.campaigns-highlight-icon svg { width: 20px; height: 20px; }
.campaigns-highlight-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #059669; font-weight: var(--weight-semibold);
}
.campaigns-highlight-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  margin-top: 2px;
  color: var(--text-primary);
}
.campaigns-highlight-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Modal RDV : canvas teinté + fields en cards blanches + autocomplete lead --- */
.appt-modal .modal-header {
  background: linear-gradient(180deg, color-mix(in oklch, var(--primary) 5%, var(--bg-card)) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border-subtle);
}
.appt-modal .modal-body {
  background: var(--bg-app);
  padding: var(--space-5) var(--space-6);
}
.appt-modal .modal-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}
.appt-form { display: flex; flex-direction: column; gap: var(--space-3); }
.appt-form > .field {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 0;
  box-shadow: var(--shadow-xs);
}
.appt-form > .field:hover { border-color: var(--border); }
.appt-form .field-hint { color: var(--text-muted); margin-top: 6px; }
.appt-form #a-date-preview {
  padding: 8px 12px;
  background: color-mix(in oklch, var(--primary) 8%, var(--bg-card));
  border: 1px solid color-mix(in oklch, var(--primary) 25%, var(--border-subtle));
  border-radius: var(--radius);
  color: var(--primary);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  margin: 0;
}

/* Autocomplete lead */
.lead-autocomplete { position: relative; }
.lead-autocomplete-input {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.lead-autocomplete-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.lead-autocomplete-input svg {
  width: 14px; height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lead-autocomplete-input input {
  flex: 1;
  padding: 6px 0;
  border: 0; background: transparent; outline: 0;
  font-size: var(--text-sm);
  color: var(--text-primary);
  min-height: 28px;
}
.lead-autocomplete-input input::placeholder { color: var(--text-muted); }
.lead-autocomplete-clear {
  background: transparent; border: 0;
  padding: 4px; border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center;
}
.lead-autocomplete-clear:hover { background: var(--bg-hover); color: var(--text-primary); }
.lead-autocomplete-clear svg { width: 14px; height: 14px; }
.lead-autocomplete-clear[hidden] { display: none; }

.lead-autocomplete-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto;
  z-index: var(--z-dropdown);
  padding: 4px;
}
.lead-autocomplete-results[hidden] { display: none; }
.lead-autocomplete-item {
  display: block; width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 0; background: transparent;
  text-align: left; cursor: pointer;
  transition: background var(--transition-fast);
}
.lead-autocomplete-item:hover { background: var(--bg-hover); }
.lead-autocomplete-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.lead-autocomplete-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.lead-autocomplete-empty {
  padding: 12px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Agenda (vues Mois / Semaine / Liste) --- */
.agenda-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.agenda-view-switch {
  display: inline-flex; gap: 2px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.agenda-view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.agenda-view-btn:hover { color: var(--text-primary); }
.agenda-view-btn svg { width: 14px; height: 14px; }
.agenda-view-btn.is-active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--border);
}
.agenda-nav { display: inline-flex; align-items: center; gap: var(--space-2); }

/* Mois */
.agenda-month {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.agenda-week-labels {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: var(--weight-medium);
}
.agenda-week-labels > div { padding: 8px 10px; text-align: right; }
.agenda-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--border);
  gap: 1px;
}
.agenda-cell {
  background: var(--bg-card);
  min-height: 108px;
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.agenda-cell:hover { background: color-mix(in oklch, var(--primary) 4%, var(--bg-card)); }
.agenda-cell.outside { background: var(--bg-subtle); color: var(--text-muted); }
.agenda-cell.outside:hover { background: color-mix(in oklch, var(--primary) 3%, var(--bg-subtle)); }
.agenda-cell.today {
  background: color-mix(in oklch, var(--primary) 6%, var(--bg-card));
  outline: 1px solid color-mix(in oklch, var(--primary) 30%, transparent);
  outline-offset: -1px;
}
.agenda-cell-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}
.agenda-cell.today .agenda-cell-day { color: var(--primary); }
.agenda-today-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}
.agenda-cell-body { display: flex; flex-direction: column; gap: 2px; }
.agenda-appt-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px;
  background: color-mix(in oklch, var(--chip) 15%, var(--bg-card));
  border: 1px solid color-mix(in oklch, var(--chip) 35%, transparent);
  border-left: 3px solid var(--chip);
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: var(--weight-medium);
  color: var(--text-primary);
  cursor: pointer; text-align: left; overflow: hidden;
}
.agenda-appt-chip:hover { background: color-mix(in oklch, var(--chip) 22%, var(--bg-card)); }
.agenda-appt-time {
  font-variant-numeric: tabular-nums;
  color: var(--chip); font-weight: var(--weight-semibold);
  flex-shrink: 0;
}
.agenda-appt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-more {
  font-size: 11px; color: var(--text-muted);
  padding: 2px 6px; font-weight: var(--weight-medium);
}

/* Semaine */
.agenda-week {
  display: grid; grid-template-columns: 60px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.agenda-week-hours {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
}
.agenda-hour-label {
  padding: 4px 8px 0 0;
  font-size: 10px; color: var(--text-muted);
  text-align: right; font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}
.agenda-hour-spacer { border-bottom: 1px solid var(--border); height: 40px; }
.agenda-week-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--border-subtle);
  gap: 1px;
}
.agenda-week-col { background: var(--bg-card); }
.agenda-week-col.today { background: color-mix(in oklch, var(--primary) 4%, var(--bg-card)); }
.agenda-week-daytitle {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  height: 40px;
  background: var(--bg-subtle);
}
.agenda-week-dayname {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: var(--weight-medium);
}
.agenda-week-daynum {
  font-size: 14px; font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}
.agenda-week-daynum.is-today {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: var(--primary-fg);
  font-size: 12px;
}
.agenda-week-daybody { position: relative; }
.agenda-slot {
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.agenda-slot:hover { background: color-mix(in oklch, var(--primary) 6%, transparent); }
.agenda-event {
  position: absolute; left: 2px; right: 2px;
  padding: 4px 6px;
  background: color-mix(in oklch, var(--chip) 18%, var(--bg-card));
  border: 1px solid color-mix(in oklch, var(--chip) 40%, transparent);
  border-left: 3px solid var(--chip);
  border-radius: var(--radius);
  font-size: 11px;
  text-align: left; overflow: hidden;
  cursor: pointer;
  z-index: 1;
}
.agenda-event:hover {
  background: color-mix(in oklch, var(--chip) 25%, var(--bg-card));
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.agenda-event-time {
  font-weight: var(--weight-semibold);
  color: var(--chip);
  font-variant-numeric: tabular-nums;
}
.agenda-event-name {
  color: var(--text-primary);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* RDV court (~30 min) : tout sur une ligne, sinon le nom est sous le pli */
.agenda-event.is-compact {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 6px;
}
.agenda-event.is-compact .agenda-event-time { flex-shrink: 0; }
.agenda-event.is-compact .agenda-event-name { margin-top: 0; flex: 1; min-width: 0; }

/* --- Leads import modal (étapes visuelles + preview) --- */
.lim-shell { display: flex; flex-direction: column; max-height: min(90vh, 800px); }
.lim-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, color-mix(in oklch, var(--primary) 5%, var(--bg-card)) 0%, var(--bg-card) 100%);
}
.lim-title-row { display: flex; gap: var(--space-3); align-items: flex-start; }
.lim-title-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 15%, var(--bg-card));
  color: var(--primary);
  flex-shrink: 0;
}
.lim-title-icon svg { width: 20px; height: 20px; }
.lim-title { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; margin: 0; }
.lim-subtitle { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; line-height: 1.5; max-width: 640px; }

.lim-body {
  flex: 1; overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  background: var(--bg-app);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.lim-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.lim-section-title {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.lim-step-badge {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 11px; font-weight: var(--weight-bold);
}
.lim-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}
.lim-mapping-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}
.lim-mapping-field .label { text-transform: none; letter-spacing: 0; }
.lim-warning {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in oklch, #dc2626 8%, var(--bg-card));
  border: 1px solid color-mix(in oklch, #dc2626 30%, var(--border));
  border-radius: var(--radius);
  font-size: var(--text-xs);
  color: #b91c1c;
}
.lim-warning svg { width: 14px; height: 14px; flex-shrink: 0; }

.lim-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

/* --- Settings : upload logo (preview + actions) --- */
.logo-upload {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}
.logo-upload-preview {
  min-width: 120px; height: 72px;
  padding: var(--space-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.logo-upload-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-muted); font-size: 11px;
}
.logo-upload-empty svg { width: 20px; height: 20px; }
.logo-upload-actions {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  flex: 1;
}

/* --- Settings : onglets Plateforme / CRM --- */
.settings-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.settings-tab {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  color: var(--text-primary);
}
.settings-tab svg { width: 22px; height: 22px; color: var(--text-muted); flex-shrink: 0; }
.settings-tab-title { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.settings-tab-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.settings-tab:hover {
  border-color: color-mix(in oklch, var(--primary) 30%, var(--border));
  background: color-mix(in oklch, var(--primary) 3%, var(--bg-card));
}
.settings-tab.is-active {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 6%, var(--bg-card));
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 12%, transparent);
}
.settings-tab.is-active svg,
.settings-tab.is-active .settings-tab-title { color: var(--primary); }

/* --- Settings : gros séparateurs (legacy, encore utilisé si un jour on regroupe à l'intérieur d'un tab) --- */
/* Prévisualisation live du theming client (Réglages → Plateforme) */
.settings-preview-sticky {
  position: sticky;
  top: 8px;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}
.settings-preview-sticky > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  user-select: none;
}
.settings-preview-sticky > summary::-webkit-details-marker { display: none; }
.settings-preview-sticky > summary svg { width: 15px; height: 15px; color: var(--primary); }
.settings-preview-sticky[open] > summary { border-bottom: 1px solid var(--border); }
.settings-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}
@media (max-width: 900px) {
  .settings-preview-grid { grid-template-columns: 1fr; }
  .settings-preview-sticky { position: static; }
}
.settings-preview-caption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.settings-group-header {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-6) 0 var(--space-4);
  background: linear-gradient(135deg, color-mix(in oklch, var(--primary) 8%, var(--bg-card)) 0%, var(--bg-card) 100%);
  border: 1px solid color-mix(in oklch, var(--primary) 20%, var(--border));
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
}
.settings-group-header:first-child { margin-top: 0; }
.settings-group-icon {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 15%, var(--bg-card));
  color: var(--primary);
  flex-shrink: 0;
}
.settings-group-icon svg { width: 18px; height: 18px; }
.settings-group-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text-primary);
}
.settings-group-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.5;
}

/* --- Empty page loader --- */
.page-loading {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-16);
  color: var(--text-muted);
  gap: var(--space-2);
}

/* --- Invoice --- */
.invoice-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-16) var(--space-8);
  background: var(--white);
  min-height: 100vh;
}
@media print {
  body { background: white; }
  .invoice-page { padding: 0; }
}

/* ============================================================
   Module Mail (Zoho intégré) — page #mail + composer + viewer
   ============================================================ */
.mail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 16px;
  align-items: start;
  min-height: 60vh;
}
.mail-list-col { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.mail-list-toolbar { padding: 10px 12px; border-bottom: 1px solid var(--slate-100); display: flex; flex-direction: column; gap: 8px; }
.mail-folder-tabs { display: flex; gap: 6px; }
.mail-folder-tabs button {
  border: 1px solid var(--border-strong);
  background: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.mail-folder-tabs button.is-active {
  background: color-mix(in srgb, var(--primary) 10%, white);
  border-color: color-mix(in srgb, var(--primary) 40%, white);
  color: var(--primary);
}
.mail-search-wrap { position: relative; }
.mail-search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); }
.mail-search-wrap input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 10px 7px 30px;
  font-size: 13px;
  background: var(--slate-50, #f8fafc);
}
.mail-list { overflow-y: auto; max-height: calc(100vh - 280px); }
.mail-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
  position: relative;
}
.mail-item:hover { background: color-mix(in srgb, var(--primary) 4%, white); }
.mail-item.is-selected { background: color-mix(in srgb, var(--primary) 8%, white); box-shadow: inset 3px 0 0 var(--primary); }
.mail-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mail-item-sender { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.is-unread .mail-item-sender { font-weight: 700; }
.mail-item.is-unread::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.mail-item-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.mail-item-subject { font-size: 12px; display: flex; align-items: center; gap: 4px; margin-top: 2px; overflow: hidden; }
.mail-item-subject > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.is-unread .mail-item-subject { font-weight: 600; }
.mail-item-lead { color: var(--primary); display: inline-flex; flex-shrink: 0; }
.mail-item-lead i { width: 12px; height: 12px; }
.mail-item-snippet { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mail-item-box {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--slate-100);
  border-radius: 999px;
  padding: 1px 7px;
}
.mail-view-col { padding: 18px 20px; min-height: 420px; }
.mail-view-head { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--slate-100); margin-bottom: 12px; }
.mail-view-subject { font-size: 16px; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.mail-view-meta { font-size: 12px; color: var(--text-muted); word-break: break-word; }
.mail-view-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mail-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  background: var(--slate-50, #f8fafc);
  cursor: pointer;
}
.mail-att-chip i { width: 12px; height: 12px; }
.mail-att-chip:hover { border-color: var(--primary); color: var(--primary); }
.mail-att-size { color: var(--text-muted); font-size: 11px; }
.mail-back-btn { display: none; margin-bottom: 8px; }
.mail-compose-mode { display: flex; gap: 6px; margin: 4px 0 12px; }
.mail-compose-mode button {
  border: 1px solid var(--border-strong);
  background: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mail-compose-mode button i { width: 13px; height: 13px; }
.mail-compose-mode button.is-active {
  background: color-mix(in srgb, var(--primary) 10%, white);
  border-color: color-mix(in srgb, var(--primary) 40%, white);
  color: var(--primary);
}

@media (max-width: 1023px) {
  .mail-layout { grid-template-columns: 1fr; }
  .mail-view-col { display: none; }
  .mail-layout.has-selection .mail-list-col { display: none; }
  .mail-layout.has-selection .mail-view-col { display: block; }
  .mail-back-btn { display: inline-flex; }
  .mail-list { max-height: none; }
}

/* ═══ Performance — live + journal d'activité vendeur (30/08) ═══ */
.perf-live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #10b981; margin-left: 6px; vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: perf-live-pulse 2s ease-out infinite;
}
@keyframes perf-live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.perf-seller-link {
  font-weight: 500; color: var(--text-primary); text-decoration: none;
  border-bottom: 1px dashed var(--border-strong); cursor: pointer;
}
.perf-seller-link:hover { color: var(--primary); border-bottom-color: var(--primary); }

.journal-drawer-backdrop {
  /* Non bloquant : la page reste utilisable (changer la période met le
     journal à jour) — fermeture par la croix ou Échap. */
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.12);
  z-index: 89; opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.journal-drawer-backdrop.is-open { opacity: 1; }
.journal-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--bg-card); border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
  z-index: 90; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
}
.journal-drawer.is-open { transform: translateX(0); }
.journal-drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--border-subtle);
}
.journal-drawer-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.journal-drawer-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.journal-summary {
  display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 20px;
  font-size: 12px; color: var(--text-secondary); background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.journal-summary span { display: inline-flex; align-items: center; gap: 5px; }
.journal-summary svg { width: 13px; height: 13px; color: var(--text-muted); }
.journal-kinds {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.journal-kind {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-full); font-size: 12px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer;
}
.journal-kind span {
  font-size: 11px; padding: 0 6px; border-radius: var(--radius-full);
  background: var(--bg-muted); color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.journal-kind:hover { border-color: var(--border-strong); }
.journal-kind.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.journal-kind.is-active span { background: rgba(255, 255, 255, 0.22); color: var(--primary-fg); }
.journal-drawer-body { flex: 1; overflow-y: auto; padding: 12px 20px 24px; }
.journal-day { margin-bottom: 18px; }
.journal-day-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin: 6px 0 8px; position: sticky; top: -12px;
  background: var(--bg-card); padding: 6px 0;
}
.journal-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--border-subtle);
}
.journal-time {
  width: 42px; flex-shrink: 0; font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; padding-top: 5px;
}
.journal-icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in oklch, var(--c) 12%, var(--bg-card)); color: var(--c);
}
.journal-icon svg { width: 14px; height: 14px; }
.journal-main { flex: 1; min-width: 0; }
.journal-title { font-size: 13px; color: var(--text-primary); }
.journal-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.journal-lead { color: var(--primary); font-weight: 500; text-decoration: none; }
.journal-lead:hover { text-decoration: underline; }
.journal-lead.is-plain { color: var(--text-secondary); font-weight: 500; }
@media (max-width: 640px) {
  .journal-drawer { width: 100vw; border-left: 0; }
}

/* ═══ Hub Produits (Catalogue / Stock / Fournisseurs) — 30/08 ═══ */
.products-hub-tabs { margin-bottom: 20px; }
.products-hub-tabs .lead-tab { text-decoration: none; }

/* Dashboard — carte « Clients en ligne » (08/10) */
.dash-online-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--slate-300);
}
.dash-online.has-online .dash-online-dot {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: dash-online-pulse 2s ease-out infinite;
}
@keyframes dash-online-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.dash-online-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px;
  padding: 8px 12px 12px; max-height: 320px; overflow-y: auto;
}
.dash-online-row {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-lg);
}
.dash-online-row:hover { background: var(--bg-subtle); }

/* Dashboard — carte « Utilisateurs en ligne » (28/10) */
.dash-staff-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-staff-row.is-offline { opacity: .62; }
.dash-staff-row.is-offline:hover { opacity: 1; }
.dash-staff-state { font-size: 11px; color: var(--text-muted); }
.dash-staff-row.is-online .dash-staff-state { color: #16a34a; }
.dash-staff-row.is-away .dash-staff-state { color: #d97706; }
.dash-staff-role { flex-shrink: 0; font-size: 10px; font-weight: 600; letter-spacing: .02em; padding: 1px 6px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-muted); margin-left: 6px; vertical-align: 1px; }

/* --- Campagne ↔ Google Sheet (10/10) --- */
.csh { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.csh-toggle { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; cursor: pointer; }
.csh-toggle input { grid-row: span 2; width: 16px; height: 16px; accent-color: var(--primary); }
.csh-toggle-text { display: flex; align-items: center; gap: 6px; font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.csh-toggle-text svg { width: 16px; height: 16px; color: var(--primary); }
.csh-toggle .field-hint { grid-column: 2; }
#csh-block { margin-top: var(--space-3); padding: var(--space-4); background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.csh-hint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.csh-hint svg { width: 14px; height: 14px; flex-shrink: 0; }
.csh-email { font-family: var(--font-mono, monospace); font-size: 11px; padding: 2px 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); user-select: all; }
.csh-email.csh-copied { border-color: #059669; color: #059669; }
.csh-url-row { display: flex; gap: var(--space-2); }
.csh-url-row .input { flex: 1; min-width: 0; }
.csh-url-row .btn { white-space: nowrap; }
.csh-ok { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: #059669; margin: -4px 0 var(--space-3); }
.csh-ok svg { width: 14px; height: 14px; }
.csh-checks { display: flex; flex-direction: column; gap: 8px; justify-content: flex-end; padding-bottom: 4px; }
.csh-check { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
.csh-check input { width: 15px; height: 15px; accent-color: var(--primary); }
.csh-status { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); }
.csh-status span { display: inline-flex; align-items: center; gap: 4px; }
.csh-status svg { width: 13px; height: 13px; }
.csh-badge { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.csh-badge svg { width: 12px; height: 12px; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
@media (max-width: 640px) {
  .csh-url-row { flex-direction: column; }
  #csh-block > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* --- Settings : bannières pub de l'accueil client --- */
.home-banners-list { display: flex; flex-direction: column; gap: var(--space-3); }
.home-banners-empty {
  padding: var(--space-5); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); background: var(--bg-subtle);
}
.home-banner-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: var(--space-4); align-items: start;
  padding: var(--space-3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--bg-card);
}
.home-banner-thumb {
  width: 150px; overflow: hidden; border-radius: var(--radius);
  background: var(--bg-subtle); border: 1px solid var(--border);
  padding: 4px; box-sizing: border-box;   /* même esprit que le cadre client */
}
.home-banner-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--radius) - 3px); }
.home-banner-thumb.is-auto img { height: auto; }
.home-banner-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.home-banner-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-banner-pos { font-size: 11px; color: var(--text-muted); font-weight: 600; }
@media (max-width: 700px) {
  .home-banner-row { grid-template-columns: 1fr; }
  .home-banner-fields { grid-template-columns: 1fr; }
  .home-banner-actions { flex-direction: row; justify-content: flex-end; }
}
.home-banner-actions .btn { padding: 4px 6px; }

/* ── Meilleurs créneaux d'appel (19/10, page Performance) ── */
.call-heat th { font-size: 12px; white-space: nowrap; }
.call-heat-cell {
  text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2;
  background: color-mix(in oklch, #10b981 var(--heat, 0%), transparent);
}
.call-heat-cell strong { display: block; font-size: 13px; }
.call-heat-cell span { font-size: 10px; color: var(--text-muted); }
.call-heat-cell.is-weak { opacity: 0.45; }
.call-heat-cell.is-none { color: var(--text-muted); }
.call-heat-total th, .call-heat-total td { border-top: 2px solid var(--border); }
