/* ============================================================
   RDV Entretien — Premium Design System
   Inspiré de Stripe / Linear / Vercel / Notion
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ------------------------------------------------------------
   Design tokens (light mode par défaut)
   ------------------------------------------------------------ */
:root {
  /* Surfaces (light mode : on creuse le contraste bg ↔ surface pour
     que les cartes blanches se détachent vraiment du fond) */
  --bg: #eef2f7;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f4f6fa;
  --surface-hover: #eef2f7;
  --surface-active: #e2e8f0;

  /* Textes (renforcés pour utilisateurs 50+ et écrans non-calibrés) */
  --text: #0b1220;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --text-inverse: #ffffff;

  /* Bordures (un cran plus marquées en light mode) */
  --border: #d8dee7;
  --border-strong: #b8c2d0;
  --border-focus: #93c5fd;

  /* Accents */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-soft-2: #dbeafe;
  --primary-text: #1e40af;

  /* Status */
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --success-text: #166534;

  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --info: #0ea5e9;
  --info-soft: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #075985;

  --violet: #8b5cf6;
  --violet-soft: #f5f3ff;
  --violet-border: #ddd6fe;
  --violet-text: #5b21b6;

  /* Rayons (consolidés à 2 valeurs : éléments fins / containers) */
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 14px;
  --radius-2xl: 14px;

  /* Ombres (douces, pas lourdes) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 50px rgba(15, 23, 42, 0.12);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing scale (4/8pt grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Ombres colorées (accent — pour boutons primary, etc.) */
  --shadow-primary: 0 6px 16px -4px rgba(37, 99, 235, 0.35), 0 2px 6px -2px rgba(37, 99, 235, 0.20);
  --shadow-primary-sm: 0 2px 6px -1px rgba(37, 99, 235, 0.22);
  --shadow-success: 0 6px 16px -4px rgba(22, 163, 74, 0.30), 0 2px 6px -2px rgba(22, 163, 74, 0.18);
  --shadow-danger: 0 6px 16px -4px rgba(239, 68, 68, 0.32), 0 2px 6px -2px rgba(239, 68, 68, 0.18);
}

/* ------------------------------------------------------------
   Dark mode
   ------------------------------------------------------------ */
[data-theme='dark'] {
  /* Palette neutre zinc (à la Linear/Vercel) — plus cinématique et éditorial
     que le bleu navy générique. Noir légèrement chaud, pas gris métallique. */
  --bg: #0a0a0b;
  --bg-elevated: #141416;
  --surface: #141416;
  --surface-muted: #0e0e10;
  --surface-hover: #1c1c1f;
  --surface-active: #26262a;

  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --border: #27272a;
  --border-strong: #3f3f46;
  --border-focus: #38bdf8;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-soft: rgba(56, 189, 248, 0.18);
  --primary-soft-2: rgba(56, 189, 248, 0.28);
  --primary-text: #bae6fd;

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.20);
  --success-border: rgba(34, 197, 94, 0.4);
  --success-text: #bbf7d0;

  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.20);
  --warning-border: rgba(251, 191, 36, 0.4);
  --warning-text: #fde68a;

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.20);
  --danger-border: rgba(248, 113, 113, 0.4);
  --danger-text: #fecaca;

  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.18);
  --info-border: rgba(56, 189, 248, 0.4);
  --info-text: #bae6fd;

  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.22);
  --violet-border: rgba(167, 139, 250, 0.4);
  --violet-text: #ddd6fe;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);

  /* Ombres colorées dark mode (plus subtiles, l'œil sature vite sur fond sombre) */
  --shadow-primary: 0 6px 18px -4px rgba(56, 189, 248, 0.45), 0 2px 8px -2px rgba(56, 189, 248, 0.25);
  --shadow-primary-sm: 0 2px 8px -1px rgba(56, 189, 248, 0.30);
  --shadow-success: 0 6px 18px -4px rgba(34, 197, 94, 0.40), 0 2px 8px -2px rgba(34, 197, 94, 0.20);
  --shadow-danger: 0 6px 18px -4px rgba(248, 113, 113, 0.40), 0 2px 8px -2px rgba(248, 113, 113, 0.22);
}

/* ------------------------------------------------------------
   Reset + base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p, ul, ol, pre, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  transition: background var(--transition), color var(--transition);
}

/* Numérique tabulaire dans tout ce qui affiche des chiffres "métier" */
.kpi-value,
.drawer-tab-count,
.week-item-day-num,
.badge,
input[type="date"],
input[type="number"],
.timeline-meta {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

/* Focus visible premium */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* L'attribut `hidden` doit TOUJOURS l'emporter, même contre `display: flex/grid`
   posés sur les composants. Sinon les onglets, les cartes pliées et autres
   éléments « cachés » continuent à s'afficher (bug de spécificité CSS classique). */
[hidden] { display: none !important; }

/* Fade-out doux (RDV.fadeOutAndRemove) : appliqué juste avant de retirer du DOM. */
.fade-out {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 220ms ease-out, transform 220ms ease-out;
  pointer-events: none;
}

/* Respect des préférences d'animation OS */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------
   App shell (sidebar + main)
   ------------------------------------------------------------ */
.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
  /* Léger padding visuel invisible en clair, fond blanc subtil en sombre pour garder le logo lisible */
  padding: 2px 4px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
[data-theme='dark'] .brand-logo {
  background: #ffffff;
}
.brand-logo-lg {
  height: 72px;
  width: auto;
  display: block;
  object-fit: contain;
}
[data-theme='dark'] .brand-logo-lg {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
}

.sidebar-close {
  display: none;
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.sidebar-close:hover { background: var(--surface-hover); color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item-active {
  background: var(--primary-soft);
  color: var(--primary-text);
}
.nav-item-active .nav-icon { color: var(--primary); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); transition: color var(--transition-fast); }
.nav-item:hover .nav-icon { color: var(--text); }

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--danger);
  color: white;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all var(--transition-fast);
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text); }
.theme-toggle-icon { width: 16px; height: 16px; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 9999px;
  background: var(--text); /* par défaut : couleur du texte, surchargée via style inline pour les clients */
  color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
[data-theme='dark'] .user-avatar { background: var(--surface-active); color: var(--text); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 12px; color: var(--text-muted); line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.topbar-burger {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Pastille statut système (topbar) — l'artisan voit en 1 coup d'œil si l'envoi
   d'emails est actif ou si quelque chose lui manque. Lien vers settings. */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.status-pill:hover { border-color: var(--border-strong); color: var(--text); }
.status-pill-dot {
  width: 8px; height: 8px;
  border-radius: 9999px;
  background: var(--text-subtle);
  flex-shrink: 0;
}
.status-pill-ok { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
.status-pill-ok .status-pill-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }
.status-pill-todo { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.status-pill-todo .status-pill-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.status-pill-warning { color: var(--warning-text); border-color: var(--warning-border); background: var(--warning-soft); }
.status-pill-warning .status-pill-dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }

@media (max-width: 640px) {
  .status-pill { display: none; }
}

.page {
  padding: 24px 28px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.page-narrow { max-width: 900px; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 25;
  backdrop-filter: blur(4px);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay { display: block; }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .main { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .topbar-burger { display: inline-flex; }
  .page { padding: 24px 20px; }
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 38px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast),
              box-shadow var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast), filter var(--transition-fast);
  white-space: nowrap;
  font-family: inherit;
  will-change: transform;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { filter: brightness(0.96); }

.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; border-radius: var(--radius-sm); }
.btn-lg { height: 44px; padding: 0 18px; font-size: 15px; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: transparent;
}
.btn-danger:hover:not(:disabled) { filter: brightness(0.95); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) { filter: brightness(0.95); }

.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm { width: 32px; height: 32px; }

.icon-sm { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; }
.icon-md { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.icon-lg { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card-lg { border-radius: var(--radius-xl); }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.card-body { padding: var(--space-6); }
.card-body-sm { padding: var(--space-4); }
.card-body-lg { padding: var(--space-8); }

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ------------------------------------------------------------
   KPI cards
   ------------------------------------------------------------ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .kpi-grid, .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-grid, .kpi-grid-3 { grid-template-columns: 1fr; } }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  transition: border-color var(--transition-fast);
}
.kpi:hover { border-color: var(--border-strong); }

.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

.kpi-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-muted);
  color: var(--text-subtle);
  border: 1px solid var(--border);
}
/* Variantes conservées (transparentes — la couleur passe par le dot du badge) */
.kpi-icon-primary,
.kpi-icon-warning,
.kpi-icon-danger,
.kpi-icon-success { background: var(--surface-muted); color: var(--text-subtle); }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.kpi-value {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}
.kpi-delta { font-size: 12px; color: var(--text-subtle); }

/* Sous-titre clarificateur sous la valeur (ex : "RDV qui attendent une action") */
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* KPI cliquable : déco de lien retirée + curseur + feedback hover */
.kpi-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}
.kpi-link::after {
  /* petit chevron subtil en haut à droite pour indiquer qu'on peut cliquer */
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 16px; height: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  color: var(--text-subtle);
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.kpi-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-primary-sm);
  transform: translateY(-1px);
}
.kpi-link:hover::after {
  opacity: 1;
  transform: translateX(2px);
}
.kpi-link:active { transform: translateY(0); }

/* Variante danger pour les Retards — bord rouge au hover */
.kpi-link-danger:hover {
  border-color: var(--danger);
  box-shadow: 0 2px 6px -1px rgba(239, 68, 68, 0.22);
}

/* ------------------------------------------------------------
   Form controls
   ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; gap: 12px; }

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.field-label-optional::after {
  content: ' facultatif';
  font-weight: 400;
  color: var(--text-subtle);
  font-size: 12px;
}
.field-label-required::after {
  content: ' *';
  color: var(--danger);
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:hover:not(:focus), .select:hover:not(:focus), .textarea:hover:not(:focus) { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px var(--primary-soft-2),
    0 0 0 1px var(--primary),
    0 4px 12px -4px rgba(37, 99, 235, 0.25);
}
[data-theme='dark'] .input:focus,
[data-theme='dark'] .select:focus,
[data-theme='dark'] .textarea:focus {
  box-shadow:
    0 0 0 3px rgba(56, 189, 248, 0.25),
    0 0 0 1px var(--primary),
    0 0 16px rgba(56, 189, 248, 0.18);
}

.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

.field-hint { font-size: 12px; color: var(--text-subtle); }
.field-error { font-size: 12px; color: var(--danger); }

/* Checkbox et radio styled */
.checkbox {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background: var(--surface);
  transition: all var(--transition-fast);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}
.checkbox:checked { background: var(--primary); border-color: var(--primary); }
.checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ------------------------------------------------------------
   Badges / status pills
   ------------------------------------------------------------ */
/* Badges minimalistes : outline + dot coloré (style Vercel/Plausible).
   En light mode, fond légèrement teinté pour qu'ils se détachent du blanc.
   En dark mode (override plus bas), fond transparent. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
[data-theme='dark'] .badge { background: transparent; }
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 9999px;
  background: var(--text-subtle);
  flex-shrink: 0;
}
.badge-primary { color: var(--text); }
.badge-primary .badge-dot { background: var(--primary); }
.badge-success { color: var(--text); }
.badge-success .badge-dot { background: var(--success); }
.badge-warning { color: var(--text); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-danger { color: var(--danger); border-color: var(--danger-border); }
.badge-danger .badge-dot { background: var(--danger); }
.badge-info { color: var(--text); }
.badge-info .badge-dot { background: var(--primary); }
.badge-violet { color: var(--text); }
.badge-violet .badge-dot { background: var(--primary); }
.badge-neutral { color: var(--text-muted); }
.badge-neutral .badge-dot { background: var(--text-subtle); }

/* Badges d'URGENCE — plus forts que les badges de statut (fond teinté + bold)
   car ils signalent une action à faire / un délai. On veut qu'ils sautent aux yeux. */
.badge-urgent {
  font-weight: 700;
  padding: 3px 10px;
  letter-spacing: 0.01em;
}
.badge-urgent-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}
.badge-urgent-warning {
  background: var(--warning-soft);
  color: var(--warning-text);
  border-color: var(--warning-border);
}
.badge-urgent-soft {
  background: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border);
  font-weight: 600;
}
/* Dark mode : couleurs de texte plus claires pour garder la lisibilité sur fond sombre */
[data-theme='dark'] .badge-urgent-danger { background: rgba(248, 113, 113, 0.14); color: #fecaca; border-color: rgba(248, 113, 113, 0.32); }
[data-theme='dark'] .badge-urgent-warning { background: rgba(251, 191, 36, 0.14); color: #fde68a; border-color: rgba(251, 191, 36, 0.32); }

/* ------------------------------------------------------------
   Banners / alerts
   ------------------------------------------------------------ */
.banner {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: 14px;
  line-height: 1.5;
}
.banner-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 1px;
}
.banner-body { flex: 1; }
.banner-title { font-weight: 600; margin-bottom: 2px; }
.banner-primary { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-soft-2); }
.banner-success { background: var(--success-soft); color: var(--success-text); border-color: var(--success-border); }
.banner-warning { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning-border); }
.banner-danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.banner-info { background: var(--info-soft); color: var(--info-text); border-color: var(--info-border); }

.banner-link { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 16px;
  z-index: 50;
  animation: modal-fade-in var(--transition) both;
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  animation: modal-slide var(--transition) both;
}
@keyframes modal-slide {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.modal-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.modal-close {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.modal-body { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ------------------------------------------------------------
   Dropdown menu
   ------------------------------------------------------------ */
.menu {
  position: absolute;
  right: 0;
  margin-top: 6px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 40;
  animation: menu-in 120ms ease both;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.menu-item:hover { background: var(--surface-hover); }
.menu-item-danger { color: var(--danger-text); }
.menu-item-danger:hover { background: var(--danger-soft); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Menu-item avec un sous-titre explicatif (ex : "Annuler le RDV" + "Ce RDV ne se fera pas") */
.menu-item-desc {
  align-items: flex-start;
  padding: 10px 10px;
}
.menu-item-desc .icon-sm { margin-top: 2px; flex-shrink: 0; }
.menu-item-desc-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.menu-item-title {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  line-height: 1.3;
}
.menu-item-sub {
  font-size: 11px;
  color: var(--text-subtle);
  line-height: 1.35;
}
.menu-item-danger .menu-item-sub { color: #b91c1c; opacity: 0.75; }
[data-theme='dark'] .menu-item-danger .menu-item-sub { color: #fca5a5; opacity: 0.7; }

/* Menu un peu plus large quand on a des descriptions pour que ça tienne */
.menu.menu-wide { min-width: 280px; }

/* Bloc info "Ce qui va se passer" dans les modales d'action destructive */
.action-info {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}
.action-info-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  color: var(--text-subtle);
}
.action-info strong { color: var(--text); font-weight: 600; }
.action-info ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.action-info li { margin-top: 2px; }

/* ------------------------------------------------------------
   List
   ------------------------------------------------------------ */
.list { list-style: none; padding: 0; margin: 0; }
.list-item {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-muted); }

/* Ligne client entièrement cliquable (dashboard "À traiter", listing clients…) */
.list-item-clickable {
  cursor: pointer;
}
.list-item-clickable:hover {
  background: var(--surface-hover);
}
/* Boutons et liens d'action conservent leur cursor par défaut
   (pour que l'user sache visuellement qu'ils ont une action propre) */
.list-item-clickable button,
.list-item-clickable a { cursor: pointer; }

/* Liste des emails envoyés (tiroir "Emails (30j)") */
.emails-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.email-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast);
}
.email-item:hover { border-color: var(--border-strong); }
.email-item-failed { border-left: 3px solid var(--danger); }
.email-item-skeleton {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.email-item-details { width: 100%; }
.email-item-summary {
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.email-item-summary::-webkit-details-marker { display: none; }
.email-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.email-item-time {
  font-size: 12px;
  color: var(--text-subtle);
}
.email-item-subject {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.email-item-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.email-item-client {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.email-item-client:hover { color: var(--primary); text-decoration: underline; }
.email-item-error {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: var(--danger-text);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.email-item-body {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  max-height: 280px;
  overflow-y: auto;
}

/* Barre de filtre actif sur la liste "À traiter" (dashboard) */
.urgent-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 0 var(--space-6) 0;
  border-top: 1px solid var(--border);
  background: var(--primary-soft);
  border-bottom: 1px solid var(--primary-soft-2);
  font-size: 13px;
  color: var(--primary-text);
}
.urgent-filter-bar strong { font-weight: 700; }
.urgent-filter-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.urgent-filter-clear {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--primary-soft-2);
  background: var(--surface);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.urgent-filter-clear:hover { background: var(--primary-soft); }
.urgent-filter-clear .icon-sm { width: 12px; height: 12px; }
@media (max-width: 640px) {
  .urgent-filter-bar { margin: 0 var(--space-4); padding: 10px 12px; font-size: 12px; }
  .urgent-filter-clear { font-size: 11px; padding: 4px 8px; }
}

/* ------------------------------------------------------------
   Timeline
   ------------------------------------------------------------ */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 10px; bottom: 10px;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -20px; top: 6px;
  width: 16px; height: 16px;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
}
.timeline-dot .icon-sm { width: 9px; height: 9px; }

/* Timeline item cliquable (envoi email — affiche le contenu au clic) */
.timeline-item-clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-left: -10px;
  margin-right: -10px;
}
.timeline-item-clickable:hover { background: var(--surface-muted); }

/* "Voir l'email" = bouton-lien inline, toujours visible à droite du texte */
.timeline-item-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  transition: background var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}
.timeline-item-action .icon-sm { width: 11px; height: 11px; }
.timeline-item-clickable:hover .timeline-item-action {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateX(1px);
}

/* Modal preview-avant-envoi : 2 colonnes (édition à gauche, aperçu à droite) */
.send-preview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-height: 600px;
  overflow: hidden;
}
.send-preview-fields {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.send-preview-preview {
  display: flex;
  flex-direction: column;
  background: var(--surface-muted);
  min-height: 0;
}
.send-preview-preview .email-preview-frame { flex: 1; height: auto; min-height: 400px; }
@media (max-width: 780px) {
  .send-preview-body { grid-template-columns: 1fr; max-height: none; }
  .send-preview-fields { border-right: 0; border-bottom: 1px solid var(--border); }
  .send-preview-preview .email-preview-frame { height: 400px; }
}
.timeline-dot-success { border-color: var(--success); color: var(--success); }
.timeline-dot-danger { border-color: var(--danger); color: var(--danger); }
.timeline-dot-warning { border-color: var(--warning); color: var(--warning); }
.timeline-dot-primary { border-color: var(--primary); color: var(--primary); }
.timeline-dot-neutral { border-color: var(--border-strong); color: var(--text-muted); }
.timeline-content { font-size: 14px; color: var(--text); }
.timeline-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ------------------------------------------------------------
   Skeleton
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--surface-active) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ------------------------------------------------------------
   Spinner
   ------------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--text);
  min-width: 240px;
  max-width: 380px;
  animation: toast-in 280ms cubic-bezier(0.2, 0, 0, 1.1) both;
  pointer-events: auto;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.toast-icon-success { color: var(--success); }
.toast-icon-danger { color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------
   Utilities
   ------------------------------------------------------------ */
.grid { display: grid; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.hidden { display: none !important; }
.w-full { width: 100%; }
.relative { position: relative; }
.cursor-pointer { cursor: pointer; }
/* Échelle typographique : taille + line-height + letter-spacing par niveau.
   Plus le texte est gros, plus on resserre le tracking et l'interligne. */
.text-xs   { font-size: 12px; line-height: 1.42; letter-spacing: 0; }
.text-sm   { font-size: 13px; line-height: 1.46; letter-spacing: 0; }
.text-base { font-size: 14px; line-height: 1.5;  letter-spacing: -0.005em; }
.text-lg   { font-size: 16px; line-height: 1.5;  letter-spacing: -0.01em; }
.text-xl   { font-size: 18px; line-height: 1.45; letter-spacing: -0.012em; }
.text-2xl  { font-size: 22px; line-height: 1.32; letter-spacing: -0.02em; }
.text-3xl  { font-size: 28px; line-height: 1.22; letter-spacing: -0.025em; }
.text-4xl  { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-5 > * + * { margin-top: 20px; }
.space-y-6 > * + * { margin-top: 24px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Responsive helpers */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
}
@media (max-width: 640px) {
  .hidden-mobile { display: none !important; }
}

/* ------------------------------------------------------------
   Auth pages (login/register/welcome)
   ------------------------------------------------------------ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.auth-shell::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 400px;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}
.auth-card-wrap { width: 100%; max-width: 420px; position: relative; }

/* ------------------------------------------------------------
   Landing
   ------------------------------------------------------------ */
.landing-hero {
  padding: 80px 20px 60px;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}
.landing-title {
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
}
/* Mot accentué du H1 : couleur pleine + soulignement "dessiné à la main" via SVG.
   Plus éditorial/artisan qu'un gradient bleu-violet générique. */
.landing-title-accent {
  color: var(--primary);
  position: relative;
  white-space: nowrap;
  padding-bottom: 0.08em;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'><path d='M 3 9 C 40 4, 80 12, 120 6 S 180 10, 197 4' stroke='%232563eb' stroke-width='3' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 0.18em;
}
[data-theme='dark'] .landing-title-accent {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'><path d='M 3 9 C 40 4, 80 12, 120 6 S 180 10, 197 4' stroke='%2338bdf8' stroke-width='3' fill='none' stroke-linecap='round'/></svg>");
}
.landing-subtitle {
  margin-top: 24px;
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 1000px;
  margin: 48px auto 0;
  padding: 0 20px;
}
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }

.feature {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}
.feature-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.feature-desc { font-size: 14px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; }

/* ------------------------------------------------------------
   Landing — stats band (3 chiffres)
   ------------------------------------------------------------ */
.stats-band {
  max-width: 900px;
  margin: 56px auto 0;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.stats-item { text-align: center; min-width: 0; }
.stats-number {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stats-number-accent { color: var(--primary); }
.stats-unit {
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-left: 2px;
}
.stats-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}
.stats-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}
@media (max-width: 780px) {
  .stats-band {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .stats-divider { display: none; }
}

/* ------------------------------------------------------------
   Landing — Avant / Après
   ------------------------------------------------------------ */
.compare-band {
  max-width: 1000px;
  margin: 64px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: stretch;
}
.compare-col {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.compare-before {
  background: var(--surface-muted);
  border-color: var(--border);
}
.compare-after {
  border-color: var(--success-border);
  background: linear-gradient(180deg, var(--success-soft) 0%, var(--surface) 60%);
}
.compare-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  margin-bottom: 14px;
}
.compare-after .compare-eyebrow { color: var(--success); }
.compare-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.compare-list li {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  padding-left: 22px;
  position: relative;
}
.compare-before .compare-list li::before {
  content: '✕';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--danger);
  font-weight: 700;
}
.compare-after .compare-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 700;
}
.compare-arrow {
  font-size: 28px;
  color: var(--primary);
  align-self: center;
  font-weight: 400;
}
@media (max-width: 780px) {
  .compare-band { grid-template-columns: 1fr; }
  .compare-arrow { transform: rotate(90deg); margin: 0 auto; }
}

/* ------------------------------------------------------------
   Landing — Pricing (tarif unique, 14j gratuits)
   ------------------------------------------------------------ */
.pricing {
  max-width: 540px;
  margin: 100px auto 0;
  padding: 0 20px;
  scroll-margin-top: 20px;
}
.pricing-header {
  text-align: center;
  margin-bottom: 36px;
}
.pricing-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.pricing-title {
  font-size: clamp(26px, 3.8vw, 36px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}
.pricing-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.55;
}

.pricing-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 44px 32px 32px;
  box-shadow: 0 24px 50px -12px rgba(37, 99, 235, 0.18), 0 4px 10px rgba(15, 23, 42, 0.04);
  text-align: center;
}
[data-theme='dark'] .pricing-card {
  background: var(--surface);
  box-shadow: 0 24px 50px -12px rgba(37, 99, 235, 0.25);
}

.pricing-ribbon {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 7px 16px;
  border-radius: 9999px;
  white-space: nowrap;
  box-shadow: var(--shadow-primary-sm);
}

.pricing-plan-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pricing-amount {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.pricing-value {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.pricing-currency-period {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  text-align: left;
}
.pricing-currency {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.pricing-period {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}
.pricing-tax {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 6px;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 28px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.pricing-features li {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}
.pricing-features li::before {
  content: "";
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 9999px;
  background-color: var(--success-soft);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2316a34a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m5 10.5 3.2 3.2L15 7'/></svg>");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
  margin-top: 1px;
}
[data-theme='dark'] .pricing-features li::before {
  background-color: rgba(22, 163, 74, 0.15);
}

.pricing-cta {
  width: 100%;
  box-shadow: var(--shadow-primary);
}

.pricing-reassure {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 16px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 640px) {
  .pricing { margin-top: 72px; }
  .pricing-card { padding: 36px 22px 24px; border-radius: var(--radius-lg); }
  .pricing-value { font-size: 60px; }
  .pricing-ribbon { font-size: 11px; padding: 6px 12px; }
}

/* ------------------------------------------------------------
   Landing — CTA final
   ------------------------------------------------------------ */
.final-cta {
  max-width: 720px;
  margin: 72px auto 24px;
  text-align: center;
  padding: 48px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 70%);
  border: 1px solid var(--primary-soft-2);
}
.final-cta-title {
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}
.final-cta-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.55;
}

/* Footer landing */
.landing-footer {
  margin-top: 80px;
  padding: 32px 20px 40px;
  border-top: 1px solid var(--border);
}
.landing-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.landing-footer-sign {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: right;
  margin: 0;
  max-width: 380px;
}
@media (max-width: 640px) {
  .landing-footer-inner { flex-direction: column; align-items: flex-start; }
  .landing-footer-sign { text-align: left; }
}

/* Landing topbar */
.landing-topbar {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

/* ------------------------------------------------------------
   Divers
   ------------------------------------------------------------ */
.dot-divider { width: 3px; height: 3px; border-radius: 9999px; background: var(--text-subtle); display: inline-block; vertical-align: middle; margin: 0 8px; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
}

/* Bloc "dernier rappel" (fiche client) — synthèse immédiate pour le pro. */
.last-relance-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.last-relance-icon {
  width: 36px; height: 36px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.last-relance-icon-ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.last-relance-icon-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.last-relance-body { flex: 1; min-width: 200px; }
.last-relance-title { font-size: 14px; color: var(--text); }
.last-relance-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.55; }
.last-relance-actions { flex-shrink: 0; }

/* Hero empty (premier login, 0 client). Plus accueillant qu'un .empty-state. */
.hero-empty {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-8) var(--space-6);
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 100%);
  border: 1px solid var(--primary-soft-2);
  border-radius: var(--radius-lg);
}
.hero-empty-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--primary-soft-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.hero-empty-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero-empty-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.55;
  max-width: 60ch;
}
@media (max-width: 640px) {
  .hero-empty { grid-template-columns: 1fr; padding: var(--space-6); }
}
.empty-state-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   "Cette semaine" — carte cliquable, sobre
   ------------------------------------------------------------ */
.week-card {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-5) var(--space-6);
  transition: border-color var(--transition-fast);
}
.week-card:hover { border-color: var(--border-strong); }
.week-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.week-card-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.week-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  flex-shrink: 0;
}
.week-card-main { flex: 1; min-width: 200px; }
.week-card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.week-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.week-card-meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}
.week-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.week-card:hover .week-card-cta { color: var(--primary); }

.dot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.dot-chip .badge-dot { width: 6px; height: 6px; border-radius: 9999px; background: var(--text-subtle); }
.dot-chip-violet { color: var(--text); }
.dot-chip-violet .badge-dot { background: var(--primary); }
.dot-chip-warning { color: var(--text); }
.dot-chip-warning .badge-dot { background: var(--warning); }

/* ------------------------------------------------------------
   Drawer (tiroir latéral)
   ------------------------------------------------------------ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  animation: modal-fade-in var(--transition) both;
}
.drawer {
  background: var(--surface);
  border-left: 1px solid var(--border);
  width: 100%;
  max-width: 720px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.15);
  animation: drawer-slide var(--transition) both;
}
@keyframes drawer-slide {
  from { opacity: 0; }
  to { opacity: 1; }
}
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.drawer-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.drawer-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.drawer-tab:hover { background: var(--surface); color: var(--text); }
.drawer-tab-active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary-soft-2);
  box-shadow: var(--shadow-xs);
}
.drawer-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--surface-active);
  color: var(--text-muted);
}
.drawer-tab-active .drawer-tab-count { background: var(--primary-soft); color: var(--primary-text); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 32px;
}

/* ------------------------------------------------------------
   Liste RDV cette semaine
   ------------------------------------------------------------ */
.week-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.week-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.week-item:hover { border-color: var(--primary-soft-2); box-shadow: var(--shadow-xs); }
.week-item-cancelled { background: var(--surface-muted); border-style: dashed; opacity: 0.92; }
.week-item-cancelled .week-item-name { text-decoration: line-through; text-decoration-color: var(--text-subtle); }

.week-item-day {
  width: 56px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  text-align: center;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}
.week-item-day-num { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.04em; line-height: 1; }
.week-item-day-month { font-size: 10px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }
.week-item-cancelled .week-item-day {
  background: var(--surface);
  border-color: var(--border);
}
.week-item-cancelled .week-item-day-num,
.week-item-cancelled .week-item-day-month { color: var(--text-muted); }

.week-item-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.week-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.week-item-name:hover { color: var(--primary); }
.week-item-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.week-item-contact {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.week-item-contact a { color: var(--text-muted); text-decoration: none; }
.week-item-contact a:hover { color: var(--primary); text-decoration: underline; }
.week-item-last {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  align-self: flex-start;
  margin-top: 2px;
}
.week-item-last em { font-style: normal; font-weight: 600; color: var(--text); }
.week-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}
.week-item-skeleton {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

@media (max-width: 640px) {
  .week-item {
    grid-template-columns: 52px 1fr;
  }
  .week-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .drawer { max-width: 100%; }
}

/* ------------------------------------------------------------
   Chips (motifs d'annulation préréglés)
   ------------------------------------------------------------ */
.chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* ------------------------------------------------------------
   Bouton ghost rouge (action destructive secondaire)
   ------------------------------------------------------------ */
.btn-danger-ghost {
  color: var(--danger-text);
}
.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* ------------------------------------------------------------
   Avatar petite taille
   ------------------------------------------------------------ */
.user-avatar-sm {
  width: 28px !important;
  height: 28px !important;
  font-size: 11px !important;
}

/* ============================================================
   PAGE PARAMÈTRES — onglets, assistants, fournisseurs
   ============================================================ */

/* Largeur dédiée pour la page paramètres (entre page-narrow 900px
   et la page complète 1440px) — laisse respirer la grille fournisseurs
   sans noyer le formulaire. */
.settings-page {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* ----- Bloc statut SMTP : verdict en 1 coup d'œil ----- */
.smtp-status {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.smtp-status-icon {
  width: 36px; height: 36px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.smtp-status-icon svg { width: 20px; height: 20px; }
.smtp-status-body { min-width: 0; }
.smtp-status-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.smtp-status-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.smtp-status-checks {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}
.smtp-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.smtp-check-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.smtp-check-ok { color: var(--text); }
.smtp-check-ok .smtp-check-mark { background: var(--success); color: white; }
.smtp-check-todo { color: var(--text-muted); }
.smtp-check-todo .smtp-check-mark { background: var(--surface-muted); color: var(--text-subtle); border: 1px solid var(--border); }

.smtp-status-actions { flex-shrink: 0; }

/* Variantes de statut */
.smtp-status-ok {
  border-color: var(--success-border);
  background: linear-gradient(180deg, var(--success-soft) 0%, var(--surface) 80%);
}
.smtp-status-ok .smtp-status-icon { background: var(--success); color: white; }
.smtp-status-ok .smtp-status-icon svg { color: white; }

.smtp-status-partial {
  border-color: var(--warning-border);
  background: linear-gradient(180deg, var(--warning-soft) 0%, var(--surface) 80%);
}
.smtp-status-partial .smtp-status-icon { background: var(--warning); color: white; }
.smtp-status-partial .smtp-status-icon svg { color: white; }

.smtp-status-todo {
  border-color: var(--danger-border);
  background: linear-gradient(180deg, var(--danger-soft) 0%, var(--surface) 80%);
}
.smtp-status-todo .smtp-status-icon { background: var(--danger); color: white; }
.smtp-status-todo .smtp-status-icon svg { color: white; }

@media (max-width: 640px) {
  .smtp-status {
    grid-template-columns: 1fr;
  }
  .smtp-status-icon { margin-bottom: -8px; }
}

/* Onglets en haut de page */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}
.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  font-family: inherit;
  flex: 1;
  justify-content: center;
}
.settings-tab:hover { color: var(--text); }
.settings-tab-active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.settings-tab-status {
  font-size: 11px;
  line-height: 1;
}
.settings-tab-status-ok { color: var(--success); }
.settings-tab-status-warning { color: var(--warning); }
.settings-tab-status-todo { color: var(--text-subtle); }

.settings-panel { display: flex; flex-direction: column; gap: var(--space-4); }

/* Étape numérotée (setup wizard) */
.setup-step {
  padding: var(--space-6);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-5);
}
.setup-step-num {
  width: 32px; height: 32px;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--primary-soft-2);
  flex-shrink: 0;
}
.setup-step-content { min-width: 0; }
.setup-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.setup-step-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* Grille de fournisseurs (1 carte par fournisseur, sélection au clic) */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.provider-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  text-align: left;
  font-family: inherit;
}
.provider-card:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.provider-card-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}
/* Vignette fournisseur (vrais logos).
   Conteneur stable 40×40 blanc, l'image s'adapte : remplie si icône carrée,
   ajustée avec marge si wordmark large (Free, OVH). */
.provider-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}
.provider-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
/* Icône carrée (Gmail, Outlook, Yahoo, SFR, Orange, La Poste) : on laisse
   l'image remplir quasiment tout le carré, avec une petite marge. */
.provider-logo-icon img {
  width: 28px;
  height: 28px;
}
/* Wordmark (Free, OVH) : plus d'air autour pour que le texte respire. */
.provider-logo-wordmark img {
  width: 32px;
  height: 20px;
}
/* "Autre fournisseur" : carré pointillé + icône SVG */
.provider-logo-ghost {
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
}
.provider-logo-ghost svg { width: 18px; height: 18px; }

/* Dark mode : le fond blanc des vignettes peut trop "flasher". On le matifie
   légèrement pour qu'il s'intègre à la carte. */
[data-theme='dark'] .provider-logo { background: #f4f6fa; border-color: rgba(255, 255, 255, 0.08); }
.provider-info { min-width: 0; flex: 1; }
.provider-name { font-size: 14px; font-weight: 600; color: var(--text); }
.provider-diff {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}
.provider-diff-simple { color: var(--success); }
.provider-diff-moyen { color: var(--warning); }
.provider-diff-avance { color: var(--text-subtle); }

/* Tutoriel pas-à-pas */
.tuto-steps {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.tuto-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tuto-step-num {
  width: 24px; height: 24px;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.tuto-step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.tuto-step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 4px;
}
.tuto-step-desc a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.tuto-step-desc code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  word-break: break-all;
}

/* Toggle "Paramètres avancés" */
.advanced-toggle {
  margin-top: var(--space-4);
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}
.advanced-toggle summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
  list-style: none;
}
.advanced-toggle summary::-webkit-details-marker { display: none; }
.advanced-toggle summary:hover { color: var(--text); }

/* Bouton "tester" + résultat */
.setup-test {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.setup-test-result {
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* Règles d'alerte */
.alert-rules {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.alert-rules-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.alert-rule {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--text);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition-fast);
}
.alert-rule:hover { border-color: var(--border-strong); }
.alert-rule-toggle {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.alert-rule-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.alert-rule-when {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 30px;
  transition: opacity var(--transition);
}
.alert-rule-when-disabled { opacity: 0.4; pointer-events: none; }
.alert-rule-num {
  width: 84px;
  text-align: center;
  padding: 6px 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Inline number input dans les card-subtitles */
.inline-num {
  display: inline-block;
  width: 64px;
  padding: 4px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  margin: 0 2px;
}

/* Textarea monospace pour modèles */
.textarea-mono {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* Bloc variables */
.vars-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.vars-row code {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text);
}

/* Bloc preview email — rendu type boîte de réception (Gmail/Outlook style).
   La vraie HTML du mail est rendue dans une iframe pour isoler les styles. */
.email-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.email-preview-head {
  padding: 10px var(--space-4);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.email-preview-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.email-preview-inbox {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.email-preview-row {
  display: flex;
  gap: 12px;
  font-size: 13px;
  align-items: baseline;
}
.email-preview-label {
  width: 50px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}
.email-preview-val { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.email-preview-subject { font-weight: 600; }
.email-preview-frame {
  width: 100%;
  height: 460px;
  border: 0;
  display: block;
  background: #f4f6fa;
}
/* Dark mode : l'iframe a un fond fixe clair (les emails sont toujours light).
   On ajoute juste un halo discret autour pour séparer visuellement. */
[data-theme='dark'] .email-preview-frame { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
@media (max-width: 640px) {
  .email-preview-frame { height: 520px; }
}

/* Save bar sticky */
.save-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(calc(-50% + var(--sidebar-width) / 2));
  z-index: 30;
  max-width: 560px;
  width: calc(100% - 40px);
}
@media (max-width: 900px) {
  .save-bar { transform: translateX(-50%); }
}
.save-bar-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--text-subtle);
  display: inline-block;
}

/* Mobile : étape sans grille (icône au-dessus) */
@media (max-width: 640px) {
  .setup-step {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-5);
  }
  .setup-step-num { margin-bottom: -8px; }
  .provider-grid { grid-template-columns: 1fr 1fr; }
  .settings-tab { padding: 8px 10px; font-size: 12px; }
}

/* ============================================================
   MOBILE FIXES — safe-area iOS, anti-débordement, touch targets,
   paddings adaptatifs, topbar/modal/drawer/toast compacts.
   Ce bloc est volontairement tout à la fin : il override les règles
   desktop ci-dessus sans avoir à les modifier.
   ============================================================ */

/* Piège tout débordement horizontal inattendu (empêche le scroll bizarre mobile) */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  -webkit-tap-highlight-color: transparent;
}

/* Sidebar mobile : respecte le notch gauche et l'indicateur home bas */
@media (max-width: 900px) {
  .sidebar {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
  }
  .sidebar-footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-height) + env(safe-area-inset-top));
  }
}

/* ---- Mobile strict (≤640px) ---- */
@media (max-width: 640px) {
  /* iOS zoome les inputs dont la taille est <16px au focus. On la force à 16px. */
  .input, textarea.input, select.input { font-size: 16px; }

  /* Topbar : padding latéral avec safe-area, gap + sous-titre compacts */
  .topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    gap: 10px;
  }
  .topbar-title { font-size: 15px; }
  .topbar-subtitle { display: none; }
  .topbar-burger { width: 40px; height: 40px; }
  .topbar-actions { gap: 6px; margin-left: auto; }
  /* Bouton "Ajouter un client" : icône seule sur mobile pour libérer la largeur */
  .topbar-actions .btn-primary { padding: 0 10px; min-width: 38px; }
  .topbar-actions .btn-primary > span:not([class*="icon"]) { display: none; }

  /* Page : padding + safe-area (pour notch en paysage et home indicator) */
  .page {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* Touch targets confortables sur mobile (40×40 mini — densité visuelle préservée) */
  .btn-icon-sm { width: 40px; height: 40px; }
  .sidebar-close { width: 40px; height: 40px; }
  .modal-close { width: 40px; height: 40px; }

  /* Cards : paddings serrés, header qui wrap proprement */
  .card-body { padding: var(--space-4); }
  .card-body-sm { padding: var(--space-3); }
  .card-body-lg { padding: var(--space-5); }
  .card-header {
    padding: var(--space-4);
    flex-wrap: wrap;
  }

  /* KPI : padding réduit, valeur plus compacte */
  .kpi { padding: var(--space-4); gap: var(--space-3); }
  .kpi-value { font-size: 26px; }

  /* Week-card : padding réduit, CTA qui passe sous le titre si pas la place */
  .week-card { padding: var(--space-4); }
  .week-card-inner { gap: var(--space-3); }
  .week-card-main { min-width: 0; width: 100%; }
  .week-card-title { font-size: 15px; }
  .week-card-cta { width: 100%; justify-content: flex-end; font-size: 12px; }

  /* Hero vide */
  .hero-empty-title { font-size: 18px; }
  .hero-empty-sub { font-size: 13px; }

  /* Modal : pleine largeur, hauteur dynamique (ignore la barre URL mobile), paddings compacts */
  .modal-overlay { padding: 24px 12px 12px; }
  .modal {
    max-width: 100%;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
  }
  .modal-header { padding: var(--space-4); }
  .modal-body { padding: var(--space-4); gap: var(--space-3); }
  .modal-footer {
    padding: var(--space-3) var(--space-4);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .modal-footer .btn { flex: 1; }

  /* Drawer : pleine largeur, tabs scrollables si besoin, padding bottom avec safe-area */
  .drawer {
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
  }
  .drawer-header { padding: 14px 16px; }
  .drawer-title { font-size: 16px; }
  .drawer-tabs {
    padding: 6px 10px;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .drawer-tabs::-webkit-scrollbar { display: none; }
  .drawer-tab {
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .drawer-body {
    padding: 12px 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* Week-item compact */
  .week-item { padding: 12px; gap: 12px; }
  .week-item-day { width: 48px; padding: 6px; }
  .week-item-day-num { font-size: 20px; }

  /* Banner un cran plus serré */
  .banner { padding: 12px 14px; }

  /* Toast : s'étale sur la largeur disponible, ancré en bas + safe-area */
  .toast-container {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .toast {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Save bar (settings) : safe-area */
  .save-bar {
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }

  /* ===== Settings page : onglets scrollables + pad-bottom anti save-bar ===== */
  /* Onglets : taille naturelle (plus de flex:1 qui force et déborde),
     scroll horizontal avec snap + fondu droit pour indiquer qu'il y a plus à voir */
  .settings-tabs {
    flex-wrap: nowrap;
    padding: 5px;
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 9px 14px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Le contenu ne doit jamais passer sous la save-bar flottante.
     70px save-bar + 20px respiration + safe-area. !important pour override
     le style inline `padding-bottom: 120px` présent dans settings.html. */
  .settings-page {
    padding-bottom: calc(110px + env(safe-area-inset-bottom)) !important;
  }
}

/* ============================================================
   SETTINGS — Panneau Abonnement (Stripe)
   ============================================================ */
.billing-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  border-left: 4px solid var(--border);
  transition: border-color var(--transition);
}
.billing-card.billing-card-active { border-left-color: var(--success); }
.billing-card.billing-card-trial  { border-left-color: var(--primary); }
.billing-card.billing-card-expired { border-left-color: var(--danger); }
.billing-card.billing-card-warning { border-left-color: var(--warning); }

.billing-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.billing-hero-icon {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.billing-hero-icon svg { width: 24px; height: 24px; }
.billing-hero-icon-ok {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}
.billing-hero-icon-trial {
  background: var(--primary-soft);
  border-color: var(--primary-soft-2);
  color: var(--primary);
}
.billing-hero-icon-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}
.billing-hero-icon-warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.billing-hero-body { flex: 1; min-width: 0; }
.billing-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.billing-hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.billing-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
@media (max-width: 640px) {
  .billing-info-grid { grid-template-columns: 1fr; }
}
.billing-info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}
.billing-info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.billing-cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.billing-cta .btn { justify-content: center; }
.billing-cta-hint {
  font-size: 12px;
  color: var(--text-subtle);
  text-align: center;
}

.billing-features {
  list-style: none;
  padding: 16px 0 0;
  margin: 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.billing-features li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 20px;
  position: relative;
}
.billing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 700;
}

/* ============================================================
   PWA INSTALL — bouton sidebar + modal d'instructions iOS/Android
   ============================================================ */

/* Bouton "Installer l'app" dans la sidebar (hérite du style .theme-toggle).
   Juste un accent subtil pour le distinguer. */
.sidebar-install {
  color: var(--text);
}
.sidebar-install .theme-toggle-icon { color: var(--primary); }

/* Masque le bouton si l'app tourne déjà en standalone (double sécurité vs JS) */
body.pwa-installed .sidebar-install { display: none !important; }

/* Modal PWA : un peu plus étroit pour garder le focus sur les étapes */
.pwa-modal { max-width: 480px; }

/* Preview "comme ça ressemblera sur l'écran d'accueil" */
.pwa-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pwa-preview-icon {
  width: 72px; height: 72px;
  border-radius: 18px; /* mimique l'arrondi iOS */
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.pwa-preview-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.pwa-preview-url {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Phrase d'intro sous la preview */
.pwa-lead {
  color: var(--text-muted);
  font-size: 14px;
  margin: var(--space-4) 0 var(--space-3);
}

/* Hint callout (info / warning) */
.pwa-hint, .pwa-hint-warning {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: var(--space-3);
  line-height: 1.5;
}
.pwa-hint {
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  color: var(--primary-text);
}
.pwa-hint-warning {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}
.pwa-hint-warning .icon-md, .pwa-hint .icon-md { flex-shrink: 0; margin-top: 2px; }

.pwa-hint-inline {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: var(--space-3);
  text-align: center;
}

/* Icônes inline dans le texte (taille du texte, alignées) */
.pwa-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin: 0 2px;
  color: var(--primary);
  vertical-align: -4px;
}
.pwa-inline-icon svg { width: 100%; height: 100%; }

/* Bouton install full-width (Chrome/Edge prompt natif) */
.pwa-install-btn {
  width: 100%;
  margin-top: var(--space-2);
  box-shadow: var(--shadow-primary);
}

/* Chaîne visuelle « 3 gestes » : [icône] → [icône] → [icône] */
.pwa-chain {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  margin: var(--space-4) 0 var(--space-3);
}
.pwa-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.pwa-step-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}
.pwa-step-icon span { display: inline-flex; width: 26px; height: 26px; }
.pwa-step-icon svg { width: 100%; height: 100%; }
.pwa-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
}
.pwa-step-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  width: 18px; height: 56px;
  flex-shrink: 0;
}
.pwa-step-arrow svg { width: 16px; height: 16px; }

/* Hint bleu avec flèche vers le bas, pointant vers le Partager Safari */
.pwa-bottom-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-top: var(--space-3);
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
  color: var(--primary-text);
}
.pwa-bottom-hint-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  animation: pwa-arrow-bounce 1.6s ease-in-out infinite;
}
@keyframes pwa-arrow-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* Mobile : étapes plus serrées */
@media (max-width: 420px) {
  .pwa-step-icon { width: 48px; height: 48px; border-radius: 14px; }
  .pwa-step-icon span { width: 22px; height: 22px; }
  .pwa-step-label { font-size: 11px; }
  .pwa-step-arrow { height: 48px; width: 14px; }
  .pwa-step-arrow svg { width: 12px; height: 12px; }
}

/* ---- Très petit mobile (≤380px) : iPhone SE, Galaxy Fold fermé ---- */
@media (max-width: 380px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 12px; }
  .week-item-day { width: 44px; }
  .week-item-day-num { font-size: 18px; }
  .modal-overlay { padding: 12px 8px; }
  .drawer-header { padding: 12px 14px; }
}
