/* =====================================================================
 * styles.css — Socle visuel de Gestion CACES® (SaaS)
 * Repris de legacy/index.html (variables, typographie, champs, boutons,
 * sections, tableaux, écran de connexion, voile de chargement), complété
 * par la mise en page de la coquille (en-tête, navigation latérale).
 * Le CSS propre à un module se reprend de legacy/index.html AVEC le module.
 * ===================================================================== */
:root {
  --fond:        #131a25;   /* fond de page, charbon profond */
  --surface:     #f7f8fa;   /* panneaux clairs — ressortent sur le fond */
  --surface-2:   #edf0f4;   /* sous-titres, zones secondaires */
  --surface-3:   #e1e6ee;   /* en-têtes, survol, champs actifs */
  --bord:        #c9d1dd;   /* séparations */
  --bord-doux:   #e2e7ee;   /* grille interne */
  --texte:       #1a2230;   /* écriture noire (bleu-noir doux) */
  --texte-2:     #4d5b70;   /* libellés secondaires */
  --texte-3:     #919cad;   /* placeholders, vides */
  --accent:      #d9741f;   /* orange BrainUpdate, lisible sur fond clair */
  --accent-fort: #e07f35;
  --accent-tint: rgba(224, 127, 53, .13);
  --sur-accent:  #14100b;   /* couleur du texte POSÉ SUR l'accent (boutons) ; recalculée en marque blanche selon la luminance */
  --bleu:        #3a6ea8;   /* accent secondaire, informatif */
  --vert:        #2f8f5d;
  --rouge:       #c4404e;
  --opt-tel:     #3f72ac;   /* option télécommande — bleu léger (muted) */
  --opt-pe:      #8163a6;   /* option porte-engin — violet léger (muted) */
  --radius:      10px;
  --ombre:       0 10px 34px rgba(2, 6, 12, .5);
  /* Coquille : textes et bords sur fond sombre (valeurs de legacy) */
  --sombre-texte:   #d4dce8;
  --sombre-texte-2: #9fadc2;
  --sombre-panneau: #10151d;
  --largeur-nav:      216px;   /* nav déployée (au survol) */
  --largeur-nav-rail:  58px;   /* nav repliée : icônes seules */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body { margin: 0; font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
       color: var(--texte); background: var(--fond);
       font-size: 13.5px; line-height: 1.4;
       -webkit-font-smoothing: antialiased; }

/* ---------- Champs et boutons ---------- */
select, input[type=text], input[type=search], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=file] {
  font: inherit; font-size: 13px; color: var(--texte);
  padding: 6px 10px; border: 1px solid var(--bord); border-radius: 8px;
  background: var(--surface); transition: border-color .15s, background .15s; }
input[type=date] { font-variant-numeric: tabular-nums; }
select:hover, input:hover { border-color: var(--texte-3); }
select:disabled, input:disabled { opacity: .55; background: var(--surface-2);
  color: var(--texte-3); cursor: not-allowed; }
select:focus, input:focus { outline: none; border-color: var(--accent);
  background: var(--surface-2); box-shadow: 0 0 0 3px var(--accent-tint); }
input[readonly] { background: var(--surface-2); color: var(--texte-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-fort); }

button { font: inherit; font-weight: 500; color: var(--texte);
         padding: 7px 14px; border: 1px solid var(--bord); border-radius: 8px;
         background: transparent; cursor: pointer;
         transition: background .15s, border-color .15s, color .15s; }
button:hover { background: var(--surface-3); border-color: var(--texte-3); }
button.primaire { background: var(--accent-fort); border-color: var(--accent-fort);
                  color: var(--sur-accent); font-weight: 600; }
button.primaire:hover { background: var(--accent); border-color: var(--accent); }
button.danger { color: var(--rouge); border-color: rgba(232, 128, 138, .35); }
button.danger:hover { background: rgba(232, 128, 138, .08); border-color: var(--rouge); }
button:disabled { opacity: .35; cursor: not-allowed; }
button:disabled:hover { background: transparent; border-color: var(--bord); }
button.petit { padding: 4px 10px; font-size: 14.5px; }

/* ---------- Sections (panneaux clairs sur fond sombre) ---------- */
section { background: var(--surface); border: 1px solid var(--bord);
          border-top: 2px solid var(--accent-fort);
          border-radius: var(--radius); margin-bottom: 16px;
          overflow: hidden; overflow-x: auto; box-shadow: var(--ombre); }
section > h2 { font-size: 13px; font-weight: 700; text-transform: uppercase;
               letter-spacing: .09em; color: var(--texte); margin: 0;
               padding: 13px 16px 4px; }
.corpsSection { padding: 12px 16px; }

/* Blocs pliables de la fiche (infos session / inscrits) — <details> natif */
.blocPliable { border: 1px solid var(--bord-doux); border-radius: 8px; margin-bottom: 12px;
               background: var(--surface); overflow: hidden; }
.blocPliable:last-child { margin-bottom: 0; }
.blocPliable > summary { list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte); background: var(--surface-2); }
.blocPliable > summary::-webkit-details-marker { display: none; }
.blocPliable > summary::before { content: "\25B8"; font-size: 11px; color: var(--texte-3); transition: transform .15s; }
.blocPliable[open] > summary::before { transform: rotate(90deg); }
.blocPliable > summary:hover { background: var(--surface-3); }
.blocCorps { padding: 13px 14px; }

/* ---------- Tableaux ---------- */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--bord-doux); padding: 7px 10px;
         text-align: center; vertical-align: top; }
td { font-weight: 500; }
thead th { background: var(--surface-3); color: var(--texte);
           font-weight: 700; font-size: 13px; letter-spacing: .02em;
           border-bottom: 1px solid var(--bord); }
tbody th { font-weight: 600; color: var(--texte); }

/* ---------- Textes utilitaires ---------- */
.badge { display: inline-block; background: var(--surface-3);
         border: 1px solid var(--bord); border-radius: 20px;
         padding: 1px 9px; font-size: 13px; margin-left: 8px;
         font-weight: 500; color: var(--texte-2); letter-spacing: .01em; }
.note { font-size: 14.5px; color: var(--texte-2); }
.erreur { color: var(--rouge); font-size: 15px; }
.ok { color: var(--vert); }

/* ---------- Écran de connexion ---------- */
#ecranConnexion { display: flex; flex-direction: column; align-items: center;
                  justify-content: center; min-height: 100vh; min-height: 100dvh;
                  padding: 24px 16px; }
#ecranConnexion .carte { background: var(--surface); border: 1px solid var(--bord);
                         border-radius: 16px; box-shadow: var(--ombre);
                         padding: 44px 52px; display: flex; flex-direction: column;
                         align-items: center; gap: 14px; width: min(440px, 100%); }
#ecranConnexion .logo { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .01em; }
#ecranConnexion .logo span { color: var(--accent); }
#ecranConnexion .note { max-width: 340px; margin: 0 0 6px; text-align: center; }
#ecranConnexion button { min-width: 220px; padding: 10px 18px; margin-top: 6px; }
#ecranConnexion .erreur { margin: 0; text-align: center; }
#ecranConnexion .erreur:empty { display: none; }
.champSaisie { align-self: stretch; display: flex; flex-direction: column; gap: 5px;
               font-size: 14.5px; font-weight: 600; color: var(--texte-2); }
.champSaisie input { width: 100%; font-weight: 400; }
.creditCarte { align-self: stretch; font-size: 12.5px; color: var(--texte-3); text-align: center;
               line-height: 1.7; margin: 10px 0 0; border-top: 1px solid var(--bord-doux);
               padding-top: 14px; }
@media (max-width: 480px) {
  #ecranConnexion .carte { padding: 32px 22px; }
}

/* ---------- Coquille : en-tête + navigation latérale + module ---------- */
#coquille { display: grid; height: 100vh; height: 100dvh; position: relative;
            grid-template-columns: var(--largeur-nav-rail) minmax(0, 1fr);
            grid-template-rows: auto minmax(0, 1fr);
            grid-template-areas: "entete entete" "nav contenu"; }
.entete { grid-area: entete; z-index: 20;
          background: rgba(247, 248, 250, .96); backdrop-filter: blur(8px);
          border-bottom: 2px solid var(--accent-fort);
          padding: 9px 20px; display: flex; align-items: center; gap: 16px;
          flex-wrap: wrap; }
.entete h1 { font-size: 16px; font-weight: 600; letter-spacing: .02em; margin: 0; }
.entete h1 span { color: var(--accent); }
.enteteOrganisation { min-width: 0; padding-left: 18px; border-left: 1px solid var(--bord);
                      font-weight: 600; overflow: hidden; text-overflow: ellipsis;
                      white-space: nowrap; }
.enteteUtilisateur { margin-left: auto; font-size: 14px; color: var(--texte-2); }

/* Navigation : rail d'icônes (replié) qui s'étend au survol en RECOUVRANT le
   contenu (le contenu ne se décale pas — la colonne de grille reste au rail). */
.navLaterale { grid-area: nav; overflow-x: hidden; overflow-y: auto; display: flex;
               flex-direction: column; gap: 3px; padding: 12px 9px;
               background: var(--sombre-panneau); border-right: 1px solid rgba(255, 255, 255, .06);
               width: var(--largeur-nav-rail); position: relative; z-index: 40;
               transition: width .14s ease; }
.navLaterale:hover { width: var(--largeur-nav); box-shadow: 8px 0 28px rgba(2, 6, 12, .45); }
.navTitre { margin: 0 0 5px; padding: 0 12px; font-size: 11px; font-weight: 700;
            text-transform: uppercase; letter-spacing: .09em; color: var(--sombre-texte-2);
            white-space: nowrap; opacity: 0; transition: opacity .12s ease; }
.navLaterale:hover .navTitre { opacity: 1; }
.navLaterale a { display: flex; align-items: center; gap: 12px; padding: 9px 11px;
                 border-radius: 8px; color: var(--sombre-texte); text-decoration: none;
                 font-weight: 500; white-space: nowrap;
                 transition: background .15s, color .15s; }
.navLaterale a svg { width: 20px; height: 20px; flex: 0 0 20px; }
.navLabel { opacity: 0; transition: opacity .12s ease; }
.navLaterale:hover .navLabel { opacity: 1; }
.navLaterale a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.navLaterale a[aria-current="page"] { background: var(--accent-tint); color: #fff;
                                      font-weight: 600; box-shadow: inset 3px 0 0 var(--accent-fort); }
.navLaterale a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#contenuModule { grid-area: contenu; overflow: auto; padding: 16px 18px; }
/* Emplacement réservé d'un module pas encore porté (et erreur de chargement) */
.etatVide { margin: 10px 0 4px; padding: 30px 20px; border: 1px dashed var(--bord);
            border-radius: 8px; background: var(--surface-2); color: var(--texte-2);
            text-align: center; }
.etatVide.erreur { border-color: var(--rouge); background: rgba(196, 64, 78, .06); }

/* Écran étroit : la navigation passe en bandeau horizontal sous l'en-tête */
@media (max-width: 800px) {
  #coquille { grid-template-columns: minmax(0, 1fr);
              grid-template-rows: auto auto minmax(0, 1fr);
              grid-template-areas: "entete" "nav" "contenu"; }
  /* Bandeau horizontal : pas de rail, pas de survol-déploiement, libellés visibles */
  .navLaterale { flex-direction: row; overflow-x: auto; overflow-y: hidden;
                 padding: 8px 12px; border-right: none; width: auto;
                 z-index: auto; box-shadow: none; transition: none;
                 border-bottom: 1px solid rgba(255, 255, 255, .06); }
  .navLaterale:hover { width: auto; box-shadow: none; }
  .navTitre { display: none; }
  .navLaterale a { white-space: nowrap; }
  .navLabel { opacity: 1; }
  #contenuModule { padding: 14px 12px; }
  .entete { padding: 10px 12px; gap: 8px 14px; }
  .enteteOrganisation { padding-left: 14px; }
}
@media (max-width: 480px) {   /* téléphone : titre + déconnexion, puis l'organisation */
  .enteteUtilisateur { display: none; }
  #btnDeconnexion { margin-left: auto; }
  .enteteOrganisation { order: 1; flex-basis: 100%; padding-left: 0; border-left: none; }
}

/* ---------- Blocs communs aux modules (repris de legacy/index.html) ---------- */
.filtresBar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
              padding: 10px 16px; border-bottom: 1px solid var(--bord-doux); }
.grille2 { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 9px 12px;
           align-items: center; font-size: 13px; }
.grille2 > label { color: var(--texte-2); }
.grille2 input, .grille2 select { width: 100%; }
.piedEdition { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px;
               padding-top: 12px; border-top: 1px solid var(--bord-doux); }

/* ---------- Modules à liste + fiche (stagiaires, intervenants, sessions) ---------- */
.grilleStagiaires, .grilleSessions, .grilleIntervenants { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
                                     gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grilleStagiaires, .grilleSessions, .grilleIntervenants { grid-template-columns: minmax(0, 1fr); } }
/* Sessions : liste (avec filtre semaine + famille) et fiche EMPILÉES en pleine largeur */
.grilleSessions { grid-template-columns: minmax(0, 1fr); }
.navSemaineSes { display: flex; align-items: center; gap: 6px; }
.navSemaineSes button { padding: 5px 9px; }
.navSemaineSes .libSemaine { min-width: 196px; text-align: center; font-weight: 600;
                             color: var(--texte-2); font-size: 13.5px; }
.filtresBar input[type=search] { flex: 1; min-width: 200px; }
.zoneTableau { max-height: 65vh; overflow: auto; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) :is(th, td) { text-align: left; vertical-align: middle; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) thead th { position: sticky; top: 0; z-index: 1; padding: 0; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) thead th button { width: 100%; padding: 8px 10px; border: none;
  border-radius: 0; text-align: left; font-weight: 700; font-size: 13px; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) th[aria-sort="ascending"] button::after { content: " ▲"; color: var(--accent); font-size: .75em; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) th[aria-sort="descending"] button::after { content: " ▼"; color: var(--accent); font-size: .75em; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) tbody tr { cursor: pointer; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) tbody tr:hover td { background: var(--accent-tint); }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
:is(table.tabStagiaires, table.tabSessions, table.tabIntervenants) tr.selectionnee td { background: var(--accent-tint) !important;
  box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
table.tabSessions td:last-child { font-variant-numeric: tabular-nums; }
.etatListe { margin: 10px 16px 14px; }
.etatListe:empty, .ficheMessage:empty { display: none; }
.ficheMessage { margin: 12px 0 0; white-space: pre-line; }
/* Confirmation intégrée à la fiche (suppression, homonyme) */
.barreConfirmation { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--accent-fort);
                     border-radius: 8px; background: var(--accent-tint); }
.barreConfirmation p { margin: 0 0 10px; white-space: pre-line; }
/* Confirmation / message inline au-dessus de la ligne d'inscrit concernée */
.confirmInscritLigne { margin: 0 0 6px; }
.messageInscritLigne { margin: 0 0 6px; }
/* Sous-sections de fiche (NIR, inscrits) — titre au style des blocs de legacy (.resBloc h4) */
.sectionNir, .sectionInscrits, .sectionPhoto { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bord); }
:is(.sectionNir, .sectionInscrits, .sectionPhoto) h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--texte-2); }
.sectionNir .note { margin: 0; }
.sectionNir input { font-variant-numeric: tabular-nums; letter-spacing: .03em; }

/* Photo du titulaire (fiche stagiaire) */
.photoEdition { display: flex; gap: 14px; align-items: center; }
.photoApercu { width: 96px; height: 96px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--bord); background: var(--surface-2); flex: 0 0 auto; }
.photoApercu.photoVide { display: flex; align-items: center; justify-content: center;
  color: var(--texte-3); font-size: 12px; }
.photoActions { display: flex; flex-wrap: wrap; gap: 8px; }
.sectionPhoto .note { margin: 8px 0 0; }

/* Organisation — marque blanche (module admin) + logo dans l'en-tête */
.enteteLogo { height: 28px; width: auto; max-width: 130px; object-fit: contain; border-radius: 4px; }
.grilleOrganisation { max-width: 760px; }
.zoneLogo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.apercuLogo { height: 56px; max-width: 180px; object-fit: contain; border: 1px solid var(--bord);
  border-radius: 8px; background: var(--surface-2); padding: 4px; }
.actionsLogo { display: flex; gap: 8px; align-items: center; }
.boutonFichier { display: inline-block; padding: 6px 13px; border: 1px solid var(--bord);
  border-radius: 7px; background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.boutonFichier:hover { border-color: var(--accent); background: var(--accent-tint); }
.zoneLogo [data-ref="logoInfo"] { flex-basis: 100%; margin: 4px 0 0; }
.grilleOrganisation .grille2 textarea { width: 100%; resize: vertical; font: inherit; line-height: 1.4; }
.champCouleur { display: flex; align-items: center; gap: 10px; }
.champCouleur input[type="color"] { width: 44px; height: 30px; padding: 0; border: 1px solid var(--bord);
  border-radius: 6px; background: none; cursor: pointer; flex: 0 0 auto; }
.champCouleur .note { margin: 0; }
/* Membres & rôles (module admin) */
.ligneMembre { display: grid; grid-template-columns: minmax(140px, 1.2fr) 2fr auto; align-items: center;
  gap: 10px; padding: 8px 10px; border: 1px solid var(--bord-doux); border-radius: 6px; margin-bottom: 6px; }
.ligneMembre .mbEmail { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rolesChoix { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.roleCase { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.actionsMembre { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* Pastilles de choix (catégories CACES) — repris de legacy */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 16px; border: 1px solid var(--bord); border-radius: 20px;
        background: var(--surface); font-weight: 600; font-size: 15.5px;
        cursor: pointer; transition: all .12s; }
.chip.petite { padding: 3px 11px; font-size: 13.5px; }
.chip:hover { border-color: var(--accent); background: var(--accent-tint); }
.chip.actif { background: var(--accent-fort); border-color: var(--accent-fort); color: var(--sur-accent); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
/* Bascule d'option (télécommande / porte-engin) attachée à une catégorie : plus discrète */
.chip.petite.chipOption { font-size: 12px; padding: 2px 9px; }
.chipOption:not(.actif) { border-style: dashed; color: var(--texte-2); background: transparent; }
.chip.petite.chipOption.actif { background: var(--accent-tint); border-color: var(--accent-fort); color: var(--accent); }
/* Inscrits d'une session — Modèle 3 : ligne repliée (nom | résumé compact | actions)
   + panneau d'édition dépliable à la demande (bloc plein largeur sous la ligne). */
.ligneInscrit { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto;
                align-items: start; gap: 10px; text-align: left; padding: 7px 10px;
                border: 1px solid var(--bord-doux); border-radius: 6px; margin-bottom: 6px; }
.ligneInscrit .name { font-weight: 600; padding-top: 2px; min-width: 0; word-break: break-word; }
.ligneInscrit.inscritNouveau { border-color: var(--accent-fort); box-shadow: 0 0 0 2px var(--accent-tint); }
.actionsInscrit { display: flex; gap: 6px; }
/* Résumé compact, STRICTEMENT lecture seule : par catégorie, statut calculé + options regroupés */
.resumeInscription { display: flex; flex-wrap: wrap; gap: 5px 8px; min-width: 0; align-items: center; }
.grpCat { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.grpCat + .grpCat { padding-left: 8px; border-left: 1px solid var(--bord-doux); }
/* Catégorie / option simplement inscrite, sans statut calculé (brouillon, ajout en attente) */
.miniStatut.inscrit { background: var(--surface-2); color: var(--texte-2); border-color: var(--bord); }
/* Panneau d'édition déplié */
.foldInscrit { margin: -2px 0 9px; padding: 10px 12px;
               border: 1px solid var(--bord-doux); border-left: 3px solid var(--accent-fort);
               border-radius: 6px; background: var(--surface-2);
               display: flex; flex-direction: column; gap: 11px; }
.foldBlock { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.foldLabel { flex-basis: 100%; font-size: 11.5px; font-weight: 700; color: var(--texte-3);
             text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px; }
.foldAide { flex-basis: 100%; margin: 0 0 4px; font-size: 11.5px; color: var(--texte-3); line-height: 1.35; }
/* Catégorie inscrite : × de retrait explicite (pas de clic-pastille) */
.catChip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px 3px 11px;
           border: 1px solid var(--accent-fort); border-radius: 20px;
           background: var(--accent-tint); color: var(--accent); font-weight: 600; font-size: 13.5px; }
.catChipX { border: none; background: transparent; color: inherit; cursor: pointer;
            font-size: 16px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.catChipX:hover { background: rgba(196,64,78,.18); color: var(--rouge); }
/* Catégorie disponible : clic = inscrire */
.catPill { padding: 3px 11px; border: 1px dashed var(--bord); border-radius: 20px;
           background: var(--surface); color: var(--texte-2); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.catPill:hover { border-style: solid; border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
/* Options par catégorie : une ligne [CAT] + bascules */
.optLigne { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.optLigne + .optLigne { margin-top: 2px; }
.opillEdit { padding: 2px 10px; border: 1px dashed var(--bord); border-radius: 16px;
             background: transparent; color: var(--texte-2); font-size: 12.5px; cursor: pointer; }
.opillEdit:hover { border-color: var(--accent); color: var(--accent); }
.opillEdit.actif { border-style: solid; background: var(--accent-tint); border-color: var(--accent-fort); color: var(--accent); }
/* Annulation immédiate d'un retrait (sans pop-up de confirmation) */
.foldUndo { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texte-2); }
.lienUndo { border: none; background: transparent; color: var(--accent); font-weight: 600;
            cursor: pointer; padding: 0; text-decoration: underline; font-size: 13px; }
/* Formateurs de session (bloc dynamique) — repris de legacy */
.ligneFormateur { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.ligneFormateur select { min-width: 0; width: auto; }
.ligneFormateur select:first-child { flex: 1; }
/* Recherche d'un stagiaire à inscrire (combobox de legacy) */
.ajoutInscrit { margin-top: 10px; }
.ajoutInscrit input[type=search] { width: 100%; }
.listeDefilante { max-height: 220px; overflow-y: auto; margin-top: 4px;
                  border: 1px solid var(--bord); border-radius: 8px; background: var(--surface); }
.giLigne { display: block; width: 100%; padding: 7px 12px; text-align: left; border: none;
           border-bottom: 1px solid var(--bord-doux); border-radius: 0; }
.giLigne:last-child { border-bottom: none; }
.giLigne:hover { background: var(--accent-tint); }
.giVide { padding: 10px 12px; }

/* ---------- Voile de chargement ---------- */
#chargement { position: fixed; inset: 0; background: rgba(15, 21, 32, .65);
              backdrop-filter: blur(2px); display: none; align-items: center;
              justify-content: center; z-index: 90; padding: 16px; text-align: center;
              font-size: 16px; font-weight: 600; letter-spacing: .03em;
              color: #eef2f8; }
#chargement.ouvert { display: flex; }

/* ---------- Écrans tactiles (tablettes) : cibles plus grandes ---------- */
@media (pointer: coarse) {
  button { min-height: 44px; }
  button.petit { min-height: 38px; padding: 8px 14px; }
  select, input[type=text], input[type=search], input[type=email], input[type=password],
  input[type=number], input[type=date], input[type=file] { min-height: 44px; }
  th, td { padding: 12px 10px; }
  .navLaterale a { padding-top: 13px; padding-bottom: 13px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
 * Module Tests — Évaluation pratique (web/modules/tests.js)
 * ===================================================================== */
/* Focus pendant l'évaluation : la fiche prend toute la largeur, la sélection est masquée */
.grillePratique.evalActive { grid-template-columns: minmax(0, 1fr); }
.grillePratique.evalActive .selPratique { display: none; }

/* Mode kiosque : pendant une évaluation, la coquille masque entête + nav latérale
   (le testeur reste concentré sur la fiche ; on sort par le bouton Fermer). */
body.modeEvaluation #coquille {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "contenu";
}
body.modeEvaluation .entete,
body.modeEvaluation .navLaterale { display: none; }
.grillePratique { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
                  gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grillePratique { grid-template-columns: minmax(0, 1fr); } }
.selPratique .corpsSection { display: flex; flex-direction: column; gap: 12px; }
.selPratique label.bloc { display: flex; flex-direction: column; gap: 5px;
                          font-size: 13px; font-weight: 600; color: var(--texte-2); }
.selPratique label.bloc select { font-weight: 400; }

/* En-tête de la fiche : candidat / grille / testeur */
.enteteEval { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 0 4px; }
.enteteEval div { font-size: 15px; }
.enteteEval b { color: var(--texte-2); font-weight: 600; }

/* Thèmes et questions */
.themeEval { margin-top: 16px; }
.themeEval > h3 { margin: 0 0 6px; font-size: 13px; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .04em; color: var(--texte-2);
                  display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.themeEval > h3 .themeBareme { font-weight: 600; text-transform: none; letter-spacing: 0;
                               font-size: 13px; color: var(--texte-3); }
.ligneQuestion { display: grid; grid-template-columns: 44px minmax(0, 1fr) 92px;
                 gap: 10px; align-items: center; padding: 7px 0;
                 border-bottom: 1px solid var(--bord-doux); }
.ligneQuestion:last-child { border-bottom: none; }
.ligneQuestion .ptNum { text-align: center; font-weight: 700; color: var(--texte-2);
                        font-variant-numeric: tabular-nums; }
.ligneQuestion .critere { font-size: 15px; }
.ligneQuestion .critere .sousSection { display: block; font-size: 13px; color: var(--texte-3);
                                        margin-bottom: 2px; }
.ligneQuestion select { width: 100%; text-align: center; font-variant-numeric: tabular-nums; }

/* Reprise des évaluations en cours (brouillons) */
.repriseEnCours { border: 1px solid rgba(224,127,53,.4); background: var(--accent-tint);
                  border-radius: 8px; padding: 10px 12px; }
.repriseTitre { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase;
                letter-spacing: .04em; color: var(--accent); }
.repriseLigne { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                padding: 5px 0; font-size: 14.5px; }
.repriseLigne + .repriseLigne { border-top: 1px solid var(--bord-doux); }
.repriseActions { display: flex; align-items: center; gap: 6px; flex: none; }

/* Récapitulatif du statut du candidat (acquis / à passer / formation seule) */
.recapStatut { margin: 2px 0 2px; }
.recapStatut .chipsStatut { display: flex; flex-wrap: wrap; gap: 6px; }
.miniStatut { font-size: 13px; padding: 3px 9px; border-radius: 14px;
              border: 1px solid var(--bord); background: var(--surface-2); color: var(--texte-2);
              font-variant-numeric: tabular-nums; }
.miniStatut.acquise { background: rgba(47,143,93,.12); color: var(--vert); border-color: rgba(47,143,93,.4); }
.miniStatut.a_passer { background: var(--accent-tint); color: var(--accent); border-color: rgba(224,127,53,.4); }
.miniStatut.formation_seule { background: var(--surface-2); color: var(--texte-3); border-style: dashed; }
.miniStatut.manque { background: rgba(196,64,78,.10); color: var(--rouge); border-color: rgba(196,64,78,.4); }
.miniStatut.opt { font-size: 12.5px; opacity: .9; }
/* S3 : déjà inscrit(e) sur une autre session en cours de la même famille (réinscription signalée, non bloquée) */
.miniStatut.avert { background: rgba(214,158,46,.14); color: #8a6400; border-color: rgba(214,158,46,.45); }

/* Saisie 2 engins : deux colonnes de note côte à côte (colonnes F/G du template) */
.evalDeuxEngins { width: 100%; border-collapse: collapse; margin-top: 12px; table-layout: fixed; }
.evalDeuxEngins thead th { position: sticky; top: 0; z-index: 1; }
.evalDeuxEngins th.colCrit { text-align: left; }
.evalDeuxEngins th.colNote { width: 110px; }
.evalDeuxEngins td { vertical-align: middle; }
.evalDeuxEngins td.cellCrit { font-size: 15px; }
.evalDeuxEngins td.cellCrit .ptNum { display: inline-block; min-width: 26px; text-align: center;
                                      font-weight: 700; color: var(--texte-2);
                                      font-variant-numeric: tabular-nums; margin-right: 8px; }
.evalDeuxEngins td.cellCrit .sousSection { display: block; font-size: 13px; color: var(--texte-3);
                                           margin: 2px 0 2px 34px; }
.evalDeuxEngins td.cellNote { text-align: center; }
.evalDeuxEngins td.cellNote select { width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.evalDeuxEngins td.cellNote .noteVide { color: var(--texte-3); }
.evalDeuxEngins tr.themeLigne td { background: var(--surface-2);
                                   border-top: 2px solid var(--bord); padding: 8px 10px; }
.evalDeuxEngins tr.themeLigne b { font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
                                  color: var(--texte-2); }
.evalDeuxEngins tr.themeLigne .themeBareme { display: block; margin-top: 3px; font-size: 13px;
                                             font-weight: 600; color: var(--texte-3); }

/* Éliminations + durée */
.blocElim { margin-top: 16px; }
.blocElim label { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0;
                  font-size: 15px; cursor: pointer; }
.blocElim input[type=checkbox] { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.blocDuree { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.blocDuree input[type=number] { width: 90px; text-align: center; font-variant-numeric: tabular-nums; }

/* Panneau verdict (aperçu temps réel + résultat serveur) */
.verdictPanel { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--bord);
                border-radius: 8px; background: var(--surface-2); }
.verdictGlobal { font-size: 17px; font-weight: 700; display: flex; align-items: center;
                 gap: 10px; margin-bottom: 10px; }
.verdictGlobal .pastille { padding: 2px 12px; border-radius: 20px; font-size: 14px; }
.pastille.reussite { background: rgba(47, 143, 93, .15); color: var(--vert); border: 1px solid var(--vert); }
.pastille.echec    { background: rgba(196, 64, 78, .12); color: var(--rouge); border: 1px solid var(--rouge); }
.verdictRegles { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.vInd { font-size: 13.5px; padding: 3px 10px; border-radius: 16px; border: 1px solid var(--bord); }
.vInd.ok    { background: rgba(47, 143, 93, .10); color: var(--vert); border-color: rgba(47,143,93,.4); }
.vInd.echec { background: rgba(196, 64, 78, .08); color: var(--rouge); border-color: rgba(196,64,78,.4); }
.verdictMotifs { margin: 10px 0 0; font-size: 14px; color: var(--texte-2); white-space: pre-line; }

/* Fiche imprimable (PDF réglementaire) : cachée à l'écran, seule visible à l'impression */
.fichePrint { display: none; }
.fichePrint table { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 12px; }
.fichePrint th, .fichePrint td { border: 1px solid #333; padding: 5px 7px; text-align: left; vertical-align: top; }
.fichePrint thead th { background: #eee; text-align: center; }
.fichePrint .pTitre { font-size: 16px; font-weight: 700; text-align: center; margin: 0 0 4px; }
.fichePrint .pMeta { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; margin: 6px 0; flex-wrap: wrap; }
.fichePrint .pSynthese td:last-child { font-weight: 700; text-align: center; width: 110px; }
.fichePrint .pSignature { margin-top: 20px; font-size: 12px; }
.fichePrint h4 { margin: 14px 0 4px; font-size: 13px; }

/* ---------- Module Tests : sous-onglets Pratique / Théorique ---------- */
.sousNavTests { display: flex; gap: 8px; margin: 0 0 14px; border-bottom: 1px solid var(--bord); }
.sousOnglet { background: transparent; border: 1px solid transparent; border-bottom: none;
              border-radius: 8px 8px 0 0; padding: 8px 16px; font-weight: 600; color: var(--texte-2);
              margin-bottom: -1px; }
.sousOnglet:hover { background: var(--surface-2); color: var(--texte); }
.sousOnglet.actif { background: var(--surface); border-color: var(--bord);
                    border-bottom: 2px solid var(--accent-fort); color: var(--texte); }

/* ---------- Théorique (console intégrée au module Tests) ---------- */
.selTheo label.bloc, .reouvreZone label.bloc { display: flex; flex-direction: column; gap: 5px;
                      font-size: 13px; font-weight: 600; color: var(--texte-2); }
.selTheo label.bloc select, .selTheo label.bloc input,
.reouvreZone label.bloc select, .reouvreZone label.bloc input { font-weight: 400; }
.ligneTheo { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.ligneTheo > .bloc { flex: 1 1 220px; }
.toggleSessions { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--texte-2); font-weight: 400; margin: 0 0 12px; }
.toggleSessions input { width: auto; }
.resMotif { font-size: 13px; color: var(--texte-2); background: var(--accent-tint); border-radius: 6px; padding: 6px 10px; }
.toolbarTheo { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
button.petite { padding: 4px 10px; font-size: 12.5px; }
.badge.bOk { background: rgba(47,143,93,.12); color: var(--vert); border-color: rgba(47,143,93,.35); }
.badge.bKo { background: rgba(196,64,78,.12); color: var(--rouge); border-color: rgba(196,64,78,.35); }
.ficheMessage.ok { color: var(--vert); }
.ficheMessage.erreur { color: var(--rouge); }
.reouvreZone { border: 1px solid var(--accent-fort); border-radius: 8px; padding: 12px 14px;
               margin: 0 0 14px; background: var(--accent-tint); }
.reouvreZone b { display: block; margin: 0 0 8px; }
.plancheTheo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qrcardT { border: 1px dashed #b9c2cd; border-radius: 10px; padding: 12px; text-align: center;
           break-inside: avoid; background: #fff; }
.qrcardT .nomT { font-weight: 700; font-size: 14px; margin: 0 0 2px; color: #000; }
.qrcardT .catT { font-size: 11px; color: #555; margin: 0 0 8px; min-height: 14px; }
.qrcardT img { width: 150px; height: 150px; image-rendering: pixelated; }
.qrcardT .legT { font-size: 10px; color: #555; margin-top: 6px; }
.planchePrint { display: block; }

@media print {
  /* Technique de visibilité (reprise de legacy) : tout masqué, seule la fiche
     imprimable et son contenu redeviennent visibles — robuste quelle que soit
     l'imbrication (la fiche est profondément nichée dans la section). */
  body { background: #fff; }
  body * { visibility: hidden !important; }
  .fichePrint, .fichePrint *,
  .planchePrint, .planchePrint * { visibility: visible !important; }
  .fichePrint { display: block !important; position: absolute; left: 0; top: 0;
                width: 100%; padding: 14px 18px; color: #000; }
  .planchePrint { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 10px; }
  .plancheTheo { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
}

/* =====================================================================
   Module RÉSULTATS (consultation + remédiation)
   ===================================================================== */
.resChoix { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.resultats label.bloc { display: flex; flex-direction: column; gap: 5px; font-weight: 600;
  color: var(--texte-2); font-size: 14px; flex: 1 1 220px; }
.resultats .bloc { flex: 1 1 220px; }
.resultats label.bloc input, .resultats label.bloc select,
.resRemediation input, .resRemediation textarea { font-weight: 400; }

/* Combobox stagiaire : liste déroulante flottante sous le champ.
   La règle globale « section { overflow:hidden } » (coins arrondis) rognerait
   la liste absolue : on rétablit overflow:visible sur la carte de sélection. */
.resSelection { overflow: visible; }
.resComboStg { display: flex; flex-direction: column; gap: 5px; position: relative;
  font-weight: 600; color: var(--texte-2); font-size: 14px; }
.resComboStg input { width: 100%; font-weight: 400; }
.resComboStg .listeDefilante { position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  box-shadow: var(--ombre); }

.resConsultation { margin-top: 18px; padding: 16px 18px 18px; }
.resConsultation > .resGrille > .resColonneListes > h3:first-child { margin-top: 0; }
.resGrille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.resColonneListes h3, .resColonneDetail h3 { margin: 0 0 8px; font-size: 15px; color: var(--texte-2); }
.resColonneListes h3 + div + h3 { margin-top: 18px; }
@media (max-width: 900px) { .resGrille { grid-template-columns: minmax(0, 1fr); } }

table.tabResultats { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabResultats th { text-align: left; font-weight: 600; color: var(--texte-2); font-size: 13px;
  border-bottom: 1px solid var(--bord); padding: 6px 8px; }
.tabResultats td { padding: 6px 8px; border-bottom: 1px solid var(--bord-doux); }
.tabResultats tr[data-theo], .tabResultats tr[data-prat], .tabResultats tr[data-option] { cursor: pointer; }
.tabResultats tr[data-theo]:hover td, .tabResultats tr[data-prat]:hover td,
.tabResultats tr[data-option]:hover td { background: var(--surface-2); }
.tabResultats tr.selectionnee td { background: var(--accent-tint); }
.resVerdict.reussite { color: var(--vert); font-weight: 600; }
.resVerdict.echec { color: var(--rouge); font-weight: 600; }

.chevPrat { cursor: pointer; color: var(--texte-2); }
.chevVide { display: inline-block; width: 1.2em; }
.ligneOption td { color: var(--texte-2); }
.ligneOption .libOption { padding-left: 28px; }
/* Numéro de session d'un résultat, en sous-ligne discrète */
.resSousSession { display: block; font-size: 11.5px; color: var(--texte-3); margin-top: 1px; }

.resDetail > p { margin: 0 0 8px; }
.resBloc { margin-top: 14px; }
.resBloc h4 { margin: 0 0 6px; font-size: 14px; color: var(--texte-2); }
.resTheme { padding: 2px 0; font-size: 14px; }
.resMotif { white-space: pre-line; background: rgba(196, 64, 78, .06);
  border: 1px solid rgba(196, 64, 78, .25); border-radius: var(--radius); padding: 8px 10px; font-size: 14px; }
.resRemediation { display: flex; flex-direction: column; gap: 8px; }
.resRemediation label.bloc { display: flex; flex-direction: column; gap: 5px; font-weight: 600;
  color: var(--texte-2); font-size: 14px; }
.resRemediation input, .resRemediation textarea { width: 100%; }

/* ---------- Module Cartes : titres externes ---------- */
.cartes .carteListe { margin-top: 14px; }
.ceType { display: flex; gap: 18px; align-items: center; }
.ceType label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--texte); }
.ceIndice { margin: 10px 0 0; }
.ceFiltres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.ceFiltres input, .ceFiltres select { width: auto; }
.lienJustif { border: none; background: transparent; color: var(--accent); font-weight: 600;
  cursor: pointer; padding: 0; text-decoration: underline; font-size: 13px; }
.lienJustif:disabled { opacity: .5; cursor: default; }

/* ---------- Module Cartes : génération / aperçu ---------- */
/* La liste déroulante du combobox est en position absolue : la règle globale
   .blocPliable{overflow:hidden} la rognerait → on rétablit overflow visible sur
   les sections qui portent un combobox. */
.cartes .blocPliable.blocCombo { overflow: visible; }
/* overflow:visible laisse les coins droits du summary (fond --surface-2) dépasser
   le bord arrondi du bloc → on arrondit le summary pour les faire coïncider
   (rayon intérieur = rayon du bloc − bordure : 8px − 1px = 7px). */
.cartes .blocCombo > summary { border-radius: 7px 7px 0 0; }
.cartes .blocCombo:not([open]) > summary { border-radius: 7px; }
.actionsCarte { display: flex; flex-wrap: wrap; gap: 8px; }
.ceGenForm { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 6px 0 10px; }
.ceGenForm .resComboStg { min-width: 240px; }
.ceGenForm label.bloc { min-width: 160px; }
.ceSousTitre { margin: 22px 0 8px; font-size: 15px; }
.carteApercu { width: 100%; height: 540px; margin-top: 12px; border: 1px solid var(--bord);
  border-radius: var(--rayon); background: #fff; }
