/* ==========================================================================
   Console d'administration — habillage OUTIL du design system public.
   admin/css/style.css est une copie du style public (tokens :root, polices,
   composants QCM) ; ce fichier ne fait que l'adapter à un usage dense :
   tables compactes, barre d'en-tête encre, badges mono. AUCUNE couleur en
   dur : tout passe par var(--primary)/var(--accent)/tokens sémantiques,
   l'accent du site peut changer sans retoucher ce fichier.
   ========================================================================== */

/* ---- Coquille : neutralise la colonne centrée du site public ------------ */
.wrapper.admin-wrapper {
    max-width: none;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-login {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Ancré en haut (et non centré verticalement) : la révélation du champ
       2FA ne recentre plus la carte — position fixe dès le premier rendu */
    justify-content: flex-start;
    padding-top: 10vh;
    align-items: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.admin-login .auth-form {
    width: 100%;
}

.admin-dashboard {
    flex: 1;
    padding: 0;
}

/* ---- Barre d'en-tête : encre, wordmark condensé, nav en pilules --------- */
.admin-header {
    background: var(--accent);
    color: #fff;
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    margin: 0;
    font-family: var(--font-wordmark);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #fff;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Burger : visible uniquement sur écran étroit, remplace la rangée d'onglets */
.nav-burger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    padding: 9px 8px;
    cursor: pointer;
}

.nav-burger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.45rem 1rem;
    cursor: pointer;
    border-radius: var(--pill);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.logout-btn {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}

.logout-btn:hover {
    background: var(--danger-deep) !important;
}

/* Barre au-dessus du contenu, visible sur tous les onglets : recharge
   les données de l'onglet courant */
.section-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 2rem 0;
}

.admin-section {
    padding: 2rem;
}

.admin-section h2 {
    margin-top: 0;
    color: var(--accent);
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0.5rem;
}

/* ---- Statistiques -------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* Le style public définit déjà .stat-card ; version compacte outil */
.admin-section .stat-card {
    background: var(--bg-card);
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.admin-section .stat-card h3 {
    margin: 0 0 0.75rem 0;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--muted);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.admin-section .stat-number {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 2.1rem;
    font-weight: 500;
    color: var(--primary);
    margin: 0;
}

.stats-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.stat-detail-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
}

.stat-detail-card h3 {
    margin: 0 0 1rem 0;
    color: var(--accent);
}

.subject-stats .subject-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.subject-stats .subject-item:last-child {
    border-bottom: none;
}

.recent-activity .activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.recent-activity .activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* ---- Tables (utilisateurs, sujets, questions, abonnements, légal) -------
   Surface blanche, filets hairline, en-têtes mono capitales, survol
   surface-2, chiffres tabulaires. */
.users-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.users-controls input {
    flex: 1;
    min-width: 250px;
    margin: 0;
}

/* Bouton et listes à la hauteur exacte du champ de recherche */
.users-controls .btn {
    align-self: stretch;
    padding-top: 0;
    padding-bottom: 0;
}

.users-table-container,
.subjects-table-container,
.questions-table-container,
.subscriptions-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.users-table,
.subjects-table,
.questions-table,
.subscriptions-table {
    border-collapse: collapse;
}

.users-table th,
.subjects-table th,
.questions-table th,
.subscriptions-table th {
    background: var(--bg-card);
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    white-space: nowrap;
}

.users-table td,
.subjects-table td,
.subscriptions-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    font-variant-numeric: tabular-nums;
}

.users-table tbody tr:hover,
.subjects-table tbody tr:hover,
.questions-table tbody tr:hover,
.subscriptions-table tbody tr:hover {
    background: var(--surface-2);
}

.users-table {
    width: 100%;
}

/* Tableau utilisateurs + abonnements fusionné : largeurs naturelles, le
   conteneur défile horizontalement. */
.users-table-container .users-table {
    width: max-content;
    min-width: 100%;
}

.users-table-container .users-table th,
.users-table-container .users-table td {
    white-space: nowrap;
}

.subjects-table {
    width: 100%;
    min-width: 700px;
    table-layout: fixed;
}

.subjects-table th:nth-child(1), .subjects-table td:nth-child(1) { width: 80px; }
.subjects-table th:nth-child(2), .subjects-table td:nth-child(2) { width: 100px; }
.subjects-table th:nth-child(3), .subjects-table td:nth-child(3) { width: auto; }
.subjects-table th:nth-child(4), .subjects-table td:nth-child(4) { width: 150px; }
.subjects-table th:nth-child(5), .subjects-table td:nth-child(5) { width: 150px; }

.subjects-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Questions : largeur naturelle des colonnes, défilement horizontal */
.questions-table {
    width: max-content;
    min-width: 100%;
}

.questions-table th,
.questions-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

.questions-table td {
    border-bottom: 1px solid var(--border-soft);
    font-variant-numeric: tabular-nums;
}

.questions-table td:nth-child(3) {  /* slug */
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.questions-table td:nth-child(6) {  /* titre */
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.questions-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
}

.questions-table th.sortable:hover {
    background-color: var(--surface-2);
}

.questions-table th.sortable .sort-indicator {
    position: absolute;
    right: 0.5rem;
    color: var(--muted);
    font-size: 0.8em;
}

.questions-table th.sortable.active .sort-indicator {
    color: var(--primary);
}

.questions-filter {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.questions-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ---- Badges de statut : pastilles mono teintées -------------------------- */
.status-badge,
.subscription-status {
    padding: 0.22rem 0.6rem;
    border-radius: var(--pill);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
}

.status-active,
.status-verified {
    background: var(--success-tint);
    color: var(--success-deep);
}

.status-inactive,
.status-unverified,
.status-inactive-old {
    background: var(--danger-tint);
    color: var(--danger-deep);
}

.status-paid {
    background: var(--info-tint);
    color: var(--info-deep);
}

.status-unpaid,
.status-inactive-recent {
    background: var(--warning-tint);
    color: var(--warning-deep);
}

.status-never {
    background: var(--surface-2);
    color: var(--muted);
}

.days-remaining {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Deux chiffres dans une tuile : découverte / total, même taille, avec leurs
   libellés alignés dessous. */
.stat-duo { display: flex; align-items: baseline; justify-content: center; gap: 0.5rem; }
.stat-duo i { font-style: normal; color: var(--muted); font-weight: 400; }
.stat-duo-legend {
    display: flex; justify-content: center; gap: 1.6rem;
    color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem;
}

.days-warning { color: var(--warning-deep); }
.days-danger { color: var(--danger-deep); }

/* Bouton d'édition dans une tuile (Tarifs) */
.stat-card .stat-card-edit { margin-top: 0.6rem; }

/* Livre des recettes : état d'un paiement rendu ou contesté */
.legal-refunded { color: var(--warning-deep); font-size: 0.85em; }
.legal-dispute { color: var(--danger-deep); font-weight: 600; font-size: 0.85em; }

/* Pastilles type/sujet DANS LES TABLES : version compacte des teintes
   publiques (l'aperçu qv2, lui, garde le rendu exact du site) */
td .question-type {
    padding: 0.2rem 0.55rem;
    border-radius: var(--pill);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
}

.type-kprim {
    background: var(--warning-tint);
    color: var(--warning-deep);
}

.subject-badge {
    background: var(--success-tint);
    color: var(--success-deep);
    padding: 0.2rem 0.55rem;
    border-radius: var(--pill);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
}

/* ---- Boutons de l'outil --------------------------------------------------
   .btn/.btn-secondary/.btn-danger viennent du style public ; ici seulement
   les variantes et tailles propres à la console. */
.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-deep);
    border-color: var(--success-deep);
}

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

.btn-warning:hover {
    background: var(--warning-deep);
    border-color: var(--warning-deep);
}

.action-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    margin-right: 0.25rem;
}

.action-btn:hover {
    background: var(--primary-dark);
}

.action-btn.danger {
    background: var(--danger);
}

.action-btn.danger:hover {
    background: var(--danger-deep);
}

/* Boutons compacts dans les tables */
.btn.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 6px;
    min-height: 0;
    min-width: 0;
    margin-right: 0.25rem;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    min-height: 0;
    min-width: 0;
}

/* ---- Sous-onglets (section QCM) : soulignement comme les onglets publics - */
.subtabs {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}

.subtab-btn {
    padding: 0.55rem 2px 0.65rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    transition: color 0.2s var(--ease);
}

.subtab-btn:hover {
    color: var(--accent);
}

.subtab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--primary);
}

/* Pastille « questions en attente » sur le sous-onglet Validation */
.pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--pill);
    background: var(--warning);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1;
    vertical-align: middle;
}

/* Choix de la personne (import / validation) : Théo ou Hugo */
.qv2-author-choice {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.qv2-author-label {
    font-weight: 600;
    color: var(--accent);
}

.qv2-author-choice label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

.qv2-author-choice input[type="radio"] {
    width: auto;
    margin: 0;
}

.qv2-author-hint {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---- Bouton « Colonnes » (tables data-colhide) --------------------------- */
.col-toggle {
    position: relative;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.col-toggle-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 300;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.6rem 0.9rem;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    text-align: left;
}

.col-toggle-panel label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
}

/* Neutralise le style global des inputs (width: 100%, grosses marges) */
.col-toggle-panel input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    cursor: pointer;
}

/* ---- Filtres, SysAdmin, succès manuels ----------------------------------- */
.users-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.users-filters select {
    width: auto;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    align-self: stretch;
}

.sysadmin-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge-manual-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.badge-manual-controls input[type="email"] {
    flex: 1;
    min-width: 220px;
}

.badge-manual-controls select {
    min-width: 220px;
}

/* Signalements cadence : compteur neutre à 0, coloré dès le premier drapeau */
.tf-cell {
    text-align: center;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
/* Fraîcheur du dernier signalement : rouge < 24 h, orange < 48 h, noir au-delà */
.tf-cell.tf-recent-24 {
    color: var(--danger-deep);
    font-weight: 700;
}
.tf-cell.tf-recent-48 {
    color: var(--warning-deep);
    font-weight: 700;
}
.tf-cell.tf-old {
    color: inherit;
    font-weight: 700;
}
/* Le chiffre non nul est un bouton : même rendu que le texte, souligné au survol */
.tf-cell .tf-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline dotted;
}
.tf-cell .tf-link:hover { text-decoration: underline; }

/* ---- Formulaires d'édition (v1, encore référencés) ----------------------- */
.large-modal .modal-content {
    max-width: 1800px;
    max-height: 90vh;
    overflow-y: auto;
    width: 95%;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.form-section h3 {
    margin-bottom: 1rem;
    color: var(--accent);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.answer-item {
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.answer-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.answer-header label {
    font-weight: 600;
    margin: 0;
}

.correct-label {
    font-size: 0.9rem;
    color: var(--success);
}

/* ---- Modales ------------------------------------------------------------- */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 35, 48, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--accent);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--muted);
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--accent);
}

.checkbox-group {
    margin: 1rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Liste de cases à cocher (sujets associés à une matière) */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.35rem 1rem;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: normal;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkbox-list input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

/* Examens d'une matière et semestre de chaque sujet */
.matiere-subject-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}
.matiere-subject-row label { min-width: 0; }
.checkbox-list select.matiere-sem {
    width: auto;
    margin: 0;
    padding: 0.1rem 0.3rem;
    font-size: 0.85em;
    flex-shrink: 0;
}
.matiere-exam-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
    margin: 0.3rem 0 0.2rem;
}
.matiere-exam-dates label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: normal;
    margin: 0;
}
.matiere-exam-dates input[type="date"] { width: auto; margin: 0; }
.matiere-exam-hint {
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
    margin: 0.2rem 0 0.8rem;
}
#matiereEditModal [hidden] { display: none !important; }

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.modal-actions button {
    flex: 1;
    min-width: 100px;
}

/* Rangée secondaire d'une fenêtre (export des données d'un compte) :
   discrète, sous les actions principales, boutons à leur taille naturelle */
.modal-actions-secondary {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-soft, #e6e6e6);
    align-items: center;
    gap: 0.6rem;
}
.modal-actions-secondary button { flex: 0 0 auto; min-width: 0; }
.modal-actions-secondary .info-text { margin: 0; font-size: 0.85rem; }

/* ---- Messages ------------------------------------------------------------ */
.alert {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.alert-success {
    background: var(--success-tint);
    color: var(--success-deep);
    border: 1px solid rgba(46, 125, 82, .3);
}

.alert-error {
    background: var(--danger-tint);
    color: var(--danger-deep);
    border: 1px solid rgba(178, 58, 46, .3);
}

.alert-info {
    background: var(--info-tint);
    color: var(--info-deep);
    border: 1px solid rgba(38, 104, 127, .3);
}

/* ---- Spinner (sur fond coloré : bouton en cours) ------------------------- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Aperçu / éditeur en ligne ------------------------------------------- */
.preview-section {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
}

.preview-header {
    background: var(--primary);
    color: #fff;
    padding: 1.5rem;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h2 {
    margin: 0;
    color: #fff;
    border-bottom: none;
    padding-bottom: 0;
}

.preview-nav {
    display: flex;
    gap: 1rem;
}

.preview-nav .btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.preview-nav .btn:hover,
.preview-nav .btn.active {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.preview-content {
    padding: 2rem;
    min-height: 400px;
}

.question-container.preview-mode {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* État admin « bonne réponse » dans l'aperçu (pas montré aux étudiants) */
.answer-card.preview-correct {
    border-color: var(--success);
    background: var(--success-tint);
}

.inline-editor {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
}

.editor-header {
    background: var(--surface-2);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h2 {
    margin: 0;
    color: var(--accent);
    border-bottom: none;
    padding-bottom: 0;
}

.editor-actions {
    display: flex;
    gap: 1rem;
}

.inline-editor .form-section {
    margin: 0;
    background: transparent;
    border: none;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}

.inline-editor .form-section:last-of-type {
    border-bottom: none;
}

.form-actions {
    padding: 1.5rem;
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Aperçu compact (grille de la revue) */
.preview-question {
    max-width: 800px;
    margin: 0 auto;
}

.preview-question .question-header {
    background: var(--surface-2);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.preview-question .question-enonce {
    margin-bottom: 1.5rem;
}

.preview-question .answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.preview-question .answer-card {
    background: var(--bg-card);
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 1rem;
    position: relative;
    min-height: 0;
}

.preview-question .answer-card.correct {
    border-color: var(--success);
    background: var(--success-tint);
}

.preview-question .answer-card.incorrect {
    border-color: var(--danger);
    background: var(--danger-tint);
}

.preview-question .general-correction,
.general-correction {
    background: var(--surface-2);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    margin-bottom: 1rem;
}

/* ---- Section Import ------------------------------------------------------ */
.import-instructions {
    background: var(--info-tint);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 2rem;
    border-left: 3px solid var(--info);
}

.import-instructions details {
    margin-top: 1rem;
}

.import-instructions summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--info-deep);
}

.import-instructions pre {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-top: 0.5rem;
}

.import-instructions code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.import-upload-zone {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.upload-card {
    background: var(--bg-card);
    padding: 2rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.upload-card h3 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.upload-card input[type="file"] {
    margin: 1rem 0;
}

.file-status {
    margin-top: 1rem;
    min-height: 24px;
}

.status-success {
    color: var(--success);
    font-weight: 600;
}

.status-error {
    color: var(--danger);
    font-weight: 600;
}

.upload-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.import-progress {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background: var(--surface-2);
    border-radius: var(--pill);
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
}

.import-preview {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.question-number-display {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: var(--primary-tint);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.preview-content-wrapper {
    margin: 2rem 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--surface-2);
}

.image-reference {
    background: var(--warning-tint);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.import-validation-errors {
    background: var(--danger-tint);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.import-validation-errors h4 {
    color: var(--danger-deep);
    margin-top: 0;
}

.import-validation-errors ul {
    margin: 0;
    padding-left: 1.5rem;
}

.import-validation-errors li {
    color: var(--danger-deep);
    margin: 0.5rem 0;
}

.import-preview-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.import-summary {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius);
    text-align: center;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 2rem 0;
}

.summary-card {
    background: var(--surface-2);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.summary-card.success {
    background: var(--success-tint);
    border-color: var(--success);
}

.summary-card.error {
    background: var(--danger-tint);
    border-color: var(--danger);
}

.summary-number {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.summary-card.success .summary-number {
    color: var(--success);
}

.summary-card.error .summary-number {
    color: var(--danger);
}

.summary-label {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 600;
}

/* ---- Éditeur de questions v2 (YAML) -------------------------------------- */
.qv2-editor h3 { margin-bottom: 0.5rem; }
.qv2-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
#qv2Yaml {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    resize: vertical;
    tab-size: 2;
}
.qv2-actions { display: flex; gap: 0.75rem; margin-top: 0.75rem; flex-wrap: wrap; }
.qv2-status { margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.95rem; }
.qv2-status.success { background: var(--success-tint); color: var(--success-deep); border: 1px solid rgba(46, 125, 82, .3); }
.qv2-status.error { background: var(--danger-tint); color: var(--danger-deep); border: 1px solid rgba(178, 58, 46, .3); white-space: pre-wrap; }
.qv2-status.info { background: var(--info-tint); color: var(--info-deep); border: 1px solid rgba(38, 104, 127, .3); }

/* ---- Aperçu « comme sur le site public » ---------------------------------
   Les composants QCM (question-enonce, answers-grid, answer-card, pastilles
   sujet/type, correction-zone…) viennent maintenant DIRECTEMENT du style
   public copié — plus de duplication à resynchroniser. Ici : uniquement le
   cadre de l'aperçu et ses annotations propres à l'admin. */
.qv2-preview {
    margin-top: 1rem;
    padding: 1.5rem 2rem 2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.qv2-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
    color: var(--muted);
}
.qv2-preview-toolbar code {
    background: var(--bg-card);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
}
.qv2-preview .question-meta { margin-bottom: 1.5rem; }
.qv2-preview .answers-grid { margin: 0 auto 2rem; }
/* Signale deux propositions rendues identiques (collision de distracteurs) */
.qv2-preview .answer-card.qv2-duplicate { border-color: var(--danger); border-style: dashed; }
.qv2-preview .qv2-duplicate-flag { color: var(--danger); font-size: 0.85rem; font-weight: 600; margin-top: 0.5rem; }
.qv2-preview .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }
@media (max-width: 768px) {
    .qv2-preview .answers-grid { grid-template-columns: 1fr; gap: 1rem; }
    .qv2-preview .answer-card { min-height: 100px; padding: 1rem; }
}

/* ---- Onglet Légal : livre des recettes ----------------------------------- */
.legal-table {
    width: max-content;
    min-width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}
.legal-table th,
.legal-table td {
    white-space: nowrap;
    padding: 0.55rem 1rem;
    text-align: left;
}
.legal-table th {
    user-select: none;
}
.legal-table td.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.legal-table td.clip {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Sélection multiple (barre d'actions groupées) ----------------------- */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
    padding: 0.6rem 1rem;
    background: var(--info-tint);
    border: 1px solid rgba(38, 104, 127, .3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.bulk-bar span { font-weight: 600; color: var(--info-deep); margin-right: auto; }
.bulk-col { width: 34px; text-align: center; }
.bulk-col input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }
tr.row-selected > td { background: var(--primary-tint); }

/* ---- Taux de réussite dans la liste des questions ------------------------ */
.qv2-rate-hard { color: var(--danger); }    /* < 30 % : trop difficile */
.qv2-rate-easy { color: var(--warning-deep); } /* >= 90 % : trop facile */
.qv2-rate-ok   { color: var(--success); }
.qv2-rate-none { color: var(--muted); }

/* ---- Motif d'un renvoi en validation (onglet Validation) ----------------- */
.qv2-renvoi {
    margin-top: 4px;
    font-size: 0.85em;
    color: var(--warning-deep);
}

/* ---- Commentaires de relecture ------------------------------------------- */
/* Dernier commentaire, sous le titre dans les listes. La couleur dit l'étape :
   rouge pour un refus (à corriger ou à jeter), ambre pour un renvoi en
   validation (à relire), vert pour une reprise (quelqu'un a répondu). */
.qv2-comment-inline {
    margin-top: 4px;
    font-size: 0.85em;
}
.qv2-comment-inline.qv2-c-refus   { color: var(--danger-deep); }
.qv2-comment-inline.qv2-c-renvoi  { color: var(--warning-deep); }
.qv2-comment-inline.qv2-c-reprise { color: var(--success-deep); }

/* Historique déplié sous la ligne. max-width : la table est en
   width:max-content, sans plafond un commentaire long l'élargirait et
   déclencherait un défilement horizontal — le défaut qui a fait sortir
   l'aperçu de la table. */
.qv2-comments {
    padding: 10px 14px;
    background: var(--surface-2);
    border-left: 3px solid var(--border);
    max-width: 70ch;
    white-space: normal;
    overflow-wrap: anywhere;
}

.qv2-comment-history {
    margin: 0;
    padding-left: 1.2rem;
}

.qv2-comment-history li {
    margin-bottom: 0.7rem;
}

.qv2-comment-history li:last-child {
    margin-bottom: 0;
}

.qv2-comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8em;
}

.qv2-comment-status {
    font-family: var(--font-mono);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.qv2-comment-status.qv2-c-refus   { color: var(--danger-deep); }
.qv2-comment-status.qv2-c-renvoi  { color: var(--warning-deep); }
.qv2-comment-status.qv2-c-reprise { color: var(--success-deep); }

.qv2-comment-date { color: var(--muted); }

.qv2-comment-body {
    display: block;
    margin-top: 2px;
}

/* ---- Contrôles d'abonnements --------------------------------------------- */
.subscription-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

.control-group input,
.control-group select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin: 0;
}

.quick-actions {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.quick-actions h3 {
    margin: 0 0 1rem 0;
    color: var(--accent);
}

.action-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.action-group:last-child {
    margin-bottom: 0;
}

.action-group input[type="email"] {
    flex: 1;
    min-width: 250px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0;
}

.subscriptions-table {
    width: 100%;
    font-size: 0.9rem;
    min-width: 800px;
}

/* ---- Toast de confirmation (indépendant du bandeau de section) ----------- */
.admin-toast {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10000;
    background: var(--success);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.92rem;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.admin-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 768px) {
    .admin-header {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        position: relative;
    }

    /* Onglets repliés derrière le burger */
    .nav-burger {
        display: flex;
        position: absolute;
        top: 0.85rem;
        right: 1rem;
    }

    .admin-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-nav.open {
        display: flex;
    }

    .admin-nav .nav-btn {
        text-align: left;
    }

    .admin-section {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .admin-section .stat-number {
        font-size: 1.7rem;
    }

    .users-controls {
        flex-direction: column;
    }

    .users-controls input {
        min-width: auto;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }
}
/* ---- Cours (chapitres du polycopié) ---- */
.cours-editor-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.8rem 0;
    font-size: 0.92rem;
}
.cours-links-label { font-weight: 600; margin-right: 0.5rem; }
.cours-links-checks { display: inline-flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.cours-check { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: normal; white-space: nowrap; }
.cours-check input { width: auto; margin: 0; }

.cours-typst-editor {
    width: 100%;
    min-height: 480px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.8rem;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    resize: vertical;
    white-space: pre;
}

.cours-preview {
    margin-top: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    max-height: 75vh;
    overflow-y: auto;
}

/* Formules inline atomiques (voir style.css du site) */
.katex { white-space: nowrap; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

/* ---- Mon compte : état de sécurité, modale de ré-authentification -------- */
.acc-role {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.6rem;
    border-radius: var(--pill, 999px);
    background: var(--primary-tint);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}

.acc-security {
    margin: 0.25rem 0 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg, #f7f8fa);
    font-size: 0.9rem;
}

.acc-security-list {
    margin: 0;
    display: grid;
    gap: 0.4rem 0;
}

.acc-security-row {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 0 1rem;
    align-items: baseline;
}

.acc-security-row dt {
    color: var(--muted);
    font-weight: 500;
}

.acc-security-row dd {
    margin: 0;
}

.acc-warn {
    color: var(--warning-deep);
}

.acc-meter {
    margin-top: 0.35rem;
    height: 6px;
    max-width: 260px;
    border-radius: 3px;
    background: rgba(26, 35, 48, 0.1);
    overflow: hidden;
}

.acc-meter-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s var(--ease, ease);
}

.acc-meter-fill.is-warn {
    background: var(--warning);
}

/* Bouton mis en avant quand le mot de passe est à renouveler */
.action-btn.acc-attention {
    background: var(--warning-deep);
    box-shadow: 0 0 0 3px var(--warning-tint);
}

.action-btn.acc-attention:hover {
    background: var(--warning);
}

/* Pastille sur l'onglet Mon compte (pseudo-élément : le bouton reste un seul nœud) */
.nav-btn.nav-alert {
    position: relative;
}

.nav-btn.nav-alert::after {
    content: '!';
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: var(--pill, 999px);
    background: var(--warning);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    box-shadow: 0 0 0 2px var(--accent);
}

.acc-modal .acc-modal-intro {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    color: inherit;
}

.acc-modal .acc-modal-help {
    margin: -0.5rem 0 1rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.acc-modal label {
    display: block;
    margin-top: 0.25rem;
}

.acc-modal .acc-modal-msg {
    margin: 0.5rem 0 0;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.acc-modal .acc-modal-msg.is-error {
    background: var(--danger-tint);
    color: var(--danger-deep);
    border: 1px solid rgba(178, 58, 46, 0.3);
}

.acc-modal .acc-modal-msg.is-success {
    background: var(--success-tint);
    color: var(--success-deep);
    border: 1px solid rgba(46, 125, 82, 0.3);
}

@media (max-width: 600px) {
    .acc-security-row {
        grid-template-columns: 1fr;
    }
}

/* ---- SignalBot : voyants, file d'attente, encadré de liaison ------------- */
/* SysAdmin › E-mail */
.email-test-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.email-test-row label { font-weight: 600; }
.email-test-row input[type="email"] { flex: 1 1 16rem; min-width: 12rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.email-compose-grid { display: grid; grid-template-columns: 11rem 1fr; gap: 0.6rem 0.9rem; align-items: start; margin-bottom: 0.75rem; }
.email-compose-grid label { font-weight: 600; padding-top: 0.45rem; }
.email-compose-grid input, .email-compose-grid textarea { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.email-compose-grid textarea { line-height: 1.45; resize: vertical; }
.email-compose-btn { display: grid; grid-template-columns: 1fr 2fr; gap: 0.6rem; }
#composePreview { width: 100%; height: 720px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
@media (max-width: 700px) { .email-compose-grid, .email-compose-btn { grid-template-columns: 1fr; } }
.qv2-offline-import { margin: 0.75rem 0 1rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.qv2-offline-import textarea { width: 100%; font-family: var(--font-mono, monospace); font-size: 0.85rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; margin: 0.4rem 0 0.6rem; }
.email-compose-grid select { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
/* Filtre des destinataires : critères cumulés, sur une ou plusieurs lignes */
.email-compose-grid .compose-filter-label { font-weight: 600; padding-top: 0.45rem; }
.compose-filter { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; align-items: center; }
.compose-filter[hidden], .compose-filter-label[hidden] { display: none; }
.compose-filter select { width: auto; }
.email-compose-grid .compose-filter-check { font-weight: 400; padding-top: 0; display: inline-flex; align-items: center; gap: 0.4rem; }
.email-compose-grid .compose-filter-check input[type="checkbox"] { width: auto; }
.email-compose-grid .compose-filter-check input[type="number"] { width: 5.5rem; }
.compose-recipients { margin: 0 0 0.75rem 0; }
.compose-recipients summary { cursor: pointer; font-weight: 600; }
.compose-recipients pre { max-height: 16rem; overflow: auto; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; white-space: pre-wrap; }
.prorata-box { margin: 0.5rem 0 1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.prorata-box summary { cursor: pointer; font-weight: 600; }
.prorata-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0 0.3rem; }
.prorata-row input[type="date"] { width: auto; margin: 0; }
.prorata-row label { margin: 0; }
.email-samples { list-style: none; margin: 0; padding: 0; }
.email-samples li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--border-soft, var(--border)); }
.email-samples li:first-child { border-top: 0; }
.email-samples li > div { display: flex; flex-direction: column; gap: 0.15rem; }
.email-samples li span { color: var(--muted); font-size: 0.88rem; }
.email-samples .action-btn { flex: none; }

.signal-help {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0.25rem 0 0.75rem;
}

.form-group small.signal-help {
    display: block;
    margin: 0.35rem 0 0;
}

.signal-lights {
    list-style: none;
    margin: 0.5rem 0 0.75rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.4rem 1.5rem;
}

.signal-light {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
}

.signal-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
}

.signal-light.is-ok .signal-dot {
    background: var(--success);
    border-color: var(--success-deep);
}

.signal-light.is-ko .signal-dot {
    background: var(--danger);
    border-color: var(--danger-deep);
}

.signal-light-state {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.signal-light.is-ok .signal-light-state { color: var(--success-deep); }
.signal-light.is-ko .signal-light-state { color: var(--danger-deep); }

.signal-pending {
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

.signal-pending.is-warning {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--warning-tint);
    color: var(--warning-deep);
    border: 1px solid rgba(178, 106, 0, 0.3);
}

.signal-link-box {
    margin: 0.75rem 0 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.signal-link-box h4 {
    margin: 0 0 0.5rem;
}

.signal-steps {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
    font-size: 0.9rem;
}

.signal-steps li {
    margin-bottom: 0.6rem;
}

.signal-cmd {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.signal-cmd code {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre;
}

.signal-events label {
    font-weight: normal;
}

#signalTestResult.is-success { color: var(--success-deep); }
#signalTestResult.is-error { color: var(--danger-deep); }

/* .btn impose display:inline-block, qui l'emporte sur l'attribut hidden */
.btn[hidden] { display: none !important; }

/* ---- Suspension / fermeture d'un compte : motif et traceurs --------------- */
/* Ouverte par-dessus la fiche du compte (même z-index, placée avant dans le DOM) */
#sanctionModal { z-index: 1100; }
.sanction-modal { max-width: 640px; }
.sanction-period { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.sanction-period > div { flex: 1 1 10rem; }
.sanction-modal textarea { width: 100%; resize: vertical; font: inherit; }
/* Pastille de compte (alarmes des dernières 24 h) sur un onglet ou un titre */
.count-badge {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 0.4em;
    border-radius: 999px;
    background: var(--warning-deep);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
}
/* Ligne d'alarme des dernières 24 h : mise en avant */
.users-table tr.flag-new td { background: #fff6e5; }

/* Blocages en place (Veille) : texte long dans des cellules, sous-titres de section */
.limits-table td { white-space: normal; vertical-align: top; font-size: 0.86rem; line-height: 1.35; }
.limits-table td:nth-child(4) { color: var(--text-muted, #67707e); font-style: italic; }
.limits-table tbody th { text-align: left; padding-top: 0.9rem; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted, #67707e); }

/* Bandeau d'outils de la fiche : traceurs et blocages côte à côte, état à droite */
.account-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.6rem;
    margin: 0.25rem 0 0.5rem;
}
.account-tools .btn { margin: 0; }
.account-tools .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.account-tools-state {
    font-size: 0.82rem;
    color: var(--text-muted, #67707e);
    flex: 1 1 12rem;
}
.account-tools-state.is-blocked { color: var(--warning-deep); font-weight: 600; }

.sanction-evidence {
    margin: 0.25rem 0 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}
.sanction-evidence h4 { margin: 0 0 0.4rem; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted, #67707e); }
.sanction-evidence ul { margin: 0; padding-left: 1.1rem; }
.sanction-evidence li { margin: 0.15rem 0; }

/* Répartition par sujet : chiffres alignés à droite, colonnes de même largeur de chiffres */
.subject-breakdown td:not(:first-child), .subject-breakdown th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.subject-breakdown tfoot td { border-top: 2px solid var(--border); }
/* Validées en retard sur leur total : à regarder */
.subject-breakdown td.num-warn { color: var(--warning); font-weight: 600; }

/* Pied de page de la console : même origine que le site public (server/footer.php) */
.footer { margin-top: 2rem; padding: 1.25rem 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.footer-origin { margin-top: 0.4rem; font-size: 0.78rem; }
.footer-origin .swiss-flag { display: inline-block; vertical-align: -2px; margin-right: 0.4em; border-radius: 2px; }

/* Matières › Ordre des sujets */
.subject-order-list { list-style: none; counter-reset: subj; margin: .75rem 0 0; padding: 0; }
.subject-order-list li { counter-increment: subj; display: grid; align-items: center; gap: .5rem;
    padding: .35rem .5rem; border-bottom: 1px solid var(--border-soft, #e5e7eb); }
/* En-tête des colonnes de semestre (une par matière), même grille que les lignes */
.subject-order-head { display: grid; gap: .5rem; padding: 0 .5rem; margin-top: .75rem;
    font-size: .72rem; font-weight: 700; color: var(--muted, #6b7280); }
.subject-order-col { text-align: center; overflow: hidden; text-overflow: ellipsis; }
.subject-order-list li .subject-sem { justify-self: center; }
.subject-sem-static { justify-self: center; text-align: center; min-width: 2rem; font-weight: 700;
    font-size: .72rem; color: var(--muted, #6b7280); cursor: default; }
.subject-sem-static.none { font-weight: 400; opacity: .6; }
.subject-order-list li::before { content: counter(subj) "."; min-width: 1.8rem; color: var(--muted, #6b7280); }
.subject-order-name { flex: 1; }
.subject-order-name small { color: var(--muted, #6b7280); }
.subject-order-btns { display: flex; gap: .3rem; }
.subject-order-btns button:disabled { opacity: .35; cursor: default; }
/* Ordre et semestre des sujets : bouton A / P, fond blanc et cadre bleu,
   A en bleu, P en orange */
.action-btn.subject-sem,
.action-btn.subject-sem:hover {
    min-width: 2rem; font-weight: 700;
    background: #fff; border: 1.5px solid #2a5c9e; color: #2a5c9e;
}
.action-btn.subject-sem[data-sem="P"],
.action-btn.subject-sem[data-sem="P"]:hover { color: #d9730d; }

/* Éditeur du cours : coupure de l'Accès découverte dans l'aperçu */
.cours-trial-note { display: flex; gap: .5rem; align-items: center; margin: 0 0 1rem; font-size: .85rem; color: var(--muted, #6b7280); }
.cours-trial-wall-preview { margin: 1.5rem 0; padding: 1rem; text-align: center; border: 2px dashed #d9730d;
    border-radius: 8px; color: #8a5300; font-weight: 600; }

/* Champs de date au format suisse (js/swiss-date.js) : champ texte jj.mm.aaaa,
   bouton calendrier, champ natif invisible mais présent (showPicker) */
.swiss-date { position: relative; display: inline-flex; align-items: center; gap: .3rem; vertical-align: middle; }
.swiss-date .swiss-date-text { width: 8.5em; margin: 0; font-variant-numeric: tabular-nums; }
.swiss-date .swiss-date-text[aria-invalid="true"] { border-color: var(--danger, #b23a2e); }
.swiss-date-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: none; background: none; color: var(--muted, #67707e); cursor: pointer; border-radius: 6px; }
.swiss-date-btn:hover { color: var(--primary, #2a5c9e); background: rgba(42, 92, 158, .08); }
.swiss-date-btn:disabled { opacity: .4; cursor: default; }
.swiss-date input.swiss-date-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; opacity: 0; pointer-events: none; }

/* Tableau de périmètre : sujet absent d'un cours à sujets fixes (case cliquable) */
.action-btn.subject-sem.subject-sem-none,
.action-btn.subject-sem.subject-sem-none:hover { opacity: .5; font-weight: 400; }
.subject-order-col small { font-weight: 400; color: var(--muted, #6b7280); }
