/* ---------------------------------------------------------------------------
   Système de design MediClinic — source unique de vérité.

   Une seule famille de marque (le vert #1e4d40), une seule famille de neutres
   (froids, slate), quatre couleurs sémantiques. Une couleur écrite en dur dans
   un composant est un bug : elle ne suit pas le thème sombre et elle échappe à
   toute correction ultérieure. L'audit du 2026-09-01 a trouvé six palettes
   concurrentes et ~500 hex en dur, voir
   docs/superpowers/plans/2026-09-01-audit-ui-ux-antislop.md.

   Les polices sont chargées depuis index.html (preconnect + stylesheet) et non
   plus par un @import ici : un @import en tête de feuille sérialise la requête
   et bloque le rendu.
   --------------------------------------------------------------------------- */

:root {
  /* --- Échelle de marque, hsl(163 44% L) dérivée de #1e4d40 --------------- */
  --brand-50:  hsl(163, 40%, 96%);
  --brand-100: hsl(163, 38%, 91%);
  --brand-200: hsl(163, 34%, 81%);
  --brand-300: hsl(163, 36%, 66%);
  --brand-400: hsl(163, 40%, 48%);
  --brand-500: hsl(163, 44%, 36%);
  --brand-600: hsl(163, 44%, 28%);
  --brand-700: hsl(163, 44%, 21%); /* #1e4d40 — la couleur de marque */
  --brand-800: hsl(163, 42%, 16%);
  --brand-900: hsl(163, 40%, 11%);

  /* --- Rôles de marque ---------------------------------------------------
     Le remplissage et l'encre sont deux tokens distincts : une même valeur ne
     peut pas servir à la fois de fond de bouton et de texte sur la page dans
     les deux thèmes. Confondre les deux est exactement ce qui rendait les
     pastilles illisibles en mode sombre. */
  --brand-fill: var(--brand-700);
  --brand-fill-hover: var(--brand-800);
  --brand-fill-fg: #ffffff;
  --brand-soft: var(--brand-50);
  --brand-soft-ink: var(--brand-700);
  --brand-line: var(--brand-200);

  /* --primary reste l'ENCRE d'accent (texte, icônes, bordures) : c'est son
     usage majoritaire dans le dépôt. Pour un fond, utiliser --brand-fill. */
  --primary-h: 163;
  --primary-s: 44%;
  --primary-l: 24%;
  --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --primary-rgb: 30, 77, 64;
  --primary-hover: var(--brand-700);
  --primary-light: var(--brand-50);
  --primary-light-hover: var(--brand-100);
  --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.25);

  --secondary: #0f172a;
  --secondary-rgb: 15, 23, 42;

  /* --- Neutres : une seule famille, froide ------------------------------- */
  --bg-primary: #f7f9fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  /* #8a99ad ne donnait que 2,9:1 sur blanc, sous le minimum AA de 4,5:1, et
     c'est le token le plus répandu de l'application (libellés de cartes,
     sous-titres, métadonnées). #64748b donne 4,8:1. */
  --text-muted: #64748b;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.4);

  /* Glassmorphism system */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(30, 77, 64, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(30, 77, 64, 0.04);

  /* --- Sémantiques -------------------------------------------------------
     Chaque couleur a trois rôles : la teinte pleine (--x), le fond teinté
     (--x-surface) et l'encre lisible sur ce fond (--x-ink). Les trois sont
     redéfinis en thème sombre, ce que les anciens rgba() ne faisaient pas. */
  --success: #10b981;
  --success-surface: hsl(152, 55%, 95%);
  --success-ink: hsl(152, 60%, 24%);
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-surface: hsl(38, 92%, 95%);
  --warning-ink: hsl(30, 80%, 30%);
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-surface: hsl(0, 86%, 96%);
  --danger-ink: hsl(0, 65%, 40%);
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #0284c7;
  --info-surface: hsl(199, 89%, 95%);
  --info-ink: hsl(201, 90%, 27%);
  --info-light: rgba(2, 132, 199, 0.15);

  /* Shadows and Offsets */
  --shadow-sm: 0 2px 4px 0 rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 16px -6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 20px 30px -10px rgba(15, 23, 42, 0.09), 0 10px 20px -8px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 30px 50px -15px rgba(15, 23, 42, 0.13), 0 15px 30px -10px rgba(15, 23, 42, 0.07);

  /* --- Rayons : trois paliers utiles, plus la pastille ------------------- */
  --radius-sm: 8px;   /* contrôles : champs, petits boutons */
  --radius-md: 14px;  /* cartes, pastilles de statut */
  --radius-lg: 20px;  /* conteneurs, modales */
  --radius-xl: 28px;  /* images de la vitrine */
  --radius-full: 9999px;

  /* --- Échelle typographique --------------------------------------------
     Six paliers. Les tailles improvisées (0,72 / 0,78 / 0,82 / 0,925 rem…)
     sont à remplacer par ces tokens au fil des passages. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  /* --- Barre latérale ----------------------------------------------------
     Elle reste sombre dans les deux thèmes, c'est un choix assumé. Ses valeurs
     sont dérivées de la même échelle de marque : elle avait jusqu'ici son
     propre vert (#162a26, #1c4436, #1f3a33) et ses propres gris verdâtres. */
  --sidebar-bg: var(--brand-900);
  --sidebar-surface: var(--brand-800);
  --sidebar-active: var(--brand-700);
  --sidebar-fg: hsl(163, 14%, 72%);
  --sidebar-fg-strong: #ffffff;
  --sidebar-muted: hsl(163, 12%, 50%);

  /* Fonts */
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-secondary: 'Plus Jakarta Sans', 'Outfit', sans-serif;

  /* Skeleton loading (see components/Skeleton.tsx) */
  --skeleton-base: #e3ecf3;
  --skeleton-sheen: rgba(255, 255, 255, 0.75);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sizing */
  --sidebar-width: 260px;
  --header-height: 70px;
}

/* Premium Dark Mode ("fond un peu noir" theme) */
[data-theme="dark"] {
  --bg-primary: #05080f; /* Rich deep black-blue */
  --bg-secondary: #0b111e; /* Sleek dark card container */
  --bg-tertiary: #131c2e; /* Slate/dark-blue accent background */

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  /* #64748b ne donnait que 3,95:1 sur --bg-secondary, sous le minimum AA. */
  --text-muted: #94a3b8;

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-focus: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.6);

  /* L'encre d'accent s'éclaircit, le remplissage reste un vert soutenu qui
     porte encore du texte blanc. Les deux tokens divergent ici : c'est tout
     l'intérêt de les avoir séparés. */
  --primary-s: 40%;
  --primary-l: 62%;
  --brand-fill: hsl(163, 44%, 30%);
  --brand-fill-hover: hsl(163, 44%, 36%);
  --brand-fill-fg: #ffffff;
  --brand-soft: hsl(163, 34%, 13%);
  --brand-soft-ink: hsl(163, 42%, 72%);
  --brand-line: hsl(163, 30%, 26%);
  --primary-hover: hsl(163, 40%, 72%);
  --primary-light: hsl(163, 34%, 13%);
  --primary-light-hover: hsl(163, 32%, 17%);

  --success-surface: hsl(152, 40%, 13%);
  --success-ink: hsl(152, 50%, 64%);
  --warning-surface: hsl(35, 45%, 14%);
  --warning-ink: hsl(38, 80%, 65%);
  --danger-surface: hsl(0, 40%, 15%);
  --danger-ink: hsl(0, 80%, 74%);
  --info-surface: hsl(201, 45%, 14%);
  --info-ink: hsl(199, 80%, 68%);

  --glass-bg: rgba(11, 17, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);

  --skeleton-base: #17202f;
  --skeleton-sheen: rgba(255, 255, 255, 0.07);

  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 16px -6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 20px 30px -10px rgba(0, 0, 0, 0.6), 0 10px 20px -8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 30px 50px -15px rgba(0, 0, 0, 0.7), 0 15px 30px -10px rgba(0, 0, 0, 0.5);
}

html, body {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Resets & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* Focus clavier : une seule règle pour toute l'application. Il n'en existait
   qu'une (.input-control), face à 21 « outline: none » — un utilisateur au
   clavier perdait le curseur dès qu'il quittait un champ de formulaire.
   :focus-visible ne s'affiche pas au clic à la souris, donc rien ne change
   pour les autres. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Les éléments qui posent eux-mêmes « outline: none » en inline gardent une
   marque visible via l'ombre portée. */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--border-focus);
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-semibold { font-weight: 500; }
.text-bold { font-weight: 700; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Common Layout Containers */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding-bottom: 64px; /* room for the fixed mobile quick-actions bar */
  }
}

/* ===== Mobile quick-actions bar (Patient / Rendez-vous / Dépôt) ===== */
.mobile-quick-actions {
  display: none;
}

@media (max-width: 768px) {
  .mobile-quick-actions {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .mobile-quick-actions-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
  }

  .mobile-quick-actions-btn:active {
    background-color: var(--bg-tertiary);
    color: var(--primary);
  }
}

.page-container {
  padding: 2rem;
  flex-grow: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .page-container {
    padding: 1rem 0.75rem;
  }
}

/* Header & Card styles */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
}

/* ===== Global ripple effect (see utils/ripple.ts) ===== */
@keyframes ripple-anim {
  from { transform: scale(0); opacity: 0.35; }
  to { transform: scale(1); opacity: 0; }
}

.ripple-span {
  position: absolute;
  border-radius: 50%;
  background-color: currentColor;
  transform: scale(0);
  opacity: 0.35;
  animation: ripple-anim 600ms ease-out forwards;
  pointer-events: none;
}

/* ===== Stat card entrance + hover lift (Dashboard, Accounting journal, etc.) ===== */
@keyframes stat-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-card-animate {
  animation: stat-card-in 450ms ease-out both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card-animate:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}
.stat-card-animate:nth-child(1) { animation-delay: 0ms; }
.stat-card-animate:nth-child(2) { animation-delay: 60ms; }
.stat-card-animate:nth-child(3) { animation-delay: 120ms; }
.stat-card-animate:nth-child(4) { animation-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  .ripple-span { animation: none; display: none; }
  .stat-card-animate { animation: none; }
}

/* ===== Skeleton loading placeholders (see components/Skeleton.tsx) =====
   Un seul bloc gris qui balaie une lueur — pas de librairie, pas d'image.
   Les couleurs viennent de --skeleton-* pour suivre le thème clair/sombre. */
@keyframes skeleton-shimmer {
  from { background-position: -150% 0; }
  to { background-position: 250% 0; }
}

.skeleton {
  display: block;
  background-color: var(--skeleton-base);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    var(--skeleton-sheen) 50%,
    transparent 100%
  );
  background-size: 40% 100%;
  background-repeat: no-repeat;
  background-position: -150% 0;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  /* rien de lisible ni de sélectionnable dans un placeholder */
  color: transparent;
  user-select: none;
  pointer-events: none;
}

.skeleton-line { height: 0.8rem; border-radius: var(--radius-full); }
.skeleton-circle { border-radius: 50%; }

/* La lueur qui balaie est purement décorative : sans elle le bloc gris
   reste visible et lisible comme placeholder statique. */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background-image: none; }
}

/* Texte réservé aux lecteurs d'écran (annonce « Chargement… » pendant que
   les skeletons, eux, sont aria-hidden). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.25);
}

.grid-cols-1 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 1024px) {
  .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ===== Reusable "main content + narrow side panel" split (form pages, detail pages) ===== */
.side-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 992px) {
  .side-panel-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Wider variant for dense two-column detail views (timeline + action widgets) */
.detail-split-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .detail-split-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Small 3-across grid for compact numeric inputs (vitals, etc.) */
.compact-3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

@media (max-width: 480px) {
  .compact-3-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full); /* Rounded Pill! */
  font-weight: 600;
  font-family: var(--font-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  font-size: 0.875rem;
}

.btn-primary {
  background-color: var(--brand-fill);
  color: var(--brand-fill-fg);
  box-shadow: 0 4px 14px 0 rgba(var(--primary-rgb), 0.25);
}
.btn-primary:hover {
  background-color: var(--brand-fill-hover);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(var(--primary-rgb), 0.35);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background-color: var(--border);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Badges / Chips */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-info { background-color: var(--info-light); color: var(--info); }

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

.custom-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background-color: var(--bg-tertiary);
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.custom-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.9375rem;
}

@media (max-width: 640px) {
  .custom-table th, .custom-table td {
    padding: 0.75rem 0.875rem;
    font-size: 0.85rem;
  }
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tbody tr:hover {
  background-color: var(--bg-primary);
}

/* Inputs & Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-control {
  width: 100%;
  max-width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.input-control::placeholder {
  color: var(--text-muted);
}

/* Phone input with country/dial-code selector (react-phone-number-input) */
.phone-input-wrapper .PhoneInput {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  transition: var(--transition);
}

.phone-input-wrapper .PhoneInput--focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.phone-input-wrapper .PhoneInputCountry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.phone-input-wrapper .PhoneInputCountrySelect {
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

/* The dropdown popup is rendered natively by the OS/browser with a light
   background regardless of page theme — force readable dark-on-light text
   for the option list itself, independent of the (invisible) closed select. */
.phone-input-wrapper .PhoneInputCountrySelect option {
  color: #111827;
  background-color: #ffffff;
}

.phone-input-wrapper .PhoneInputCountryIcon {
  width: 22px;
  box-shadow: none;
}

.phone-input-wrapper .PhoneInputCountrySelectArrow {
  color: var(--text-muted);
  opacity: 1;
}

.phone-input-wrapper .PhoneInputInput {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0.125rem 0;
}

.phone-input-wrapper .PhoneInputInput::placeholder {
  color: var(--text-muted);
}

.phone-input-wrapper .PhoneInput--disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Modal backdrop & animations */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  padding: 1rem;
  overflow-y: auto;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Many modals wrap .modal-body + .modal-footer in a <form> that's a direct
   child of .modal-content. .modal-content is a flex column, but <form>
   defaults to display:block, which breaks the flex chain — .modal-body's
   flex/overflow-y rules below only apply when it's an actual flex item, so
   without this the body never scrolls and .modal-content's overflow:hidden
   just silently clips content instead (footer can end up squeezed/hidden).
   This keeps the flex column going through the <form>. */
.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.rx-med-line-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 1.2fr 0.8fr 30px;
  gap: 8px;
  align-items: center;
}

@media (max-width: 640px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
  .modal-backdrop {
    padding: 0.5rem;
  }
  .modal-content {
    max-height: 95vh;
  }
  .modal-header, .modal-body, .modal-footer {
    padding: 1rem;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .modal-footer .btn {
    width: 100%;
  }
  .rx-med-line-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .rx-med-line-grid > div:nth-child(1) {
    grid-column: 1 / -1;
  }
  .rx-med-line-grid > .rx-med-line-remove {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-tertiary);
  flex-shrink: 0;
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes logoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}
.app-loading-logo {
  animation: logoPulse 1.6s ease-in-out infinite;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utility Flex */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }

/* Alerts banner */
.alert-banner {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
}
.alert-banner-danger {
  background-color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}
.alert-banner-warning {
  background-color: var(--warning-light);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}
.alert-banner-info {
  background-color: var(--info-light);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

/* Responsive Sidebar toggling */
.sidebar {
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
  .sidebar {
    width: min(78vw, 240px) !important;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle-btn {
    display: flex !important;
  }

  .sidebar-close-btn {
    display: flex !important;
  }
}

/* ===== Landing Page (mobile-first: unprefixed = 375px base, min-width layers up) ===== */
.landing-page {
  background-color: #0b0f19;
  color: #f9fafb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-primary);
}

.landing-nav {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #1f2937;
}

.landing-nav-links {
  display: none;
  gap: 2rem;
}

.landing-nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: #e5e7eb;
  cursor: pointer;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .landing-nav-actions { gap: 1rem; }
}

@media (min-width: 768px) {
  .landing-nav { padding: 1.5rem 2rem; }
  .landing-nav-links { display: flex; }
}

.landing-hero {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

@media (min-width: 1024px) {
  .landing-hero {
    flex-direction: row;
    align-items: center;
    padding: 4rem 2rem;
    gap: 3rem;
  }
}

.landing-hero-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .landing-hero-content { flex: 1; max-width: 560px; }
}

.landing-hero-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  font-family: var(--font-secondary);
}

@media (min-width: 640px) {
  .landing-hero-title { font-size: 2.75rem; }
}

@media (min-width: 1024px) {
  .landing-hero-title { font-size: 3.25rem; }
}

.landing-cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.landing-cta-row .btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 480px) {
  .landing-cta-row { flex-direction: row; }
  .landing-cta-row .btn { width: auto; }
}

.landing-hero-visual {
  position: relative;
}

@media (min-width: 1024px) {
  .landing-hero-visual { flex: 1; max-width: 440px; }
}

.landing-preview-panel {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 40px -20px rgba(13, 148, 136, 0.25);
}

.landing-preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #0b0f19;
  border: 1px solid #1f2937;
  border-radius: var(--radius-sm);
}

.landing-preview-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(13, 148, 136, 0.15);
  color: rgb(13, 148, 136);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.landing-section {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

@media (min-width: 768px) {
  .landing-section { padding: 4rem 2rem; }
}

.landing-section-title {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-family: var(--font-secondary);
}

@media (min-width: 768px) {
  .landing-section-title { font-size: 2rem; margin-bottom: 0.75rem; }
}

.landing-section-lead {
  text-align: center;
  color: #94a3b8;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  font-size: 0.9375rem;
}

@media (min-width: 768px) {
  .landing-section-lead { font-size: 1rem; }
}

.landing-feature-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 1.5rem;
}

.landing-feature-icon {
  background: rgba(13, 148, 136, 0.1);
  color: rgb(13, 148, 136);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.landing-cta-band {
  background: linear-gradient(180deg, #0d1527 0%, #070d18 100%);
  border-top: 1px solid rgba(13, 148, 136, 0.25);
  border-bottom: 1px solid #1f2937;
  padding: 4rem 1.25rem;
  text-align: center;
  position: relative;
}

@media (min-width: 768px) {
  .landing-cta-band { padding: 5rem 2rem; }
}

.landing-cta-band h2 {
  color: #ffffff !important;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .landing-cta-band h2 { font-size: 2.5rem; }
}

.landing-cta-band p {
  color: #cbd5e1 !important;
  font-size: 1.05rem;
  line-height: 1.6;
}

.landing-cta-band .landing-cta-row {
  max-width: 360px;
  margin: 2rem auto 0;
}

@media (min-width: 480px) {
  .landing-cta-band .landing-cta-row { max-width: none; justify-content: center; }
}

.landing-image-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 45px -10px rgba(13, 148, 136, 0.35);
  border: 1px solid rgba(13, 148, 136, 0.3);
  width: 100%;
  max-width: 520px;
  margin: 0 auto 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.landing-image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 50px -10px rgba(13, 148, 136, 0.45);
}

.landing-image-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.landing-footer {
  text-align: center;
  padding: 2rem 1.25rem;
  color: #6b7280;
  font-size: 0.8125rem;
  margin-top: auto;
  border-top: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .landing-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 2.5rem 2rem;
  }
}

.landing-footer-links {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Auth Page (mobile-first) ===== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(circle at 50% 120%, rgba(13, 148, 136, 0.15), rgba(5, 8, 15, 0));
}

@media (min-width: 1024px) {
  .auth-shell { flex-direction: row; }
}

.auth-brand-panel {
  background-color: #0b0f19;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-brand-extra {
  display: none;
}

.auth-brand-copyright {
  display: none;
}

@media (min-width: 1024px) {
  .auth-brand-panel {
    width: 42%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 3rem;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  .auth-brand-extra { display: block; }

  .auth-brand-copyright {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    opacity: 0.5;
  }
}

.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

@media (min-width: 640px) {
  .auth-form-panel { padding: 2.5rem 2rem; }
}

/* ===== Terms of Service — Banani pixel-parity light theme =====
   Deliberate one-page exception to the fixed-dark Landing/Auth shell (user
   decision, 2026-07-27 re-fetch): tokens copied verbatim from the Banani
   flow's shared style.css, same source as the Platform Admin token pass. */
/* Vitrine : page publique, palette claire fixe pour la même raison que les CGU
   (data-theme peut être resté sur « dark » sans personne de connecté). Les
   valeurs viennent de la famille de marque, mais figées ici. La vitrine
   portait jusqu'ici 149 couleurs écrites à la main, dont un violet #7c3aed
   qui était le seul violet du produit. */
.landing-page {
  --lp-bg: #ffffff;
  --lp-bg-alt: #f7f9fb;
  --lp-fg: #0f172a;
  --lp-muted: #64748b;
  --lp-border: #e2e8f0;
  --lp-border-strong: #cbd5e1;
  --lp-brand: hsl(163, 44%, 21%);
  --lp-brand-hover: hsl(163, 42%, 16%);
  --lp-brand-ink: hsl(163, 44%, 24%);
  --lp-brand-soft: hsl(163, 40%, 96%);
  --lp-brand-line: hsl(163, 34%, 81%);
  --lp-dark: hsl(163, 38%, 12%);
  --lp-dark-fg: #e2e8f0;
  --lp-dark-accent: hsl(163, 45%, 70%);
  --lp-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  /* Mise en garde « données d'exemple », priorités de la maquette : valeurs
     figées, pas les tokens sémantiques de l'app, qui basculent en sombre. */
  --lp-warn-bg: hsl(38, 92%, 95%);
  --lp-warn-fg: hsl(30, 80%, 32%);
  /* Le pied de page est sombre : --lp-muted (#64748b) n'y donnait que 3,75:1,
     sous le seuil AA. Mesuré par Lighthouse sur la page construite. */
  --lp-footer-fg: #a3b2c4;
}

/* Page CGU : elle est publique et sans en-tête d'application, donc elle porte
   ses propres tokens plutôt que ceux du tableau de bord. Ils sont désormais
   pris dans la même famille : elle avait son quatrième vert (#3D6B5E) et son
   propre neutre papier. */
.terms-page {
  /* Page publique : elle garde une palette claire fixe, indépendante du thème
     de l'application (l'attribut data-theme peut rester à « dark » depuis une
     session précédente alors que personne n'est connecté). Les valeurs sont
     tirées de la même famille que le reste, mais écrites en dur ici, à dessein.
     --tp-fg sert aussi de FOND au bandeau de titre (.terms-header) : le
     brancher sur --text-primary rendait ce bandeau blanc, avec son titre blanc
     dessus, dès que le thème sombre était actif. */
  --tp-bg: #f7f9fb;
  --tp-fg: #0f172a;
  --tp-border: #e2e8f0;
  --tp-input: #eef2f7;
  --tp-secondary: var(--brand-50);
  --tp-primary: hsl(163, 44%, 24%);
  --tp-muted: #64748b;
  background-color: var(--tp-bg);
  color: var(--tp-fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.terms-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--tp-border);
  background-color: var(--tp-bg);
}

@media (min-width: 768px) {
  .terms-nav { padding: 1rem 4rem; }
}

.terms-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.terms-nav-actions a {
  font-size: 0.85rem;
  color: var(--tp-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.terms-header {
  background: var(--tp-fg);
  padding: 2rem 1.25rem;
}

@media (min-width: 768px) {
  .terms-header { padding: 3rem 4rem; }
}

.terms-layout {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  flex: 1;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .terms-layout { padding: 3rem 4rem; flex-direction: row; gap: 3rem; }
}

.terms-toc {
  display: none;
}

@media (min-width: 768px) {
  .terms-toc {
    display: block;
    width: 220px;
    flex-shrink: 0;
  }
  .terms-toc-inner { position: sticky; top: 2rem; }
}

.terms-toc a {
  display: block;
  font-size: 0.8125rem;
  color: var(--tp-muted);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.terms-toc a:hover {
  color: var(--tp-fg);
  background: var(--tp-input);
}

.terms-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 720px;
}

.terms-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--tp-border);
}

.terms-section:last-of-type {
  border-bottom: none;
}

.terms-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid var(--tp-border);
}

@media (min-width: 768px) {
  .terms-footer { justify-content: space-between; padding: 1.5rem 4rem; }
}

/* ===== Landing Page Responsive Styles ===== */
.landing-nav-desktop {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.landing-nav-actions-desktop {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.landing-mobile-toggle {
  display: none;
}

@media (max-width: 900px) {
  .landing-nav-desktop,
  .landing-nav-actions-desktop {
    display: none !important;
  }
  .landing-mobile-toggle {
    display: flex !important;
  }
  .landing-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }
  .landing-hero-title {
    font-size: 2.25rem !important;
  }
  .landing-showcase-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }
  .landing-pricing-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 500px) {
  .landing-hero-title {
    font-size: 1.85rem !important;
  }
  .landing-feature-pills {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
  }
}

/* Very narrow phones: 2 columns get too cramped, drop to 1 */
@media (max-width: 380px) {
  .landing-feature-pills {
    grid-template-columns: 1fr !important;
  }
}

/* Boutons de la vitrine. Le style plein et le style contour étaient recopiés
   en inline à huit endroits, avec des rayons et des ombres qui avaient déjà
   commencé à diverger (10px ici, 12px là). */
.landing-cta,
.landing-cta-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.landing-cta {
  background-color: var(--lp-brand);
  color: #ffffff;
  border: 1px solid var(--lp-brand);
  box-shadow: 0 6px 18px -6px rgba(15, 23, 42, 0.35);
}

.landing-cta:hover {
  background-color: var(--lp-brand-hover);
  border-color: var(--lp-brand-hover);
}

.landing-cta-ghost {
  background-color: var(--lp-bg);
  color: var(--lp-fg);
  border: 1px solid var(--lp-border-strong);
}

.landing-cta-ghost:hover {
  border-color: var(--lp-brand);
}

/* Variante posée sur le bandeau sombre de fin de page. */
.landing-facts .landing-cta-ghost,
.landing-closing .landing-cta-ghost {
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.landing-facts .landing-cta-ghost:hover,
.landing-closing .landing-cta-ghost:hover {
  border-color: #ffffff;
}

.landing-cta-sm {
  padding: 10px 16px;
  font-size: 0.85rem;
  width: 100%;
}

/* Bouton de navigation en texte simple (Connexion). */
.landing-nav-link-btn {
  background: none;
  border: none;
  color: var(--lp-fg);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 16px;
}

/* Bandeau de clôture. */
.landing-closing {
  background-color: var(--lp-dark);
  padding: 4rem 1.5rem;
  display: flex;
  justify-content: center;
  text-align: center;
}

/* Cartes de tarifs. Le corps de la carte était écrit huit fois en inline, avec
   des ternaires sur chaque propriété selon le plan mis en avant : la variante
   tient maintenant dans une seule classe. */
.landing-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 2rem 1.75rem;
  text-align: left;
  background-color: var(--lp-bg);
  border: 1px solid var(--lp-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.landing-plan-on {
  background-color: var(--lp-brand-soft);
  border: 2px solid var(--lp-brand);
  box-shadow: 0 12px 32px -14px rgba(15, 23, 42, 0.35);
}

.landing-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--lp-brand);
}

.landing-plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--lp-bg-alt);
  color: var(--lp-brand);
}

.landing-plan-on .landing-plan-badge {
  background-color: var(--lp-brand);
  color: #ffffff;
}

.landing-plan-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--lp-muted);
  margin: 0 0 4px;
}

.landing-plan-price {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.landing-plan-amount {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--lp-fg);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.landing-plan-unit {
  display: flex;
  flex-direction: column;
  padding-bottom: 2px;
  font-size: 0.7rem;
  color: var(--lp-muted);
}

.landing-plan-rows {
  list-style: none;
  margin: 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--lp-border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.landing-plan-rows li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--lp-fg);
}

.landing-plan-check {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--lp-brand-soft);
  color: var(--lp-brand);
}

.landing-plan-on .landing-plan-check {
  background-color: #ffffff;
}

/* Note commune sous les trois cartes de tarifs. */
.landing-plans-note {
  max-width: 720px;
  margin: 2.25rem auto 0;
  padding: 0.9rem 1.25rem;
  background-color: var(--lp-bg-alt);
  border: 1px solid var(--lp-border);
  border-radius: var(--radius-md);
  text-align: left;
}

.landing-plans-note p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--lp-muted);
}

.landing-plans-note strong {
  color: var(--lp-fg);
  font-weight: 700;
}

/* ===== Landing Page: bandeau « modules + faits » =====
   Remplace le carrousel infini et la bande de quatre colonnes icône-libellé.
   Composition asymétrique : les modules réels à gauche, les faits à droite,
   ce qui casse aussi l'alternance image-texte des deux sections précédentes. */
.landing-facts {
  background-color: var(--lp-dark);
  color: var(--lp-dark-fg);
  padding: 3rem 1.5rem;
}

.landing-facts-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .landing-facts-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 4rem;
    align-items: start;
  }
}

.landing-facts-title {
  font-family: var(--font-secondary);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.landing-facts-lead {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--lp-dark-fg);
  margin: 0 0 1.5rem;
  max-width: 52ch;
}

.landing-module-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.landing-module-list li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}

.landing-module-list svg {
  color: var(--lp-dark-accent);
  flex-shrink: 0;
}

.landing-fact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.landing-fact-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-fact-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.landing-fact-list svg {
  color: var(--lp-dark-accent);
  flex-shrink: 0;
}

/* ===== Landing Page: Entrance & Hover Micro-interactions ===== */
@keyframes landing-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered entrance for the hero column's direct children */
.landing-entrance > * {
  opacity: 0;
  animation: landing-fade-up 550ms ease-out forwards;
}
.landing-entrance > *:nth-child(1) { animation-delay: 60ms; }
.landing-entrance > *:nth-child(2) { animation-delay: 140ms; }
.landing-entrance > *:nth-child(3) { animation-delay: 220ms; }
.landing-entrance > *:nth-child(4) { animation-delay: 300ms; }
.landing-entrance > *:nth-child(5) { animation-delay: 380ms; }

/* Scroll-reveal: JS toggles .is-visible via IntersectionObserver */
.landing-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.landing-reveal.landing-reveal-left { transform: translateX(-28px); }
.landing-reveal.landing-reveal-right { transform: translateX(28px); }
.landing-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Buttons: slight relief + cyan halo on hover */
.landing-btn-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.landing-btn-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.22), 0 10px 22px rgba(13, 148, 136, 0.22) !important;
}
.landing-btn-lift:active {
  transform: translateY(0);
}

/* Cards: lift + shadow grow on hover (pricing) */
.landing-card-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.landing-card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(30, 77, 64, 0.16);
}

/* Feature pills: lift + tint + soft shadow on hover */
.landing-pill-hover {
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.landing-pill-hover:hover {
  transform: translateY(-2px);
  background-color: #e6f4ea;
  border-color: #bbf7d0;
  box-shadow: 0 8px 18px rgba(13, 148, 136, 0.12);
}

/* Nav / text links: sliding underline on hover */
.landing-link {
  position: relative;
  transition: color 0.2s ease;
}
.landing-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: #0d9488;
  transition: width 0.25s ease;
}
.landing-link:hover {
  color: #0f172a !important;
}
.landing-link:hover::after {
  width: 100%;
}

/* Footer links: brighten + sliding cyan underline on hover */
.landing-footer-link {
  position: relative;
  transition: color 0.2s ease;
}
.landing-footer-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: #5eead4;
  transition: width 0.25s ease;
}
.landing-footer-link:hover {
  color: #ffffff !important;
}
.landing-footer-link:hover::after {
  width: 100%;
}

/* Logo mark: subtle pop on hover */
.landing-logo-mark {
  transition: transform 0.2s ease;
}
.landing-logo-mark:hover {
  transform: scale(1.08);
}

/* Pricing section 3-card grid (Landing Page) — 1 col mobile, 3 cols 850px+.
   Separate from Settings' local .plan-cards-grid (same pattern, different
   file) to avoid touching that already-shipped page for this change. */
.pricing-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 850px) {
  .pricing-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===== Landing Page: Aperçu de l'interface (maquette statique) =====
   Reproduction inerte de l'écran Banani « Nouveau Rendez-vous »
   (new_screen11.jsx + NewAppointmentMobile.jsx), insérée dans la landing
   comme vitrine produit. Voir .planning/banani/landing-app-preview.md.

   Valeurs figées et scopées ici, comme .terms-page (--tp-*) et
   .platform-admin-shell : la vitrine est en thème clair fixe, la maquette ne
   doit pas suivre le [data-theme] de l'app.

   Elles reproduisent maintenant la palette CLAIRE RÉELLE de l'application
   (mêmes valeurs que le bloc :root en haut de ce fichier). Elles venaient de
   la maquette Banani : vert-gris sur papier chaud, une palette qui n'existe
   nulle part dans le produit. La section s'intitule « Voyez l'interface avant
   de vous inscrire » : elle doit montrer l'interface, pas une autre. */
.app-preview {
  --ap-bg: #f7f9fb;
  --ap-fg: #0f172a;
  --ap-border: #e2e8f0;
  --ap-input: #eef2f7;
  --ap-primary: hsl(163, 44%, 24%);
  --ap-primary-fg: #ffffff;
  --ap-secondary: hsl(163, 40%, 96%);
  --ap-secondary-fg: hsl(163, 44%, 21%);
  --ap-muted: #eef2f7;
  --ap-muted-fg: #64748b;
  --ap-card: #ffffff;
  --ap-sidebar: hsl(163, 40%, 11%);
  --ap-sidebar-fg: hsl(163, 14%, 72%);
  --ap-sidebar-muted: rgba(255, 255, 255, 0.12);
  --ap-sidebar-accent: hsl(163, 44%, 21%);
  --ap-r-md: 8px;
  --ap-r-lg: 14px;

  display: flex;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--ap-border);
  border-radius: 16px;
  background-color: var(--ap-bg);
  color: var(--ap-fg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  text-align: left;
  line-height: 1.4;
  /* Décor, pas une commande : rien n'est cliquable ni sélectionnable, et le
     bloc entier est aria-hidden côté JSX. Aucun <button>/<a> à l'intérieur,
     donc aucun arrêt de tabulation non plus. */
  pointer-events: none;
  user-select: none;
}

/* Bascule mobile <-> desktop. Chaque maquette Banani est suivie à sa propre
   largeur : le mock mobile a un champ Date compact, le desktop un vrai
   mini-calendrier ; ce ne sont pas deux rendus du même bloc.

   Sélecteurs préfixés par .app-preview à dessein : .ap-card/.ap-btn/.ap-ctas
   posent aussi un `display` et sont déclarés plus bas, donc une bascule de
   même spécificité perdrait — les cartes « desktop » resteraient visibles à
   375px. */
.app-preview .ap-desktop-only { display: none; }
.app-preview .ap-mobile-only { display: flex; }

/* Même bascule pour du texte en ligne : les deux maquettes n'emploient pas
   les mêmes libellés (« Récents » contre « Patients récents », etc.), et le
   CSS seul ne peut pas remplacer du texte. */
.app-preview .ap-t-d { display: none; }
.app-preview .ap-t-m { display: inline; }

.ap-sidebar { display: none; }

.ap-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ap-mobile-header {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ap-border);
}

.ap-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.ap-form-col,
.ap-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ap-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--ap-card);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-lg);
}

.ap-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ap-border);
}

.ap-card-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.ap-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.ap-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ap-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.ap-label-plain {
  font-size: 11px;
  font-weight: 500;
  color: var(--ap-muted-fg);
}

.ap-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  font-size: 12px;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
}

.ap-field-tall { padding: 16px 12px; align-items: flex-start; }

.ap-recent {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 11px;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
  min-width: 0;
}

.ap-chip-on {
  background-color: var(--ap-secondary);
  border-color: var(--ap-primary);
  color: var(--ap-primary);
}

.ap-chip-new {
  justify-content: center;
  border-style: dashed;
  background-color: var(--ap-bg);
  color: var(--ap-muted-fg);
}

.ap-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  background-color: var(--ap-secondary);
  color: var(--ap-secondary-fg);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ap-selected-patient {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background-color: var(--ap-secondary);
  border: 1px solid rgba(61, 107, 94, 0.3);
  border-radius: var(--ap-r-md);
  min-width: 0;
}

.ap-doctors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ap-doctor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  text-align: center;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
}

.ap-doctor-on {
  background-color: var(--ap-secondary);
  border-color: var(--ap-primary);
}

.ap-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ap-slot {
  padding: 6px 2px;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
}

.ap-slot-on {
  background-color: var(--ap-primary);
  border-color: var(--ap-primary);
  color: var(--ap-primary-fg);
}

.ap-slot-off {
  color: var(--ap-muted-fg);
  border-color: transparent;
  opacity: 0.4;
}

.ap-priorities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ap-priority {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
}

.ap-priority-on {
  background-color: var(--ap-secondary);
  border-color: var(--ap-primary);
  color: var(--ap-primary);
}

.ap-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ap-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  text-align: center;
}

.ap-cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  font-size: 11px;
  background-color: var(--ap-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
}

.ap-cal-day-empty { background: none; border: none; }
.ap-cal-day-off { background-color: var(--ap-muted); color: var(--ap-muted-fg); border-color: transparent; opacity: 0.4; }
.ap-cal-day-on { background-color: var(--ap-primary); border-color: var(--ap-primary); color: var(--ap-primary-fg); font-weight: 700; }

.ap-recap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background-color: var(--ap-fg);
  border-radius: var(--ap-r-lg);
}

.ap-recap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--ap-bg);
  opacity: 0.8;
}

.ap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 700;
  background-color: var(--ap-primary);
  color: var(--ap-primary-fg);
  border: 1px solid var(--ap-primary);
  border-radius: var(--ap-r-md);
}

.ap-btn-ghost {
  background-color: var(--ap-input);
  border-color: var(--ap-border);
  color: var(--ap-fg);
  font-weight: 500;
  padding: 9px 16px;
}

.ap-ctas {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ≥640px : les grilles serrées du mock mobile respirent avant la bascule
   desktop, sinon 4 cartes médecin sur 2 colonnes occupent une tablette
   entière pour rien. */
@media (min-width: 640px) {
  .ap-doctors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ap-slots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ap-recent { flex-direction: row; flex-wrap: wrap; }
  .ap-chip { flex: 1 1 180px; }
}

/* ≥1024px : mise en page du mock desktop — barre latérale, barre du haut,
   colonne formulaire + rail de 288px. */
@media (min-width: 1024px) {
  .app-preview .ap-desktop-only { display: flex; }
  .app-preview .ap-mobile-only { display: none; }
  .app-preview .ap-t-d { display: inline; }
  .app-preview .ap-t-m { display: none; }

  .ap-sidebar {
    display: flex;
    flex-direction: column;
    width: 224px;
    flex-shrink: 0;
    background-color: var(--ap-sidebar);
    color: var(--ap-sidebar-fg);
  }

  .ap-topbar {
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--ap-border);
  }

  .ap-body {
    flex-direction: row;
    gap: 24px;
    padding: 24px 32px;
  }

  .ap-form-col,
  .ap-rail { gap: 20px; }

  /* Sans `flex: 1` la colonne se dimensionne sur son contenu : elle remplit
     aujourd'hui parce que son texte le plus long dépasse la place
     disponible, ce qui est un accident, pas une règle. */
  .ap-form-col { flex: 1; }

  .ap-rail {
    width: 288px;
    flex-shrink: 0;
  }

  /* En-tête « Nouveau rendez-vous » + paire Annuler/Confirmer. À 1024px la
     colonne formulaire ne fait que ~374px : sans enroulement, le groupe de
     boutons (flex-shrink: 0, ~285px) écrasait le titre sur trois lignes et
     le sous-titre sur un mot par ligne. Même famille de défaut que le nom de
     clinique du journal d'activité corrigé le 2026-08-09. */
  .ap-page-head { flex-wrap: wrap; gap: 12px; }
  .ap-page-head > :first-child { flex: 1 1 260px; min-width: 0; }

  .ap-card-head { padding: 14px 20px; }
  .ap-card-body { padding: 20px; gap: 16px; }
  .ap-field { font-size: 13px; padding: 10px 12px; }
  .ap-chip { font-size: 12px; flex: 0 1 auto; }
  .ap-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ap-priorities {
    display: flex;
    flex-wrap: wrap;
  }
  /* Le mock desktop pose « Priorité » à gauche des puces, pas au-dessus. */
  .ap-group-priority {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

/* Entre 1024 et 1279px, barre latérale (224px) et rail (288px) laissent une
   colonne formulaire trop étroite pour quatre cartes médecin : « Dr. Coulibaly
   A. » s'y coupait sur trois lignes. Le mock Banani est dessiné à 1440px, où
   la question ne se pose pas. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .ap-doctors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Payment provider badges: lift on hover */
.landing-payment-badge {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background-color: var(--lp-bg-alt);
  border: 1px solid var(--lp-border);
  color: var(--lp-fg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.landing-payment-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Image zoom-on-hover frames (hero + showcase photos) */
.landing-img-zoom img {
  transition: transform 0.4s ease;
}
.landing-img-zoom:hover img {
  transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
  .landing-entrance > * { animation: none; opacity: 1; transform: none; }
  .landing-reveal { transition: none; opacity: 1; transform: none; }
  .landing-btn-lift:hover,
  .landing-card-lift:hover,
  .landing-pill-hover:hover,
  .landing-payment-badge:hover,
  .landing-logo-mark:hover,
  .landing-img-zoom:hover img {
    transform: none;
  }
}

/* ===== Shared root page wrapper (Patients, Pharmacy, Laboratory, Prescriptions) ===== */
.app-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background-color: var(--bg-primary);
  min-height: calc(100vh - var(--header-height));
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .app-page {
    padding: 1rem 0.875rem;
    gap: 1.15rem;
  }
}

/* ===== Shared page-header primary CTA button (Ajouter/Nouveau buttons) ===== */
@media (max-width: 640px) {
  .page-cta-btn {
    padding: 8px 14px !important;
    font-size: 0.8rem !important;
  }
}

/* ===== Shared page-header search/actions toolbar (Patients, Pharmacy, Laboratory, Prescriptions) ===== */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-search-box {
  position: relative;
  width: 280px;
  max-width: 100%;
}

@media (max-width: 640px) {
  .page-header-actions {
    width: 100%;
  }
  .page-search-box {
    flex: 1 1 auto;
    width: auto;
  }
}

/* ===== Dashboard Mobile Responsive Styles ===== */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background-color: var(--bg-primary);
  min-height: calc(100vh - var(--header-height));
  box-sizing: border-box;
}

.dashboard-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-top-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.dashboard-appt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dashboard-appt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  transition: var(--transition);
}

/* Media Queries for Mobile & Tablet */
@media (max-width: 992px) {
  .dashboard-container {
    padding: 1rem !important;
  }
  .dashboard-main-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.85rem !important;
  }
}

@media (max-width: 640px) {
  .dashboard-top-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .dashboard-top-right {
    width: 100% !important;
  }
  .dashboard-top-right > div:first-child {
    flex: 1 !important;
    width: 100% !important;
  }
  .dashboard-quick-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .dashboard-quick-actions button {
    width: 100% !important;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    justify-content: center !important;
  }
  .dashboard-trial-badge {
    grid-column: 1 / -1 !important;
    margin-left: 0 !important;
  }
  .dashboard-stats-grid {
    grid-template-columns: 1fr !important;
  }
  .dashboard-legend {
    display: none !important;
  }
  .dashboard-appt-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .dashboard-appt-row {
    padding: 10px 12px !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
}

/* ===== Platform Admin — Banani pixel-parity tokens =====
   Fixed light palette independent of the app-wide dark/light toggle: this is
   a separate operator console (own dark sidebar already, see
   PlatformAdminPage.tsx), not a clinic-facing themed page, so it doesn't
   need to track the visitor's theme preference the way the rest of the app
   does. Values copied verbatim from the Banani flow's shared style.css. */
.platform-admin-shell {
  --bg-primary: #F4F3F0;
  --bg-secondary: #FFFFFF;
  --text-primary: #1E2A2A;
  --text-secondary: #1E2A2A;
  --text-muted: #7A8585;
  --border: #D6D2CB;
  --border-focus: rgba(61, 107, 94, 0.35);
  --success: hsl(163, 40%, 36%);
  --success-light: rgba(61, 138, 106, 0.15);
  --warning: hsl(30, 65%, 43%);
  --warning-light: rgba(212, 129, 58, 0.15);
  --danger: hsl(6, 64%, 45%);
  --danger-light: rgba(192, 57, 43, 0.15);
  --info: var(--primary);
  --info-light: var(--brand-50);

  /* La console est claire en permanence : elle doit donc redéclarer les fonds
     sémantiques, sinon le thème sombre de l'application lui envoie ses propres
     surfaces foncées à l'intérieur d'une interface claire. */
  --success-surface: hsl(152, 55%, 95%);
  --success-ink: hsl(152, 60%, 24%);
  --warning-surface: hsl(38, 92%, 95%);
  --warning-ink: hsl(30, 80%, 30%);
  --danger-surface: hsl(0, 86%, 96%);
  --danger-ink: hsl(0, 65%, 40%);
  --info-surface: hsl(199, 89%, 95%);
  --info-ink: hsl(201, 90%, 27%);
  --brand-soft: var(--brand-50);
  --brand-soft-ink: var(--brand-700);
  --brand-line: var(--brand-200);

  /* La console garde son fond papier, hérité de la maquette Banani et assumé :
     c'est l'outil de l'exploitant, pas une page vue par une clinique. En
     revanche elle ne garde plus son propre vert ni sa propre police. Elle
     avait hsl(163 27% 33%) là où l'application a hsl(163 44% 24%) : deux verts
     à un clic d'écart, pour aucune raison. */
  --primary-h: 163;
  --primary-s: 44%;
  --primary-l: 24%;
  --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --primary-rgb: 30, 77, 64;
  --primary-hover: var(--brand-700);
  --primary-light: var(--brand-50);
}

/* Console dense : une carte qui contient un tableau de vingt lignes ne doit
   pas sauter de 4px au survol (.card:hover global). Le relief au survol reste,
   par l'ombre seule. */
.platform-admin-shell .card:hover {
  transform: none;
}

/* .table-container apporte sa propre bordure + rayon + ombre ; posé dans une
   .card qui en a déjà, cela dessinait un double cadre. */
.platform-admin-shell .card > .table-container {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
}

.platform-admin-shell input,
.platform-admin-shell select,
.platform-admin-shell button {
  font-family: var(--font-primary);
}

/* Banani badges/pills are rounded-md (6px), not the app-wide full-pill shape */
.platform-admin-shell .badge {
  border-radius: 6px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
  font-size: 0.72rem;
}

.platform-admin-shell .filter-pill {
  border-radius: 6px !important;
}

/* Real <th>/<td> styling — these tables are bare <table> elements (no
   .custom-table class), so without this they fall back to UA defaults */
.platform-admin-shell table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.platform-admin-shell thead tr {
  background-color: #ECEAE5; /* Banani --color-input */
}
.platform-admin-shell th {
  padding: 0.75rem 1.1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.platform-admin-shell td {
  padding: 0.75rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.platform-admin-shell tbody tr:last-child td {
  border-bottom: none;
}

/* Stat-card icon box — Banani wraps each stat icon in a small tinted square */
.platform-admin-shell .stat-icon-box {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  background-color: #D4E0DC;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Barre latérale collante à partir de 900px. La liste des cliniques dépasse
   de loin la hauteur d'un écran, et la nav défilait avec la page : au milieu
   du tableau il ne restait qu'une colonne sombre vide, et il fallait remonter
   tout en haut pour changer de section. align-self: flex-start est
   indispensable — un élément flex étiré (comportement par défaut, stretch) ne
   peut pas coller. overflow-y sur la barre elle-même : sur un écran de 600px
   de haut, les neuf entrées plus le pied dépassent les 100vh. */
@media (min-width: 900px) {
  .platform-admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    overflow-y: auto;
  }
}

@media (max-width: 640px) {
  .platform-admin-shell th,
  .platform-admin-shell td {
    padding: 0.6rem 0.7rem;
    font-size: 0.78rem;
  }
  /* Les cartes sans padding en ligne (Rapports, Sécurité, Config. système)
     gardaient les 1.75rem de .card : 56px de marges perdues sur 375px. */
  .platform-admin-shell .card {
    padding: 1rem;
  }
  /* Cibles tactiles : les pastilles de filtre et les boutons « Gérer » des
     tableaux tombaient autour de 24-30px de haut, sous le minimum de 44px. */
  .platform-admin-shell .filter-pill,
  .platform-admin-shell .btn-outline,
  .platform-admin-shell .page-cta-btn {
    min-height: 40px;
  }
}

/* Sous 640px, les tableaux d'exploitation (.platform-table) deviennent des
   fiches empilées. Le défilement horizontal reste la solution pour les
   journaux de Sécurité et Rapports — données courtes et chronologiques, qui se
   lisent en grille — mais sur huit colonnes et 375px de large il ne se lit
   pas, il se déchiffre : on fait glisser pour trouver le statut, puis on
   revient pour savoir de quelle clinique il s'agissait.
   Chaque cellule porte son intitulé en data-label, repris ici en ::before :
   pas de second balisage mobile à maintenir en parallèle du tableau. */
@media (max-width: 640px) {
  .platform-admin-shell .platform-table {
    min-width: 0 !important;
  }
  .platform-admin-shell .platform-table thead {
    display: none;
  }
  .platform-admin-shell .platform-table,
  .platform-admin-shell .platform-table tbody,
  .platform-admin-shell .platform-table tr,
  .platform-admin-shell .platform-table td {
    display: block;
    width: 100%;
  }
  .platform-admin-shell .platform-table tr {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border);
  }
  .platform-admin-shell .platform-table tbody tr:last-child {
    border-bottom: none;
  }
  .platform-admin-shell .platform-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border: none;
    font-size: 0.82rem;
  }
  .platform-admin-shell .platform-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
  }
  /* Première cellule = titre de la fiche : le nom de la clinique ou le sujet
     du ticket se passe d'intitulé. */
  .platform-admin-shell .platform-table td:first-child {
    display: block;
    font-size: 0.9rem;
    padding-bottom: 6px;
  }
  .platform-admin-shell .platform-table td:first-child::before {
    content: none;
  }
  /* Cellule vide — colonne « Illimité » d'une clinique ordinaire, colonne
     d'action sur sa propre ligne : pas de ligne fantôme réduite à son
     intitulé. */
  .platform-admin-shell .platform-table td:empty {
    display: none;
  }
  /* Les lignes dépliées par « Gérer » couvrent toutes les colonnes : elles
     gardent leur bloc de commandes, la mise en fiche n'a pas de sens ici. */
  .platform-admin-shell .platform-table td[colspan] {
    display: block;
  }
  .platform-admin-shell .platform-table td[colspan]::before {
    content: none;
  }
}

/* Mobile-first responsive shell — Banani's mockup is desktop-only
   (screenSize: 'desktop'), so this collapse pattern is our own design
   decision: sidebar becomes a horizontal scrollable icon strip under
   900px instead of a fixed 240px column, matching the mobile nav pattern
   already used by the real clinic Sidebar (MobileQuickActionsBar). */
@media (max-width: 899px) {
  .platform-admin-shell {
    flex-direction: column !important;
  }
  .platform-admin-sidebar {
    width: 100% !important;
    min-height: auto !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    /* Même raison qu'en desktop : la nav doit rester atteignable en cours de
       défilement d'un tableau. 50 passe sous la barre d'actions mobile (90)
       et sous les toasts (1000). */
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
  }
  /* Le bloc qui porte l'en-tête et la nav est un élément flex comme un autre :
     sans ceci il se comprimait au lieu de laisser la barre défiler, et les
     libellés se tronquaient au milieu. */
  .platform-admin-sidebar > div {
    flex-shrink: 0;
  }
  .platform-admin-sidebar-header {
    display: none !important;
  }
  .platform-admin-sidebar-nav {
    flex-direction: row !important;
    padding: 0.5rem 0.6rem !important;
    gap: 4px !important;
  }
  .platform-admin-sidebar-nav button,
  .platform-admin-sidebar-nav .coming-soon-item {
    flex-direction: column !important;
    gap: 3px !important;
    font-size: 0.62rem !important;
    padding: 8px !important;
    white-space: nowrap !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    min-height: 44px;
    justify-content: center !important;
  }
  .platform-admin-sidebar-divider {
    display: none !important;
  }
  /* Footer stays visible (it's the only way to exit the console / log out)
     but becomes a compact horizontal action pair instead of a stacked block */
  .platform-admin-sidebar-footer {
    flex-direction: row !important;
    border-top: none !important;
    padding: 0.5rem 0.6rem !important;
    gap: 4px !important;
    flex-shrink: 0;
  }
  .platform-admin-sidebar-footer button {
    flex-direction: column !important;
    gap: 3px !important;
    font-size: 0.58rem !important;
    line-height: 1.15 !important;
    padding: 6px 6px !important;
    white-space: normal !important;
    text-align: center !important;
    max-width: 72px !important;
    flex-shrink: 0 !important;
    min-height: 44px;
    justify-content: center !important;
  }
  .platform-admin-sidebar-username {
    display: none !important;
  }
  .platform-admin-main-header {
    padding: 1rem 1.25rem !important;
  }
  .platform-admin-main-body {
    padding: 1rem 1.25rem !important;
  }
}

/* Un libellé de mois sur deux sous 480px (voir BarChart.tsx). visibility et
   non display : la largeur de chaque case reste celle de sa barre, sinon les
   libellés restants se décalent par rapport aux barres qu'ils nomment. */
@media (max-width: 480px) {
  .bar-chart-labels span:nth-child(even) {
    visibility: hidden;
  }
}

/* Après le bloc 899px, et pas avant : à spécificité et !important égaux,
   c'est l'ordre du fichier qui tranche — placé plus haut, ce padding se
   faisait écraser par celui de 1.25rem ci-dessus. */
@media (max-width: 480px) {
  .platform-admin-main-header,
  .platform-admin-main-body {
    padding: 0.85rem !important;
  }
}



