/* ============================================================
   style_v3.css — Design system ERP EFPA v3.5 « Thème manuel »
   Chargé APRÈS style.css (cohabitation, écrasement progressif).
   Toutes les règles sont scopées aux classes .v3-* afin de ne
   JAMAIS casser les vues non migrées — exceptions assumées et
   globales : tokens :root, correction AA de .muted et .footer,
   indicateur :focus-visible.
   V3.3 : mode sombre (section 10) — redéfinition des tokens
   + surcharges des fonds en dur hérités de style.css ; le mode
   clair est STRICTEMENT inchangé (régression zéro).
   V3.4 : correctif du bug de contraste des ancres-boutons
   (.v3-main a écrasait la couleur de .btn-primary/.btn-danger,
   y compris en mode sombre) + branding SIFPA (logo de la sidebar
   et lockup de la page de connexion).
   V3.5 : thème sombre MANUEL — la section 10 est préfixée
   html:not([data-theme='clair']) (bloc média) et doublée d'un bloc
   MIROIR STRICTEMENT IDENTIQUE html[data-theme='sombre'] ; la
   préférence est rendue côté serveur sur <html data-theme>
   (+ interrupteur .v3-theme-btn de la topbar).
   Sommaire :
   01. Design tokens (variables)
   02. Reset & base (typographie, liens, focus)
   03. Layout (sidebar, topbar, breadcrumbs, conteneurs)
   04. Composants (boutons, cartes, badges, alertes, dialogue…)
   05. Tableaux
   06. Formulaires
   07. États (vide, chargement, flash/toast)
   08. Utilitaires (espacement, visibilité, print-hide)
   09. Impression
   10. Mode sombre (média système + miroir forcé manuel)
   11. Tableaux modernes (V3.1)
   ============================================================ */

/* ---------- 01. Design tokens ---------- */
:root {
  /* Nuancier primaire (vert EFPA) — échelle 50→900 */
  --couleur-primaire-50:  #eef5f1;
  --couleur-primaire-100: #d6e8de;
  --couleur-primaire-200: #aed1bf;
  --couleur-primaire-300: #7fb49b;
  --couleur-primaire-400: #549377;
  --couleur-primaire-500: #2e6b4f;   /* couleur historique — inchangée */
  --couleur-primaire-600: #265842;
  --couleur-primaire-700: #1e4635;
  --couleur-primaire-800: #173529;
  --couleur-primaire-900: #10251c;

  /* Neutres chauds — le muted passe de #8b877e (3,31:1) à une teinte AA */
  --couleur-fond:        #f7f6f3;
  --couleur-surface:     #ffffff;
  --couleur-bordure:     #e3e0d8;
  --couleur-texte:       #2b2925;
  --couleur-texte-muted: #6b675e;    /* 5,9:1 sur #f7f6f3 — conforme AA */

  /* Couleurs sémantiques — toutes vérifiées ≥ 4,5:1 pour le texte */
  --couleur-succes:        #1e6b3f;
  --couleur-avertissement: #8a5a00;  /* fond ambre clair associé */
  --couleur-erreur:        #b3261e;
  --couleur-info:          #1a5a8a;

  /* Espacements — échelle 4 px */
  --espace-1: 0.25rem;  --espace-2: 0.5rem;  --espace-3: 0.75rem;
  --espace-4: 1rem;     --espace-6: 1.5rem;  --espace-8: 2rem;

  /* Rayons & ombres */
  --rayon-1: 4px;  --rayon-2: 8px;  --rayon-3: 12px;
  --ombre-1: 0 1px 2px rgb(43 41 37 / 0.08);
  --ombre-2: 0 4px 12px rgb(43 41 37 / 0.10);

  /* Typographie */
  --police: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --taille-texte: 0.9375rem;   /* 15 px — densité gestion */
  --taille-kpi: 2rem;          /* un seul chiffre pour les 14 KPI */
  --hauteur-cible: 2.25rem;    /* 36 px — cibles d'action conformes */
}

/* ---------- 02. Reset & base (typographie, liens, focus) ---------- */
/* Focus visible global — remplace l'outline à 20 % d'opacité (AA) */
:focus-visible {
  outline: 2px solid var(--couleur-primaire-500);
  outline-offset: 2px;
}

/* Correction AA du texte discret : #8b877e (3,31:1) → --couleur-texte-muted (5,9:1) */
.muted { color: var(--couleur-texte-muted); }
.footer { color: var(--couleur-texte-muted); }

/* Corps du contenu migré */
.v3-main {
  font-size: var(--taille-texte);
}
.v3-main a { color: var(--couleur-primaire-600); }

/* ---------- 03. Layout (sidebar, topbar, breadcrumbs, conteneurs) ---------- */
.v3-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.v3-sidebar {
  background: var(--couleur-surface);
  border-right: 1px solid var(--couleur-bordure);
  padding: var(--espace-4) var(--espace-3);
  overflow-y: auto;
}
.v3-brand {
  display: flex;
  align-items: center;
  gap: 10px; /* V3.4 — emblème + wordmark alignés */
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--couleur-primaire-700);
  padding: var(--espace-2) var(--espace-2) var(--espace-4);
  border-bottom: 1px solid var(--couleur-bordure);
  margin-bottom: var(--espace-3);
  white-space: nowrap;
}
/* V3.4 — emblème SIFPA : badge clair FIXE pour rester lisible
   aussi en mode sombre (pas de surcharge sombre sur cette règle) */
.v3-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f7f6f3;
  padding: 2px;
}
.v3-side-group { margin-bottom: var(--espace-4); }
.v3-side-titre {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--couleur-texte-muted);
  margin: var(--espace-2) var(--espace-2) var(--espace-1);
}
.v3-side-link {
  display: flex;
  align-items: center;
  gap: var(--espace-2);
  padding: 7px var(--espace-2);
  min-height: var(--hauteur-cible);
  border-radius: var(--rayon-1);
  color: var(--couleur-texte);
  font-size: 0.9rem;
  line-height: 1.2;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.v3-side-link:hover {
  background: var(--couleur-primaire-50);
  color: var(--couleur-primaire-700);
  text-decoration: none;
}
.v3-side-link.active {
  background: var(--couleur-primaire-100);
  border-left-color: var(--couleur-primaire-500);
  color: var(--couleur-primaire-700);
  font-weight: 600;
}
.v3-side-link .nav-ic { width: 15px; height: 15px; flex: none; opacity: 0.9; }

/* Colonne de contenu */
.v3-corps {
  display: flex;
  flex-direction: column;
  min-width: 0; /* évite le débordement des tables larges */
}

/* Topbar fine, blanche, bordure basse */
.v3-topbar {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  background: var(--couleur-surface);
  border-bottom: 1px solid var(--couleur-bordure);
  padding: 6px var(--espace-4);
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--hauteur-cible);
}
.v3-topbar .navburger {
  color: var(--couleur-texte);
  border: 1px solid var(--couleur-bordure);
}

/* Fil d'Ariane (ol/li, séparateur « › ») */
.v3-breadcrumb { flex: 1; min-width: 0; }
.v3-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--espace-1);
  list-style: none;
  font-size: 0.85rem;
}
.v3-breadcrumb li { display: flex; align-items: center; gap: var(--espace-1); }
.v3-breadcrumb li + li::before {
  content: "›";
  color: var(--couleur-texte-muted);
}
.v3-breadcrumb a { color: var(--couleur-primaire-600); }
.v3-breadcrumb [aria-current="page"] {
  color: var(--couleur-texte);
  font-weight: 600;
}

/* Zone utilisateur */
.v3-userbox {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  font-size: 0.9rem;
  white-space: nowrap;
}
.v3-userbox em {
  font-style: normal;
  color: var(--couleur-texte-muted);
}

/* Contenu principal */
.v3-main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--espace-6) var(--espace-4);
}

/* Drawer mobile : sous 960 px, la sidebar devient tiroir (checkbox hack, zéro JS) */
@media (max-width: 960px) {
  .v3-app { grid-template-columns: 1fr; }
  .v3-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--ombre-2);
  }
  #navtoggle:checked ~ .v3-sidebar { transform: translateX(0); }
  .v3-main { padding: var(--espace-4) var(--espace-3); }
  .v3-userbox span { display: none; } /* nom long masqué sur petit écran */
}

/* ---------- 04. Composants (boutons, cartes, badges, alertes…) ---------- */
/* V3.4 — Correctif BUG de contraste des ancres-boutons : la règle
   .v3-main a (spécificité 0,1,1) écrasait le color:#fff de .btn-primary /
   .btn-danger (0,1,0) de style.css → texte vert foncé illisible (~1,2:1)
   sur fond vert/rouge pour les 142 ancres-boutons des vues.
   Neutralisation à spécificité 0,2,1 (bat .v3-main a) ; contrastes vérifiés :
   blanc/#2e6b4f = 6,26:1, blanc/#a94442 = 5,82:1, #2c2a26/blanc = 14,6:1 (AA).
   Les <button> ne sont pas touchés ; le focus visible (outline primaire) est
   conservé. Correctif 100 % CSS — aucune vue modifiée. */
.v3-main a.btn { color: #2c2a26; }
.v3-main a.btn-primary { color: #fff; }
.v3-main a.btn-danger { color: #fff; }
.v3-main a.btn:hover { text-decoration: none; }

/* Bandeau « Mode test » (impersonation) — reprend les 9 propriétés
   historiquement inline du layout (couleurs inchangées) */
.v3-bandeau-test {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff3cd;
  color: #7a5b00;
  border-bottom: 2px solid #e0a800;
  padding: 8px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.v3-bandeau-test form { margin: 0; }

/* KPI — valeur unique + libellé discret (adopté par les vues en V3.1+) */
.v3-kpi {
  background: var(--couleur-surface);
  border: 1px solid var(--couleur-bordure);
  border-radius: var(--rayon-2);
  padding: var(--espace-4);
  box-shadow: var(--ombre-1);
}
.v3-kpi-valeur {
  font-size: var(--taille-kpi);
  font-weight: 700;
  color: var(--couleur-primaire-700);
  line-height: 1.1;
}
/* Note discrète à côté d'une valeur KPI (ex. « taux de réussite ») */
.v3-kpi-valeur small {
  font-size: 0.45em;
  font-weight: 400;
  color: var(--couleur-texte-muted);
}
.v3-kpi-libelle {
  color: var(--couleur-texte-muted);
  font-size: 0.85rem;
}

/* V3.3 — Boîte de confirmation native <dialog> (public/assets/app.js).
   Un seul dialogue dans le layout ; message multiligne (pre-line) ;
   le bouton Confirmer est en .btn-danger (suppressions). */
.v3-dialog {
  border: 1px solid var(--couleur-bordure);
  border-radius: var(--rayon-3);
  padding: var(--espace-6);
  max-width: 420px;
  background: var(--couleur-surface);
  color: var(--couleur-texte);
  box-shadow: var(--ombre-2);
}
.v3-dialog::backdrop { background: rgb(0 0 0 / 0.4); }
.v3-dialog-titre { font-weight: 700; margin-bottom: var(--espace-2); }
.v3-dialog-message { white-space: pre-line; margin-bottom: var(--espace-4); }
.v3-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--espace-3);
}

/* V3.5 — Interrupteur de thème (topbar, dans .v3-userbox) : bouton discret
   transparent ; la variante sombre (bordure/encre adaptées) est définie
   dans la section 10 — bloc média ET bloc miroir (y rester synchronisée). */
.v3-theme-form { display: inline-flex; margin: 0; }
.v3-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--couleur-bordure);
  border-radius: 6px;
  padding: 4px 6px;
  color: inherit;
  cursor: pointer;
}
.v3-theme-btn:hover { background: var(--couleur-primaire-50); }
.v3-theme-btn:focus-visible {
  outline: 2px solid var(--couleur-primaire-500);
  outline-offset: 2px;
}

/* V3.4 — Lockup SIFPA de la page de connexion : conteneur clair FIXE
   (même en mode sombre) pour la lisibilité du wordmark vert du logo */
.v3-login-logo {
  background: #f7f6f3;
  border: 1px solid var(--couleur-bordure, #e5e1d8);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
  text-align: center;
}
.v3-login-logo img {
  max-width: 240px;
  width: 100%;
  height: auto;
  display: inline-block;
}

/* ---------- 05. Tableaux ---------- */
/* Amorce V3.0 : l'en-tête <thead> se distingue, le composant table
   complet (sticky, overflow-x, densité) arrive en V3.1 */
.v3-main table.table thead th {
  background: var(--couleur-primaire-50);
  color: var(--couleur-primaire-800);
  border-bottom: 2px solid var(--couleur-primaire-200);
}
.v3-main table.table tbody tr:hover td { background: var(--couleur-primaire-50); }

/* ---------- 06. Formulaires ---------- */
/* Focus des champs dans le contenu migré : outline pleine (remplace
   l'outline à 20 % d'opacité de l'ancien style.css) */
.v3-app input:focus,
.v3-app select:focus,
.v3-app textarea:focus {
  outline: 2px solid var(--couleur-primaire-500);
  outline-offset: 0;
  border-color: var(--couleur-primaire-500);
}

/* V3.2 — Grille formulaires : 2 colonnes, 1 colonne sous 720 px */
.v3-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--espace-4) var(--espace-6);
  align-items: start;
}
@media (max-width: 720px) {
  .v3-form { grid-template-columns: 1fr; }
}
.v3-form .v3-champ--plein { grid-column: 1 / -1; } /* textarea, longs champs, titres */

/* Champ : label au-dessus du contrôle */
.v3-form .v3-champ label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.v3-form .v3-requis { color: var(--couleur-erreur); }
/* Groupes de cases à cocher / boutons radio en ligne */
.v3-form .v3-choix {
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace-2) var(--espace-4);
}
.v3-form .v3-choix label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  margin-bottom: 0;
}
.v3-form .v3-choix input { width: auto; margin-top: 0; }

/* Message d'erreur sous le champ */
.v3-form .v3-champ-erreur {
  color: var(--couleur-erreur);
  font-size: 0.82rem;
  margin: 4px 0 0;
}
.v3-form .v3-champ-erreur::before { content: "⚠ "; }

/* Champ en erreur : bordure rouge + fond teinté très léger */
.v3-app input.v3-input-erreur,
.v3-app select.v3-input-erreur,
.v3-app textarea.v3-input-erreur {
  border-color: var(--couleur-erreur);
  background: #fdf2f1;
}

/* Focus renforcé dans les formulaires migrés ; rouge pour les champs en erreur */
.v3-form input:focus-visible,
.v3-form select:focus-visible,
.v3-form textarea:focus-visible {
  outline: 2px solid var(--couleur-primaire-500);
  outline-offset: 0;
  box-shadow: 0 0 0 3px var(--couleur-primaire-100);
}
.v3-form input.v3-input-erreur:focus-visible,
.v3-form select.v3-input-erreur:focus-visible,
.v3-form textarea.v3-input-erreur:focus-visible {
  outline-color: var(--couleur-erreur);
  border-color: var(--couleur-erreur);
  box-shadow: 0 0 0 3px #f6d5d2;
}

/* Rangée de boutons alignée à droite */
.v3-form .v3-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--espace-3);
  margin-top: var(--espace-4);
}

/* ---------- 07. États (vide, chargement, flash/toast) ---------- */
/* Messages flash — remplacent les anciennes classes .flash (layout V3.0) */
.v3-flash {
  padding: 10px 14px;
  border-radius: var(--rayon-2);
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.v3-flash--succes {
  background: #e6f2ea;
  border-color: #b7d9c2;
  color: var(--couleur-succes);
}
.v3-flash--erreur {
  background: #fbe9e7;
  border-color: #efc5c1;
  color: var(--couleur-erreur);
}
.v3-flash--info {
  background: #e9eff5;
  border-color: #c3d2e0;
  color: var(--couleur-info);
}

/* État vide — icône + titre + texte + action (adopté par les vues en V3.1+) */
.v3-etat-vide {
  text-align: center;
  padding: var(--espace-8) var(--espace-4);
  color: var(--couleur-texte-muted);
}
.v3-etat-vide .v3-etat-vide-icone {
  width: 32px;
  height: 32px;
  opacity: 0.6;
  margin-bottom: var(--espace-2);
}
.v3-etat-vide .v3-etat-vide-titre {
  font-weight: 600;
  color: var(--couleur-texte);
  margin-bottom: var(--espace-1);
}
.v3-etat-vide .v3-etat-vide-action { margin-top: var(--espace-3); }

/* ---------- 08. Utilitaires (espacement, visibilité, print-hide) ---------- */
.v3-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.v3-texte-muted { color: var(--couleur-texte-muted); }
.v3-mt-2 { margin-top: var(--espace-2); }
.v3-mt-4 { margin-top: var(--espace-4); }

/* V3.3 — Utilitaires de finition (remplacement des styles inline) */
/* Marges */
.v3-m-0 { margin: 0; }
.v3-mv-1 { margin: var(--espace-1) 0; }
.v3-mv-2 { margin: var(--espace-2) 0; }
.v3-mv-3 { margin: var(--espace-3) 0; }
.v3-mv-4 { margin: var(--espace-4) 0; }
.v3-mt-1 { margin-top: var(--espace-1); }
.v3-mt-3 { margin-top: var(--espace-3); }
.v3-mt-6 { margin-top: var(--espace-6); }
.v3-mb-2 { margin-bottom: var(--espace-2); }
.v3-mb-3 { margin-bottom: var(--espace-3); }
/* Formulaire d'action dans une cellule de tableau / fil d'actions */
.v3-form-inline { display: inline; margin: 0; }
/* Barres de filtres / d'actions (formulaires GET, rangées flex) */
.v3-barre-filtres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace-2) var(--espace-3);
  align-items: flex-end;
}
/* Rangée flex centrée verticalement (actions courtes) */
.v3-ligne-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace-2);
  align-items: center;
}
/* Groupe inline sans alignement forcé (radios, bascules de vue) */
.v3-groupe-inline { display: flex; flex-wrap: wrap; gap: var(--espace-3); }
/* Champ élastique dans une barre flex */
.v3-champ-flex { flex: 1; min-width: 260px; }
.v3-champ-large { min-width: 280px; }
.v3-auto-centre { align-self: center; }
/* Largeurs de cartes (remplacent les max-width inline) */
.v3-carte--etroite { max-width: 480px; }
.v3-carte--moyenne { max-width: 640px; }
.v3-carte--large { max-width: 960px; }
/* Texte */
.v3-centre { text-align: center; }
.v3-petit { font-size: 0.8rem; }
/* Largeurs fixes (colonnes de tables, champs courts) */
.v3-w-auto { width: auto; }
.v3-w-26 { width: 26px; }
.v3-w-60 { width: 60px; }
.v3-w-70 { width: 70px; }
.v3-w-80 { width: 80px; }
.v3-w-90 { width: 90px; }
.v3-w-100 { width: 100px; }
.v3-w-110 { width: 110px; }
.v3-w-120 { width: 120px; }
.v3-w-140 { width: 140px; }
.v3-w-160 { width: 160px; }
.v3-w-200 { width: 200px; }
.v3-w-220 { width: 220px; }
.v3-w-240 { width: 240px; }
.v3-w-280 { width: 280px; }
.v3-wmax-120 { max-width: 120px; }
/* Cellule longue tronquée avec ellipse (audit) */
.v3-tronque {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* <summary> déguisé en bouton + panneau d'édition dépliable */
summary.v3-summary { display: inline-block; cursor: pointer; }
.v3-details-inline { display: inline-block; }
.v3-panneau {
  border: 1px solid #e5e1d8;
  border-radius: 6px;
  padding: 10px;
  margin-top: 6px;
  min-width: 260px;
}
/* Formulaire d'édition flottant (details ouvert, ex. édition de salle) */
.v3-panneau-flottant { position: absolute; z-index: 5; min-width: 430px; }
/* Grilles de saisie hors .v3-form (fiche formateur) */
.v3-grille-fiche {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-width: 1100px;
}
.v3-pleine-largeur { grid-column: 1 / -1; }
.v3-grille-coches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 12px;
  max-width: 1100px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #e5e1d8;
  border-radius: 6px;
  padding: 8px;
}
.v3-fieldset {
  border: 1px solid #cfcabf;
  border-radius: 6px;
  padding: 6px 10px;
}
.v3-input-compact { padding: 3px 6px; font-size: 0.8rem; }
/* Codes de récupération 2FA (grille monospace) */
.v3-codes-recuperation {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 12px 0;
  font-family: monospace;
  font-size: 1.1rem;
}
.v3-code-bloc {
  background: #f0ede6;
  padding: 6px 10px;
  border-radius: 4px;
  text-align: center;
}
/* Bloc QR : le fond BLANC est voulu (lisibilité du QR), même en mode sombre */
.v3-qr-bloc {
  background: #fff;
  display: inline-block;
  padding: 10px;
  border: 1px solid #e5e1d8;
  border-radius: 6px;
}
/* Carte d'avertissement ambre (changement de mot de passe obligatoire) */
.v3-alerte-importante { border-color: #ecd9a8; background: #fdf3e0; }
/* Lignes de prévisualisation d'import (statut par ligne) */
.v3-ligne-ok { background: #e6f2ea; }
.v3-ligne-alerte { background: #fdf3e0; }
.v3-ligne-erreur { background: #fbe9e7; }
/* Ligne désactivée (module/promotion inactif) */
.v3-inactif { opacity: 0.6; }
.v3-liste-compacte { margin: var(--espace-1) 0; padding-left: 18px; }
.v3-sparkline { max-width: 100%; display: block; }
/* Marqueur sémantique : élément masqué à l'impression (voir section 09) */
.v3-imprimable-cache { /* aucun style écran — la règle @media print le masque */ }

/* ---------- 09. Impression ---------- */
/* Chrome applicatif masqué ; les vues d'impression autonomes (layout vide)
   ne sont pas concernées. V3.3 : impression globale complétée — actions de
   formulaire, pagination, barres de filtres et les classes historiques
   .noprint (8 occ.) / .no-print (11 occ.) sont masquées ; corps ≥ 11 pt ;
   tableaux sans ombre ni rayon, wrap déplié (toutes les lignes imprimées). */
@media print {
  .v3-sidebar,
  .v3-topbar,
  .v3-breadcrumb,
  .v3-bandeau-test,
  .v3-form-actions,
  .v3-pagination,
  .v3-barre-filtres,
  .v3-imprimable-cache,
  .noprint,
  .no-print { display: none; }
  .v3-app { display: block; }
  .v3-main { max-width: none; padding: 0; }
  body { font-size: 11pt; }
  .v3-table-wrap {
    overflow: visible;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
  }
  .v3-table-wrap .table { min-width: 0; }
  table.table, .card, .v3-kpi { box-shadow: none; }
}

/* ---------- 10. Mode sombre (V3.3 — préférence système ; V3.5 — forçage manuel) ---------- */
/* Deux blocs aux déclarations STRICTEMENT IDENTIQUES (mêmes déclarations,
   même ordre ; seul le préfixe de sélecteur change) :
   1. bloc MÉDIA @media (prefers-color-scheme: dark) — chaque règle est
      préfixée html:not([data-theme='clair']) : le thème forcé « clair »
      (V3.5) désactive le mode sombre même si le système le demande ;
   2. bloc MIROIR html[data-theme='sombre'] — thème forcé « sombre » (V3.5),
      appliqué quelle que soit la préférence système.
   ⚠ TOUTE MODIFICATION du bloc média doit être REPORTÉE dans le bloc
   miroir (et inversement).
   Redéfinition UNIQUEMENT des tokens + surcharges des fonds en dur hérités
   de style.css : le mode clair reste strictement inchangé.
   Contrastes mesurés (luminance relative WCAG) :
   texte #e8e6e0 / fond #181c1a = 13,8:1 ; muted #a9a59a / fond = 7,0:1 ;
   primaire-500 #7fb49b / fond = 7,3:1 — tous ≥ 4,5:1. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme='clair']) {
    /* Nuancier primaire inversé : les teintes claires deviennent des fonds
       profonds, la teinte de référence est éclaircie d'un cran (500 = ancien
       300/400) pour rester ≥ 4,5:1 sur les fonds sombres */
    --couleur-primaire-50:  #1f2a24;
    --couleur-primaire-100: #263a2f;
    --couleur-primaire-200: #3d5c4b;
    --couleur-primaire-300: #549377;
    --couleur-primaire-400: #6aa58b;
    --couleur-primaire-500: #7fb49b;   /* 7,3:1 sur --couleur-fond */
    --couleur-primaire-600: #8fc3a9;   /* liens — 8,7:1 sur --couleur-fond */
    --couleur-primaire-700: #a9cfba;
    --couleur-primaire-800: #cfe0d4;
    --couleur-primaire-900: #e4efe8;

    /* Neutres sombres chauds */
    --couleur-fond:        #181c1a;
    --couleur-surface:     #212826;
    --couleur-bordure:     #3a423d;
    --couleur-texte:       #e8e6e0;    /* 13,8:1 sur --couleur-fond */
    --couleur-texte-muted: #a9a59a;    /* 7,0:1 sur --couleur-fond — AA */

    /* Couleurs sémantiques éclaircies (texte sur fonds sombres) */
    --couleur-succes:        #7fcfa0;
    --couleur-avertissement: #e0b45c;
    --couleur-erreur:        #f09a92;
    --couleur-info:          #8fbfdc;

    /* Ombres renforcées (le flou clair disparaît sur fond sombre) */
    --ombre-1: 0 1px 2px rgb(0 0 0 / 0.40);
    --ombre-2: 0 4px 12px rgb(0 0 0 / 0.50);
  }

  /* Fonds en dur hérités de style.css (v2) — surcharges scopées */
  html:not([data-theme='clair']) body { background: var(--couleur-fond); color: var(--couleur-texte); }
  html:not([data-theme='clair']) a { color: var(--couleur-primaire-600); }
  html:not([data-theme='clair']) h1, html:not([data-theme='clair']) h2 { color: var(--couleur-primaire-800); }
  html:not([data-theme='clair']) .card, html:not([data-theme='clair']) .login-card {
    background: var(--couleur-surface);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) .card h3, html:not([data-theme='clair']) .login-card h1 { color: var(--couleur-primaire-500); }
  html:not([data-theme='clair']) .btn {
    background: var(--couleur-surface);
    color: var(--couleur-texte);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) .btn:hover { background: var(--couleur-primaire-50); }
  html:not([data-theme='clair']) .btn-primary:hover { background: #2e6b4f; }
  /* V3.4 — Restauration de l'affordance des boutons remplis : la règle .btn
     sombre ci-dessus égalise la spécificité de .btn-primary / .btn-danger et
     gagne par ordre (le bouton perdait son fond vert/rouge). Surcharge à
     spécificité supérieure APRÈS la règle .btn ; les ancres-boutons de
     .v3-main sont couvertes dans la même règle. Contrastes conservés ≥ 4,5:1. */
  html:not([data-theme='clair']) .btn-primary, html:not([data-theme='clair']) .v3-main a.btn-primary { background:#2e6b4f; border-color:#2e6b4f; color:#fff; }
  html:not([data-theme='clair']) .btn-primary:hover, html:not([data-theme='clair']) .v3-main a.btn-primary:hover { background:#265741; color:#fff; }
  html:not([data-theme='clair']) .btn-danger, html:not([data-theme='clair']) .v3-main a.btn-danger { background:#a94442; border-color:#a94442; color:#fff; }
  html:not([data-theme='clair']) .btn-danger:hover, html:not([data-theme='clair']) .v3-main a.btn-danger:hover { background:#8f3a38; color:#fff; }
  html:not([data-theme='clair']) input[type=text], html:not([data-theme='clair']) input[type=email], html:not([data-theme='clair']) input[type=password], html:not([data-theme='clair']) input[type=number], html:not([data-theme='clair']) input[type=date], html:not([data-theme='clair']) select, html:not([data-theme='clair']) textarea {
    background: var(--couleur-surface);
    color: var(--couleur-texte);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) table.table { background: var(--couleur-surface); }
  html:not([data-theme='clair']) table.table th, html:not([data-theme='clair']) table.table td { border-color: var(--couleur-bordure); }
  html:not([data-theme='clair']) table.table th { background: var(--couleur-primaire-50); color: var(--couleur-primaire-800); }
  html:not([data-theme='clair']) table.table tr:nth-child(even) td { background: #1c2220; }

  /* Badges sémantiques (style.css) : fonds sombres teintés, textes clairs */
  html:not([data-theme='clair']) .badge-R { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .badge-E { background: #3d1f1d; color: #f0a49c; }
  html:not([data-theme='clair']) .badge-A { background: #3a2e12; color: #e3c37c; }
  html:not([data-theme='clair']) .badge-Aba { background: #2c2f2d; color: #b3b0a6; }
  html:not([data-theme='clair']) .badge-I { background: #1c2a3a; color: #9dc3e0; }

  /* Étapes (imports admissions) */
  html:not([data-theme='clair']) .steps .step { background: #2a2f2c; color: var(--couleur-texte-muted); }
  html:not([data-theme='clair']) .steps .step.active { background: #2e6b4f; color: #fff; }
  html:not([data-theme='clair']) .steps .step.done { background: #1d3a2a; color: #8fd0a8; }

  /* Flashs V3 (fonds en dur de la section 07) */
  html:not([data-theme='clair']) .v3-flash--succes { background: #15301f; border-color: #2a5a3c; }
  html:not([data-theme='clair']) .v3-flash--erreur { background: #381c19; border-color: #6b322c; }
  html:not([data-theme='clair']) .v3-flash--info { background: #16232f; border-color: #2c4a6e; }

  /* Bandeau « Mode test » (ambre sombre) */
  html:not([data-theme='clair']) .v3-bandeau-test { background: #3a2e12; color: #e3c37c; border-bottom-color: #8a6d1f; }

  /* Champs en erreur (fonds teintés de la section 06) */
  html:not([data-theme='clair']) .v3-app input.v3-input-erreur, html:not([data-theme='clair']) .v3-app select.v3-input-erreur, html:not([data-theme='clair']) .v3-app textarea.v3-input-erreur { background: #2f1d1b; }
  html:not([data-theme='clair']) .v3-form input.v3-input-erreur:focus-visible, html:not([data-theme='clair']) .v3-form select.v3-input-erreur:focus-visible, html:not([data-theme='clair']) .v3-form textarea.v3-input-erreur:focus-visible { box-shadow: 0 0 0 3px #5a2a26; }

  /* Utilitaires V3.3 à fond en dur (légers en clair → profonds en sombre) */
  html:not([data-theme='clair']) .v3-panneau, html:not([data-theme='clair']) .v3-grille-coches { border-color: var(--couleur-bordure); }
  html:not([data-theme='clair']) .v3-fieldset { border-color: var(--couleur-bordure); }
  html:not([data-theme='clair']) .v3-code-bloc { background: #2a2f2c; }
  html:not([data-theme='clair']) .v3-alerte-importante { background: #3a2e12; border-color: #8a6d1f; }
  html:not([data-theme='clair']) .v3-ligne-ok { background: #173626; }
  html:not([data-theme='clair']) .v3-ligne-alerte { background: #3a2e12; }
  html:not([data-theme='clair']) .v3-ligne-erreur { background: #3d1f1d; }
  /* Interrupteur de thème V3.5 : bordure et encre adaptées aux fonds sombres */
  html:not([data-theme='clair']) .v3-theme-btn { border-color: var(--couleur-bordure); color: var(--couleur-texte); }
  /* Missions des référents (V3.8) — miroir sombre des règles de couleur de la section 12 */
  html:not([data-theme='clair']) .v3-badge-mission--a-faire   { background: #2c2f2d; color: #b3b0a6; }
  html:not([data-theme='clair']) .v3-badge-mission--en-cours  { background: #1c2a3a; color: #9dc3e0; }
  html:not([data-theme='clair']) .v3-badge-mission--transmise { background: #3a2e12; color: #e3c37c; }
  html:not([data-theme='clair']) .v3-badge-mission--validee   { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .v3-badge-mission--a-refaire { background: #3d1f1d; color: #f0a49c; }
  html:not([data-theme='clair']) .v3-badge-retard { background: #6b2a26; color: #f3c3bd; }
  html:not([data-theme='clair']) .v3-badge-nav { background: var(--couleur-primaire-200); color: var(--couleur-primaire-900); }
  html:not([data-theme='clair']) table.table tr.v3-ligne-region td { background: var(--couleur-primaire-50); color: var(--couleur-primaire-800); }
  /* NB : .v3-qr-bloc RESTE blanc — un QR doit garder un fond clair lisible */
}

/* Bloc MIROIR (thème forcé « sombre », V3.5) — STRICTEMENT IDENTIQUE au
   bloc média ci-dessus : mêmes déclarations, même ordre ; seul le préfixe
   de sélecteur change. Toute modification doit être reportée dans les deux. */
html[data-theme='sombre'] {
  /* Nuancier primaire inversé : les teintes claires deviennent des fonds
     profonds, la teinte de référence est éclaircie d'un cran (500 = ancien
     300/400) pour rester ≥ 4,5:1 sur les fonds sombres */
  --couleur-primaire-50:  #1f2a24;
  --couleur-primaire-100: #263a2f;
  --couleur-primaire-200: #3d5c4b;
  --couleur-primaire-300: #549377;
  --couleur-primaire-400: #6aa58b;
  --couleur-primaire-500: #7fb49b;   /* 7,3:1 sur --couleur-fond */
  --couleur-primaire-600: #8fc3a9;   /* liens — 8,7:1 sur --couleur-fond */
  --couleur-primaire-700: #a9cfba;
  --couleur-primaire-800: #cfe0d4;
  --couleur-primaire-900: #e4efe8;

  /* Neutres sombres chauds */
  --couleur-fond:        #181c1a;
  --couleur-surface:     #212826;
  --couleur-bordure:     #3a423d;
  --couleur-texte:       #e8e6e0;    /* 13,8:1 sur --couleur-fond */
  --couleur-texte-muted: #a9a59a;    /* 7,0:1 sur --couleur-fond — AA */

  /* Couleurs sémantiques éclaircies (texte sur fonds sombres) */
  --couleur-succes:        #7fcfa0;
  --couleur-avertissement: #e0b45c;
  --couleur-erreur:        #f09a92;
  --couleur-info:          #8fbfdc;

  /* Ombres renforcées (le flou clair disparaît sur fond sombre) */
  --ombre-1: 0 1px 2px rgb(0 0 0 / 0.40);
  --ombre-2: 0 4px 12px rgb(0 0 0 / 0.50);
}

/* Fonds en dur hérités de style.css (v2) — surcharges scopées */
html[data-theme='sombre'] body { background: var(--couleur-fond); color: var(--couleur-texte); }
html[data-theme='sombre'] a { color: var(--couleur-primaire-600); }
html[data-theme='sombre'] h1, html[data-theme='sombre'] h2 { color: var(--couleur-primaire-800); }
html[data-theme='sombre'] .card, html[data-theme='sombre'] .login-card {
  background: var(--couleur-surface);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] .card h3, html[data-theme='sombre'] .login-card h1 { color: var(--couleur-primaire-500); }
html[data-theme='sombre'] .btn {
  background: var(--couleur-surface);
  color: var(--couleur-texte);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] .btn:hover { background: var(--couleur-primaire-50); }
html[data-theme='sombre'] .btn-primary:hover { background: #2e6b4f; }
/* V3.4 — Restauration de l'affordance des boutons remplis : la règle .btn
   sombre ci-dessus égalise la spécificité de .btn-primary / .btn-danger et
   gagne par ordre (le bouton perdait son fond vert/rouge). Surcharge à
   spécificité supérieure APRÈS la règle .btn ; les ancres-boutons de
   .v3-main sont couvertes dans la même règle. Contrastes conservés ≥ 4,5:1. */
html[data-theme='sombre'] .btn-primary, html[data-theme='sombre'] .v3-main a.btn-primary { background:#2e6b4f; border-color:#2e6b4f; color:#fff; }
html[data-theme='sombre'] .btn-primary:hover, html[data-theme='sombre'] .v3-main a.btn-primary:hover { background:#265741; color:#fff; }
html[data-theme='sombre'] .btn-danger, html[data-theme='sombre'] .v3-main a.btn-danger { background:#a94442; border-color:#a94442; color:#fff; }
html[data-theme='sombre'] .btn-danger:hover, html[data-theme='sombre'] .v3-main a.btn-danger:hover { background:#8f3a38; color:#fff; }
html[data-theme='sombre'] input[type=text], html[data-theme='sombre'] input[type=email], html[data-theme='sombre'] input[type=password], html[data-theme='sombre'] input[type=number], html[data-theme='sombre'] input[type=date], html[data-theme='sombre'] select, html[data-theme='sombre'] textarea {
  background: var(--couleur-surface);
  color: var(--couleur-texte);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] table.table { background: var(--couleur-surface); }
html[data-theme='sombre'] table.table th, html[data-theme='sombre'] table.table td { border-color: var(--couleur-bordure); }
html[data-theme='sombre'] table.table th { background: var(--couleur-primaire-50); color: var(--couleur-primaire-800); }
html[data-theme='sombre'] table.table tr:nth-child(even) td { background: #1c2220; }

/* Badges sémantiques (style.css) : fonds sombres teintés, textes clairs */
html[data-theme='sombre'] .badge-R { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .badge-E { background: #3d1f1d; color: #f0a49c; }
html[data-theme='sombre'] .badge-A { background: #3a2e12; color: #e3c37c; }
html[data-theme='sombre'] .badge-Aba { background: #2c2f2d; color: #b3b0a6; }
html[data-theme='sombre'] .badge-I { background: #1c2a3a; color: #9dc3e0; }

/* Étapes (imports admissions) */
html[data-theme='sombre'] .steps .step { background: #2a2f2c; color: var(--couleur-texte-muted); }
html[data-theme='sombre'] .steps .step.active { background: #2e6b4f; color: #fff; }
html[data-theme='sombre'] .steps .step.done { background: #1d3a2a; color: #8fd0a8; }

/* Flashs V3 (fonds en dur de la section 07) */
html[data-theme='sombre'] .v3-flash--succes { background: #15301f; border-color: #2a5a3c; }
html[data-theme='sombre'] .v3-flash--erreur { background: #381c19; border-color: #6b322c; }
html[data-theme='sombre'] .v3-flash--info { background: #16232f; border-color: #2c4a6e; }

/* Bandeau « Mode test » (ambre sombre) */
html[data-theme='sombre'] .v3-bandeau-test { background: #3a2e12; color: #e3c37c; border-bottom-color: #8a6d1f; }

/* Champs en erreur (fonds teintés de la section 06) */
html[data-theme='sombre'] .v3-app input.v3-input-erreur, html[data-theme='sombre'] .v3-app select.v3-input-erreur, html[data-theme='sombre'] .v3-app textarea.v3-input-erreur { background: #2f1d1b; }
html[data-theme='sombre'] .v3-form input.v3-input-erreur:focus-visible, html[data-theme='sombre'] .v3-form select.v3-input-erreur:focus-visible, html[data-theme='sombre'] .v3-form textarea.v3-input-erreur:focus-visible { box-shadow: 0 0 0 3px #5a2a26; }

/* Utilitaires V3.3 à fond en dur (légers en clair → profonds en sombre) */
html[data-theme='sombre'] .v3-panneau, html[data-theme='sombre'] .v3-grille-coches { border-color: var(--couleur-bordure); }
html[data-theme='sombre'] .v3-fieldset { border-color: var(--couleur-bordure); }
html[data-theme='sombre'] .v3-code-bloc { background: #2a2f2c; }
html[data-theme='sombre'] .v3-alerte-importante { background: #3a2e12; border-color: #8a6d1f; }
html[data-theme='sombre'] .v3-ligne-ok { background: #173626; }
html[data-theme='sombre'] .v3-ligne-alerte { background: #3a2e12; }
html[data-theme='sombre'] .v3-ligne-erreur { background: #3d1f1d; }
/* Interrupteur de thème V3.5 : bordure et encre adaptées aux fonds sombres */
html[data-theme='sombre'] .v3-theme-btn { border-color: var(--couleur-bordure); color: var(--couleur-texte); }
/* Missions des référents (V3.8) — miroir sombre des règles de couleur de la section 12 */
html[data-theme='sombre'] .v3-badge-mission--a-faire   { background: #2c2f2d; color: #b3b0a6; }
html[data-theme='sombre'] .v3-badge-mission--en-cours  { background: #1c2a3a; color: #9dc3e0; }
html[data-theme='sombre'] .v3-badge-mission--transmise { background: #3a2e12; color: #e3c37c; }
html[data-theme='sombre'] .v3-badge-mission--validee   { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .v3-badge-mission--a-refaire { background: #3d1f1d; color: #f0a49c; }
html[data-theme='sombre'] .v3-badge-retard { background: #6b2a26; color: #f3c3bd; }
html[data-theme='sombre'] .v3-badge-nav { background: var(--couleur-primaire-200); color: var(--couleur-primaire-900); }
html[data-theme='sombre'] table.table tr.v3-ligne-region td { background: var(--couleur-primaire-50); color: var(--couleur-primaire-800); }
/* NB : .v3-qr-bloc RESTE blanc — un QR doit garder un fond clair lisible */


/* ---------- 11. Tableaux modernes (V3.1) ---------- */
/* Conteneur : défilement horizontal sur petit écran, cadre + ombre ;
   max-height pour l'en-tête sticky (overflow-x:auto rend overflow-y:auto) */
.v3-table-wrap {
  overflow-x: auto;
  max-height: 70vh;
  border: 1px solid var(--couleur-bordure);
  border-radius: var(--rayon-2);
  background: var(--couleur-surface);
  box-shadow: var(--ombre-1);
  margin-bottom: var(--espace-4);
}
/* Neutralise la marge de l'ancien .table ; min-width déclenche le scroll */
.v3-table-wrap .table {
  margin: 0;
  min-width: 560px;
}
/* Densité : cellules plus compactes dans le wrap (6px 10px au lieu de 8px 10px) */
.v3-table-wrap th,
.v3-table-wrap td {
  padding: 6px 10px;
}
/* En-tête sticky : fond primaire-50 (lisible, remplace le #f0ede6 hérité) */
.v3-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--couleur-primaire-50);
  border-bottom: 2px solid var(--couleur-primaire-200);
}
/* Survol de ligne */
.v3-table-wrap tbody tr:hover td {
  background: var(--couleur-primaire-50);
}

/* Lien d'en-tête triable (flèche ▲/▼ active, ↕ inactive) */
.v3-tri {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}
.v3-tri:hover {
  color: var(--couleur-primaire-700);
  text-decoration: none;
}
.v3-tri .v3-tri-fleche {
  color: var(--couleur-texte-muted);
  font-size: 0.8em;
  line-height: 1;
}
.v3-tri .v3-tri-fleche--actif {
  color: var(--couleur-primaire-500);
}

/* Barre de pagination centrée (Précédent / compteur / Suivant) */
.v3-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--espace-3);
  margin: var(--espace-4) 0;
}
.v3-pagination .v3-pagination-compteur {
  color: var(--couleur-texte-muted);
  font-size: 0.9em;
}
.v3-pagination [aria-disabled] {
  color: var(--couleur-texte-muted);
  border-color: var(--couleur-bordure);
  background: var(--couleur-fond);
  cursor: default;
  pointer-events: none;
}

/* ---------- 12. Missions des référents (V3.8) ---------- */
/* Badges de statut du workflow (5 couleurs sobres, faible saturation,
   lisibles dans les deux thèmes), badge « En retard », barre de
   progression fine, badge compteur de navigation.
   ⚠ Toute règle de couleur ci-dessous possède son miroir sombre dans la
   section 10 (bloc média ET bloc html[data-theme='sombre'], pattern V3.5). */
.v3-badge-mission {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.v3-badge-mission--a-faire   { background: #eceae4; color: #55514a; } /* neutre */
.v3-badge-mission--en-cours  { background: #e9eff5; color: #2f4a66; } /* bleu discret */
.v3-badge-mission--transmise { background: #fdf3e0; color: #8a6d1f; } /* ambre */
.v3-badge-mission--validee   { background: #e6f2ea; color: #245c3e; } /* vert */
.v3-badge-mission--a-refaire { background: #fbe9e7; color: #8c2f2b; } /* rouge doux */

/* Badge « En retard » (calculé, jamais stocké) : plein, bien visible */
.v3-badge-retard {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: #8c2f2b;
  color: #fff;
}

/* Barre de progression fine (transmises + validées / cibles) — élément
   <progress> natif (aucun style inline, règle V3.3), couleurs par tokens */
.v3-progression {
  display: inline-flex;
  align-items: center;
  gap: var(--espace-2);
}
.v3-progression-barre {
  width: 90px;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--couleur-bordure);
  vertical-align: middle;
  appearance: none;
}
.v3-progression-barre::-webkit-progress-bar { background: var(--couleur-bordure); border-radius: 3px; }
.v3-progression-barre::-webkit-progress-value { background: var(--couleur-primaire-400); border-radius: 3px; }
.v3-progression-barre::-moz-progress-bar { background: var(--couleur-primaire-400); border-radius: 3px; }
.v3-progression-texte {
  font-size: 0.85em;
  color: var(--couleur-texte-muted);
  white-space: nowrap;
}

/* Badge compteur du lien « Mes missions » (sidebar) : discret */
.v3-badge-nav {
  margin-left: auto;
  min-width: 1.3rem;
  padding: 0 5px;
  border-radius: 9px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3rem;
  background: var(--couleur-primaire-500);
  color: #fff;
}

/* Ligne d'en-tête de région intercalée dans les tableaux de missions
   (sélecteur renforcé : doit primer sur le zébrage tr:nth-child(even)) */
table.table tr.v3-ligne-region td {
  background: var(--couleur-primaire-50);
  color: var(--couleur-primaire-800);
  font-size: 0.85em;
}

/* Matrice établissements × missions : colonnes resserrées */
.v3-matrice td, .v3-matrice th { text-align: center; }
.v3-matrice td:first-child, .v3-matrice th:first-child { text-align: left; }
.v3-legende { display: flex; flex-wrap: wrap; align-items: center; gap: var(--espace-2); }

/* ---------- 13. V4.0 — Refonte visuelle ---------- */
/* Surcharges visuelles (rayons, ombres, bordures, survols) des composants
   existants + composants nouveaux du dashboard. Toutes les classes sont
   préfixées .v3- (contrainte smoke_v30 T4). Les variantes sombres utilisent
   leurs propres blocs @media et html[data-theme='sombre'] placés DANS
   cette section (hors zone comparée par v35 T3). */

/* === Grille KPI (4 cartes) === */
.v3-kpi-grille {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--espace-4);
  margin-bottom: var(--espace-4);
}
.v3-kpi-carte {
  background: var(--couleur-surface);
  border: 1px solid var(--couleur-bordure);
  border-radius: var(--rayon-3);
  box-shadow: var(--ombre-1);
  padding: var(--espace-4);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.v3-kpi-carte:hover {
  box-shadow: var(--ombre-2);
  transform: translateY(-1px);
}
.v3-kpi-carte .v3-kpi-ligne-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--espace-3);
}
.v3-kpi-carte .v3-kpi-etiquette {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--couleur-texte-muted);
}
.v3-kpi-carte .v3-kpi-icone {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.v3-kpi-icone .v3-kpi-icone-svg {
  width: 18px;
  height: 18px;
}
.v3-kpi-icone--primaire { background: var(--couleur-primaire-50); }
.v3-kpi-icone--primaire .v3-kpi-icone-svg { stroke: var(--couleur-primaire-700); }
.v3-kpi-icone--info     { background: #e9eff5; }
.v3-kpi-icone--info .v3-kpi-icone-svg     { stroke: var(--couleur-info); }
.v3-kpi-icone--avert    { background: #fdf3e0; }
.v3-kpi-icone--avert .v3-kpi-icone-svg    { stroke: var(--couleur-avertissement); }
.v3-kpi-icone--erreur   { background: #fbe9e7; }
.v3-kpi-icone--erreur .v3-kpi-icone-svg   { stroke: var(--couleur-erreur); }
.v3-kpi-carte .v3-kpi-valeur {
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--couleur-texte);
}
.v3-kpi-carte .v3-kpi-valeur .v3-kpi-unite {
  font-size: 1.05rem;
  color: var(--couleur-texte-muted);
  font-weight: 600;
}
.v3-kpi-carte .v3-kpi-ligne-bas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--espace-2);
  gap: var(--espace-2);
}
.v3-kpi-carte .v3-kpi-periode {
  font-size: 0.72rem;
  color: var(--couleur-texte-muted);
}

/* === Pilule de tendance (placebo — visuel seul) === */
.v3-pilule {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.v3-pilule--hausse { background: #e6f2ea; color: var(--couleur-succes); }
.v3-pilule--baisse { background: #fbe9e7; color: var(--couleur-erreur); }

/* === Grille de widgets (dashboard) === */
.v3-widget-grille {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--espace-4);
}
.v3-widget-grille .v3-widget--col2 { grid-column: span 2; }

/* === Widget (carte de contenu) === */
.v3-widget {
  background: var(--couleur-surface);
  border: 1px solid var(--couleur-bordure);
  border-radius: var(--rayon-3);
  box-shadow: var(--ombre-1);
  padding: var(--espace-4);
  transition: box-shadow 0.18s ease;
}
.v3-widget:hover { box-shadow: var(--ombre-2); }
.v3-widget .v3-widget-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--espace-4);
  gap: var(--espace-3);
}
.v3-widget .v3-widget-titre {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--couleur-texte);
}
.v3-widget .v3-widget-sous {
  font-size: 0.76rem;
  color: var(--couleur-texte-muted);
  margin-top: 2px;
}
.v3-widget .v3-lien-widget {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--couleur-primaire-700);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  white-space: nowrap;
}
.v3-widget .v3-lien-widget:hover { text-decoration: underline; }
.v3-widget .v3-lien-widget svg {
  width: 12px;
  height: 12px;
  stroke: var(--couleur-primaire-700);
  flex-shrink: 0;
}

/* === Missions (barres de progression) === */
.v3-mission-ligne { margin-bottom: 14px; }
.v3-mission-ligne:last-child { margin-bottom: 0; }
.v3-mission-ligne .v3-mission-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 10px;
}
.v3-mission-ligne .v3-mission-nom {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--couleur-texte);
}
.v3-mission-ligne .v3-mission-etab {
  font-size: 0.74rem;
  color: var(--couleur-texte-muted);
}
.v3-mission-ligne .v3-mission-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--couleur-primaire-700);
  white-space: nowrap;
}
.v3-piste {
  height: 8px;
  border-radius: 999px;
  background: var(--couleur-fond);
  border: 1px solid var(--couleur-bordure);
  overflow: hidden;
}
.v3-remplissage {
  height: 100%;
  border-radius: 999px;
  background: var(--couleur-primaire-500);
  transition: width 0.5s ease;
}

/* === Étiquettes de statut (missions / diffusions) === */
.v3-etiquette-statut {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2.5px 9px;
  white-space: nowrap;
}
.v3-etiquette-statut--en-cours  { background: #e9eff5; color: var(--couleur-info); }
.v3-etiquette-statut--terminee  { background: #e6f2ea; color: var(--couleur-succes); }
.v3-etiquette-statut--a-relancer{ background: #fdf3e0; color: var(--couleur-avertissement); }
.v3-etiquette-statut--active    { background: #e6f2ea; color: var(--couleur-succes); }
.v3-etiquette-statut--retiree   { background: #eceae4; color: #55514a; }

/* === Alertes & discipline (lignes d'alerte) === */
.v3-alerte-ligne {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--rayon-2);
  margin-bottom: 9px;
  border: 1px solid var(--couleur-bordure);
  background: var(--couleur-fond);
}
.v3-alerte-ligne:last-child { margin-bottom: 0; }
.v3-alerte-pastille {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.v3-alerte-pastille svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.v3-alerte-pastille--erreur { background: #fbe9e7; }
.v3-alerte-pastille--erreur svg { stroke: #b3261e; }
.v3-alerte-pastille--avert  { background: #fdf3e0; }
.v3-alerte-pastille--avert svg  { stroke: #8a5a00; }
.v3-alerte-pastille--info   { background: #e9eff5; }
.v3-alerte-pastille--info svg   { stroke: #1a5a8a; }
.v3-alerte-pastille--primaire { background: var(--couleur-primaire-50); }
.v3-alerte-pastille--primaire svg { stroke: var(--couleur-primaire-700); }
.v3-alerte-titre {
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--couleur-texte);
}
.v3-alerte-detail {
  font-size: 0.74rem;
  color: var(--couleur-texte-muted);
  margin-top: 2px;
}

/* === Graphique barres filières (CSS) === */
.v3-barre-ligne {
  display: grid;
  grid-template-columns: minmax(0, 210px) 1fr 46px;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.v3-barre-ligne:last-child { margin-bottom: 0; }
.v3-barre-libelle {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--couleur-texte);
}
.v3-barre-total {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  color: var(--couleur-texte);
}
.v3-barre-ligne .v3-piste { height: 12px; }

/* === Donut niveaux === */
.v3-donut-conteneur {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.v3-donut-legendes {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 140px;
}
.v3-donut-legende {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  white-space: nowrap;
  color: var(--couleur-texte);
}
.v3-donut-carre {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex-shrink: 0;
}
.v3-donut-val {
  margin-left: auto;
  font-weight: 700;
  padding-left: 8px;
  color: var(--couleur-texte);
}

/* === Tableau diffusions === */
.v3-diffusion-tab {
  width: 100%;
  border-collapse: collapse;
}
.v3-diffusion-tab th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--couleur-texte-muted);
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--couleur-bordure);
}
.v3-diffusion-tab td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--couleur-bordure);
  font-size: 0.85rem;
  vertical-align: middle;
  color: var(--couleur-texte);
}
.v3-diffusion-tab tr:last-child td { border-bottom: none; }
.v3-diffusion-tab tbody tr { transition: background 0.12s ease; }
.v3-diffusion-tab tbody tr:hover { background: var(--couleur-primaire-50); }
.v3-cellule-titre { font-weight: 600; }
.v3-cellule-sous {
  font-weight: 400;
  font-size: 0.73rem;
  color: var(--couleur-texte-muted);
  margin-top: 1px;
}

/* === Puce type de fichier === */
.v3-puce-fichier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 7px;
  padding: 3px 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.v3-puce-fichier svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.v3-puce-fichier--pdf  { background: #fbe9e7; color: var(--couleur-erreur); }
.v3-puce-fichier--xlsx { background: #e6f2ea; color: var(--couleur-succes); }
.v3-puce-fichier--docx { background: #e9eff5; color: var(--couleur-info); }
.v3-puce-fichier--pptx { background: #fdf3e0; color: var(--couleur-avertissement); }
.v3-puce-fichier--autre{ background: #eceae4; color: #55514a; }

/* === Responsive dashboard === */
@media (max-width: 1120px) {
  .v3-kpi-grille { grid-template-columns: repeat(2, 1fr); }
  .v3-widget-grille { grid-template-columns: 1fr 1fr; }
  .v3-widget-grille .v3-widget--col2 { grid-column: span 2; }
}
@media (max-width: 860px) {
  .v3-widget-grille { grid-template-columns: 1fr; }
  .v3-widget-grille .v3-widget--col2 { grid-column: span 1; }
}
@media (max-width: 560px) {
  .v3-kpi-grille { grid-template-columns: 1fr; }
}

/* === Variantes sombres (section 12) === */
@media (prefers-color-scheme: dark) {
  html:not([data-theme='clair']) .v3-kpi-carte,
  html:not([data-theme='clair']) .v3-widget {
    background: var(--couleur-surface);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) .v3-piste {
    background: var(--couleur-primaire-50);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) .v3-alerte-ligne {
    background: var(--couleur-primaire-50);
    border-color: var(--couleur-bordure);
  }
  html:not([data-theme='clair']) .v3-kpi-icone--primaire { background: var(--couleur-primaire-100); }
  html:not([data-theme='clair']) .v3-kpi-icone--info     { background: #1c2a3a; }
  html:not([data-theme='clair']) .v3-kpi-icone--avert    { background: #3a2e12; }
  html:not([data-theme='clair']) .v3-kpi-icone--erreur   { background: #3d1f1d; }
  html:not([data-theme='clair']) .v3-pilule--hausse { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .v3-pilule--baisse { background: #3d1f1d; color: #f0a49c; }
  html:not([data-theme='clair']) .v3-etiquette-statut--en-cours  { background: #1c2a3a; color: #9dc3e0; }
  html:not([data-theme='clair']) .v3-etiquette-statut--terminee  { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .v3-etiquette-statut--a-relancer{ background: #3a2e12; color: #e3c37c; }
  html:not([data-theme='clair']) .v3-etiquette-statut--active    { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .v3-etiquette-statut--retiree   { background: #2c2f2d; color: #b3b0a6; }
  html:not([data-theme='clair']) .v3-puce-fichier--pdf  { background: #3d1f1d; color: #f0a49c; }
  html:not([data-theme='clair']) .v3-puce-fichier--xlsx { background: #173626; color: #8fd0a8; }
  html:not([data-theme='clair']) .v3-puce-fichier--docx { background: #1c2a3a; color: #9dc3e0; }
  html:not([data-theme='clair']) .v3-puce-fichier--pptx { background: #3a2e12; color: #e3c37c; }
  html:not([data-theme='clair']) .v3-puce-fichier--autre{ background: #2c2f2d; color: #b3b0a6; }
  html:not([data-theme='clair']) .v3-diffusion-tab tbody tr:hover { background: var(--couleur-primaire-100); }
}

html[data-theme='sombre'] .v3-kpi-carte,
html[data-theme='sombre'] .v3-widget {
  background: var(--couleur-surface);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] .v3-piste {
  background: var(--couleur-primaire-50);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] .v3-alerte-ligne {
  background: var(--couleur-primaire-50);
  border-color: var(--couleur-bordure);
}
html[data-theme='sombre'] .v3-kpi-icone--primaire { background: var(--couleur-primaire-100); }
html[data-theme='sombre'] .v3-kpi-icone--info     { background: #1c2a3a; }
html[data-theme='sombre'] .v3-kpi-icone--avert    { background: #3a2e12; }
html[data-theme='sombre'] .v3-kpi-icone--erreur   { background: #3d1f1d; }
html[data-theme='sombre'] .v3-pilule--hausse { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .v3-pilule--baisse { background: #3d1f1d; color: #f0a49c; }
html[data-theme='sombre'] .v3-etiquette-statut--en-cours  { background: #1c2a3a; color: #9dc3e0; }
html[data-theme='sombre'] .v3-etiquette-statut--terminee  { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .v3-etiquette-statut--a-relancer{ background: #3a2e12; color: #e3c37c; }
html[data-theme='sombre'] .v3-etiquette-statut--active    { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .v3-etiquette-statut--retiree   { background: #2c2f2d; color: #b3b0a6; }
html[data-theme='sombre'] .v3-puce-fichier--pdf  { background: #3d1f1d; color: #f0a49c; }
html[data-theme='sombre'] .v3-puce-fichier--xlsx { background: #173626; color: #8fd0a8; }
html[data-theme='sombre'] .v3-puce-fichier--docx { background: #1c2a3a; color: #9dc3e0; }
html[data-theme='sombre'] .v3-puce-fichier--pptx { background: #3a2e12; color: #e3c37c; }
html[data-theme='sombre'] .v3-puce-fichier--autre{ background: #2c2f2d; color: #b3b0a6; }
html[data-theme='sombre'] .v3-diffusion-tab tbody tr:hover { background: var(--couleur-primaire-100); }
