/* ============================================================
   Pronote ESUP — charte graphique
   Palette : bleu marine / navy institutionnel (identite + appels a
   l'action), terre de Sienne brulee en accent secondaire, gris clair
   en fond neutre, blanc.
   ============================================================ */

:root {
    /* Bleu marine / navy — identite institutionnelle (du marine clair au navy profond) */
    --navy: #1b2b4b;
    --navy-dark: #101d38;
    --navy-light: #2c4373;

    /* Accent principal (appels a l'action) — aligne sur le bleu marine
       institutionnel. Noms --gold/--gold-dark conserves pour ne pas
       toucher les ~40 usages ; ils ne pointent plus vers l'ocre. */
    --gold: #2c4373;
    --gold-dark: #1b2b4b;

    /* Terre de Sienne brulee — accent secondaire (liseres, eyebrow, survols) */
    --sienna: #9a4a2b;
    --sienna-dark: #7a3820;

    --text: #1f2733;
    --text-muted: #5b6774;

    /* Gris clair — fond neutre */
    --bg: #eef0f2;
    --white: #ffffff;
    --border: #dde1e6;

    --success-bg: #e6f4ea;
    --success-border: #34a853;
    --error-bg: #fce8e6;
    --error-border: #d93025;
    --radius: 8px;
    --shadow: 0 2px 10px rgba(16, 29, 56, 0.09);
    --shadow-hover: 0 8px 24px rgba(16, 29, 56, 0.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: inherit; }

h1, h2, h3, h4 {
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--navy);
    line-height: 1.25;
    margin-top: 0;
}

img { max-width: 100%; display: block; }

/* ---------------- Header / nav public ---------------- */

.public-header {
    background: linear-gradient(120deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: box-shadow 0.25s ease, padding 0.25s ease, background 0.25s ease;
}

.public-header.is-scrolled {
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    background: linear-gradient(120deg, var(--navy-dark) 0%, var(--navy) 100%);
}

.public-header.is-scrolled .header-inner {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.public-header .header-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    transition: padding 0.25s ease;
}

.public-header .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--white);
}

.public-header .brand img {
    height: 42px;
    width: auto;
    border-radius: 4px;
    background: var(--white);
    padding: 2px;
    transition: transform 0.3s ease;
}

.public-header .brand:hover img {
    transform: scale(1.07) rotate(-2deg);
}

.public-header .brand-text .site-name {
    font-weight: 700;
    font-size: 1.05rem;
    display: block;
}

.public-header .brand-text .slogan {
    font-size: 0.78rem;
    color: #b9c6db;
    display: block;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.public-nav a {
    position: relative;
    color: #dbe4f3;
    text-decoration: none;
    font-size: 0.92rem;
    padding: 0.5rem 0.8rem;
    border-radius: 5px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.public-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    transform: translateY(-1px);
}

.public-nav a span {
    position: relative;
    display: inline-block;
}

.public-nav a span::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.public-nav a:hover span::after,
.public-nav a.is-active span::after {
    transform: scaleX(1);
}

.public-nav a.is-active {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

.public-nav a.nav-cta {
    background: var(--gold);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 600;
    animation: nav-cta-pulse 2.6s ease-in-out infinite;
}

.public-nav a.nav-cta:hover {
    background: var(--gold-dark);
    transform: translateY(-1px) scale(1.03);
}

@keyframes nav-cta-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(44,67,115,0.55); }
    50%      { box-shadow: 0 0 0 6px rgba(44,67,115,0); }
}

@media (prefers-reduced-motion: reduce) {
    .public-nav a.nav-cta { animation: none !important; }
}

/* ---------------- Hero ---------------- */

.hero {
    background-color: var(--navy);
    color: var(--white);
    padding: 5.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Image de fond isolee dans un calque a part (plutot que sur .hero directement) pour que le
   voile degrade et le texte puissent se superposer proprement.
   IMPORTANT (nettete de l'image) : ce calque reste ENTIEREMENT STATIQUE, aucune animation
   dessus (ni "transform", ni "background-position") — deux effets differents essayes ici degradaient
   le rendu des qu'une propriete du calque etait animee en continu (voir historique dans README).

   IMPORTANT #2 (nettete sur petit ecran) : sur une fenetre/viewport etroite, `background-size:
   cover` doit reduire l'image source de moitie ou plus pour l'ajuster — et le filtre de
   redimensionnement utilise par les navigateurs pour un background-image de cette taille est
   visiblement moins bon qu'un redimensionnement classique (verifie par comparaison directe :
   le meme fichier, redimensionne "a la main" en haute qualite puis affiche a la meme taille,
   est nettement plus net que ce que produit le navigateur). Plutot que de compter sur le
   navigateur pour bien reduire une tres grande image, on lui fournit directement un fichier deja
   a la bonne taille pour chaque palier de largeur (moins de travail de reduction a faire = moins
   de perte de qualite) : hero-fusion(-960|-640).(jpg|webp), generes par redimensionnement
   Lanczos haute qualite. */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Repli universel : JPEG, compris de tous les navigateurs. Plus de voile degrade ici — la
       photo s'affiche telle quelle, a la demande explicite de l'utilisateur (le voile l'assombrissait
       et donnait l'impression de gater/flouter la photo). Lisibilite du texte assuree autrement,
       par un text-shadow sur .hero h1/.hero p, pas par un calque sombre sur l'image. */
    background-image: url('/uploads/site/hero-fusion.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center 22%;
    z-index: 0;
}

@media (max-width: 900px) {
    .hero::before {
        background-image: url('/uploads/site/hero-fusion-960.jpg');
    }
}

@media (max-width: 480px) {
    .hero::before {
        background-image: url('/uploads/site/hero-fusion-640.jpg');
    }
}

/* Navigateurs comprenant image-set() : servent le WebP (plus leger que le JPEG, meme qualite
   visuelle) et retombent sur le JPEG s'ils ne savent pas decoder le WebP. @supports protege les
   navigateurs qui ne comprennent pas image-set() du tout : ils gardent le background-image JPEG
   simple defini juste au-dessus plutot que de perdre l'image de fond. Meme paliers de largeur
   que ci-dessus, en double (JPEG + WebP) pour chaque palier. */
@supports (background-image: image-set(url('data:,') 1x)) {
    .hero::before {
        background-image: image-set(url('/uploads/site/hero-fusion.webp') type('image/webp'),
                                     url('/uploads/site/hero-fusion.jpg') type('image/jpeg'));
    }

    @media (max-width: 900px) {
        .hero::before {
            background-image: image-set(url('/uploads/site/hero-fusion-960.webp') type('image/webp'),
                                         url('/uploads/site/hero-fusion-960.jpg') type('image/jpeg'));
        }
    }

    @media (max-width: 480px) {
        .hero::before {
            background-image: image-set(url('/uploads/site/hero-fusion-640.webp') type('image/webp'),
                                         url('/uploads/site/hero-fusion-640.jpg') type('image/jpeg'));
        }
    }
}

.hero > * {
    position: relative;
    z-index: 1;
}

/* Repere de defilement en bas du hero, invitant a continuer vers le contenu — pur CSS/HTML
   (ancre vers #section-formations, defilement fluide via html{scroll-behavior:smooth}). */
.hero-scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 1;
    width: 38px;
    height: 38px;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    font-size: 1.1rem;
    animation: hero-scroll-bounce 2.2s ease-in-out infinite;
    transition: background 0.2s, border-color 0.2s;
}

.hero-scroll-cue:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.85);
}

@keyframes hero-scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(7px); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-scroll-cue { animation: none; }
}

.hero h1 {
    color: var(--white);
    font-size: 2.6rem;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 16px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.7);
    animation: hero-fade-up 0.8s ease both;
}

.hero p {
    color: #e4eaf5;
    font-size: 1.15rem;
    max-width: 640px;
    margin: 0 auto 1.9rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.35);
    animation: hero-fade-up 0.8s ease both 0.12s;
}

.hero .btn, .hero .btn-outline {
    animation: hero-fade-up 0.8s ease both 0.24s;
}

/* Sans voile sombre sur la photo, le bouton transparent (fond clair du batiment, ciel...) a
   besoin de son propre ombrage pour rester lisible en toutes circonstances. */
.hero .btn-outline {
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

@keyframes hero-fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Spots publicitaires (carrousel plein cadre au-dessus du landscape) ---------------- */

.spot-carousel {
    position: relative;
    padding: 3rem 1.5rem 3.25rem;
    overflow: hidden;
    background: var(--navy-dark);
    isolation: isolate;
    transition: opacity 0.5s ease, max-height 0.5s ease, padding 0.5s ease;
}

.spot-carousel.is-dismissed {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.spot-carousel-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.5) saturate(1.15);
    transform: scale(1.15);
    opacity: 0;
    transition: opacity 1.1s ease;
    z-index: 0;
}

.spot-carousel-bg.is-active { opacity: 1; }

.spot-social-rail {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 2;
}

.spot-social-rail a {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background 0.2s ease, transform 0.2s ease;
}

.spot-social-rail a:hover { background: rgba(255,255,255,0.3); transform: translateY(-2px); }

.spot-carousel-close {
    position: absolute;
    left: 1rem;
    top: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--white);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s ease;
}

.spot-carousel-close:hover { background: rgba(255,255,255,0.3); }

.spot-carousel-inner {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.spot-carousel-title {
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.15rem;
    min-height: 1.6em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.spot-carousel-stage {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 22px 55px rgba(0,0,0,0.45);
    background: var(--white);
    aspect-ratio: 16 / 6.2;
}

.spot-carousel-slide {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease;
}

.spot-carousel-slide.is-active {
    opacity: 1;
    visibility: visible;
}

.spot-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.spot-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(11,31,58,0.5);
    border: 1px solid rgba(255,255,255,0.5);
    color: var(--white);
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s ease;
}

.spot-carousel-arrow:hover { background: rgba(11,31,58,0.8); }
.spot-carousel-prev { left: 0.6rem; }
.spot-carousel-next { right: 0.6rem; }

.spot-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.spot-carousel-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.spot-carousel-dot.is-active {
    background: var(--gold);
    transform: scale(1.25);
}

@media (max-width: 640px) {
    .spot-carousel-stage { aspect-ratio: 16 / 9; }
    .spot-social-rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .spot-carousel-bg, .spot-carousel-slide, .spot-carousel { transition: none !important; }
}

.btn {
    position: relative;
    display: inline-block;
    background: var(--gold);
    color: var(--white);
    font-weight: 600;
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.22);
    cursor: pointer;
    font-size: 0.95rem;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.25s cubic-bezier(.16,1,.3,1), background 0.2s, box-shadow 0.25s;
}

/* Reflet lumineux qui balaie le bouton au survol (effet "pro" courant sur les CTA de
   produits/SaaS) : une bande claire, inclinee, translatee de gauche a droite. */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.55) 48%, transparent 66%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

.btn:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(16,29,56,0.35);
}

.btn:hover::after {
    transform: translateX(120%);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 1.5px solid rgba(255,255,255,0.6);
    transition: transform 0.25s cubic-bezier(.16,1,.3,1), background 0.25s, border-color 0.25s, color 0.25s;
}

.btn-outline:hover {
    background: var(--white);
    color: var(--navy-dark);
    border-color: var(--white);
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    .btn::after { transition: none; }
    .btn:hover, .btn-outline:hover { transform: none; }
}

/* ---------------- Page banner (pages secondaires) ---------------- */

.page-banner {
    position: relative;
    background: radial-gradient(circle at 15% 20%, rgba(255,255,255,0.10), transparent 45%),
                linear-gradient(120deg, var(--navy-dark) 0%, var(--navy) 55%, var(--navy-light) 100%);
    color: var(--white);
    padding: 3.25rem 1.5rem;
    text-align: center;
    overflow: hidden;
}

.page-banner h1 {
    position: relative;
    color: var(--white);
    margin: 0;
    animation: hero-fade-up 0.7s ease both;
}

@media (prefers-reduced-motion: reduce) {
    .page-banner h1 { animation: none; }
}

/* ---------------- Layout general ---------------- */

.section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-title {
    position: relative;
    text-align: center;
    margin-bottom: 0.4rem;
    padding-bottom: 0.85rem;
}

/* Petit trait marine centre sous le titre de section, qui se deploie une fois la section
   revelee au defilement (voir .reveal.is-visible) plutot que d'etre visible d'emblee. */
.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 46px;
    height: 3px;
    background: var(--gold);
    border-radius: 999px;
    transform: translateX(-50%) scaleX(0);
    transition: transform 0.5s cubic-bezier(.16,1,.3,1) 0.15s;
}

.reveal.is-visible .section-title::after {
    transform: translateX(-50%) scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
    .section-title::after { transition: none; transform: translateX(-50%) scaleX(1); }
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2.25rem;
}

.section-eyebrow {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--sienna);
    margin-bottom: 0.5rem;
}

.section-alt {
    background: var(--white);
}

main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

main.wide { max-width: none; padding: 0; }

/* ---------------- Cartes (formations / actualites) ---------------- */

.card-grid, .formations-grid, .news-grid, .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.35s cubic-bezier(.16,1,.3,1), transform 0.35s cubic-bezier(.16,1,.3,1);
    display: flex;
    flex-direction: column;
}

/* Fine liseree marine -> sienne qui se deploie depuis le centre au survol (accent de marque
   discret, plutot qu'une simple ombre) — z-index au-dessus de .card-media pour rester visible. */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--sienna) 100%);
    transform: scaleX(0);
    transition: transform 0.35s cubic-bezier(.16,1,.3,1);
    z-index: 2;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-6px);
}

.card:hover::before {
    transform: scaleX(1);
}

.card .card-media {
    aspect-ratio: 16/10;
    background: var(--bg);
    overflow: hidden;
}

.card .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(.16,1,.3,1);
}

.card:hover .card-media img {
    transform: scale(1.08);
}

/* Bandeau genere en CSS pour les formations/actualites sans photo : evite le grand vide
   blanc qui apparaissait auparavant quand une carte sans image partageait sa ligne de
   grille avec des cartes illustrees (la grille etire toutes les cartes a la meme hauteur). */
/* Specificite .card .card-media.card-media-placeholder (et pas juste .card-media-placeholder)
   necessaire pour l'emporter sur .card .card-media { background: var(--bg) } ci-dessus, sinon
   ce degrade de secours est silencieusement ecrase par le fond gris generique. */
.card .card-media.card-media-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,0.10), transparent 55%),
        linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

.card-media-placeholder .card-media-icon {
    font-size: 2.4rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
    transition: transform 0.5s cubic-bezier(.16,1,.3,1);
}

.card:hover .card-media-placeholder .card-media-icon {
    transform: scale(1.15) rotate(-4deg);
}

.card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.card .card-body h3, .card .card-body h2 {
    font-size: 1.05rem;
    margin: 0;
}

.card .card-body p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0;
    flex: 1;
}

.card .card-body time {
    color: var(--gold-dark);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card .card-link {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

.card .card-link:hover { color: var(--gold-dark); }

/* Page Contact : ligne adresse/telephone/email avec icone, liens telephone/email cliquables. */
.contact-body .contact-line {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    flex: none;
}

.contact-body .contact-icon {
    flex: none;
    font-size: 1.1rem;
}

.contact-body a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.contact-body a:hover { color: var(--gold-dark); }

/* Formations */
.formations-grid article, .formations-grid .card {
    padding: 1.5rem;
}

.formations-grid article h2 {
    font-size: 1.1rem;
}

.formation-cycle-badge {
    display: inline-block;
    align-self: flex-start;
    background: rgba(11,31,58,0.08);
    color: var(--navy);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

/* ---------------- Presentation / mot du directeur ---------------- */

.presentation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
}

.presentation .presentation-text p {
    color: var(--text-muted);
}

.presentation blockquote {
    margin: 1rem 0 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg);
    border-left: 4px solid var(--gold);
    border-radius: 4px;
    font-style: italic;
    color: var(--text);
}

.presentation .signature {
    margin-top: 0.75rem;
    font-weight: 700;
    color: var(--navy);
    font-style: normal;
}

@media (max-width: 780px) {
    .presentation { grid-template-columns: 1fr; }
}

/* ---------------- Carte "Notre etablissement" ---------------- */

.etab-card {
    max-width: 940px;
    margin: 0 auto;
    background: var(--white, #fff);
    border: 1px solid var(--border, #dde1e6);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(16, 29, 56, .14);
}

.etab-card-header {
    position: relative;
    padding: 2.1rem 2.4rem 1.7rem;
    color: #fff;
    background: linear-gradient(125deg, var(--navy-dark, #101d38) 0%, var(--navy-light, #2c4373) 100%);
}

.etab-card-header::after {
    content: "";
    position: absolute;
    left: 2.4rem;
    bottom: 0;
    width: 70px;
    height: 4px;
    background: var(--sienna, #9a4a2b);
    border-radius: 3px 3px 0 0;
}

.etab-card-eyebrow {
    margin: 0 0 .45rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .68);
}

.etab-card-header h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    line-height: 1.2;
}

.etab-card-slogan {
    margin: .55rem 0 0;
    font-style: italic;
    color: rgba(255, 255, 255, .82);
}

.etab-card-body {
    position: relative;
    padding: 1.9rem 2.4rem 2.1rem;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text, #1f2733);
}

.etab-card-body::before {
    content: "\201C";
    position: absolute;
    top: .1rem;
    right: 1.6rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 6rem;
    line-height: 1;
    color: var(--sienna, #9a4a2b);
    opacity: .12;
    pointer-events: none;
}

.etab-card-body > p { margin: 0; }

.etab-card-cta {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: 1.5rem;
    font-weight: 700;
    color: var(--navy, #1b2b4b);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}

.etab-card-cta:hover {
    color: var(--sienna, #9a4a2b);
    border-bottom-color: var(--sienna, #9a4a2b);
}

@media (max-width: 640px) {
    .etab-card-header,
    .etab-card-body { padding-left: 1.5rem; padding-right: 1.5rem; }
    .etab-card-header::after { left: 1.5rem; }
    .etab-card-body::before { font-size: 4.5rem; right: 1rem; }
}

/* ---------------- Mots de la direction (cartes) ---------------- */

.leader-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
    margin-top: 1.5rem;
}

.leader-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, rgba(0, 0, 0, .08));
    border-radius: var(--radius, 12px);
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(13, 59, 102, .08);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

.leader-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 44px rgba(13, 59, 102, .14);
}

.leader-card-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.leader-photo {
    width: 84px;
    height: 84px;
    flex: 0 0 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold, #c9a227);
    background: var(--bg, #f4f6fb);
}

.leader-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    background: var(--navy, #0d3b66);
    text-transform: uppercase;
}

.leader-role {
    display: inline-block;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold, #c9a227);
}

.leader-name {
    margin: .25rem 0 0;
    font-weight: 700;
    color: var(--navy, #0d3b66);
}

.leader-message {
    margin: 0;
    padding: 1rem 1.25rem;
    background: var(--bg, #f4f6fb);
    border-left: 4px solid var(--gold, #c9a227);
    border-radius: 4px;
    font-style: italic;
    color: var(--text, #1c2b3a);
    line-height: 1.7;
}

a.leader-card { text-decoration: none; color: inherit; cursor: pointer; }

.leader-card-more {
    margin-top: auto;
    font-weight: 700;
    font-size: .85rem;
    color: var(--navy, #1b2b4b);
    letter-spacing: .02em;
}

a.leader-card:hover .leader-card-more { color: var(--gold-dark, #1b2b4b); }
a.leader-card:hover .leader-photo { border-color: var(--navy, #1b2b4b); }

/* ---------------- Page dediee : mot d'un dirigeant ---------------- */

.leader-word { max-width: 900px; margin: 0 auto; }

.leader-word-hero {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2.5rem;
    align-items: center;
    padding: 2.5rem 0 2rem;
}

.leader-word-hero-media img,
.leader-word-hero-initial {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--gold, #2c4373);
    box-shadow: 0 16px 40px rgba(27, 43, 75, .18);
    display: block;
}

.leader-word-hero-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5rem;
    font-weight: 800;
    color: #fff;
    background: var(--navy, #1b2b4b);
    text-transform: uppercase;
}

.leader-word-hero-text h1 { margin: .35rem 0 0; }

.leader-word-hero-sub {
    margin: .5rem 0 0;
    font-weight: 700;
    color: var(--navy, #1b2b4b);
}

.leader-word-hero-lead {
    margin: .9rem 0 0;
    color: var(--text-muted, #5b6774);
    font-size: 1.05rem;
}

.leader-word-body {
    border-top: 1px solid var(--border, #dde1e6);
    padding-top: 2.25rem;
}

.leader-word-prose {
    position: relative;
    max-width: 68ch;
    margin: 0 auto;
    font-size: 1.12rem;
    line-height: 1.95;
    color: var(--text, #1f2733);
}

.leader-word-prose::before {
    content: "\201C";
    position: absolute;
    top: -2.6rem;
    left: -.5rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 7rem;
    line-height: 1;
    color: var(--gold, #2c4373);
    opacity: .18;
}

.leader-word-prose p {
    margin: 0 0 1.4rem;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.leader-word-prose .leader-word-salutation {
    margin: 0 0 1.9rem;
    font-size: 1.16rem;
    font-weight: 600;
    color: var(--navy, #1b2b4b);
    text-align: left;
    hyphens: manual;
    -webkit-hyphens: manual;
}

.leader-word-prose .leader-word-addr {
    position: relative;
    margin: 0 0 1.5rem;
    padding: .5rem 0 .5rem 1.6rem;
    border-left: 3px solid var(--gold, #2c4373);
}

.leader-word-prose .leader-word-addr::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 1.15rem;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--gold, #2c4373);
    box-shadow: 0 0 0 4px rgba(44, 67, 115, .14);
}

.leader-word-prose .leader-word-addr-to {
    font-weight: 700;
    color: var(--navy, #1b2b4b);
}

.leader-word-prose .lead-para-dropcap {
    float: left;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 3.6rem;
    line-height: .82;
    font-weight: 700;
    padding: .2rem .6rem .1rem 0;
    color: var(--navy, #1b2b4b);
}

.leader-word-signature {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--gold, #2c4373);
    text-align: right;
    line-height: 1.4;
}

.leader-word-signature-name {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--navy, #1b2b4b);
}

.leader-word-signature-role {
    display: block;
    font-size: .8rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-muted, #5b6774);
}

.leader-word-nav {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 3rem 0 1rem;
}

@media (max-width: 720px) {
    .leader-word-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 1.5rem;
    }
    .leader-word-hero-media img,
    .leader-word-hero-initial { width: 150px; height: 150px; }
    .leader-word-prose { font-size: 1.04rem; }
    .leader-word-prose p,
    .leader-word-prose .leader-word-addr {
        text-align: left;
        hyphens: manual;
        -webkit-hyphens: manual;
    }
    .leader-word-nav { justify-content: center; }
}

/* ---------------- Visite guidee (video) ---------------- */

.visite-guidee-intro {
    max-width: 70ch;
    margin: 0 auto 1.5rem;
    text-align: center;
    color: var(--text-muted, #5b6774);
}

.video-frame {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius, 8px);
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(27, 43, 75, .22);
}

.video-frame > video,
.video-frame > iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-frame > video { object-fit: cover; background: #000; }

/* Repli pour les navigateurs sans aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
    .video-frame { height: 0; padding-bottom: 56.25%; }
}

/* ---------------- Galerie ---------------- */

.gallery-grid figure {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s cubic-bezier(.16,1,.3,1);
}

.gallery-grid figure:has(img) {
    cursor: zoom-in;
}

.gallery-grid figure:hover {
    box-shadow: var(--shadow-hover);
}

.gallery-grid img, .gallery-grid video, .gallery-grid iframe {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(.16,1,.3,1);
}

/* Video (fichier) et lecteur integre (YouTube/Vimeo) : ratio 16/9, sans zoom au
   survol (leurs controles natifs priment) et sans recadrage. */
.gallery-grid video, .gallery-grid iframe {
    aspect-ratio: 16/9;
    object-fit: contain;
    background: #000;
    border: 0;
    display: block;
}

/* Zoom + loupe reserves aux photos (agrandies au clic via lightbox.js) : une video a deja ses
   propres controles natifs, un survol qui zoome/assombrit dessus induirait en erreur. */
.gallery-grid figure:has(img):hover img {
    transform: scale(1.1);
}

.gallery-grid figure:has(img)::after {
    content: '🔍';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: rgba(11,31,58,0.35);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-grid figure:has(img):hover::after {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-grid img, .gallery-grid figure::after { transition: none; }
    .gallery-grid figure:hover img { transform: none; }
}

.gallery-grid figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* ---------------- Lightbox (zoom image au clic) ---------------- */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 21, 39, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lightbox-overlay.is-open {
    display: flex;
    opacity: 1;
}

.lightbox-image {
    max-width: min(90vw, 1100px);
    max-height: 82vh;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: lightbox-zoom-in 0.2s ease;
}

@keyframes lightbox-zoom-in {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-caption {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #dbe4f3;
    font-size: 0.9rem;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border: none;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.15s;
}

.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-close {
    top: 1.25rem;
    right: 1.25rem;
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
    line-height: 1;
}

.lightbox-prev, .lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
}

.lightbox-prev { left: 1.25rem; }
.lightbox-next { right: 1.25rem; }

/* ---------------- Partenaires (defilement continu) ---------------- */

.partners-marquee {
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.partners-track {
    display: flex;
    align-items: center;
    gap: 3.5rem;
    width: max-content;
    animation: partners-scroll 28s linear infinite;
}

.partners-marquee:hover .partners-track { animation-play-state: paused; }

.partner-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: filter 0.2s, opacity 0.2s, transform 0.2s;
}

.partner-logo:hover { filter: grayscale(0%); opacity: 1; transform: scale(1.06); }

.partner-logo img {
    height: 100%;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

@keyframes partners-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .partners-track { animation: none; }
}

/* ---------------- CTA band ---------------- */

.cta-band {
    background: var(--gold);
    color: var(--white);
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.cta-band h2 { color: var(--white); }

.cta-band .btn {
    background: var(--white);
    color: var(--navy);
    border-color: var(--white);
}

.cta-band .btn:hover { background: #eef2f8; color: var(--navy-dark); }

/* ---------------- Footer public ---------------- */

.public-footer {
    background: var(--navy-dark);
    color: #b9c6db;
    padding: 3rem 1.5rem 1.5rem;
}

.public-footer .footer-inner {
    max-width: 1160px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 2rem;
}

.public-footer h4 {
    color: var(--white);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.9rem;
}

.public-footer p { margin: 0 0 0.5rem; font-size: 0.9rem; }

.public-footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.public-footer ul li { margin-bottom: 0.5rem; }

.public-footer a {
    color: #b9c6db;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s, padding-left 0.2s;
}

.public-footer a:hover { color: var(--white); }

/* Petite fleche qui glisse depuis la gauche au survol des liens de navigation du pied de
   page (micro-interaction discrete, evite que les liens de liste restent totalement inertes). */
.public-footer ul li a {
    display: inline-block;
}

.public-footer ul li a:hover {
    padding-left: 0.35rem;
}

.public-footer .social-links {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.public-footer .social-links a {
    background: rgba(255,255,255,0.08);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}

.public-footer .social-links a:hover {
    background: var(--gold);
    color: var(--white);
    transform: translateY(-2px);
}

/* ---------------- Bouton "Remonter en haut" ---------------- */

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s, visibility 0.25s;
    z-index: 60;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--gold);
    color: var(--white);
    transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top { transition: opacity 0.1s, visibility 0.1s; }
}

.public-footer .copyright {
    max-width: 1160px;
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    text-align: center;
    color: #7c8aa0;
}

@media (max-width: 780px) {
    .public-footer .footer-inner { grid-template-columns: 1fr; }
}

/* ---------------- Scroll-reveal ---------------- */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(.16,1,.3,1), transform 0.7s cubic-bezier(.16,1,.3,1);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Petit effet d'entree en cascade sur les grilles de cartes */
.card-grid .card, .formations-grid .card {
    animation: card-fade-in 0.6s cubic-bezier(.16,1,.3,1) both;
}

.card-grid .card:nth-child(1), .formations-grid .card:nth-child(1) { animation-delay: 0.03s; }
.card-grid .card:nth-child(2), .formations-grid .card:nth-child(2) { animation-delay: 0.09s; }
.card-grid .card:nth-child(3), .formations-grid .card:nth-child(3) { animation-delay: 0.15s; }
.card-grid .card:nth-child(4), .formations-grid .card:nth-child(4) { animation-delay: 0.21s; }
.card-grid .card:nth-child(5), .formations-grid .card:nth-child(5) { animation-delay: 0.27s; }
.card-grid .card:nth-child(6), .formations-grid .card:nth-child(6) { animation-delay: 0.33s; }

@keyframes card-fade-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .reveal, .card-grid .card, .formations-grid .card, .hero h1, .hero p, .hero .btn, .hero .btn-outline {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================================
   Espaces authentifies (admin / enseignant / etudiant / login)
   ============================================================ */

.teacher-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--navy);
    color: var(--white);
    flex-wrap: wrap;
}

.teacher-nav a {
    color: var(--white);
    text-decoration: none;
    font-size: 0.9rem;
}

.teacher-nav a:hover {
    text-decoration: underline;
}

/* ---------------- Admin : sidebar + topbar ---------------- */

.admin-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* Reserve l'espace du rail replie dans la mise en page desktop (voir @media plus bas) : la vraie
   barre laterale passe en position fixed pour pouvoir se deployer par-dessus le contenu sans le
   repousser, ce spaceur invisible garde donc la place a sa place. Absent en mobile (tiroir plein
   ecran existant, pas de rail). */
.sidebar-rail-spacer { display: none; }

.admin-sidebar {
    /* Accent d'etat actif propre a la barre laterale : le --gold institutionnel
       (repointe sur le navy) n'a quasiment aucun contraste sur ce fond navy
       fonce. Scope local pour ne pas toucher aux ~40 usages de --gold ailleurs. */
    --accent: #5b8dff;
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(184deg, #1b2e56 0%, var(--navy-dark) 58%, #0b1526 100%);
    color: #c2cde3;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.18s ease;
    border-right: 1px solid rgba(255,255,255,0.06);
}

/* Barre de defilement discrete (WebKit/Blink ; Firefox garde la sienne). */
.admin-sidebar::-webkit-scrollbar { width: 9px; }
.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.09);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.16);
    background-clip: padding-box;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0 1.1rem 1rem;
    color: var(--white);
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 0.85rem;
}

.sidebar-brand-name b { font-weight: 400; color: #9db0d4; }

.sidebar-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--navy-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(91,141,255,0.30);
}

/* Champ de filtre du menu (progressif : sans JS, il n'a aucun effet). */
.sidebar-search {
    position: relative;
    margin: 0 0.9rem 0.85rem;
}

.sidebar-search-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #7f8fb0;
    opacity: 1;
    pointer-events: none;
}

.sidebar-filter-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.045);
    color: #c7d2e8;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.5rem 0.9rem 0.5rem 2.1rem;
    -webkit-appearance: none;
    appearance: none;
}

.sidebar-filter-input::placeholder { color: #8090b0; }

.sidebar-filter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91,141,255,0.20);
}

.sidebar-filter-input::-webkit-search-cancel-button { filter: invert(0.6); }

.sidebar-nav { flex: 1; padding: 0 0.75rem; }

/* Accordeon natif <details>/<summary> (aucun JS, conforme a la CSP script-src 'self' — meme
   convention que les autres accordeons du projet, ex. /admin/classes). Un seul groupe ouvert par
   defaut : celui contenant la page courante (voir _nav.php) ; les autres restent replies pour ne
   pas noyer l'ecran sous une quarantaine de liens. */
.sidebar-group summary.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.sidebar-group summary.sidebar-group-label::-webkit-details-marker { display: none; }
.sidebar-group summary.sidebar-group-label::marker { content: ''; }
.sidebar-group summary.sidebar-group-label:hover { color: #9aabc9; }

.sidebar-caret {
    display: inline-block;
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.sidebar-group[open] > summary .sidebar-caret { transform: rotate(90deg); }

.sidebar-group-label {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: #73859f;
    margin: 1rem 0.55rem 0.35rem;
    font-weight: 700;
}

.sidebar-nav .sidebar-group:first-child .sidebar-group-label { margin-top: 0.25rem; }

/* Pastille "nombre d'entrees visibles" du groupe, poussee a droite avec le chevron. */
.sidebar-group-count {
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #9fb0d0;
    background: rgba(255,255,255,0.07);
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    position: relative;
    padding: 0.52rem 0.55rem 0.52rem 0.85rem;
    border-radius: 8px;
    color: #c2cde3;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.1rem;
    transition: background 0.14s, color 0.14s;
}

.sidebar-link:hover { background: rgba(255,255,255,0.055); color: var(--white); }

.sidebar-link.active {
    background: rgba(255,255,255,0.075);
    color: var(--white);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* .sidebar-icon est desormais un <svg><use href="#ic-..."></svg> (sprite
   app/views/partials/_sidebar_icons.php). Les proprietes SVG heritables
   traversent l'instance <use> : l'icone prend la couleur du lien. */
.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.82;
}

.sidebar-link.active .sidebar-icon { opacity: 1; color: var(--accent); }

/* Filtre de la barre de recherche (public/assets/js/app.js) : masque liens et
   groupes sans correspondance. Sans JS, aucune de ces classes n'est posee. */
.sidebar-link.is-filtered-out,
.sidebar-group.is-filtered-out { display: none; }

/* Puce de role en pied (la session ne stocke pas le nom de l'utilisateur). */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.5rem 0.75rem 0;
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user-av {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy-light), var(--accent));
}

.sidebar-user-role { font-size: 0.8rem; font-weight: 600; color: #dbe4f5; }

.sidebar-site-link {
    margin: 0.5rem 0.75rem 0;
    padding: 0.55rem;
    text-align: center;
    border-radius: 8px;
    border: 1px dashed rgba(255,255,255,0.18);
    color: #b7c4dc;
    text-decoration: none;
    font-size: 0.8rem;
}

.sidebar-site-link:hover { border-color: rgba(255,255,255,0.5); color: var(--white); }

/* Rail replie (ordinateur) : le champ de recherche n'a pas la classe
   .sidebar-text, on le masque donc explicitement comme les libelles. */
@media (min-width: 901px) {
    .admin-sidebar:not(:hover):not(:focus-within) .sidebar-search {
        opacity: 0;
        height: 0;
        margin-top: 0;
        margin-bottom: 0;
        overflow: hidden;
        pointer-events: none;
    }
}

.admin-content-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-spacer { flex: 1; }

.topbar-link {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.88rem;
}

.topbar-link:hover { color: var(--gold-dark); }

.topbar-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.topbar-logout:hover { background: var(--bg); color: var(--text); }

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--navy);
}

.admin-main {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 1.75rem;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-head h1 { margin-bottom: 0.15rem; }

.page-head-subtitle { color: var(--text-muted); margin: 0; font-size: 0.92rem; }

.btn-ghost {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--navy);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--white);
}

.btn-ghost:hover { border-color: var(--gold); color: var(--gold-dark); }

/* KPI cards */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--text);
    border-left: 4px solid var(--navy);
    transition: transform 0.15s, box-shadow 0.15s;
}

a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.kpi-icon { font-size: 1.3rem; margin-bottom: 0.3rem; }

.kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1; }

.kpi-label { color: var(--text-muted); font-size: 0.82rem; }

.kpi-blue { border-left-color: #2563eb; }
.kpi-teal { border-left-color: #0d9488; }
.kpi-purple { border-left-color: #7c3aed; }
.kpi-indigo { border-left-color: #4f46e5; }
.kpi-gold { border-left-color: var(--gold); }
.kpi-sienna { border-left-color: var(--sienna); }
.kpi-green { border-left-color: #16a34a; }
.kpi-orange { border-left-color: #ea580c; }
.kpi-red { border-left-color: #dc2626; }

/* Dashboard panels */

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

.panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.panel h2 { font-size: 1rem; margin-bottom: 0.75rem; }

/* Accordeon natif (<details>/<summary>), sans JavaScript : conforme a la CSP script-src 'self'.
   Utilise pour regrouper les listes admin (classes par annee, coefficients par UE). */
.accordion {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.2rem;
    margin-bottom: 1rem;
}

.accordion summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--navy);
    padding: 0.3rem 0;
    list-style: none;
}

.accordion summary::-webkit-details-marker { display: none; }

.accordion summary::before {
    content: '\25B8';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.15s ease;
}

.accordion[open] summary::before {
    transform: rotate(90deg);
}

.accordion table { margin-top: 0.75rem; }

/* Variante compacte de .accordion (memes reflexes ▸/rotation), pensee pour tenir dans une
   cellule de tableau plutot que comme panneau autonome : pas de fond/ombre/marge propres,
   detail plus petit. Utilisee par le "Bilan des notes" de la fiche etudiant (CC/EXAM/Rattrapage
   cliquables pour voir les notes individuelles derriere chaque moyenne). */
.grade-detail summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--navy);
    list-style: none;
    white-space: nowrap;
}
.grade-detail summary::-webkit-details-marker { display: none; }
.grade-detail summary::before {
    content: '\25B8';
    display: inline-block;
    margin-right: 0.3rem;
    font-size: 0.75em;
    transition: transform 0.15s ease;
}
.grade-detail[open] summary::before { transform: rotate(90deg); }
.grade-detail-table {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    box-shadow: none;
    min-width: 260px;
}
.grade-detail-table th, .grade-detail-table td { padding: 0.3rem 0.5rem; }

/* Pagination : simples liens <a>, aucun JavaScript necessaire. */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin: 1.25rem 0;
    font-size: 0.9rem;
}

.pagination a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.pagination a:hover { text-decoration: underline; }

.pagination-disabled {
    color: var(--text-muted);
}

.pagination-status {
    color: var(--text-muted);
}

/* Selecteur "lignes par page" (voir app/views/partials/per_page_selector.php) : formulaire GET
   compact, auto-soumis via app.js (.js-autosubmit), place a cote de la pagination. */
.per-page-selector {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    max-width: none;
    margin: 0 0 0.75rem;
    justify-content: flex-end;
}

.per-page-selector label { font-weight: 500; font-size: 0.85rem; color: var(--text-muted); }

.per-page-selector select { width: auto; padding: 0.35rem 0.5rem; }

/* Onglets de filtre par role (/admin/utilisateurs) : liens simples, pas de JS necessaire. */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1rem;
}

.filter-tab {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.filter-tab:hover { background: #e7ecf5; color: var(--gold-dark); }
.filter-tab.is-active { background: var(--gold); color: var(--white); border-color: var(--gold-dark); }

/* Barre de recherche avancee (/admin/utilisateurs) : filtres combinables (texte, classe, annee,
   statut) + boutons, tous alignes sur UNE meme ligne. Le champ Recherche occupe une colonne plus
   large (2fr) que les selects (1fr chacun) ; la derniere colonne (largeur "auto", ajustee au
   contenu) porte les boutons Rechercher/Reinitialiser cote a cote. */
.search-filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
    gap: 0.75rem 1.25rem;
    align-items: end;
    margin: 0 0 1rem;
}

.search-filter-bar .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    min-width: 0;
}

/* Specificite superieure a ".search-filter-bar .field" (qui impose flex-direction: column) pour
   que les deux boutons restent bien cote a cote, sur la meme ligne que les champs. */
.search-filter-bar .field.field-buttons {
    flex-direction: row;
    align-items: center;
}

.search-filter-bar .field label { font-weight: 500; font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.search-filter-bar select, .search-filter-bar input[type="text"] { padding: 0.35rem 0.5rem; width: 100%; }

@media (max-width: 900px) {
    .search-filter-bar { grid-template-columns: repeat(2, 1fr); }
    .search-filter-bar .field-buttons { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
    .search-filter-bar { grid-template-columns: 1fr; }
}

/* /admin/etudiants : variante de .search-filter-bar dediee (le widget de recherche en cascade
   Secteur/Cycle/Niveau/Classe a besoin de bien plus de largeur que la colonne etroite que lui
   laisserait la grille generique a 5 colonnes de .search-filter-bar). Recherche/Statut/Boutons
   restent sur une premiere ligne compacte ; la cascade occupe seule toute la largeur de la ligne
   suivante, ce qui donne assez de place pour aligner Secteur, Cycle et Niveau (et le nom de la
   classe) cote a cote plutot que les uns sous les autres. Double classe pour l'emporter sur les
   regles de .search-filter-bar a specificite egale. */
.search-filter-bar.student-filter-bar {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
    grid-template-areas:
        "q status buttons"
        "cascade cascade cascade";
}
.student-filter-bar .field-q { grid-area: q; }
.student-filter-bar .field-status { grid-area: status; }
.student-filter-bar .field-buttons { grid-area: buttons; }
.student-filter-bar .cp-full-row { grid-area: cascade; }

/* A l'interieur de la ligne pleine largeur, Secteur/Cycle/Niveau se partagent 3 colonnes egales
   et le nom de la classe une 4e, plus large — au lieu de l'auto-fit generique de .form-grid
   (pense pour une colonne isolee, pas une ligne pleine largeur). */
.student-filter-bar .cp-full-row .form-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(200px, 1.6fr);
    max-width: none;
}

@media (max-width: 900px) {
    .search-filter-bar.student-filter-bar {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "q q"
            "status buttons"
            "cascade cascade";
    }
    .student-filter-bar .cp-full-row .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .search-filter-bar.student-filter-bar {
        grid-template-columns: 1fr;
        grid-template-areas:
            "q"
            "status"
            "buttons"
            "cascade";
    }
    .student-filter-bar .cp-full-row .form-grid {
        grid-template-columns: 1fr;
    }
}

/* /admin/affectations : Secteur/Cycle/Niveau sur une ligne pleine largeur au-dessus des cases a
   cocher "Classe(s)" et des autres champs (Matiere/Enseignant/Annee) — meme principe que
   .student-filter-bar .cp-full-row (batch 44) : le conteneur du widget occupe toute la largeur de
   la grille parente (.form-grid.affectation-form), puis se decoupe lui-meme en colonnes egales. */
.affectation-form .cp-full-row {
    grid-column: 1 / -1;
}
.affectation-form .cp-full-row .form-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    max-width: none;
}
@media (max-width: 700px) {
    .affectation-form .cp-full-row .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .affectation-form .cp-full-row .form-grid { grid-template-columns: 1fr; }
}

/* Boite generique bornee en hauteur avec defilement pour une liste de cases a cocher (ex.
   matieres de /admin/affectations, checkbox-inline/checkbox-group repris tels quels a
   l'interieur). .cp-class-checklist (liste de classes generee par class-picker.js quand
   $cpMultiple est actif, voir class_picker_fields.php) partage exactement le meme habillage. */
.checklist-box,
.cp-class-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    background: var(--white);
}
.cp-class-list-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Grille de formulaire responsive a 2 colonnes (voir .field / .field-full ci-dessous),
   utilisee pour les formulaires "Ajouter" les plus charges en champs (Matieres, Affectations). */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem 1.5rem;
    max-width: 760px;
    align-items: end;
}

.form-grid .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}

.form-grid .field label { margin: 0; }

/* Variante compacte de .form-grid : grille rigide a 3 colonnes egales (au lieu de la grille
   responsive minmax de .form-grid qui peut renvoyer une colonne a la ligne suivante si le
   panneau est etroit). Les 3 champs restent TOUJOURS sur une seule ligne, chacun dans sa
   propre colonne — meme decoupage que .note-type-row juste en dessous, pour que les deux
   lignes restent visuellement alignees. Pour les petits groupes de 3 champs courts qui
   doivent rester groupes visuellement (ex: saisie des notes : Periode / Libelle / Bareme). */
.form-grid-inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem 1.5rem;
    align-items: end;
}

.form-grid-inline .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    min-width: 0;
}

.form-grid .field-full {
    grid-column: 1 / -1;
}

/* /admin/notes/import : 5 filtres (annee/periode/classe/matiere/enseignant) sur une seule ligne —
   le .form-grid generique (auto-fit, max-width 760px) les renverrait a la ligne suivante des que
   la largeur totale depasse 760px, ce qui arrive presque toujours avec 5 champs. Meme principe
   que .student-filter-bar (batch 44) : grille dediee, sans le plafond generique.
   align-items:start (au lieu du "end" herite de .form-grid) : 2 des 5 champs (Matiere,
   Enseignant) ont un texte d'aide sous le champ qui les rend plus hauts que les 3 autres — "end"
   aurait desaligne label/champ de saisie entre les deux groupes. Le bouton "Continuer"
   (.field-full) n'est pas un filtre : il reste seul sur sa propre ligne en dessous. */
.form-grid.notes-import-filters {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    max-width: none;
    align-items: start;
}
@media (max-width: 1100px) {
    .form-grid.notes-import-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 700px) {
    .form-grid.notes-import-filters { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .form-grid.notes-import-filters { grid-template-columns: 1fr; }
}

/* Nom de classe calcule automatiquement (Secteur - Cycle - Niveau - Formation), affiche en
   lecture seule — voir /admin/classes (creation) et /admin/classes/modifier. Mis a jour en
   direct par public/assets/js/app.js au fil de la saisie/selection des 4 elements. */
.field-preview {
    margin: 0;
    padding: 0.55rem 0.8rem;
    background: var(--surface-2, #f3f4f6);
    border: 1px dashed var(--border, #d1d5db);
    border-radius: 6px;
    font-weight: 600;
    color: var(--text, #1f2937);
}

/* Icone devant un titre de section (h2/h3), meme langage visuel que les cartes KPI du tableau de bord. */
.section-icon { margin-right: 0.4rem; }

/* Recherche rapide de classe (/admin/classes) : recherche texte libre mise en avant (toutes
   classes, sans passer par le classement Secteur/Cycle/Niveau qui peut etre errone ou inconnu de
   l'utilisateur — voir AdminClassSearchController::search()), avec la cascade existante repliee
   en dessous pour affiner/parcourir. Meme habillage carte que .panel. */
.class-search-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.class-search-hero label {
    display: block;
    margin-bottom: 0.5rem;
}

.class-search-input-wrap {
    position: relative;
}

.class-search-input-wrap .class-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.05rem;
    pointer-events: none;
    opacity: 0.65;
}

.class-search-input-wrap input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 1.02rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.class-search-input-wrap input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(44, 67, 115, 0.25);
}

.class-search-hero .field-hint { margin-top: 0.5rem; }

/* Cascade Secteur/Cycle/Niveau : repliee par defaut derriere un <details>, presentee comme un
   moyen d'"affiner" plutot que le point d'entree principal desormais tenu par la recherche texte. */
.class-search-refine {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}

.class-search-refine summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    list-style: none;
}

.class-search-refine summary::-webkit-details-marker { display: none; }

.class-search-refine summary::before {
    content: '\25B8';
    display: inline-block;
    margin-right: 0.45rem;
    transition: transform 0.15s ease;
}

.class-search-refine[open] summary::before { transform: rotate(90deg); }

.class-search-refine .form-grid { margin-top: 1rem; }

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: normal;
    margin-right: 1rem;
}

/* Formulaire "Nouvel utilisateur" (app/views/admin/users/form.php) : carte pleine largeur,
   plus large que le formulaire standard (480px) pour accueillir la grille de roles/champs. */
.user-form {
    max-width: 760px;
    gap: 0;
}

.form-section-title {
    font-size: 0.95rem;
    color: var(--navy);
    margin: 1.5rem 0 0.9rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.user-form > .form-section-title:nth-child(2) {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Selecteur de role en cartes cliquables (plutot qu'une simple liste deroulante) : le bouton
   radio natif est visuellement masque mais reste focusable au clavier (Tab + Entree/Espace),
   c'est le <label> associe (couvrant toute la carte) qui porte l'apparence. */
.role-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem;
}

.role-option { position: relative; }

.role-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.35rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    cursor: pointer;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}

.role-card-icon { font-size: 1.9rem; line-height: 1; }

.role-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--gold); }

.role-radio:checked + .role-card {
    border-color: var(--gold);
    color: var(--navy);
    background: linear-gradient(180deg, #eef2f8 0%, var(--white) 100%);
    box-shadow: 0 0 0 3px rgba(44, 67, 115, 0.18), var(--shadow-hover);
}

.role-radio:focus-visible + .role-card {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }

.user-form-submit {
    margin-top: 1.5rem;
    background: var(--gold);
    color: var(--white);
    padding: 0.7rem 1.75rem;
    font-size: 0.95rem;
}

.user-form-submit:hover { background: var(--gold-dark); }

/* Champs specifiques a un role (numero etudiant, droits gestionnaire) : visibles par defaut
   (aucune fonctionnalite perdue sur un navigateur ancien), masques en CSS pur via :has() quand
   ce n'est pas le role choisi. :has() teste tout le sous-arbre du <form>, donc fonctionne meme si
   le radio est imbrique dans .role-picker (contrairement au combinateur ~, qui exige des freres
   directs) — voir le meme motif plus simple (freres directs) pour le type de note CC/EXAM/MIXTE. */
.role-only { margin: 0; }

form:not(:has(#role-etudiant:checked)) .role-etudiant-only,
form:not(:has(#role-gestionnaire:checked)) .role-gestionnaire-only {
    display: none;
}

.big-number { font-size: 1.9rem; font-weight: 800; color: var(--navy); margin: 0 0 0.25rem; }

.panel-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.75rem; }

/* Meme registre que .panel-hint, mais pour une precision sous un seul champ (ex: champ
   d'autocompletion "Enseignant" de /admin/notes/import) plutot que sous tout un panneau. */
.field-hint { color: var(--text-muted); font-size: 0.8rem; margin: 0.15rem 0 0; }

.mini-list { list-style: none; margin: 0 0 0.9rem; padding: 0; }

.mini-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.mini-list li:last-child { border-bottom: none; }

/* Indicateurs avances (barres CSS-only, Phase 5) */

.stat-bars { list-style: none; margin: 0; padding: 0; }

.stat-bar-row { margin: 0 0 0.65rem; }

.stat-bar-row:last-child { margin-bottom: 0; }

.stat-bar-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.stat-bar-head strong { color: var(--navy); }

.stat-bar-track {
    background: var(--border-light, #eef1f6);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--gold);
}

.stat-bar-fill.stat-bar-blue { background: #2563eb; }
.stat-bar-fill.stat-bar-teal { background: #0d9488; }
.stat-bar-fill.stat-bar-purple { background: #7c3aed; }
.stat-bar-fill.stat-bar-green { background: #16a34a; }
.stat-bar-fill.stat-bar-orange { background: #ea580c; }
.stat-bar-fill.stat-bar-red { background: #dc2626; }

.badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    text-transform: capitalize;
}

.badge-nouvelle { background: #dbeafe; color: #1e40af; }
.badge-contactee { background: #fef3c7; color: #92400e; }
.badge-validee { background: #dcfce7; color: #166534; }
.badge-rejetee { background: #fee2e2; color: #991b1b; }

.badge-en_attente { background: #fef3c7; color: #92400e; }
.badge-valide { background: #dcfce7; color: #166534; }
.badge-echoue { background: #fee2e2; color: #991b1b; }
.badge-rembourse { background: #e0e7ff; color: #3730a3; }

/* Classe incomplete (sans formation/niveau assigne) — voir /admin/classes */
.badge-warning { background: #fef3c7; color: #92400e; text-transform: none; }

/* Jauge de progression (/admin/bulletins/lot) : largeur pilotee en JS via style.width,
   valeur reelle cote serveur (nombre de bulletins effectivement generes), pas une animation. */
.progress-track {
    width: 100%;
    height: 1.1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--sienna));
    transition: width 0.25s ease;
}
.progress-status {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}
.progress-status strong { color: inherit; font-weight: 600; }
.batch-summary { margin-top: 1rem; }
.batch-summary ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

/* Ligne recapitulative "Total" d'une UE (voir /admin/bulletins/generer) : credits acquis/total,
   puis "UE n : Validee avec [moyenne]" — la moyenne est mise en avant dans un badge plus vif que
   les .badge classiques (pastel), pour rester lisible comme un resultat chiffre a part entiere. */
.ue-total-row td { font-weight: 600; background: var(--bg-subtle, #f8fafc); }
.ue-total-label { font-weight: 600; }
.ue-total-label-ok { color: #15803d; }
.ue-total-label-ko { color: #b91c1c; }
.badge-note {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.15rem 0.65rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
}
.badge-note-valide { background: #22c55e; color: #052e16; }
.badge-note-echoue { background: #f87171; color: #450a0a; }

/* Selecteur d'operateur Mobile Money : affichage du panneau correspondant en CSS pur
   (aucun script inline, conforme a la Content-Security-Policy script-src 'self').
   IMPORTANT : les <input type="radio"> et les .mm-panel/.mixte-only doivent rester des
   enfants DIRECTS du meme <form> (pas enveloppes dans un <label> ni une div englobante),
   sinon le combinateur ~ ci-dessous ne peut pas les relier. */
.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border, #d8dde3);
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    cursor: pointer;
    margin: 0.25rem 0.5rem 0.75rem 0;
    font-weight: 600;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.mm-panel {
    display: none;
    background: var(--bg, #eef0f2);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
}

#op-airtel:checked ~ #panel-airtel,
#op-moov:checked ~ #panel-moov {
    display: block;
}

/* Ligne "Type de note" (CC/EXAM/MIXTE) : meme grille rigide a 3 colonnes egales que
   .form-grid-inline juste au-dessus, pour que les pills restent alignees avec Periode /
   Libelle / Bareme et ne passent jamais a la ligne. Chaque .note-type-option masque son
   radio natif (.radio-pill-input, meme principe que .role-radio) et n'affiche que le
   .radio-pill, qui est etire (stretch) pour occuper toute sa colonne. */
.note-type-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: stretch;
    gap: 0.6rem;
    margin: 0.4rem 0 1.15rem;
}

.note-type-option { position: relative; display: flex; }

.note-type-option .radio-pill {
    flex: 1;
    justify-content: center;
    margin: 0;
}

.radio-pill-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-pill-input:checked + .radio-pill {
    border-color: var(--gold);
    color: var(--navy);
    background: linear-gradient(180deg, #eef2f8 0%, var(--white) 100%);
    box-shadow: 0 0 0 3px rgba(44, 67, 115, 0.18);
}

.radio-pill-input:focus-visible + .radio-pill {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Bascule CC/EXAM/MIXTE en CSS pur (aucun script inline, conforme a la Content-Security-Policy
   script-src 'self') : les colonnes .col-mixte sont masquees par defaut, affichees uniquement
   quand #op-mixte est coche ; .col-single fait l'inverse. Utilise :has() (deja utilise pour le
   role-picker de /admin/utilisateurs/nouveau) plutot que le combinateur ~ : #op-mixte et
   .grade-entry-table peuvent donc etre imbriques a des profondeurs differentes dans le <form>
   (ex: le radio dans .note-type-row), tant qu'ils restent tous deux descendants du meme <form>. */
.col-mixte { display: none; }

form:has(#op-mixte:checked) .grade-entry-table .col-single { display: none; }
form:has(#op-mixte:checked) .grade-entry-table .col-mixte { display: table-cell; }

.quick-links { display: flex; flex-direction: column; gap: 0.5rem; }

.quick-links a {
    color: var(--navy);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    background: var(--bg);
}

.quick-links a:hover { background: #eef1f6; color: var(--gold-dark); }

/* Rail retractable automatique (ordinateur uniquement — le mobile garde son tiroir plein ecran
   existant ci-dessous, ouvert/ferme manuellement via le bouton ☰, sans notion de survol tactile).
   Repliee par defaut a la largeur d'une simple bande d'icones ; se deploie des qu'on la survole
   ou qu'un lien a l'interieur recoit le focus clavier (:focus-within, pour rester utilisable au
   clavier). Passe en position fixed pour se deployer PAR-DESSUS le contenu plutot que de le
   repousser a chaque survol — .sidebar-rail-spacer reserve seule la place dans la mise en page. */
@media (min-width: 901px) {
    .sidebar-rail-spacer {
        display: block;
        width: 64px;
        flex-shrink: 0;
    }
    .admin-sidebar {
        width: 64px;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 60;
    }
    .admin-sidebar:hover,
    .admin-sidebar:focus-within {
        width: 250px;
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    }

    .admin-sidebar .sidebar-text,
    .admin-sidebar .sidebar-caret {
        opacity: 0;
        transition: opacity 0.1s ease;
    }
    .admin-sidebar:hover .sidebar-text,
    .admin-sidebar:hover .sidebar-caret,
    .admin-sidebar:focus-within .sidebar-text,
    .admin-sidebar:focus-within .sidebar-caret {
        opacity: 1;
    }

    .admin-sidebar .sidebar-site-link { display: none; }
    .admin-sidebar:hover .sidebar-site-link,
    .admin-sidebar:focus-within .sidebar-site-link { display: block; }

    /* Chevron inutile tant que le libelle a cote est invisible (rail replie). */
    .admin-sidebar:not(:hover):not(:focus-within) .sidebar-caret {
        display: none;
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 250px;
        z-index: 100;
        transition: left 0.2s;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .admin-shell.sidebar-open .admin-sidebar { left: 0; }
    .sidebar-toggle { display: block; }
    .admin-main { padding: 1.1rem; }
}

.login-page {
    max-width: 880px;
    margin: 3.5rem auto;
    padding: 0 1.25rem 3rem;
}

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

.login-page .login-header h1 {
    color: var(--navy);
    font-size: 1.7rem;
    margin: 0 0 0.4rem;
}

.login-page .login-header p {
    color: var(--text-muted);
    margin: 0;
}

/* Grille des cartes de profil */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
    transition: opacity 0.25s ease, max-height 0.35s ease, margin 0.35s ease;
    overflow: hidden;
}

.profile-grid.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0;
    pointer-events: none;
}

.profile-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.9rem 1.25rem 1.6rem;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    font: inherit;
    color: var(--text);
}

/* Liseré bleu marine -> terre de Sienne qui se déploie au survol (accent de marque) */
.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--sienna));
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.profile-card:hover,
.profile-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--navy-light);
    outline: none;
}

.profile-card:hover::before,
.profile-card:focus-visible::before,
.profile-card.is-active::before {
    transform: scaleX(1);
}

.profile-card.is-active {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(44, 67, 115, 0.28), var(--shadow-hover);
}

.profile-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 6px 16px rgba(16, 29, 56, 0.18);
}

.profile-card-title {
    font-weight: 700;
    color: var(--navy);
    font-size: 1.05rem;
}

.profile-card-desc {
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.4;
}

/* Panneau de connexion — "sortie" en glissement depuis le haut une fois un profil choisi */

.login-form-panel {
    max-width: 420px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 2rem;
    opacity: 0;
    max-height: 0;
    transform: translateY(-16px) scale(0.98);
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.4s ease, padding 0.3s ease;
    pointer-events: none;
}

.login-form-panel.is-open {
    opacity: 1;
    max-height: 640px;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Lien direct par profil (/connexion?profil=...) : la grille de choix est masquee,
   seul le formulaire du profil vise est presente. Le panneau reste ouvert meme si
   le JS ne s'execute pas. */
.login-page.is-locked .profile-grid { display: none; }

.login-page.is-locked .login-form-panel {
    opacity: 1;
    max-height: none;
    transform: none;
    pointer-events: auto;
}

.login-form-panel .back-to-profiles {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.login-form-panel .back-to-profiles:hover { color: var(--navy); }

.login-form-panel .login-panel-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1.25rem;
}

.login-form-panel .login-panel-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.login-form-panel h2 {
    margin: 0;
    color: var(--navy);
    font-size: 1.15rem;
}

.login-form-panel form { max-width: none; margin-bottom: 0; }

@media (max-width: 720px) {
    .profile-grid { grid-template-columns: repeat(2, 1fr); }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Conteneur de defilement horizontal pour les tableaux plus larges que leur panneau (ex. la
   grille etudiant x matiere de /admin/notes/suivi, dont la largeur croit avec le nombre de
   matieres affectees a la classe) : evite que le tableau ne deborde du panneau ou de la page. */
.table-scroll {
    overflow-x: auto;
}
.table-scroll table {
    min-width: max-content;
}

th, td {
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0.85rem;
    text-align: left;
    font-size: 0.92rem;
}

th { background: var(--bg); color: var(--navy); }

/* Formulaire d'edition inline dans une cellule de tableau (ex: coefficient dans
   /admin/coefficients) : annule la mise en page column/max-width du <form> generique
   ci-dessous pour rester sur une seule ligne, compact. */
.inline-edit-form {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    max-width: none;
    margin: 0;
}
.inline-edit-form input[type="number"] { width: 5.5rem; padding: 0.35rem 0.5rem; }
.inline-edit-form button { padding: 0.35rem 0.6rem; }

form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 480px;
    margin-bottom: 1.5rem;
}

label { font-size: 0.88rem; font-weight: 600; color: var(--navy); }

input, select, textarea {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.92rem;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

/* :not(.btn) laisse la main aux boutons de formulaire qui optent explicitement pour le style
   CTA public (.btn) — sans ca, "form button[type=submit]" (plus specifique que .btn seul)
   l'emportait toujours et rendait .btn sans effet visible sur un <button> dans un <form>
   (ex. pre-inscription). */
button:not(.btn):not(.profile-card), form button[type="submit"]:not(.btn) {
    align-self: flex-start;
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
}

button:hover { background: var(--navy-light); }

.alert {
    padding: 0.75rem 1rem;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: 5px;
}

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

/* ================================================================
   /admin/utilisateurs — mise au propre de la liste
   Avant : barre de filtres a 5 colonnes ou la cascade
   Secteur/Cycle/Niveau/Classe etait ecrasee dans une colonne
   etroite ; tableau a 8 colonnes qui deborde ; une colonne
   "Droits" logeant un <form> complet (4 cases + bouton) par
   ligne -> hauteurs de lignes tres inegales.
   Apres : meme parti que /admin/etudiants (.student-filter-bar)
   pour la barre de filtres, actions de ligne compactes et
   groupees, droits gestionnaire replies dans un <details>.
   ================================================================ */

/* Barre de filtres : Recherche / Statut / Boutons sur une ligne,
   la cascade de classe seule sur la ligne suivante, pleine largeur. */
.search-filter-bar.user-filter-bar {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
    grid-template-areas:
        "q status buttons"
        "cascade cascade cascade";
}
.user-filter-bar .field-q { grid-area: q; }
.user-filter-bar .field-status { grid-area: status; }
.user-filter-bar .field-buttons { grid-area: buttons; }
.user-filter-bar .cp-full-row { grid-area: cascade; }
.user-filter-bar .cp-full-row .form-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(200px, 1.6fr);
    max-width: none;
}
@media (max-width: 900px) {
    .search-filter-bar.user-filter-bar {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "q q"
            "status buttons"
            "cascade cascade";
    }
    .user-filter-bar .cp-full-row .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .search-filter-bar.user-filter-bar {
        grid-template-columns: 1fr;
        grid-template-areas: "q" "status" "buttons" "cascade";
    }
    .user-filter-bar .cp-full-row .form-grid { grid-template-columns: 1fr; }
}

/* Colonnes Role / Statut : le badge ne doit jamais se couper. */
.users-table td .badge { white-space: nowrap; }
.users-table th:nth-child(4), .users-table td:nth-child(4),
.users-table th:nth-child(6), .users-table td:nth-child(6) { white-space: nowrap; }

/* Groupe d'actions d'une ligne : boutons + mini-formulaires alignes,
   compacts, sans la mise en page verticale du <form> generique. */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.row-actions form {
    display: inline-flex;
    margin: 0;
    max-width: none;
    gap: 0;
}
.row-actions .btn-ghost,
.row-actions button {
    padding: 0.3rem 0.55rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* Droits d'un gestionnaire : replies dans un <details> compact au lieu
   d'un formulaire toujours deploye dans chaque ligne du tableau. */
.perm-details { margin-top: 0.4rem; }
.perm-details > summary {
    cursor: pointer;
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
    list-style: none;
}
.perm-details > summary::-webkit-details-marker { display: none; }
.perm-details[open] > summary { color: var(--navy); border-color: var(--navy); }
.perm-form {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    max-width: none;
    margin: 0.5rem 0 0;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.perm-form .checkbox-inline { margin: 0; font-size: 0.85rem; }
.perm-form button { margin-left: auto; }

/* ================================================================
   /admin/droits — module Droits & permissions
   ================================================================ */

/* Les <form> de la page ne doivent PAS heriter du form generique
   (max-width:480px + flex column) qui ecrase la matrice. */
.perm-block {
    display: block;
    max-width: none;
    margin: 0 0 1.5rem;
}

.perm-section-title {
    font-size: 1.1rem;
    margin: 2rem 0 0.35rem;
    color: var(--navy);
}

.perm-cmd {
    background: var(--bg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
}

/* Accordeons : une categorie de permissions = un <details> repliable
   (HTML pur, aucune dependance JS ; conforme a la CSP script-src 'self'). */
.perm-accordions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
}
.perm-acc {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}
.perm-acc > summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    list-style: none;
    background: var(--navy);
    color: var(--white);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}
.perm-acc > summary::-webkit-details-marker { display: none; }
.perm-acc > summary:hover { background: #163256; }
.perm-acc-title { flex: 1; }
.perm-acc-meta {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}
.perm-acc-caret { transition: transform 0.15s ease; font-size: 0.8rem; }
.perm-acc[open] > summary .perm-acc-caret { transform: rotate(90deg); }
.perm-acc .table-scroll { border-top: 1px solid var(--border); }
.perm-acc .perm-matrix { margin: 0; }
.perm-acc .perm-matrix thead th { top: 0; }

/* Carte englobant la matrice : barre d'action collante en haut, tableau
   defilant horizontalement dessous si l'ecran est etroit. */
.perm-panel { padding: 0; overflow: hidden; }
.perm-panel .table-scroll { max-height: 70vh; overflow: auto; }

.perm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--white);
}
.perm-actions button { margin: 0; }
.perm-legend {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.perm-matrix {
    width: 100%;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    font-size: 0.88rem;
}
.perm-matrix th,
.perm-matrix td {
    padding: 0.5rem 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
.perm-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    color: var(--navy);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.perm-matrix tbody tr:hover { background: #f6f8fc; }

.perm-col-name { width: auto; min-width: 260px; }
.perm-col-role,
.perm-col-admin { width: 104px; text-align: center; white-space: nowrap; }
.perm-col-override { width: 170px; }
.perm-matrix th.perm-col-role,
.perm-matrix th.perm-col-admin,
.perm-matrix th.perm-col-override { text-align: center; }
.perm-col-admin { color: #166534; font-weight: 700; }

.perm-cat-row td {
    background: var(--navy);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    padding: 0.35rem 0.85rem;
    position: sticky;
    top: 33px;
    z-index: 1;
}

.perm-label { font-weight: 500; }
.perm-kind {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    margin-right: 0.5rem;
    vertical-align: middle;
}
.perm-kind-menu { background: #dbeafe; color: #1e40af; }
.perm-kind-action { background: #eef0f4; color: #52607a; }
.perm-legend .perm-kind { margin: 0 0.15rem; }
.perm-code {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}
.perm-matrix input[type="checkbox"] { width: 1.15rem; height: 1.15rem; cursor: pointer; accent-color: var(--navy); }
.perm-matrix select { padding: 0.3rem 0.4rem; width: 100%; }

/* Selecteur de compte pour les derogations : ligne simple, pas la grille filtre. */
.perm-account-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.6rem;
    max-width: none;
    margin: 0.6rem 0 1.25rem;
}
.perm-account-picker label { align-self: center; font-weight: 500; }
.perm-account-picker select {
    flex: 1 1 auto;
    min-width: 260px;
    max-width: 560px;
    height: auto;
    padding: 0.4rem 0.55rem;
}
.perm-account-picker button { margin: 0; align-self: center; }

/* ================================================================
   /admin/bulletins/importes — visionneuse (apercu PDF + defilement)
   ================================================================ */
.bulletin-viewer { margin-bottom: 1.25rem; }
.bv-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.6rem;
}
.bv-caption {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.95rem;
}
.bv-bar .row-actions button { white-space: nowrap; }
.bv-interval {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.bv-interval select { padding: 0.25rem 0.4rem; }
.bv-frame {
    width: 100%;
    height: 78vh;
    min-height: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

/* /admin/bulletins/importes — accordéons Année · Période · Classe */
.bul-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.6rem;
    background: var(--white);
}
.bul-group > summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    list-style: none;
    background: var(--navy);
    color: var(--white);
    user-select: none;
}
.bul-group > summary::-webkit-details-marker { display: none; }
.bul-group > summary:hover { background: #163256; }
.bul-group-title { flex: 1; font-weight: 600; font-size: 0.92rem; }
.bul-group-meta { font-size: 0.78rem; opacity: 0.82; white-space: nowrap; }
.bul-group-caret { transition: transform 0.15s ease; font-size: 0.8rem; }
.bul-group[open] > summary .bul-group-caret { transform: rotate(90deg); }
.bul-group .table-scroll { border-top: 1px solid var(--border); }
.bul-group table { margin: 0; box-shadow: none; border-radius: 0; }

/* Espace étudiant — page "Mes bulletins" (accordéons par année) */
.stu-bulletins { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.stu-bulletins h1 { color: var(--navy); margin-bottom: 1rem; }

/* ================================================================
   Espace étudiant — tableau de bord (/espace-etudiant)
   ================================================================ */
.stu-dash {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stu-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #26406e 100%);
    color: var(--white);
    border-radius: 14px;
    padding: 1.6rem 1.75rem;
    box-shadow: var(--shadow);
}
.stu-hero-hi { margin: 0; opacity: 0.75; font-size: 0.9rem; letter-spacing: 0.02em; }
.stu-hero h1 { margin: 0.15rem 0 0.6rem; font-size: 1.7rem; color: var(--white); }
.stu-hero-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stu-chip {
    display: inline-block;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
}

.stu-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
}
.stu-stat {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: var(--shadow);
}
.stu-stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stu-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stu-stat-value small { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.stu-stat.is-good { border-left-color: #16a34a; }
.stu-stat.is-good .stu-stat-value { color: #15803d; }
.stu-stat.is-low { border-left-color: #dc2626; }
.stu-stat.is-low .stu-stat-value { color: #b91c1c; }

.stu-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.9rem;
}
.stu-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.stu-card:hover {
    transform: translateY(-2px);
    border-color: var(--navy);
    box-shadow: 0 6px 18px rgba(16, 29, 56, 0.16);
}
.stu-card-icon { font-size: 1.7rem; line-height: 1; }
.stu-card-body { flex: 1; display: flex; flex-direction: column; }
.stu-card-body strong { color: var(--navy); font-size: 0.98rem; }
.stu-card-body span { color: var(--text-muted); font-size: 0.82rem; }
.stu-card-go { color: var(--gold); font-weight: 700; font-size: 1.1rem; }

.stu-recent {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem 1.15rem;
    box-shadow: var(--shadow);
}
.stu-recent-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.4rem; }
.stu-recent-head h2 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.stu-recent-head a { font-size: 0.85rem; }
.stu-empty { color: var(--text-muted); margin: 0.4rem 0 0; }
.stu-note-list { list-style: none; margin: 0; padding: 0; }
.stu-note-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
}
.stu-note-list li:first-child { border-top: 0; }
.stu-note-subject { font-weight: 600; color: var(--navy); }
.stu-note-meta { grid-column: 1; color: var(--text-muted); font-size: 0.8rem; }
.stu-note-value {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.stu-note-value small { color: var(--text-muted); font-weight: 600; }
.stu-note-value.is-good { color: #15803d; }
.stu-note-value.is-low { color: #b91c1c; }

@media (max-width: 720px) {
    .stu-stats { grid-template-columns: repeat(2, 1fr); }
    .stu-hero h1 { font-size: 1.4rem; }
}

/* ---------------- Espace étudiant : barre de navigation ---------------- */

.stu-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--navy);
    box-shadow: 0 2px 10px rgba(16, 29, 56, 0.18);
}

.stu-nav-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.55rem 1.25rem;
}

.stu-nav-brand {
    color: var(--white);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

.stu-nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
    flex: 1;
}

.stu-nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    color: #c7d2e6;
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.stu-nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.stu-nav-links a.is-active {
    background: var(--white);
    color: var(--navy);
    font-weight: 600;
}

.stu-nav-ico {
    font-size: 0.95rem;
    line-height: 1;
}

.stu-nav-logout {
    margin: 0;
    flex-shrink: 0;
}

.stu-nav-logout button {
    background: transparent;
    color: #c7d2e6;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 0.42rem 0.95rem;
    font-size: 0.83rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.stu-nav-logout button:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
    border-color: var(--white);
}

@media (max-width: 860px) {
    .stu-nav-inner {
        gap: 0.6rem;
        padding: 0.5rem 0.75rem;
    }
    .stu-nav-brand { display: none; }
    .stu-nav-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .stu-nav-links::-webkit-scrollbar { display: none; }
}
