/* Socle commun. Les couleurs définitives viennent de theme-public.css (site, connexion) et theme-app.css (back office). */
@font-face { font-family: "Poppins"; src: url("../vendor/fonts/poppins-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../vendor/fonts/poppins-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../vendor/fonts/poppins-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../vendor/fonts/poppins-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --focus: #1d4ed8;
  --anneau: rgba(29, 78, 216, .18);
  --fond-non-lu: #f5f7ff;
  --fond-survol: #f7f7fb;
  --fond-entete-table: #fafafa;
  --primaire: #1d4ed8;
  --primaire-fonce: #1e3fae;
  --primaire-doux: #e8edfd;
  --encre: #141416;
  --encre-2: #1e1e22;
  --encre-3: #2c2c32;
  --texte: #1f1f23;
  --texte-doux: #5a5a62;
  --trait: #e6e4e1;
  --trait-fort: #cfccc7;
  --fond: #f6f5f3;
  --surface: #ffffff;
  --succes: #12693f; --succes-fond: #e5f4ec;
  --info: #1d4f91; --info-fond: #e7eff9;
  --attente: #8a5a00; --attente-fond: #fdf3dc;
  --alerte: #a8450a; --alerte-fond: #fcebdd;
  --danger: #b00020; --danger-fond: #fdeaec;
  --neutre: #4a4a52; --neutre-fond: #eeedeb;
  --police: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --police-titre: var(--police);
  --rayon: 12px;
  --rayon-sm: 8px;
  --ombre: 0 1px 2px rgba(20, 20, 22, .05);
  --ombre-haute: 0 12px 32px rgba(20, 20, 22, .12);
  --largeur-sidebar: 264px;
  --largeur-sidebar-reduite: 76px;
  --hauteur-header: 68px;
  --duree: .18s;

  --bs-body-font-family: var(--police);
  --bs-body-color: var(--texte);
  --bs-body-bg: var(--fond);
  --bs-border-color: var(--trait);
  --bs-primary: var(--primaire);
  --bs-link-color: var(--primaire);
  --bs-link-hover-color: var(--primaire-fonce);
  --bs-border-radius: var(--rayon-sm);
}

html { scroll-behavior: smooth; }
body { font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; touch-action: manipulation; }
h1, h2, h3, .titre-serif { font-family: var(--police-titre); font-weight: 600; letter-spacing: -.01em; color: var(--encre); }
h4, h5, h6 { font-weight: 600; color: var(--encre); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
a { text-underline-offset: 2px; }
.lien-evitement { position: absolute; inset-inline-start: 8px; top: 8px; z-index: 2000; background: var(--encre); color: #fff; padding: .75rem 1rem; }
/* Masqué sur place : un décalage négatif créerait un défilement horizontal de droite à gauche. */
.lien-evitement:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
.lien-evitement:focus { color: #fff; }
.chiffres { font-variant-numeric: tabular-nums; }
.texte-doux { color: var(--texte-doux); }
.prose { max-width: 72ch; }
.prose p:last-child { margin-bottom: 0; }

/* Boutons */
.btn { --bs-btn-border-radius: var(--rayon-sm); --bs-btn-font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: background-color var(--duree), border-color var(--duree), color var(--duree), box-shadow var(--duree); }
.btn-sm { min-height: 34px; }
.btn-primary { --bs-btn-bg: var(--primaire); --bs-btn-border-color: var(--primaire); --bs-btn-hover-bg: var(--primaire-fonce); --bs-btn-hover-border-color: var(--primaire-fonce); --bs-btn-active-bg: var(--primaire-fonce); --bs-btn-active-border-color: var(--primaire-fonce); --bs-btn-disabled-bg: var(--primaire); --bs-btn-disabled-border-color: var(--primaire); }
.btn-outline-primary { --bs-btn-color: var(--primaire); --bs-btn-border-color: var(--primaire); --bs-btn-hover-bg: var(--primaire); --bs-btn-hover-border-color: var(--primaire); --bs-btn-active-bg: var(--primaire-fonce); --bs-btn-active-border-color: var(--primaire-fonce); }
.btn-encre { --bs-btn-color: #fff; --bs-btn-bg: var(--encre); --bs-btn-border-color: var(--encre); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--encre-3); --bs-btn-hover-border-color: var(--encre-3); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--encre-3); }
.btn-clair { --bs-btn-color: var(--texte); --bs-btn-bg: #fff; --bs-btn-border-color: var(--trait-fort); --bs-btn-hover-color: var(--encre); --bs-btn-hover-bg: var(--fond); --bs-btn-hover-border-color: var(--trait-fort); --bs-btn-active-bg: var(--trait); --bs-btn-active-border-color: var(--trait-fort); }
.btn-icone { width: 36px; height: 36px; min-height: 36px; padding: 0; color: var(--texte-doux); background: transparent; border: 1px solid transparent; border-radius: var(--rayon-sm); }
.btn-icone:hover { background: var(--fond); color: var(--encre); border-color: var(--trait); }
.btn-icone.danger:hover { background: var(--danger-fond); color: var(--danger); border-color: transparent; }
.btn-danger-istmt { --bs-btn-color: #fff; --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #8c0019; --bs-btn-hover-border-color: #8c0019; --bs-btn-active-color: #fff; --bs-btn-active-bg: #8c0019; }
.btn-danger-doux { --bs-btn-color: var(--danger); --bs-btn-bg: #fff; --bs-btn-border-color: #f0c2c9; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); --bs-btn-active-color: #fff; --bs-btn-active-bg: #8c0019; }
.btn.en-cours { pointer-events: none; opacity: .75; }

/* Coque back office */
.coque { min-height: 100dvh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--largeur-sidebar); background: var(--encre); color: #d4d4d8; display: flex; flex-direction: column; z-index: 1040; transition: width var(--duree) ease-out, transform var(--duree) ease-out; }
.sidebar-tete { height: var(--hauteur-header); display: flex; align-items: center; gap: .7rem; padding: 0 1rem; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; color: #fff; text-decoration: none; }
.sidebar-tete:hover { color: #fff; }
.pastille-logo { width: 44px; height: 44px; border-radius: 50%; background: #fff; flex-shrink: 0; object-fit: contain; padding: 2px; }
.sidebar-marque { line-height: 1.15; overflow: hidden; white-space: nowrap; }
.sidebar-marque strong { font-family: var(--police-titre); font-size: 1.2rem; display: block; letter-spacing: .02em; }
.sidebar-marque span { font-size: .72rem; color: #a1a1aa; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .65rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--encre-3) transparent; }
.sidebar-section { font-size: .69rem; letter-spacing: .08em; text-transform: uppercase; color: #8e8e96; padding: 1rem .75rem .35rem; white-space: nowrap; overflow: hidden; }
.sidebar-lien { display: flex; align-items: center; gap: .75rem; min-height: 42px; padding: .45rem .75rem; border-radius: var(--rayon-sm); color: #d4d4d8; text-decoration: none; font-size: .9rem; white-space: nowrap; position: relative; transition: background-color var(--duree), color var(--duree); }
.sidebar-lien i { font-size: 1.1rem; width: 1.3rem; text-align: center; flex-shrink: 0; }
.sidebar-lien:hover { background: var(--encre-2); color: #fff; }
.sidebar-lien.actif { background: var(--encre-3); color: #fff; font-weight: 500; }
.sidebar-lien.actif::before { content: ""; position: absolute; inset-inline-start: -.65rem; top: 8px; bottom: 8px; width: 3px; background: var(--primaire); border-start-end-radius: 3px; border-end-end-radius: 3px; }
.sidebar-pastille { margin-inline-start: auto; background: var(--primaire); color: #fff; font-size: .7rem; font-weight: 600; border-radius: 999px; padding: .05rem .45rem; }
.principal { margin-inline-start: var(--largeur-sidebar); min-height: 100dvh; display: flex; flex-direction: column; transition: margin-inline-start var(--duree) ease-out; min-width: 0; }
.header-app { position: sticky; top: 0; z-index: 1030; height: var(--hauteur-header); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--trait); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; }
.recherche-globale { position: relative; flex: 1; max-width: 460px; }
.recherche-globale i { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); color: var(--texte-doux); pointer-events: none; }
.recherche-globale input { padding-inline-start: 2.4rem; background: var(--fond); border-color: transparent; height: 42px; }
.recherche-globale input:focus { background: #fff; }
.contenu { padding: 1.75rem 1.5rem 3rem; flex: 1; width: 100%; max-width: 1480px; margin-inline: auto; }
.btn-entete { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 0; background: transparent; color: var(--texte); font-size: 1.2rem; }
.btn-entete:hover { background: var(--fond); }
.compteur-notifs { position: absolute; top: 5px; inset-inline-end: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--primaire); color: #fff; font-size: .68rem; font-weight: 600; line-height: 18px; text-align: center; }
.profil-bouton { display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; min-height: 44px; }
.profil-bouton:hover { background: var(--fond); }
.profil-bouton .nom { font-size: .875rem; font-weight: 500; line-height: 1.15; text-align: left; }
.profil-bouton .role { font-size: .72rem; color: var(--texte-doux); display: block; font-weight: 400; }
.menu-notifs { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-ligne { display: flex; gap: .7rem; padding: .75rem 1rem; text-decoration: none; color: var(--texte); border-bottom: 1px solid var(--trait); }
.notif-ligne:hover { background: var(--fond); color: var(--texte); }
.notif-ligne.non-lue { background: var(--fond-non-lu); }
.notif-icone { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primaire-doux); color: var(--primaire); }
.dropdown-menu { --bs-dropdown-border-color: var(--trait); --bs-dropdown-border-radius: var(--rayon); box-shadow: var(--ombre-haute); --bs-dropdown-link-active-bg: var(--primaire); }
.dropdown-item { min-height: 38px; display: flex; align-items: center; gap: .55rem; }

/* Sidebar repliée (desktop) */
@media (min-width: 992px) {
  .sidebar-reduite .sidebar { width: var(--largeur-sidebar-reduite); }
  .sidebar-reduite .principal { margin-inline-start: var(--largeur-sidebar-reduite); }
  .sidebar-reduite .sidebar-marque, .sidebar-reduite .sidebar-lien span, .sidebar-reduite .sidebar-pastille { display: none; }
  .sidebar-reduite .sidebar-section { visibility: hidden; height: .6rem; padding: 0; }
  .sidebar-reduite .sidebar-lien { justify-content: center; padding-inline: 0; }
  .sidebar-reduite .sidebar-tete { justify-content: center; padding: 0; }
}
/* Mobile et tablette : tiroir */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  html[dir="rtl"] .sidebar-ouverte .sidebar { transform: none; }
  .sidebar-ouverte .sidebar { transform: none; box-shadow: var(--ombre-haute); }
  .principal { margin-inline-start: 0; }
  .voile-sidebar { display: none; position: fixed; inset: 0; background: rgba(20,20,22,.5); z-index: 1035; }
  .sidebar-ouverte .voile-sidebar { display: block; }
  .header-app { padding: 0 .75rem; gap: .35rem; }
  .contenu { padding: 1.25rem .9rem 2.5rem; }
  .profil-bouton .nom { display: none; }
}

/* En-tête de page */
.entete-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1.5rem; }
.entete-page h1 { font-size: 1.7rem; margin: 0; }
.entete-page p { color: var(--texte-doux); margin: .2rem 0 0; }
.fil-ariane { font-size: .82rem; margin-bottom: .35rem; }
.fil-ariane a { color: var(--texte-doux); text-decoration: none; }
.fil-ariane a:hover { color: var(--primaire); text-decoration: underline; }

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); }
.carte-corps { padding: 1.25rem; }
.carte-tete { padding: .9rem 1.25rem; border-bottom: 1px solid var(--trait); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.carte-tete h2, .carte-tete h3 { font-family: var(--police); font-size: 1rem; font-weight: 600; margin: 0; letter-spacing: 0; }
.carte-stat { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: flex-start; height: 100%; text-decoration: none; color: inherit; box-shadow: var(--ombre); transition: border-color var(--duree), box-shadow var(--duree); }
a.carte-stat:hover { border-color: var(--trait-fort); box-shadow: 0 4px 14px rgba(20,20,22,.07); color: inherit; }
.carte-stat .icone { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; background: var(--neutre-fond); color: var(--encre); }
.carte-stat.accent .icone { background: var(--primaire-doux); color: var(--primaire); }
.carte-stat .valeur { font-family: var(--police-titre); font-size: 1.8rem; line-height: 1.1; font-weight: 600; color: var(--encre); font-variant-numeric: tabular-nums; }
.carte-stat .libelle { font-size: .84rem; color: var(--texte-doux); }
.zone-graphique { position: relative; height: 280px; }

/* Badges de statut : couleur, icône et texte */
.badge-statut { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 500; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge-succes { background: var(--succes-fond); color: var(--succes); }
.badge-info { background: var(--info-fond); color: var(--info); }
.badge-attente { background: var(--attente-fond); color: var(--attente); }
.badge-alerte { background: var(--alerte-fond); color: var(--alerte); }
.badge-danger { background: var(--danger-fond); color: var(--danger); }
.badge-neutre { background: var(--neutre-fond); color: var(--neutre); }
.etiquette { display: inline-block; font-size: .74rem; padding: .12rem .5rem; border-radius: 6px; background: var(--neutre-fond); color: var(--neutre); }

/* Avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--encre); color: #fff; font-weight: 600; flex-shrink: 0; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.avatar-md { width: 38px; height: 38px; font-size: .8rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.6rem; }

/* Tableaux */
.barre-outils { display: flex; flex-wrap: wrap; gap: .6rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--trait); align-items: center; }
.barre-outils .champ-recherche { position: relative; flex: 1 1 240px; max-width: 380px; }
.barre-outils .champ-recherche i { position: absolute; inset-inline-start: .75rem; top: 50%; transform: translateY(-50%); color: var(--texte-doux); }
.barre-outils .champ-recherche input { padding-inline-start: 2.2rem; }
.barre-outils .form-select { width: auto; max-width: 240px; }
.table-istmt { margin: 0; --bs-table-bg: transparent; }
.table-istmt thead th { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); background: var(--fond-entete-table); border-bottom: 1px solid var(--trait); padding: .7rem 1rem; white-space: nowrap; }
.table-istmt thead th a { color: inherit; text-decoration: none; display: inline-flex; gap: .3rem; align-items: center; }
.table-istmt thead th a:hover, .table-istmt thead th a.trie { color: var(--primaire); }
.table-istmt td { padding: .75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--trait); }
.table-istmt tbody tr:last-child td { border-bottom: 0; }
.table-istmt tbody tr:hover { background: var(--fond-survol); }
.cellule-personne { display: flex; gap: .65rem; align-items: center; min-width: 0; }
.cellule-personne small { display: block; color: var(--texte-doux); }
/* Liens de tableau : encre au repos, rouge au survol, pour ne pas saturer la page de rouge. */
.table-istmt a.fw-medium, .message-corps a { color: var(--encre); text-decoration: none; }
.table-istmt a.fw-medium:hover { color: var(--primaire); text-decoration: underline; }
.actions-ligne { display: flex; gap: .15rem; justify-content: flex-end; flex-wrap: nowrap; }
.actions-ligne form { margin: 0; }
.pied-tableau { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; padding: .75rem 1.1rem; border-top: 1px solid var(--trait); font-size: .85rem; color: var(--texte-doux); }
.pagination { --bs-pagination-color: var(--texte); --bs-pagination-hover-color: var(--primaire); --bs-pagination-active-bg: var(--primaire); --bs-pagination-active-border-color: var(--primaire); --bs-pagination-focus-color: var(--primaire); --bs-pagination-border-color: var(--trait); margin: 0; }
.page-link { min-width: 36px; min-height: 36px; text-align: center; }
/* Sur mobile et tablette, chaque ligne devient une carte libellée. */
@media (max-width: 991.98px) {
  .table-istmt thead { display: none; }
  .table-istmt, .table-istmt tbody, .table-istmt tr, .table-istmt td { display: block; width: 100%; }
  .table-istmt tr { padding: .6rem .9rem; border-bottom: 1px solid var(--trait); }
  .table-istmt tbody tr:last-child { border-bottom: 0; }
  .table-istmt td { padding: .3rem 0; border: 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-istmt td[data-label]::before { content: attr(data-label); color: var(--texte-doux); font-size: .8rem; text-align: left; flex-shrink: 0; }
  .table-istmt td.cellule-principale { text-align: left; }
  .table-istmt td.cellule-principale::before { display: none; }
  .actions-ligne { margin-inline-start: auto; }
  .btn-icone { width: 44px; height: 44px; }
  .barre-outils .form-select, .barre-outils .champ-recherche { max-width: none; flex: 1 1 100%; width: 100%; }
}

/* États vides */
.etat-vide { text-align: center; padding: 3rem 1.25rem; }
.etat-vide svg { width: 132px; height: auto; margin-bottom: 1rem; }
.etat-vide h3 { font-family: var(--police); font-size: 1.05rem; font-weight: 600; margin-bottom: .3rem; letter-spacing: 0; }
.etat-vide p { color: var(--texte-doux); margin: 0 auto 1rem; max-width: 44ch; }

/* Formulaires */
.form-control, .form-select { background-color: var(--surface); min-height: 42px; border-color: var(--trait-fort); transition: border-color var(--duree), box-shadow var(--duree); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--primaire); box-shadow: 0 0 0 3px var(--anneau); }
.form-check-input:checked { background-color: var(--primaire); border-color: var(--primaire); }
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .3rem; }
.requis { color: var(--danger); }
.form-text { color: var(--texte-doux); font-size: .8rem; }
.invalid-feedback { color: var(--danger); font-size: .82rem; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); background-image: none; }
.section-form { margin-bottom: 1.25rem; }
.section-form-tete { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--trait); }
.section-form-tete i { color: var(--primaire); font-size: 1.15rem; line-height: 1.4; }
.section-form-tete h2 { font-family: var(--police); font-size: 1rem; font-weight: 600; margin: 0; letter-spacing: 0; }
.section-form-tete p { font-size: .84rem; color: var(--texte-doux); margin: .1rem 0 0; }
.barre-actions { position: sticky; bottom: 0; background: rgba(246,245,243,.96); border-top: 1px solid var(--trait); padding: .85rem 0; display: flex; gap: .6rem; justify-content: flex-end; z-index: 5; }
.resume-erreurs { border: 1px solid var(--danger); background: var(--danger-fond); color: var(--danger); border-radius: var(--rayon-sm); padding: .75rem 1rem; margin-bottom: 1.25rem; }
.fichier-existant { font-size: .82rem; margin-top: .3rem; display: flex; gap: .35rem; align-items: center; }
.champ-mdp { position: relative; }
.champ-mdp .form-control { padding-inline-end: 2.9rem; }
.champ-mdp button { position: absolute; inset-inline-end: 2px; top: 1px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--texte-doux); }

/* Frise du workflow de stage */
/* Langues : l'arabe s'écrit de droite à gauche, en police système (Poppins n'a pas de glyphes arabes). */
/* Dans le coin de la colonne : .auth-formulaire est en flex, un enfant normal se placerait à côté du formulaire. */
.auth-formulaire { position: relative; }
.auth-langue { position: absolute; top: 1rem; inset-inline-end: 1rem; z-index: 5; }
.auth-langue + .auth-boite { margin-top: 1.5rem; }
html[lang="ar"] { --police: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; --bs-body-font-family: var(--police); }
html[lang="ar"] * { letter-spacing: 0 !important; }
html[dir="rtl"] .bi-arrow-right::before, html[dir="rtl"] .bi-arrow-left::before, html[dir="rtl"] .bi-chevron-right::before, html[dir="rtl"] .bi-chevron-left::before { transform: scaleX(-1); }

/* ===== Téléphone ===== */
.nav-mobile, .bouton-filtres, .bascule-frise, .actions-tel { display: none; }
.zone-filtres { display: contents; }
@media (max-width: 767.98px) {
  /* Barre du bas : le menu complet reste accessible par son dernier bouton. */
  .nav-mobile { position: fixed; inset-inline: 0; bottom: 0; z-index: 1030; display: flex; background: var(--surface); border-top: 1px solid var(--trait); box-shadow: 0 -4px 16px rgba(20, 20, 22, .06); padding-bottom: env(safe-area-inset-bottom); }
  .nav-mobile a, .nav-mobile button { flex: 1 1 0; min-width: 0; min-height: 58px; padding: .35rem .15rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; background: transparent; border: 0; color: var(--texte-doux); text-decoration: none; }
  .nav-mobile .actif { color: var(--primaire); font-weight: 600; }
  .nav-mobile .icone-nav { position: relative; font-size: 1.25rem; line-height: 1; }
  .nav-mobile .compteur-notifs { top: -6px; inset-inline-end: -12px; }
  .nav-mobile .texte-nav { max-width: 100%; font-size: .68rem; line-height: 1.15; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  body:has(.nav-mobile) { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  body:has(.nav-mobile) .zone-toasts { top: 12px; }

  /* En-tête : le menu et les notifications sont dans la barre du bas. */
  .header-app [data-bascule-sidebar], .entete-notifs { display: none; }
  .profil-bouton .bi-chevron-down { display: none; }

  /* Saisie : une police sous 16 px fait zoomer iOS à chaque champ ; 44 px est la taille d'un doigt. */
  .form-control, .form-select { font-size: 16px; min-height: 44px; }
  .btn:not(.btn-close), .page-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  .page-link { min-width: 44px; }

  /* Titre et actions de page : les boutons occupent la largeur. */
  .entete-page { margin-bottom: 1rem; }
  .entete-page h1 { font-size: 1.35rem; }
  .entete-page > .d-flex { width: 100%; }
  .entete-page > .d-flex > .btn, .entete-page > .d-flex > form { flex: 1 1 auto; }
  .entete-page > .d-flex > form .btn { width: 100%; }

  /* Filtres repliés : la liste arrive plus vite. */
  .bouton-filtres { display: inline-flex; flex-shrink: 0; gap: .35rem; }
  .barre-outils .champ-recherche { flex: 1 1 0; min-width: 0; width: auto; }
  .barre-outils { padding: .7rem .8rem; }
  .barre-outils:not(.ouverte) .zone-filtres { display: none; }
  .barre-outils.ouverte .zone-filtres { display: flex; flex-wrap: wrap; gap: .6rem; width: 100%; }
  .barre-outils.ouverte .zone-filtres > .btn { flex: 1 1 auto; }

  /* Listes : fiches denses, sans cases à cocher (les actions groupées restent sur grand écran). */
  .barre-groupe, .cellule-coche { display: none !important; }
  .table-istmt .masque-mobile { display: none !important; }
  .valeur-cellule { display: block; min-width: 0; }
  .table-istmt tr { padding: .75rem .8rem; }
  .table-istmt td { padding: .15rem 0; font-size: .86rem; overflow-wrap: anywhere; }
  .table-istmt td.cellule-principale { font-size: .92rem; }
  .actions-ligne { gap: .35rem; }

  /* Frise de stage : l'étape en cours, le reste à la demande. */
  .bascule-frise { display: inline-flex; }
  .frise:not(.ouverte) li:not([aria-current="step"]) { display: none; }
  .frise:not(.ouverte) li { padding-bottom: 0; }
  .frise:not(.ouverte) li::before { display: none; }

  /* Boutons de formulaire : l'action principale d'abord. Trois boutons prendraient trop de place en position collante. */
  .barre-actions { flex-wrap: wrap; padding: .6rem 0; }
  body:has(.nav-mobile) .barre-actions { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .barre-actions .btn { flex: 1 1 auto; }
  .barre-actions .btn-primary { order: -1; flex: 1 1 100%; }
  .barre-actions:has(.btn:nth-of-type(2)):has(a.btn) { position: static; }

  .contenu { padding-inline: .8rem; }
  .sidebar-nav { overflow-x: hidden; }
  .carte-tete { flex-wrap: wrap; gap: .4rem; }

  /* Petits écrans (320 px) : un texte long passe à la ligne au lieu d'élargir la page. */
  h1, h2, h3, .details dd, .notif-ligne span { overflow-wrap: anywhere; min-width: 0; }
  .badge-statut { white-space: normal; }
  .section-publique form[role="search"]:not(.filtres-publics) > * { flex: 1 1 100%; width: 100% !important; max-width: none !important; }
}
.sous-nav { display: flex; gap: .4rem; overflow-x: auto; padding: .35rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-sm); }
.sous-nav a { flex-shrink: 0; padding: .45rem .8rem; border-radius: var(--rayon-sm); color: var(--texte); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.sous-nav a:hover { background: var(--primaire-doux); color: var(--primaire); }
.sous-nav .chiffres { color: var(--texte-doux); }
.barre-groupe { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .55rem 1rem; border-bottom: 1px solid var(--trait); background: var(--fond-survol); }
.cellule-coche { width: 2.5rem; }
.apercu-fichier { display: block; max-width: 160px; max-height: 96px; margin-top: .5rem; border-radius: var(--rayon-sm); border: 1px solid var(--trait); background: var(--surface); object-fit: contain; }
.carte-lieu { display: block; width: 100%; height: 280px; border: 1px solid var(--trait); border-radius: var(--rayon-sm); }
.logo-partenaire { width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--rayon-sm); border: 1px solid var(--trait); background: var(--surface); object-fit: contain; display: inline-flex; align-items: center; justify-content: center; color: var(--texte-doux); }
.logo-partenaire-lg { width: 88px; height: 88px; font-size: 1.8rem; }
.avancement { display: flex; align-items: center; gap: .5rem; min-width: 110px; font-size: .78rem; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.avancement .jauge { flex: 1; height: 6px; border-radius: 3px; background: var(--trait); overflow: hidden; }
.avancement .jauge span { display: block; height: 100%; background: var(--primaire); }
.signal-retard { color: var(--danger); font-weight: 500; }
.frise { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: etape; }
.frise li { flex: 1; position: relative; text-align: center; padding: 0 .35rem; min-width: 0; }
.frise li::before { content: ""; position: absolute; top: 18px; inset-inline-start: -50%; width: 100%; height: 3px; background: var(--trait); z-index: 0; }
.frise li:first-child::before { display: none; }
.frise li.fait::before, .frise li.courant::before { background: var(--encre); }
.frise .pastille { position: relative; z-index: 1; width: 38px; height: 38px; margin: 0 auto .5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--trait-fort); color: var(--texte-doux); font-size: 1rem; }
.frise li.fait .pastille { background: var(--encre); border-color: var(--encre); color: #fff; }
.frise li.courant .pastille { background: var(--primaire); border-color: var(--primaire); color: #fff; box-shadow: 0 0 0 5px var(--primaire-doux); }
.frise li.alerte .pastille { background: var(--alerte); border-color: var(--alerte); box-shadow: 0 0 0 5px var(--alerte-fond); }
.frise li.refus .pastille { background: var(--danger); border-color: var(--danger); color: #fff; }
.frise .nom-etape { font-size: .8rem; line-height: 1.25; color: var(--texte-doux); display: block; }
.frise li.courant .nom-etape { color: var(--encre); font-weight: 600; }
.frise li.fait .nom-etape { color: var(--texte); }
.frise .date-etape { font-size: .7rem; color: var(--texte-doux); display: block; margin-top: .1rem; }
@media (max-width: 767.98px) {
  .frise { flex-direction: column; gap: 0; }
  .frise li { display: grid; grid-template-columns: 38px 1fr; gap: 0 .8rem; text-align: left; padding: 0 0 1.1rem; }
  .frise li::before { top: -50%; inset-inline-start: 18px; width: 3px; height: 100%; }
  .frise .pastille { margin: 0; grid-row: span 2; }
  .frise .nom-etape { align-self: center; }
}
.chronologie { list-style: none; margin: 0; padding: 0; }
.chronologie li { position: relative; padding-block: 0 1.1rem; padding-inline: 1.5rem 0; border-inline-start: 2px solid var(--trait); margin-inline-start: .35rem; }
.chronologie li:last-child { border-left-color: transparent; padding-bottom: 0; }
.chronologie li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--encre); border: 2px solid #fff; }
.chronologie .meta { font-size: .78rem; color: var(--texte-doux); }

/* Listes de détails */
.details { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .55rem 1rem; margin: 0; }
.details dt { color: var(--texte-doux); font-weight: 400; font-size: .875rem; }
.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Forum */
.message-forum { display: flex; gap: .9rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--trait); }
.message-forum:last-child { border-bottom: 0; }
.message-forum.masque { background: var(--neutre-fond); opacity: .75; }
.message-corps { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Toasts */
.zone-toasts { position: fixed; top: 80px; inset-inline-end: 16px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 32px)); }
.toast-istmt { background: var(--encre); color: #fff; border-radius: var(--rayon-sm); padding: .8rem 1rem; display: flex; gap: .65rem; align-items: flex-start; box-shadow: var(--ombre-haute); animation: entree-toast .22s ease-out; }
.toast-istmt.erreur { background: var(--danger); }
.toast-istmt i.bi-check-circle-fill { color: #58d68d; }
.toast-istmt button { margin-inline-start: auto; background: transparent; border: 0; color: #fff; opacity: .8; }
@keyframes entree-toast { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.modal-content { border: 0; border-radius: var(--rayon); box-shadow: var(--ombre-haute); }

/* Connexion / inscription */
.page-auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: #fff; }
.auth-visuel { background: var(--encre); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-visuel h2 { color: #fff; font-size: 2.1rem; line-height: 1.2; max-width: 16ch; position: relative; }
.auth-visuel p { color: #c9c9cf; max-width: 42ch; position: relative; }
.auth-visuel .marque { display: flex; gap: .85rem; align-items: center; color: #fff; text-decoration: none; position: relative; }
.auth-visuel .pastille-logo { width: 72px; height: 72px; }
.auth-formulaire { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-boite { width: 100%; max-width: 440px; }
.auth-boite.large { max-width: 760px; }
.auth-boite h1 { font-size: 1.85rem; margin-bottom: .3rem; }
.auth-logo-mobile { display: none; }
.choix-profil { display: flex; gap: .9rem; padding: 1rem 1.1rem; border: 1px solid var(--trait-fort); border-radius: var(--rayon); text-decoration: none; color: var(--texte); align-items: center; transition: border-color var(--duree), background-color var(--duree); margin-bottom: .7rem; }
.choix-profil:hover { border-color: var(--primaire); background: var(--fond-survol); color: var(--texte); }
.choix-profil i.grande { font-size: 1.5rem; color: var(--primaire); }
.choix-profil strong { display: block; }
.choix-profil small { color: var(--texte-doux); }
@media (max-width: 991.98px) {
  .page-auth { grid-template-columns: 1fr; }
  .auth-visuel { display: none; }
  .auth-logo-mobile { display: block; width: 76px; height: 76px; margin-bottom: 1rem; }
}

/* Motif électrocardiogramme, repris de l'univers du logo */
.trace-ecg { position: absolute; left: 0; right: 0; height: 120px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='120' viewBox='0 0 480 120'%3E%3Cpath d='M0 70h150l14-18 14 18h24l10 14 16-74 18 92 12-32h36l18-14 16 14h152' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") repeat-x center; opacity: .55; pointer-events: none; }

/* Site public */
.nav-public { background: #fff; border-bottom: 1px solid var(--trait); position: sticky; top: 0; z-index: 1030; }
.nav-public .navbar-brand { display: flex; align-items: center; gap: .7rem; color: var(--encre); }
.nav-public .navbar-brand img { width: 52px; height: 52px; }
.nav-public .navbar-brand strong { font-family: var(--police-titre); font-size: 1.3rem; display: block; line-height: 1.1; }
.nav-public .navbar-brand small { font-size: .7rem; color: var(--texte-doux); white-space: normal; display: block; max-width: 230px; line-height: 1.2; }
.nav-public .nav-link { color: var(--texte); font-weight: 500; padding: .6rem .85rem !important; border-radius: var(--rayon-sm); }
.nav-public .nav-link:hover { color: var(--primaire); }
.nav-public .nav-link.actif { color: var(--primaire); }
.navbar-toggler { min-width: 44px; min-height: 44px; }
.heros { background: var(--encre); color: #fff; position: relative; overflow: hidden; padding: 5rem 0 9.5rem; }
.heros h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.7rem); line-height: 1.08; max-width: 17ch; margin-bottom: 1.1rem; }
.heros .accroche { font-size: 1.1rem; color: #d0d0d6; max-width: 54ch; margin-bottom: 1.75rem; }
.heros .surtitre { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .8rem; }
.heros .trace-ecg { bottom: 8px; }
.heros-chiffres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: rgba(255,255,255,.14); border-radius: var(--rayon); overflow: hidden; position: relative; }
.heros-chiffres div { background: var(--encre-2); padding: 1.3rem; }
.heros-chiffres strong { font-family: var(--police-titre); font-size: 2.1rem; display: block; line-height: 1.1; }
.heros-chiffres span { font-size: .84rem; color: #c0c0c8; }
.section-publique { padding: 4rem 0; }
.section-publique.alt { background: #fff; border-block: 1px solid var(--trait); }
.titre-section { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1.75rem; }
.titre-section h2 { font-size: 2rem; margin: 0; }
.titre-section p { color: var(--texte-doux); margin: .25rem 0 0; }
.carte-contenu { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; height: 100%; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: border-color var(--duree), box-shadow var(--duree); }
a.carte-contenu:hover { border-color: var(--trait-fort); box-shadow: 0 8px 22px rgba(20,20,22,.08); color: inherit; }
a.carte-contenu:hover h3 { color: var(--primaire); }
.carte-contenu h3 { font-family: var(--police-titre); font-size: 1.15rem; margin: 0 0 .4rem; transition: color var(--duree); }
.carte-contenu .corps { padding: 1.15rem; flex: 1; display: flex; flex-direction: column; }
.carte-contenu .meta { font-size: .82rem; color: var(--texte-doux); display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: auto; padding-top: .7rem; }
.carte-image { aspect-ratio: 16 / 8; background: var(--encre); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; }
.carte-image img { width: 100%; height: 100%; object-fit: cover; }
.carte-image .trace-ecg { top: 50%; transform: translateY(-50%); opacity: .8; }
.carte-image .type { position: absolute; inset-inline-start: .7rem; top: .7rem; background: #fff; color: var(--encre); font-size: .74rem; font-weight: 500; padding: .15rem .55rem; border-radius: 999px; }
.pied-public { background: var(--encre); color: #c9c9cf; padding: 3rem 0 1.5rem; margin-top: auto; }
.pied-public a { color: #e4e4e7; text-decoration: none; }
.pied-public a:hover { color: #fff; text-decoration: underline; }
.pied-public h3 { color: #fff; font-family: var(--police); font-size: .9rem; font-weight: 600; }
.pied-public ul { list-style: none; padding: 0; margin: 0; }
.pied-public li { padding: .2rem 0; }
.page-publique { display: flex; flex-direction: column; min-height: 100dvh; }
.bandeau-page { background: #fff; border-bottom: 1px solid var(--trait); padding: 2.25rem 0; }
.bandeau-page h1 { font-size: 2.2rem; margin: 0; }
.bandeau-page p { color: var(--texte-doux); margin: .35rem 0 0; }
@media (max-width: 575.98px) {
  .heros { padding: 3rem 0 8.5rem; }
  .section-publique { padding: 2.75rem 0; }
  .nav-public .navbar-brand small { display: none; }
}

/* Page d'erreur */
.page-erreur { text-align: center; padding: 4rem 1rem; }
.page-erreur .code { font-family: var(--police-titre); font-size: 4.5rem; color: var(--primaire); line-height: 1; }

/* Impression (lettre de recommandation) */
.feuille { background: #fff; max-width: 800px; margin: 2rem auto; padding: 3.5rem; border: 1px solid var(--trait); }
.feuille-entete { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid var(--encre); padding-bottom: 1rem; margin-bottom: 2rem; }
.feuille-entete img { width: 80px; height: 80px; }
.feuille p { font-family: var(--police-titre); font-size: 1.05rem; }
@media print {
  .pas-imprimer { display: none !important; }
  body { background: #fff; }
  .feuille { border: 0; margin: 0; padding: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Pas d'animation de la sidebar au chargement : uniquement quand l'utilisateur la bascule. */
body:not(.pret) .sidebar, body:not(.pret) .principal { transition: none; }
