/* assets/css/style.css - Basé sur votre style2.css */
@import url('tokens.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
}

h1, h2, h3, .font-display {
    font-family: var(--font-display);
    font-weight: 700;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--paper-raised);
    box-shadow: var(--shadow-sm);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.navbar-brand a {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.navbar-brand .mark {
    color: var(--accent);
}

.navbar-logo {
    height: 32px;
    width: auto;
    display: block;
}

/* ===== BANDEAU D'APERÇU (admin consultant un autre espace) ===== */
.apercu-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .6rem 1.5rem;
    background: var(--accent-tint);
    color: var(--accent-strong);
    border-bottom: 1px solid var(--accent);
    font-size: .85rem;
}

.apercu-banner strong {
    font-weight: 700;
}

/* La bascule de thème embarque ses propres styles dans
   partials/theme_toggle.php : elle doit rester correcte même si cette
   feuille n'est pas à jour sur le serveur. */

/* La marque de la barre : le symbole est écrit dans la page
   (partials/marque.php) et prend ses couleurs dans les jetons du thème.
   La pastille blanche qui portait l'ancien logo a disparu avec lui. */
.navbar-brand .marque {
    display: block;
    flex: none;
}

.navbar-menu {
    display: flex;
    gap: 1.75rem;
}

/* ===== La barre formateur à deux étages (maquette A + icônes B, août 2026)
   Étage 1 : l'identité et le compte, fins. Étage 2 : la navigation, au
   large, avec une petite icône par entrée et la page active soulignée.
   Classes propres (nav2-*) : l'en-tête admin garde .navbar intact. ===== */
.nav2 { background: var(--paper-raised); }
.nav2-cadre { max-width: 1400px; margin: 0 auto; padding: 0 1.2rem;
              display: flex; align-items: center; gap: 1.5rem; }
.nav2-etage1 { border-bottom: 1px solid var(--border); }
.nav2-etage1 .nav2-cadre { justify-content: space-between; min-height: 44px; }
.nav2-etage2 { border-bottom: 1px solid var(--border-strong); }
.nav2-etage2 .nav2-cadre { min-height: 46px; gap: 1.6rem; flex-wrap: wrap; }

/* La même barre, en sombre, pour l'administration. Elle reste sombre dans les
   deux thèmes : c'est le repère qui dit qu'on est dans le back-office, et il
   ne doit pas dépendre du réglage clair/sombre. */
.nav2.admin { background: var(--admin-bar); }
.nav2.admin .nav2-etage1 { border-bottom-color: rgba(255,255,255,.08); }
.nav2.admin .nav2-etage2 { border-bottom-color: rgba(255,255,255,.14); }
.nav2.admin .navbar-brand a { color: #F1F3F4; }
.nav2.admin .navbar-brand .mark { color: var(--accent-strong); }
.nav2.admin .nav2-lien { color: #9AA3AB; }
.nav2.admin .nav2-lien:hover { color: #fff; }
.nav2.admin .nav2-lien.actif { color: #fff; border-bottom-color: var(--accent-strong); }
.nav2.admin .nav2-compte span { color: #9AA3AB; }
.nav2.admin .nav2-lien-compte { color: #9AA3AB; text-decoration: none; font-size: .82rem;
                                display: inline-flex; align-items: center; gap: .3rem; }
.nav2.admin .nav2-lien-compte:hover { color: #fff; }
/* Le trait de groupe : il sépare la production, le contenu, les personnes et
   la surveillance sans ajouter un mot de plus dans une barre déjà chargée. */
.nav2-groupe { width: 1px; align-self: stretch; margin: .5rem -.4rem;
               background: var(--border); }
.nav2.admin .nav2-groupe { background: rgba(255,255,255,.14); }
/* Quand la barre se replie, le trait se retrouve en bout de rangée et ne
   sépare plus rien : il vaut mieux qu'il disparaisse. */
@media (max-width: 700px) { .nav2-groupe { display: none; } }

.nav2-compte { display: flex; align-items: center; gap: .8rem; white-space: nowrap; }
.nav2-lien { color: var(--ink-muted); text-decoration: none; font-size: .86rem;
             font-weight: 600; white-space: nowrap;
             padding: .55rem 0 calc(.55rem - 2px); border-bottom: 2px solid transparent;
             transition: color .15s ease, border-color .15s ease; }
.nav2-lien:hover { color: var(--ink); }
.nav2-lien.actif { color: var(--ink); border-bottom-color: var(--accent); }
.nav2-lien svg { vertical-align: -2px; margin-right: .35rem; }
.nav2-pousse { margin-left: auto; display: flex; align-items: center; }

@media (max-width: 768px) {
    .nav2-etage1 .nav2-cadre { flex-wrap: wrap; padding: .4rem 1rem; }
    .nav2-etage2 .nav2-cadre { gap: .2rem 1.1rem; padding: .3rem 1rem; }
    .nav2-compte { flex-wrap: wrap; }
}

.nav-link {
    color: var(--ink-muted);
    text-decoration: none;
    padding: .4rem .1rem;
    font-size: .86rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
    /* LA seule retouche voulue ici : un libellé replié sur deux lignes
       (« Mes / sessions ») centre ses lignes l'une sur l'autre au lieu de
       les caler à gauche. Le menu, lui, reste sur sa rangée unique, les
       libellés se comprimant comme ils l'ont toujours fait. */
    text-align: center;
}

.nav-link:hover {
    color: var(--ink);
}

.nav-link.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.navbar-user span {
    color: var(--ink-muted);
    font-size: .85rem;
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: .7rem;
    font-weight: 700;
}

/* Bandeau admin — nameplate sombre, distinct de l'espace formateur */
.navbar.admin {
    background: var(--admin-bar);
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.navbar.admin .navbar-brand a { color: #F1F3F4; }
.navbar.admin .navbar-brand .mark { color: var(--accent-strong); }
.navbar.admin .nav-link { color: #9AA3AB; }
.navbar.admin .nav-link:hover { color: #fff; }
.navbar.admin .nav-link.active { color: #fff; border-bottom-color: var(--accent-strong); }
.navbar.admin .navbar-user span { color: #9AA3AB; }

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background:
        linear-gradient(var(--admin-bar), var(--admin-bar)) padding-box,
        repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 28px);
}

.login-card {
    background: var(--paper-raised);
    border-radius: var(--radius-md);
    border-top: 3px solid var(--accent);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* La marque de la page de connexion : centrée, avec de l'air sous elle.
   C'est le seul écran qui la porte en grand — ailleurs elle vit en 30 px
   dans la barre.

   Le sélecteur d'enfant direct est indispensable : sans lui, la règle
   s'appliquait AUSSI au symbole logé dans le verrou complet, qui porte déjà
   son propre espacement — le nom se retrouvait chassé vers le bas. */
.login-header > .marque {
    display: block;
    margin: 0 auto .9rem;
}

/* Le verrou complet a besoin de respirer avant le titre : sans cette marge,
   « by brcode » et le titre se touchaient presque. */
.login-header .verrou {
    margin-bottom: 1.3rem;
}

/* Le symbole de la télécommande posé dans une ligne de texte : il remplace un
   émoji, il doit donc s'asseoir sur la même ligne de base que lui. */
.marque-telecommande {
    display: inline-block;
    vertical-align: -.22em;
    margin-right: .1em;
}

.login-header h1 {
    font-size: 1.6rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--ink-muted);
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.login-form small {
    display: block;
    margin-top: 0.25rem;
    color: var(--ink-faint);
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-footer code {
    display: block;
    background: var(--paper-sunken);
    color: var(--ink);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    word-break: break-all;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: .6rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    background: var(--paper-sunken);
    color: var(--ink);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--critical-bg);
    color: var(--critical);
    border-color: transparent;
}

.btn-danger:hover {
    background: var(--critical);
    color: #fff;
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: transparent;
}

.btn-success:hover {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--accent-tint);
    color: var(--accent-strong);
    border-color: transparent;
}

.btn-warning:hover {
    background: var(--accent);
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--critical-bg); color: var(--critical); }
.badge-warning { background: var(--accent-tint); color: var(--accent-strong); }
.badge-secondary { background: var(--paper-sunken); color: var(--ink-muted); }
.badge-primary { background: var(--pending-bg); color: var(--pending); }

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.alert-error,
.alert-danger {
    background: var(--critical-bg);
    color: var(--critical);
    border-color: var(--critical);
}

.alert-info {
    background: var(--pending-bg);
    color: var(--pending);
    border-color: var(--pending);
}

.alert-warning {
    background: var(--accent-tint);
    color: var(--accent-strong);
    border-color: var(--accent);
}

/* ===== DASHBOARD ===== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.6rem;
    color: var(--ink);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--paper-raised);
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 1.6rem;
    color: var(--accent);
}

.stat-content h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
}

.stat-content p {
    color: var(--ink-faint);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0;
}

.stat-card .number {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.stat-card .label {
    color: var(--ink-faint);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.session-card {
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.4rem;
    transition: box-shadow 0.15s ease;
}

.session-card:hover {
    box-shadow: var(--shadow-md);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.session-header h3 {
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--ink);
}

.session-status {
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.session-status.active {
    background: var(--success-bg);
    color: var(--success);
}

.session-body p {
    margin: 0.25rem 0;
    color: var(--ink-muted);
}

.session-actions {
    margin-top: 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3rem;
    text-align: center;
    color: var(--ink-muted);
}

.empty-state p {
    font-size: 1.05rem;
}

/* ===== MODELES ===== */
.modeles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.modele-card {
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.4rem;
}

.modele-card h4 {
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.modele-card p {
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.modele-card small {
    color: var(--ink-faint);
    display: block;
    margin: 0.5rem 0;
}

.modele-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ===== FILTER BAR ===== */
.filters {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: center;
    background: var(--paper-raised);
    border: 1px solid var(--border);
    padding: .8rem 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0 1.5rem;
}

.filter-label {
    font-weight: 600;
    font-size: .85rem;
    color: var(--ink-muted);
}

/* ===== FORM ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--paper-raised);
    color: var(--ink);
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.form-actions {
    margin-top: 2rem;
    text-align: right;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 0;
    }
    
    .navbar-menu {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .builder-container {
        grid-template-columns: 1fr !important;
    }
    
    .sessions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 2rem;
        margin: 1rem;
    }
}
/* ===== TABLEAUX SUR PETIT ÉCRAN =====
 * Conteneur posé par assets/js/tableaux-mobiles.js autour de chaque tableau
 * trop large. Le tableau défile à l'intérieur ; la page, elle, ne bouge pas.
 */
.tableau-defilant {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;   /* inertie sur iOS */
    max-width: 100%;
}

/* Les cellules ne doivent pas se comprimer au point de casser la lecture :
   mieux vaut défiler qu'afficher un mot par ligne. */
.tableau-defilant > table {
    min-width: max-content;
}

.tableau-indication {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin-bottom: 0.4rem;
    font-style: italic;
}

/* Sur grand écran, un tableau tient dans la page : ni conteneur visible,
   ni mention. La règle ci-dessus reste sans effet, le tableau ne dépassant
   pas — on neutralise seulement la largeur minimale, qui empêcherait
   sinon un tableau de s'étaler sur toute la largeur disponible. */
@media (min-width: 1025px) {
    .tableau-defilant > table {
        min-width: 0;
    }
}

/* ------------------------------------------------------------------
   QUESTIONS DE CLASSEMENT
   Rendu par partials/question_classement.php, piloté par
   assets/js/classement.js. Feuille commune : la page stagiaire et
   l'aperçu de l'administrateur doivent se ressembler au pixel près.

   Dimensionné pour le pouce avant l'écran large : les stagiaires
   répondent au téléphone, les formateurs vérifient sur tablette.
   ------------------------------------------------------------------ */
.classement-consigne {
    font-size: 0.88rem;
    color: var(--ink-muted);
    margin: 0 0 0.7rem;
}

.classement-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.classement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.85rem;
}

/* Le rang est écrit par le JavaScript : il reflète la position réelle,
   jamais un numéro figé dans le HTML qui mentirait après un déplacement. */
.classement-rang {
    flex: 0 0 auto;
    width: 1.9rem;
    height: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent-strong);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.classement-texte {
    flex: 1 1 auto;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.classement-fleches {
    flex: 0 0 auto;
    display: flex;
    gap: 0.3rem;
}

/* 44 px : la plus petite cible qu'un pouce atteint sans viser. */
.classement-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    background: var(--paper-sunken);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.classement-btn:hover:not(:disabled) {
    background: var(--accent-tint);
    color: var(--accent-strong);
    border-color: var(--accent-strong);
}

/* Le premier ne monte pas, le dernier ne descend pas : la flèche s'efface
   au lieu de rester cliquable sans effet. */
.classement-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.classement-btn:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

/* Une ligne qui change de place sans rien dire se repère mal sur un
   petit écran : elle s'éclaire une demi-seconde. */
.classement-item.vient-de-bouger {
    animation: classement-signal 0.5s ease-out;
}

@keyframes classement-signal {
    from { background: var(--accent-tint); border-color: var(--accent-strong); }
    to   { background: var(--paper-raised); border-color: var(--border); }
}

@media (prefers-reduced-motion: reduce) {
    .classement-item.vient-de-bouger { animation: none; }
}

/* ------------------------------------------------------------------
   QUESTIONS D'APPARIEMENT
   Rendu par partials/question_appariement.php. Feuille commune à la
   page stagiaire et à l'aperçu de l'administrateur.

   Les cibles sont exposées en grille au-dessus des lignes à relier :
   sur un téléphone, l'image doit rester visible pendant qu'on choisit,
   sans avoir à faire défiler la page dans les deux sens.
   ------------------------------------------------------------------ */
.appariement-consigne {
    font-size: 0.88rem;
    color: var(--ink-muted);
    margin: 0 0 0.7rem;
}

.appariement-cibles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.appariement-cible {
    position: relative;
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    text-align: center;
}

.appariement-cible img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto 0.35rem;
}

/* La lettre est l'unique lien entre la vignette et la liste déroulante :
   elle doit se lire du premier coup d'œil. */
.appariement-lettre {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    width: 1.7rem;
    height: 1.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-strong);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.appariement-cible-texte {
    display: block;
    font-size: 0.85rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.appariement-lignes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.appariement-ligne {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--paper-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
}

.appariement-libelle {
    flex: 1 1 auto;
    line-height: 1.4;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.appariement-choix {
    flex: 0 0 auto;
    min-height: 44px;          /* même cible au pouce que partout ailleurs */
    max-width: 55%;
    padding: 0 0.6rem;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.appariement-choix:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

/* Sur un téléphone tenu à la verticale, libellé et choix ne tiennent pas
   côte à côte dès que le libellé fait plus de quelques mots. */
@media (max-width: 520px) {
    .appariement-ligne {
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
    }
    .appariement-choix { max-width: 100%; }
}

/* ===========================================================================
   Modales — rendre le contenu atteignable quand il dépasse l'écran
   ===========================================================================

   Les modales de l'application se déclarent page par page, et toutes posaient
   la même chose : un conteneur `position: fixed` centré verticalement, et un
   contenu sans hauteur maximale ni défilement.

   Tant que le contenu tient dans la fenêtre, cela se voit bien. Dès qu'il
   dépasse — un formateur sur téléphone qui vient de choisir un questionnaire,
   et la liste des modèles s'ajoute aux champs — le contenu déborde en haut ET
   en bas, et rien ne défile : le conteneur est fixe, et la page derrière ne le
   déplace pas. Le bouton « Créer » devient purement inatteignable.

   Ces règles vivent ici plutôt que dans chaque page : quatre copies auraient
   fini par diverger, et la prochaine modale écrite aurait recommencé.

   `.modal.active` porte deux classes : sa spécificité l'emporte sur le
   `.modal { align-items: center }` déclaré dans les pages, quel que soit
   l'ordre de chargement. */

.modal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
}

/* Aligné en haut plutôt qu'au centre : combiné au `margin: auto` du contenu,
   cela le centre quand il tient, et le laisse défiler quand il dépasse. */
.modal.active {
    align-items: flex-start;
}

.modal-content {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    margin: auto;
}

/* Les boutons restent visibles pendant qu'on fait défiler le reste : sur un
   téléphone, chercher « Créer » en bas d'une longue liste est exactement ce
   qui fait abandonner. */
.modal-content .modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--paper-raised);
    padding: .8rem 0 .2rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
    .modal { padding: .5rem; }
    .modal-content { max-height: calc(100vh - 1rem); padding: 1.2rem !important; }
    /* Les boutons passent pleine largeur : une cible de la taille du pouce. */
    .modal-content .modal-actions { flex-direction: column-reverse; }
    .modal-content .modal-actions .btn { width: 100%; min-height: 2.9rem; }
}

/* ===== RETOUR SUR L'ÉLÉMENT QU'ON VIENT DE MODIFIER =====

   Après validation, les écrans redirigent avec une ancre (#seance-12,
   #stagiaire-47…) plutôt que de revenir en haut de page. Sur une liste d'une
   semaine de séances ou de quinze stagiaires, remonter coûtait quelques
   secondes à chaque geste : il fallait refaire défiler, retrouver la ligne,
   et vérifier que la correction avait bien pris.

   Les deux règles ci-dessous valent pour TOUTE ancre de l'application, y
   compris celles à venir : rien à réécrire dans chaque écran. Côté PHP il
   suffit d'un `id` sur l'élément et d'un `#...` dans la redirection. */

/* Sans cette marge, l'élément visé se colle au bord haut de la fenêtre — on
   le voit, mais sans le jour ni le titre qui le précèdent, donc sans contexte. */
:target {
    scroll-margin-top: 6rem;
}

/* Revenir au bon endroit ne suffit pas : parmi trois séances identiques dans
   la même journée, il faut encore savoir LAQUELLE a bougé. Le repère s'efface
   de lui-même — c'est un accusé de réception, pas un état. */
@keyframes repere-cible {
    0%, 55% { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent); }
    100%    { background: transparent;        box-shadow: inset 3px 0 0 transparent; }
}

:target {
    animation: repere-cible 2.4s ease-out;
}

/* Une animation qui clignote peut gêner, voire déclencher un malaise. Le
   repère reste, sans le mouvement. */
@media (prefers-reduced-motion: reduce) {
    :target {
        animation: none;
        box-shadow: inset 3px 0 0 var(--accent);
    }
}

/* ===== LE LIEN VERS L'AUTRE APPLICATION =====

   Le formateur travaille dans deux espaces : ses sessions dans pédagogie, ses
   contrats et sa messagerie dans SecureSign. Ce lien porte l'aller-retour.

   Il se distingue des autres entrées du menu — séparateur à gauche, icône de
   sortie — parce qu'il ne mène pas au même endroit. Un lien qui change
   d'application et qui ressemble aux liens internes trompe : on clique en
   croyant rester, on se retrouve ailleurs, on ne sait plus revenir. */
.nav-link.nav-lien-externe {
    /* En bloc et non en flex : replié sur deux lignes, un flex calait la
       suite du texte à gauche de l'icône — en flux texte, l'icône suit le
       texte et le text-align: center du .nav-link centre les deux lignes. */
    display: block;
    margin-left: .5rem;
    padding-left: .9rem;
    border-left: 1px solid var(--border-strong);
    color: var(--ink-muted);
}

.nav-link.nav-lien-externe svg {
    vertical-align: -2px;
    margin-right: .3rem;
}

.nav-link.nav-lien-externe:hover {
    color: var(--accent);
}

/* Sur mobile, le menu s'empile : le séparateur vertical n'a plus de sens. */
@media (max-width: 768px) {
    .nav-link.nav-lien-externe {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }
}

/* ------------------------------------------------------------------
   TABLEAUX TRIABLES — assets/js/tableaux-triables.js
   Un en-tête cliquable se reconnaît : curseur, petit repère, et le sens
   en cours en clair. Aucune couleur imposée : la table garde la sienne. */
table.triable th.tri-possible {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
table.triable th.tri-possible::after {
    content: ' ↕';
    opacity: .35;
    font-size: .9em;
}
table.triable th.tri-possible:hover::after,
table.triable th.tri-possible:focus-visible::after { opacity: .8; }
table.triable th[data-sens="asc"]::after  { content: ' ▲'; opacity: 1; }
table.triable th[data-sens="desc"]::after { content: ' ▼'; opacity: 1; }

/* ------------------------------------------------------------------
   LA SESSION EN COURS DANS LA BARRE, LE FIL EN TÊTE DES PAGES, ET LA
   BARRE REPLIÉE SUR TÉLÉPHONE (07/09/2026) — config/session_en_cours.php
   ------------------------------------------------------------------ */

/* La pastille « ↩ Ma session · libellé » : une seule, entre la marque et le
   compte, sur toutes les pages sauf celle de la session elle-même. */
.nav2-session {
    display: inline-flex; align-items: center; gap: .35rem;
    max-width: 28rem; min-width: 0;
    padding: .28rem .85rem; border-radius: 999px;
    background: var(--accent-tint); color: var(--accent-strong);
    border: 1px solid transparent; text-decoration: none;
    font-size: .82rem; font-weight: 600; line-height: 1.2;
}
.nav2-session:hover, .nav2-session:focus-visible { border-color: var(--accent); }
.nav2-session-lib { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.nav2-session-quoi::after { content: ' ·'; }

/* Le fil en tête des pages de travail. */
.fil-session {
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem;
    font-size: .86rem; color: var(--ink-muted); margin: 0 0 1rem;
}
.fil-session a { color: var(--accent-strong); text-decoration: none; font-weight: 600; white-space: nowrap; }
.fil-session a:hover { text-decoration: underline; }
.fil-session .fil-lib { color: var(--ink); font-weight: 500; }
.fil-session .fil-num { color: var(--ink-faint); font-weight: 400; }
.fil-session .fil-sep { color: var(--ink-faint); }
.fil-session .fil-page { color: var(--ink-muted); }
.fil-session .fil-second { margin-left: auto; font-weight: 500; }

/* Le bouton de menu : invisible au large, il replie tout sur téléphone. */
.nav2-burger {
    display: none; align-items: center; justify-content: center;
    width: 40px; height: 36px; border-radius: 8px;
    border: 1px solid var(--border-strong); background: var(--paper-raised);
    color: var(--ink); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0;
}
.nav2-burger[aria-expanded="true"] { background: var(--paper-sunken); }

@media (max-width: 768px) {
    /* Une seule rangée : la marque, la session en cours, le menu. Le compte et
       la navigation attendent derrière le bouton — un écran entier était
       perdu avant le premier contenu utile. */
    .nav2-etage1 .nav2-cadre { flex-wrap: nowrap; gap: .6rem; padding: .35rem .8rem; min-height: 48px; }
    .nav2-burger { display: inline-flex; margin-left: auto; flex-shrink: 0; }
    .nav2-session { max-width: 44vw; font-size: .78rem; padding: .22rem .6rem; }
    .nav2-session-quoi { display: none; }
    .nav2-compte { display: none; }
    .nav2-etage2 { display: none; }
    .nav2.ouverte .nav2-etage1 .nav2-cadre { flex-wrap: wrap; }
    .nav2.ouverte .nav2-compte { display: flex; flex-wrap: wrap; width: 100%; order: 9;
                                 padding: .5rem 0 .3rem; gap: .5rem .9rem; border-top: 1px solid var(--border); }
    .nav2.ouverte .nav2-etage2 { display: block; }
    .nav2.ouverte .nav2-etage2 .nav2-cadre { gap: .1rem 1rem; padding: .25rem .8rem .4rem; }
    .fil-session .fil-second { margin-left: 0; }
}
@media (max-width: 768px) {
    /* Sur téléphone, le libellé de la session tient sur une ligne, coupé s'il le faut :
       le fil reste un repère, pas un paragraphe. */
    .fil-session .fil-lib { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- Le bandeau de message (07/09) : sous la barre, un seul endroit ---- */
.bandeaux-messages { max-width: 1200px; margin: .6rem auto 0; padding: 0 1.25rem; display: grid; gap: .4rem; }
.bandeau-message { display: flex; align-items: center; gap: .8rem; padding: .55rem .9rem; border-radius: var(--radius-sm);
                   font-size: .92rem; font-weight: 600; border: 1px solid transparent; border-left-width: 4px;
                   transition: opacity .25s ease, transform .25s ease; }
.bandeau-message.ok { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.bandeau-message.ko { background: var(--critical-bg); color: var(--critical); border-color: var(--critical); }
.bandeau-message.parti { opacity: 0; transform: translateY(-4px); }
.bandeau-message span { flex: 1 1 auto; }
.bandeau-fermer { border: 0; background: none; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .2rem; opacity: .7; }
.bandeau-fermer:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .bandeau-message { transition: none; } }

/* Le fil : « ← La session » en plus gros (07/09, chantier 1) — c'est le repère. */
.fil-session .fil-retour { font-size: 1.05rem; font-weight: 700; }

/* ---- Les menus « ⋯ » (07/09) : un bouton discret, un panneau opaque qui se
   referme d'un clic ailleurs (assets/js/menus-plus.js). Le volet « Pendant »
   porte les mêmes règles en propre. ---- */
.menu-plus { position: relative; display: inline-block; }
.menu-plus > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center;
                       justify-content: center; width: 2rem; height: 1.8rem; border: 1px solid var(--border-strong);
                       border-radius: var(--radius-sm); background: var(--paper-raised); font-weight: 800;
                       letter-spacing: .06em; color: var(--ink-muted); user-select: none; }
.menu-plus > summary::-webkit-details-marker { display: none; }
.menu-plus > summary:hover, .menu-plus[open] > summary { border-color: var(--accent); color: var(--accent-strong); }
.menu-plus-corps { position: absolute; right: 0; top: calc(100% + .25rem); z-index: 30; min-width: 17rem; max-width: 23rem;
                   background: var(--paper-raised, #fff); color: var(--ink, #1B1F23);
                   border: 1px solid var(--border-strong, #C3C9CD); border-top: 3px solid var(--accent, #B9711F);
                   border-radius: var(--radius-sm, 6px); box-shadow: 0 10px 28px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
                   padding: .35rem; display: grid; gap: .1rem; text-align: left; white-space: normal; font-weight: 400; }
.menu-plus-corps form { display: block; margin: 0; }
.menu-item { display: block; width: 100%; box-sizing: border-box; text-align: left; background: none; border: 0;
             padding: .4rem .55rem; border-radius: 4px; font: inherit; font-size: .84rem; color: var(--ink);
             cursor: pointer; text-decoration: none; line-height: 1.35; }
.menu-item:hover, .menu-item:focus-visible { background: var(--paper-sunken, #E7EAEC); }
.menu-item.actif { color: var(--accent-strong); font-weight: 600; cursor: default; opacity: 1; }
.menu-item.actif:hover { background: none; }
.menu-item.danger { color: var(--critical); }
.menu-groupe { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint);
               font-weight: 600; padding: .45rem .55rem .15rem; }
.menu-note { font-size: .76rem; color: var(--ink-muted); padding: .1rem .55rem .35rem; line-height: 1.4; }
@media (max-width: 640px) {
    .menu-plus-corps { position: fixed; left: .6rem; right: .6rem; top: auto; bottom: .6rem; max-width: none; }
}
