/*
 * Gestion des absences : thème inspiré de l'identité OFPPT
 * Ardoise (navigation), vert (actions, présence), bleu (information), gris acier (texte secondaire).
 * Police : Public Sans (sobre, institutionnelle, chiffres tabulaires).
 */
:root {
    --ardoise: #13294b;
    --ardoise-2: #1b355f;
    --ardoise-3: #29497a;
    --vert: #1e8e4a;
    --vert-fonce: #16703a;
    --vert-clair: #e5f3ea;
    --bleu: #1f5fae;
    --bleu-clair: #e6eef9;
    --acier: #8a94a6;
    --gris-logo: #a7adb7;
    --rouge: #b93a2b;
    --rouge-clair: #fbeae7;
    --ambre: #9a6512;
    --ambre-clair: #fbf1dc;
    --encre: #1b2433;
    --texte: #2b3546;
    --muted: #677286;
    --bord: #dde3ea;
    --bord-fort: #c6cfda;
    --fond: #f2f5f8;
    --surface: #ffffff;
    --rayon: 10px;
    --rayon-petit: 7px;
    --menu: 248px;
    --police: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--police);
    font-size: 15px;
    line-height: 1.55;
    color: var(--texte);
    background: var(--fond);
    font-variant-numeric: tabular-nums;
}
a { color: var(--bleu); text-underline-offset: 2px; }
a:hover { color: var(--ardoise); }
:focus-visible { outline: 3px solid rgba(31, 95, 174, .45); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { color: var(--encre); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; margin: 0 0 .35rem; }
h2 { font-size: 1.08rem; font-weight: 700; margin: 0 0 1rem; }
pre {
    background: var(--fond); border: 1px solid var(--bord); padding: .65rem .85rem;
    border-radius: var(--rayon-petit); overflow-x: auto; font-size: .85rem; line-height: 1.6;
}
small { font-size: .82em; }

/* ---------- Bande tricolore (vert · gris · bleu du logo) ---------- */
.tricolore { display: flex; height: 4px; }
.tricolore i { flex: 1; }
.tricolore i:nth-child(1) { background: var(--vert); }
.tricolore i:nth-child(2) { background: var(--gris-logo); }
.tricolore i:nth-child(3) { background: var(--bleu); }

/* ---------- Navigation latérale ---------- */
.menu-lateral {
    position: fixed; inset: 0 auto 0 0; width: var(--menu); z-index: 30;
    display: flex; flex-direction: column;
    background: var(--ardoise); color: #d5ddea;
}
.marque { display: flex; align-items: center; gap: .75rem; padding: 1.15rem 1.2rem; text-decoration: none; color: #fff; }
.marque:hover { color: #fff; }
.marque-logo {
    flex: none; width: 44px; height: 44px; border-radius: 9px; background: #fff;
    display: grid; place-items: center; overflow: hidden; color: var(--ardoise);
}
.marque-logo img { width: 38px; height: 38px; object-fit: contain; }
.marque-logo .icone { width: 24px; height: 24px; }
.marque-texte { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.marque-texte b { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.marque-texte small { color: #9fb0c9; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-lateral .tricolore { margin: 0 1.2rem; border-radius: 2px; overflow: hidden; }

.navigation { flex: 1; overflow-y: auto; padding: 1rem .7rem; display: flex; flex-direction: column; gap: 2px; }
.navigation a, .compte a {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .75rem; border-radius: 8px;
    color: #c9d3e2; text-decoration: none; font-size: .92rem; font-weight: 500;
}
.navigation a:hover, .compte a:hover { background: var(--ardoise-2); color: #fff; }
.navigation a.actif, .compte a.actif { background: #fff; color: var(--ardoise); font-weight: 700; }
.navigation a.actif .icone { color: var(--vert); }
.icone { width: 20px; height: 20px; flex: none; }
.pastille {
    margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 700;
    background: var(--vert); color: #fff; border-radius: 99px; padding: 0 .5rem; line-height: 1.5rem; min-width: 1.5rem; text-align: center;
}
.navigation a.actif .pastille { background: var(--ardoise); }

.compte { border-top: 1px solid var(--ardoise-3); padding: .8rem .7rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.compte-identite { display: flex; align-items: center; gap: .7rem; padding: .3rem .75rem .65rem; }
.compte-identite b { display: block; color: #fff; font-size: .9rem; line-height: 1.25; }
.compte-identite small { color: #9fb0c9; }
.avatar {
    flex: none; width: 34px; height: 34px; border-radius: 50%;
    background: var(--ardoise-3); color: #fff; font-size: .8rem; font-weight: 700;
    display: grid; place-items: center;
}

.barre-mobile, .voile { display: none; }

/* ---------- Zone de contenu ---------- */
.avec-menu .contenu { margin-left: var(--menu); min-height: 100vh; display: flex; flex-direction: column; }
.conteneur { width: 100%; max-width: 1180px; margin: 0 auto; padding: 2rem 2.2rem 1rem; flex: 1; }
.pied { text-align: center; color: var(--acier); font-size: .8rem; padding: 1.5rem 1rem 2rem; }

/* ---------- Cartes et grilles ---------- */
.carte {
    background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: 1.35rem 1.45rem; margin-bottom: 1.25rem;
}
.carte > h2:first-child { margin-top: 0; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.grille-2 > .carte { margin-bottom: 0; }
.grille-seance { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 1.25rem; align-items: start; }
.grille-seance > .carte:only-child { grid-column: 1 / -1; }

/* Indicateurs : la couleur de la barre dit de quoi il s'agit */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .85rem; margin: 1.1rem 0 1.4rem; }
.kpi {
    background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: .95rem 1.1rem .95rem 1.2rem; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--bord-fort); }
.kpi b { display: block; font-size: 1.65rem; font-weight: 800; color: var(--encre); line-height: 1.15; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: .84rem; }
.kpi-alerte::before { background: var(--rouge); }
.kpi-alerte b { color: var(--rouge); }

/* ---------- Tableaux ---------- */
.defile { overflow-x: auto; margin: 0 -.2rem; padding: 0 .2rem; }
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th {
    text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem;
    padding: .55rem .6rem; border-bottom: 1px solid var(--bord-fort); white-space: nowrap;
}
.tableau td { padding: .7rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr:hover td { background: #f8fafc; }
.tableau td b { color: var(--encre); font-weight: 600; }
tr.inactif td { opacity: .45; }
tr.statut-present td:first-child, tr.statut-retard td:first-child { box-shadow: inset 3px 0 0 var(--vert); }
tr.statut-retard td:first-child { box-shadow: inset 3px 0 0 var(--ambre); }
tr.statut-absent td:first-child { box-shadow: inset 3px 0 0 var(--rouge); }
tr.nouveau-jour td { border-top: 2px solid var(--bord-fort); }

/* ---------- Formulaires ---------- */
label { display: block; font-size: .86rem; font-weight: 600; color: var(--encre); margin-bottom: .9rem; }
label small, label .muted { font-weight: 400; }
input, select, textarea {
    display: block; width: 100%; margin-top: .35rem;
    padding: .62rem .75rem; min-height: 42px;
    border: 1px solid var(--bord-fort); border-radius: var(--rayon-petit);
    font: inherit; font-weight: 400; color: var(--encre); background: #fff;
}
input:hover, select:hover { border-color: var(--acier); }
input:focus, select:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(31, 95, 174, .16); }
input[type=file] { padding: .45rem; min-height: auto; background: var(--fond); }
input[type=checkbox] { width: auto; min-height: auto; display: inline-block; margin: 0; accent-color: var(--vert); }
.form-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; align-items: end; }
.form-grille > .btn { margin-bottom: .9rem; min-height: 42px; }
.ligne-form { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.ligne-form input, .ligne-form select { width: auto; flex: 1; min-width: 150px; margin: 0; }
form.inline { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.decision { display: flex; gap: .35rem; flex-wrap: wrap; }
.decision input { margin: 0; min-width: 150px; flex: 1; min-height: 34px; padding: .35rem .6rem; }
.tableau select { margin: 0; padding: .35rem .55rem; min-height: 34px; }
.actions { white-space: nowrap; }
.actions-bas { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: var(--rayon-petit);
    border: 1px solid var(--bord-fort); background: #fff; color: var(--encre);
    font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.3;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ardoise); color: var(--ardoise); background: #fff; }
.btn-plein { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-plein:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); color: #fff; }
.btn-petit { padding: .32rem .7rem; font-size: .82rem; border-radius: 6px; }
.btn-large { display: flex; width: 100%; padding: .9rem 1rem; font-size: 1rem; margin: .4rem 0; }
.btn-danger { color: var(--rouge); }
.btn-danger:hover { border-color: var(--rouge); color: var(--rouge); background: var(--rouge-clair); }
.btn-succes { color: var(--vert-fonce); }
.btn-succes:hover { border-color: var(--vert); color: var(--vert-fonce); background: var(--vert-clair); }
.btn:disabled { opacity: .55; cursor: wait; }

/* ---------- Badges, alertes ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .12rem .6rem .12rem .5rem; border-radius: 99px;
    font-size: .78rem; font-weight: 600; background: var(--fond); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-present, .badge-accepte, .badge-ouverte, .badge-recu { background: var(--vert-clair); color: var(--vert-fonce); }
.badge-absent, .badge-refuse { background: var(--rouge-clair); color: var(--rouge); }
.badge-retard, .badge-en_attente, .badge-a_envoyer { background: var(--ambre-clair); color: var(--ambre); }
.badge-envoye { background: var(--bleu-clair); color: var(--bleu); }

.alerte {
    padding: .8rem 1rem .8rem 1.05rem; border-radius: var(--rayon-petit); margin-bottom: 1.1rem;
    font-size: .92rem; border: 1px solid transparent; border-left-width: 4px;
}
.alerte-succes { background: var(--vert-clair); border-color: #bfe0cb; border-left-color: var(--vert); color: #12532c; }
.alerte-erreur { background: var(--rouge-clair); border-color: #f1c8c1; border-left-color: var(--rouge); color: #7d2318; }
.alerte-info { background: var(--bleu-clair); border-color: #c8d8ef; border-left-color: var(--bleu); color: #183f72; }
.alerte .btn { margin-left: .4rem; }

.muted { color: var(--muted); }
.petit { font-size: .84rem; }
.rouge { color: var(--rouge); }
.attention { background: var(--ambre-clair); padding: .75rem 1rem; border-radius: var(--rayon-petit); }
.centre { text-align: center; }

.onglets { display: inline-flex; gap: 2px; margin-bottom: 1.1rem; flex-wrap: wrap; background: #e6ebf1; padding: 3px; border-radius: 9px; }
.onglets a { padding: .4rem .85rem; border-radius: 7px; text-decoration: none; color: var(--texte); font-size: .88rem; font-weight: 500; }
.onglets a:hover { color: var(--ardoise); background: rgba(255, 255, 255, .6); }
.onglets a.actif { background: #fff; color: var(--ardoise); font-weight: 700; box-shadow: 0 1px 2px rgba(19, 41, 75, .12); }
.pagination { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; margin-top: 1.1rem; }

/* ---------- Page de connexion ---------- */
.sans-menu .conteneur { max-width: none; padding: 0; }
.sans-menu .pied { display: none; }
.ecran-connexion { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); }
.panneau-marque {
    background: var(--ardoise); color: #d5ddea; padding: 3rem clamp(2rem, 6vw, 5rem);
    display: flex; flex-direction: column; justify-content: center; gap: 1.1rem; position: relative;
}
.panneau-marque .tricolore { position: absolute; inset: 0 0 auto 0; height: 6px; }
.panneau-marque h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.025em; margin: 0; max-width: 14ch; }
.panneau-marque p { max-width: 42ch; margin: 0; color: #b5c3d7; font-size: 1.02rem; }
.logo-connexion {
    width: 104px; height: 104px; border-radius: 18px; background: #fff;
    display: grid; place-items: center; padding: 12px;
}
.logo-connexion img { max-width: 100%; max-height: 100%; object-fit: contain; }
.panneau-formulaire { display: grid; place-items: center; padding: 2.5rem 1.5rem; background: var(--surface); }
.formulaire-connexion { width: 100%; max-width: 380px; }
.formulaire-connexion h2 { font-size: 1.6rem; font-weight: 800; margin: 0 0 .3rem; }
.formulaire-connexion .muted { margin: 0 0 1.6rem; }
.connexion { max-width: 430px; margin: 2.5rem auto; }

/* ---------- Séance : la borne QR ---------- */
.entete-seance { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.entete-seance p { margin: .2rem 0; }
.carte-qr {
    text-align: center; position: sticky; top: 1.2rem; padding: 0 1.4rem 1.4rem; overflow: hidden;
    border-color: var(--bord-fort);
}
.carte-qr::before {
    content: ""; display: block; height: 5px; margin: 0 -1.4rem 1.2rem;
    background: linear-gradient(90deg, var(--vert) 0 33.3%, var(--gris-logo) 33.3% 66.6%, var(--bleu) 66.6% 100%);
}
.carte-qr h2 { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: .6rem; }
.qr { display: flex; justify-content: center; align-items: center; min-height: 280px; margin: .3rem 0 1rem; }
.qr img, .qr canvas { max-width: 100%; height: auto; }
.code-court { font-size: .95rem; color: var(--muted); }
.code-court b {
    display: block; margin-top: .15rem;
    font-size: 2.3rem; font-weight: 800; letter-spacing: .18em; color: var(--ardoise); line-height: 1.1;
}
.barre { height: 6px; background: #e6ebf1; border-radius: 99px; overflow: hidden; margin: 1rem 0 .7rem; }
.barre div { height: 100%; background: var(--vert); transition: width .5s linear; }
.compteur { font-weight: 500; color: var(--muted); font-size: .9rem; margin-left: .4rem; }
.carte-qr.plein-ecran {
    position: fixed; inset: 0; z-index: 100; border-radius: 0; margin: 0;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.carte-qr.plein-ecran::before { position: absolute; inset: 0 0 auto 0; margin: 0; height: 8px; }
.plein-ecran h2 { font-size: 2rem; color: var(--encre); }
.plein-ecran .qr img, .plein-ecran .qr canvas { width: min(64vh, 86vw) !important; height: auto !important; }
.plein-ecran .code-court b { font-size: 3.6rem; }
.plein-ecran .barre { width: min(64vh, 86vw); }
.entete-liste { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.entete-liste h2 { margin: 0; }
.creneaux { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }

/* Selfies et appel aléatoire */
.cellule-nom { display: flex; align-items: center; gap: .65rem; }
.vignette { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; cursor: zoom-in; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--bord-fort); }
.vignette.vide { display: inline-flex; align-items: center; justify-content: center; background: var(--fond); cursor: default; font-size: 1rem; }
.vignette.grande { width: 72px; height: 72px; font-size: 2rem; }
.modale { position: fixed; inset: 0; background: rgba(19, 41, 75, .55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modale[hidden] { display: none; }
.modale-boite { background: #fff; border-radius: 12px; padding: 1.5rem; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(19, 41, 75, .3); }
#zoom img { max-width: min(90vw, 480px); max-height: 85vh; border-radius: 12px; }
.tire { display: flex; align-items: center; gap: .9rem; padding: .75rem; border: 1px solid var(--bord); border-radius: var(--rayon); margin-bottom: .6rem; }
.tire img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.tire-nom { flex: 1; font-size: 1.02rem; }
.tire-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.tire.verifie { border-color: var(--vert); background: var(--vert-clair); }
.tire.fraude { border-color: var(--rouge); background: var(--rouge-clair); }

/* ---------- Pointage du stagiaire ---------- */
.scan { max-width: 440px; margin: .5rem auto; text-align: center; }
.scan h1 { font-size: 1.5rem; }
.resultat { padding: 1.2rem 1rem; border-radius: var(--rayon); margin: 1.1rem 0; font-size: 1.05rem; font-weight: 700; }
.resultat.attente { background: var(--fond); color: var(--muted); }
.resultat.ok { background: var(--vert-clair); color: var(--vert-fonce); }
.resultat.ko { background: var(--rouge-clair); color: var(--rouge); }
.input-code { text-align: center; font-size: 1.7rem; font-weight: 700; letter-spacing: .3em; }
.camera { margin: 1rem 0; }
.camera video {
    width: 100%; max-width: 300px; aspect-ratio: 3 / 4; object-fit: cover;
    border-radius: 14px; background: var(--ardoise); transform: scaleX(-1);
    box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--bord-fort);
}

/* ---------- Absences par semaine, liste du lundi ---------- */
.entete-semaine { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.entete-semaine h2 { margin: 0; }
.entete-semaine h2 .muted { font-weight: 500; font-size: .9rem; }
.resume-semaine { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- Groupes des formateurs ---------- */
.matrice th, .matrice td.centre { text-align: center; }
.matrice th:first-child { text-align: left; }
.matrice input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }

/* ---------- Paramètres ---------- */
.apercu-logo { max-height: 120px; max-width: 100%; border: 1px solid var(--bord); border-radius: var(--rayon-petit); padding: .6rem; background: #fff; }
.logo { display: inline-flex; align-items: center; gap: .5rem; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
    .avec-menu .contenu { margin-left: 0; }
    .conteneur { padding: 1.1rem 1rem .5rem; }
    h1 { font-size: 1.45rem; }
    .barre-mobile {
        display: flex; align-items: center; justify-content: space-between; gap: .5rem;
        position: sticky; top: 0; z-index: 25; background: var(--ardoise);
        padding: .55rem .6rem .55rem .35rem; box-shadow: 0 3px 0 0 var(--vert);
    }
    .barre-mobile .marque { padding: .2rem .5rem; }
    .barre-mobile .marque-logo { width: 36px; height: 36px; border-radius: 8px; }
    .barre-mobile .marque-logo img { width: 30px; height: 30px; }
    .bouton-menu {
        width: 44px; height: 44px; border-radius: 9px; border: 1px solid var(--ardoise-3);
        background: var(--ardoise-2); color: #fff; display: grid; place-items: center; cursor: pointer;
    }
    .menu-lateral { transform: translateX(-100%); transition: transform .22s ease; width: min(84vw, 300px); }
    .menu-ouvert .menu-lateral { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
    .menu-ouvert .voile { display: block; position: fixed; inset: 0; z-index: 28; background: rgba(19, 41, 75, .45); }
    .grille-seance { grid-template-columns: 1fr; }
    .carte-qr { position: static; }
    .carte { padding: 1.05rem 1rem; }
    .ecran-connexion { grid-template-columns: 1fr; }
    .panneau-marque { padding: 2.6rem 1.4rem 2rem; gap: .8rem; }
    .panneau-marque h1 { font-size: 1.9rem; }
    .logo-connexion { width: 76px; height: 76px; border-radius: 14px; padding: 9px; }
    .panneau-formulaire { place-items: start center; padding: 1.8rem 1.2rem 2.5rem; }
}

/* ---------- Téléphone : tableaux en fiches, formulaires pleine largeur ---------- */
@media (max-width: 700px) {
    body { font-size: 15.5px; }
    .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; margin: .9rem 0 1.1rem; }
    .kpi { padding: .75rem .8rem .75rem .95rem; }
    .kpi b { font-size: 1.35rem; }
    .kpi span { font-size: .8rem; }
    .onglets { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
    .onglets a { white-space: nowrap; }
    .ligne-form input, .ligne-form select { flex: 1 1 100%; }
    .ligne-form .btn { flex: 1 1 auto; }
    .form-grille { grid-template-columns: 1fr 1fr; }
    .form-grille > label:has(select), .form-grille > label:has(input[name=module]), .form-grille > .btn, .form-grille > label:has(input[type=email]) { grid-column: 1 / -1; }
    .form-grille > .btn { width: 100%; padding: .8rem; }
    .actions-bas { flex-direction: column-reverse; }
    .actions-bas .btn { width: 100%; padding: .75rem; }
    .entete-semaine, .entete-liste, .entete-seance { flex-direction: column; align-items: stretch; }
    .entete-liste .btn, .entete-semaine form .btn { width: 100%; }
    .entete-semaine select { width: 100%; }
    .creneaux .btn { flex: 1 1 calc(50% - .4rem); padding: .55rem .4rem; }
    .creneaux > .muted { flex-basis: 100%; }
    .code-court b { font-size: 2rem; }

    /* Chaque ligne de tableau devient une fiche « libellé : valeur » */
    .defile { overflow: visible; margin: 0; padding: 0; }
    table.fiches:not(.matrice), table.fiches:not(.matrice) tbody, table.fiches:not(.matrice) tr, table.fiches:not(.matrice) td { display: block; width: 100%; }
    table.fiches:not(.matrice) tr:first-child:has(th) { display: none; }
    table.fiches:not(.matrice) tr {
        border: 1px solid var(--bord); border-radius: var(--rayon-petit);
        padding: .35rem .8rem; margin-bottom: .6rem; background: #fff;
    }
    table.fiches:not(.matrice) tr:hover td { background: transparent; }
    table.fiches:not(.matrice) td {
        border: 0; border-bottom: 1px dashed var(--bord); padding: .45rem 0;
        display: flex; justify-content: space-between; align-items: center; gap: .8rem; text-align: right;
    }
    table.fiches:not(.matrice) td:last-child { border-bottom: 0; }
    table.fiches:not(.matrice) td::before {
        content: attr(data-label); flex: none; max-width: 45%;
        color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left;
    }
    table.fiches:not(.matrice) td[data-label=""]::before { content: none; }
    table.fiches:not(.matrice) td[data-label=""] { justify-content: flex-end; }
    table.fiches:not(.matrice) td:first-child { text-align: left; justify-content: flex-start; font-size: 1rem; }
    table.fiches:not(.matrice) td:first-child::before { content: none; }
    table.fiches:not(.matrice) td[colspan] { justify-content: center; text-align: center; }
    table.fiches:not(.matrice) td[colspan]::before { content: none; }
    table.fiches:not(.matrice) td > * { max-width: 100%; }
    table.fiches:not(.matrice) td select { width: auto; min-width: 150px; }
    table.fiches:not(.matrice) td .decision { justify-content: flex-end; }
    table.fiches:not(.matrice) td.actions { white-space: normal; flex-wrap: wrap; justify-content: flex-end; }
    table.fiches:not(.matrice) td.actions::before { flex-basis: 100%; max-width: none; }
    table.fiches tr.statut-present, table.fiches tr.statut-retard, table.fiches tr.statut-absent { border-left-width: 4px; }
    table.fiches tr.statut-present { border-left-color: var(--vert); }
    table.fiches tr.statut-retard { border-left-color: var(--ambre); }
    table.fiches tr.statut-absent { border-left-color: var(--rouge); }
    table.fiches:not(.matrice) tr td:first-child { box-shadow: none; }
    .matrice th:first-child, .matrice td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
    .defile:has(.matrice) { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
    .menu-lateral, .barre-mobile, .pied, .btn, form.inline { display: none !important; }
    .avec-menu .contenu { margin-left: 0; }
    .carte { border: 0; padding: 0; }
}

/* Code de sécurité (captcha) de la connexion */
.captcha { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .3rem 0 .4rem; }
.captcha img { border: 1px solid #c9d2df; border-radius: 6px; background: #f4f6fa; }
.formulaire-connexion input[name="captcha"] { text-transform: uppercase; letter-spacing: .25em; font-weight: 600; }
.formulaire-connexion input[name="captcha"]::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }

/* Guide du selfie : ovale où placer le visage */
.cadre-video { position: relative; display: inline-block; width: 100%; max-width: 300px; }
.cadre-video video { display: block; }
.cadre-video .ovale {
    position: absolute; left: 50%; top: 46%; width: 58%; height: 62%;
    transform: translate(-50%, -50%); border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, .9);
    box-shadow: 0 0 0 999px rgba(19, 41, 75, .35); pointer-events: none;
}
.cadre-video { overflow: hidden; border-radius: 14px; }
/* Flash d'écran pour éclairer le visage dans une salle sombre */
.flash-ecran { position: fixed; inset: 0; background: #fff; z-index: 9999; }
.flash-ecran[hidden] { display: none; }

/* Bouton du selfie : très grand, toujours à portée du pouce (collé en bas de l'écran sur téléphone) */
.barre-selfie { margin: .8rem 0 .2rem; }
.bouton-selfie {
    display: flex; align-items: center; justify-content: center; gap: .7rem;
    width: 100%; min-height: 68px; padding: 1rem 1.2rem;
    font-size: 1.2rem; font-weight: 800; border-radius: 16px;
    box-shadow: 0 6px 18px rgba(30, 142, 74, .35);
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    white-space: normal; text-align: center; line-height: 1.25;
}
.bouton-selfie .icone-selfie { font-size: 1.7rem; line-height: 1; }
.bouton-selfie:active:not(:disabled) { transform: scale(.98); }
.bouton-selfie:focus-visible { outline: 4px solid #f2b705; outline-offset: 3px; }
.bouton-selfie:disabled { opacity: .75; cursor: progress; }
.cadre-video video { cursor: pointer; }
@media (max-width: 700px) {
    .barre-selfie {
        position: sticky; bottom: 0; z-index: 50;
        margin: .6rem -1rem 0; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
        background: linear-gradient(to top, #fff 82%, rgba(255, 255, 255, .85) 92%, rgba(255, 255, 255, 0));
    }
    .bouton-selfie { min-height: 72px; font-size: 1.25rem; }
}

/* Page « autoriser la caméra et la localisation » */
.carte-autorisations { max-width: 560px; margin: 1rem auto; }
.liste-autorisations { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.liste-autorisations li { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border: 1px solid var(--bord-fort); border-radius: 12px; font-size: 1.05rem; }
.liste-autorisations .etat-autorisation { margin-left: auto; font-size: .95rem; }
.etat-autorisation.granted { color: var(--vert-fonce); }
.etat-autorisation.denied { color: var(--rouge); }
.etat-autorisation.prompt { color: var(--muted); font-weight: 600; }

/* Pointage manuel : 3 gros boutons P / R / A au lieu d'une liste déroulante */
.choix-statut { display: inline-flex; gap: .35rem; }
.choix { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choix input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 12px; font-weight: 800; font-size: 1.1rem;
    border: 2px solid var(--bord-fort); background: #fff; color: var(--muted); transition: background .12s, color .12s;
}
.choix input:focus-visible + span { outline: 3px solid #f2b705; outline-offset: 2px; }
.choix-present input:checked + span { background: var(--vert, #1e8e4a); border-color: var(--vert, #1e8e4a); color: #fff; }
.choix-retard input:checked + span { background: #d98a00; border-color: #d98a00; color: #fff; }
.choix-absent input:checked + span { background: var(--rouge); border-color: var(--rouge); color: #fff; }
@media (max-width: 700px) { .choix span { width: 52px; height: 52px; font-size: 1.2rem; } }

/* Grand compteur de présents à côté du QR (pour compter les têtes) */
.grand-compteur { display: flex; align-items: baseline; justify-content: center; gap: .5rem; margin: .6rem 0; }
.grand-compteur b { font-size: 3rem; line-height: 1; color: var(--vert-fonce); }
.grand-compteur span { color: var(--muted); font-weight: 600; }

/* Signature numérique du formateur */
.carte-signature { max-width: 640px; margin: 1rem auto; }
.pad-signature { display: block; width: 100%; height: 200px; margin: .4rem 0 .8rem; background: #fff;
    border: 2px dashed var(--bord-fort); border-radius: 12px; touch-action: none; cursor: crosshair; }
.signature-actuelle { padding: .6rem; border: 1px solid var(--bord-fort); border-radius: 12px; background: #fff; text-align: center; margin-bottom: .8rem; }
.signature-actuelle img { max-width: 100%; max-height: 110px; }
