/* Filtre par section (établissement bilingue) */
.filtre-section { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.filtre-section a { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--bordure); background: var(--carte); color: var(--texte-doux); text-decoration: none; }
.filtre-section a.actif { background: var(--bleu-fonce); border-color: var(--bleu-fonce); color: white; }

/* Sélecteur de langue FR | EN (barre du haut, connexion) */
.choix-langue { display: inline-flex; border: 1px solid var(--bordure); border-radius: 999px; overflow: hidden; background: var(--carte); margin: 0; }
.choix-langue button { font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; padding: 6px 10px; border: none; background: transparent; color: var(--gris); cursor: pointer; }
.choix-langue button.actif { background: var(--bleu-fonce); color: white; }

/* =====================================================================
   NYBA Edu — styles communs à tous les portails
   (même langage visuel que la page de connexion)
   ===================================================================== */

:root {
    --nuit: #0b1a33;
    --bleu-fonce: #0f2d5b;
    --bleu: #2F5496;
    --bleu-vif: #0062cc;
    --vert-kalara: #28a745;
    --orange-kalara: #ff8a00;
    --ciel: #8fb4ff;
    --texte: #16233d;
    --texte-doux: #3c4a63;
    --gris: #6b7a93;
    --gris-clair: #94a3b8;
    --bordure: #e3e9f2;
    --fond: #f3f6fb;
    --blanc: #ffffff;
    /* Thème (mode nuit) : cartes, fonds doux, pastilles colorées — redéfinis plus bas pour html[data-theme="dark"] */
    --carte: #ffffff;
    --fond-doux: #f4f7fb;
    --bleu-fond: #eaf0fc;
    --vert-texte: #05603f;
    --rouge-texte: #a3231b;
    --ambre-texte: #7a5410;
    --bleu-texte: #1f3a6e;
    --accent: var(--bleu-fonce);
    --vert: #059669;
    --vert-fond: #e7f8f0;
    --rouge: #d63c3c;
    --rouge-fond: #fdecec;
    --ambre: #b7791f;
    --ambre-fond: #fff5e1;
    --violet: #7c3aed;
    --violet-fond: #f1ebfe;
    --vert-cm: #009a5e;
    --rouge-cm: #ce1126;
    --jaune-cm: #fcd116;
    --ombre: 0 1px 2px rgba(16, 33, 66, 0.04), 0 4px 14px rgba(16, 33, 66, 0.05);
    --ombre-forte: 0 12px 30px rgba(16, 33, 66, 0.12);
    --rayon: 16px;
    --largeur-menu: 268px;
    --titres: 'Poppins', 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
    --corps: 'Inter', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--corps); background: var(--fond); color: var(--texte); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Barre latérale ---------- */
.barre-laterale {
    position: fixed; inset: 0 auto 0 0; width: var(--largeur-menu); z-index: 40;
    display: flex; flex-direction: column;
    color: #c5d3ee;
    background: radial-gradient(500px 300px at 0% 0%, #1f3f7a 0%, transparent 70%),
                linear-gradient(180deg, var(--nuit) 0%, var(--bleu-fonce) 100%);
    box-shadow: 4px 0 24px rgba(3, 10, 30, 0.12);
    transition: transform 0.25s ease;
}
.barre-laterale .marque { display: flex; align-items: center; gap: 12px; padding: 22px 22px 0; text-decoration: none; color: white; }
.barre-laterale .embleme {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 4px 14px rgba(3, 10, 30, 0.25);
}
.barre-laterale .nom-app { font-family: var(--titres); font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: .6px; }
.barre-laterale .nom-app .edu { font-weight: 600; color: #8fe24a; }
.barre-laterale .nom-ecole { font-size: 11.5px; color: var(--ciel); line-height: 1.3; margin-top: 2px; }
.barre-laterale .drapeau { display: flex; width: 44px; height: 3px; border-radius: 3px; overflow: hidden; margin: 14px 22px 0; }
.barre-laterale .drapeau span { flex: 1; }
.barre-laterale .portail {
    margin: 18px 16px 6px; padding: 8px 12px; border-radius: 10px; font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: #dbe6ff;
    display: flex; align-items: center; gap: 8px;
}
.barre-laterale .portail .point { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,0.18); }

.menu { flex: 1; overflow-y: auto; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
.menu .menu-titre { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #6f86b3; padding: 16px 12px 6px; }
.menu a {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
    border-radius: 10px; text-decoration: none; font-size: 13.5px; font-weight: 500; color: #c5d3ee;
    transition: background 0.15s, color 0.15s;
}
.menu a svg.ic { color: #8ea3c9; transition: color 0.15s; }
.menu a:hover { background: rgba(255,255,255,0.06); color: white; }
.menu a:hover svg.ic { color: var(--ciel); }
.menu a.actif { background: linear-gradient(90deg, rgba(61,111,209,0.35), rgba(61,111,209,0.12)); color: white; font-weight: 600; }
.menu a.actif svg.ic { color: white; }
.menu.menu-aide { flex: none; overflow: visible; padding: 6px 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.menu a .pastille { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: white; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menu a.actif::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--vert-kalara), #05a4ff); }

.utilisateur { display: flex; align-items: center; gap: 10px; margin: 0 12px 14px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-family: var(--titres); font-weight: 700; font-size: 13.5px; color: white; background: linear-gradient(135deg, var(--bleu-vif), #6ee7b7); text-transform: uppercase; }
.utilisateur .qui { min-width: 0; flex: 1; }
.utilisateur .qui strong { display: block; color: white; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.utilisateur .qui span { font-size: 11.5px; color: #8ea3c9; }
.utilisateur .sortir { color: #8ea3c9; padding: 8px; border-radius: 9px; display: flex; text-decoration: none; }
.utilisateur .form-sortir { display: flex; margin: 0; }
.utilisateur button.sortir { background: none; border: 0; cursor: pointer; font: inherit; }
.utilisateur .sortir:hover { color: white; background: rgba(214,60,60,0.35); }
.barre-haut .choix-etablissement { margin-right: 8px; }
.barre-haut .choix-etablissement select { font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 30px 8px 12px; border-radius: 11px; border: 1px solid #c9d6ee; background: var(--fond-doux); color: var(--bleu); max-width: 260px; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.barre-haut .cloche { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--bordure); background: var(--carte); color: var(--texte-doux); margin-right: 8px; text-decoration: none; }
.barre-haut .cloche:hover { color: var(--bleu-vif); border-color: #c9d6ee; }
.barre-haut .cloche .pastille { position: absolute; top: -6px; right: -6px; margin: 0; }
.utilisateur .sortir.cle:hover { background: rgba(255,255,255,0.12); }

/* ---------- Zone principale ---------- */
.principal { margin-left: var(--largeur-menu); min-height: 100vh; display: flex; flex-direction: column; }
.barre-haut {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 14px 36px; background: rgba(243,246,251,0.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(227,233,242,0.8);
}
.bouton-menu { display: none; background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 8px; cursor: pointer; color: var(--texte); }
.salut strong { font-family: var(--titres); font-size: 17px; font-weight: 700; display: block; line-height: 1.25; }
.salut span { font-size: 12.5px; color: var(--gris); }
.barre-haut .droite { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge-annee { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--carte); border: 1px solid var(--bordure); font-size: 12.5px; font-weight: 600; color: var(--texte-doux); box-shadow: var(--ombre); }
.badge-annee .point { width: 7px; height: 7px; border-radius: 50%; background: var(--vert); }

main.contenu { padding: 28px 36px 48px; flex: 1; }
@keyframes apparaitre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Typographie ---------- */
h1, h2, h3 { font-family: var(--titres); color: var(--texte); letter-spacing: -0.2px; }
main.contenu h2 { font-size: 18px; font-weight: 700; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
main.contenu > h2:first-child, main.contenu > .entete-page:first-child + h2 { margin-top: 0; }
main.contenu h3 { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
main.contenu p { color: var(--texte-doux); }

/* ---------- Tuiles de chiffres clés ---------- */
.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 26px; }
.carte {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px;
    background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 20px 22px; box-shadow: var(--ombre);
    transition: transform 0.2s, box-shadow 0.2s;
}
.carte:hover { transform: translateY(-2px); box-shadow: var(--ombre-forte); }
.carte::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(61,111,209,0.07), transparent 70%); pointer-events: none; }
.carte .icone-carte { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; background: var(--bleu-fond); color: var(--bleu-vif); }
.cartes .carte:nth-child(4n+2) .icone-carte { background: var(--vert-fond); color: var(--vert); }
.cartes .carte:nth-child(4n+3) .icone-carte { background: var(--ambre-fond); color: var(--ambre); }
.cartes .carte:nth-child(4n+4) .icone-carte { background: var(--violet-fond); color: var(--violet); }
.carte .chiffre { font-family: var(--titres); font-size: 26px; font-weight: 800; color: var(--texte); line-height: 1.1; letter-spacing: -0.5px; }
.carte .libelle { font-size: 12.5px; color: var(--gris); margin-top: 4px; }
.carte.alerte { border-color: #f6caca; background: linear-gradient(180deg, #fff, #fff7f7); }
.carte.alerte .icone-carte { background: var(--rouge-fond); color: var(--rouge); }
.carte.alerte .chiffre { color: var(--rouge); }

/* ---------- Tableaux ---------- */
table { width: 100%; background: var(--carte); border-collapse: separate; border-spacing: 0; border: 1px solid var(--bordure); border-radius: 14px; overflow: hidden; box-shadow: var(--ombre); }
th, td { text-align: left; padding: 12px 16px; font-size: 13.5px; vertical-align: middle; }
th { background: var(--fond-doux); color: var(--gris); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--bordure); }
td { border-top: 1px solid var(--bordure); color: var(--texte-doux); }
tr:first-child td, th + td { border-top: none; }
tbody tr:first-child td { border-top: none; }
tr:hover td { background: var(--fond-doux); }
tr.ligne-alerte td { background: var(--rouge-fond); }
tr.ligne-alerte:hover td { background: var(--rouge-fond); }

/* ---------- Liens, boutons ---------- */
a.lien-table { color: var(--bleu-vif); text-decoration: none; font-weight: 600; }
a.lien-table:hover { color: var(--bleu); text-decoration: underline; text-underline-offset: 3px; }
a.bouton, button.bouton {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; margin-bottom: 18px;
    border: none; border-radius: 11px; cursor: pointer; text-decoration: none;
    font-family: var(--titres); font-size: 13.5px; font-weight: 700; color: white;
    background: linear-gradient(135deg, var(--bleu) 0%, var(--bleu-vif) 100%);
    box-shadow: 0 6px 16px rgba(47, 84, 150, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}
a.bouton:hover, button.bouton:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(47, 84, 150, 0.32); }

/* ---------- Formulaires (y compris ceux générés par Django) ---------- */
main.contenu input[type=text], main.contenu input[type=number], main.contenu input[type=date], main.contenu input[type=time], main.contenu input[type=datetime-local], main.contenu input[type=month],
main.contenu input[type=email], main.contenu input[type=password], main.contenu input[type=tel], main.contenu input[type=search], main.contenu select, main.contenu textarea {
    font-family: inherit; font-size: 13.5px; color: var(--texte); background: var(--carte);
    padding: 9px 12px; border: 1.5px solid #dbe3ef; border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
main.contenu input:focus, main.contenu select:focus, main.contenu textarea:focus { outline: none; border-color: var(--bleu-vif); box-shadow: 0 0 0 4px rgba(61,111,209,0.13); }
.champ-telephone { display: flex; align-items: stretch; width: 100%; }
.champ-telephone .indicatif { display: flex; align-items: center; padding: 0 11px; font-weight: 700; font-size: 13.5px; color: var(--texte-doux); background: var(--fond-doux); border: 1.5px solid #dbe3ef; border-right: none; border-radius: 10px 0 0 10px; user-select: none; }
main.contenu .champ-telephone input[type=tel] { flex: 1; min-width: 0; border-radius: 0 10px 10px 0; }
main.contenu input[type=file] { width: 100%; font-family: inherit; font-size: 13px; color: var(--texte-doux); padding: 10px; border: 1.5px dashed #c3d1ea; border-radius: 12px; background: var(--fond-doux); cursor: pointer; }
main.contenu input[type=file]:hover { border-color: var(--bleu-vif); }
main.contenu input[type=file]::file-selector-button { font-family: var(--titres); font-weight: 700; font-size: 12.5px; color: white; background: linear-gradient(135deg, var(--bleu), var(--bleu-vif)); border: none; border-radius: 9px; padding: 8px 14px; margin-right: 12px; cursor: pointer; }
main.contenu input[type=checkbox], main.contenu input[type=radio] { accent-color: var(--bleu-vif); width: 16px; height: 16px; vertical-align: middle; }
main.contenu form p { margin-bottom: 14px; }
main.contenu form p label, main.contenu .champ > label { display: block; font-size: 13px; font-weight: 600; color: var(--texte-doux); margin-bottom: 6px; }
main.contenu form p input[type=text], main.contenu form p input[type=number], main.contenu form p input[type=date],
main.contenu form p input[type=email], main.contenu form p input[type=password], main.contenu form p select, main.contenu form p textarea { width: 100%; max-width: 420px; }
main.contenu .helptext { display: block; font-size: 12px; color: var(--gris); margin-top: 4px; }
main.contenu .errorlist { list-style: none; color: var(--rouge); font-size: 12.5px; margin: 4px 0; }
input.champ-date { font-family: inherit; }

/* ---------- Formulaires standard (gabarit _champs.html) ---------- */
.formulaire {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; max-width: 780px;
    background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 26px 28px;
}
.formulaire .pleine-largeur, .formulaire-actions { grid-column: 1 / -1; }
.champ-form label { display: block; font-size: 13px; font-weight: 600; color: var(--texte-doux); margin-bottom: 7px; }
.champ-form .requis { color: var(--rouge); }
.champ-form input:not([type=checkbox]):not([type=radio]), .champ-form select, .champ-form textarea { width: 100%; }
.champ-form textarea { min-height: 110px; resize: vertical; }
.champ-form > select:not(:only-of-type) { width: auto; margin-right: 6px; }
.champ-form ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto; padding: 12px; border: 1.5px solid #dbe3ef; border-radius: 10px; }
.champ-form ul label { font-weight: 500; display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.champ-form label.case { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.champ-form .aide-champ { font-size: 12px; color: var(--gris); margin-top: 5px; }
.champ-form .erreur-champ { font-size: 12.5px; color: var(--rouge); margin-top: 5px; font-weight: 500; }
.champ-form.en-erreur input, .champ-form.en-erreur select { border-color: #f0a8a8; background: #fffafa; }
.formulaire-actions { display: flex; align-items: center; gap: 12px; padding-top: 6px; border-top: 1px solid var(--bordure); margin-top: 4px; }
.formulaire-actions .bouton { margin: 14px 0 0; }
.bouton-secondaire { display: inline-flex; align-items: center; padding: 10px 16px; margin-top: 14px; border-radius: 11px; text-decoration: none; font-weight: 600; font-size: 13.5px; color: var(--texte-doux); border: 1.5px solid var(--bordure); background: var(--carte); }
.bouton-secondaire:hover { border-color: #c9d6ee; color: var(--bleu); }
.message-erreur { background: var(--rouge-fond); border: 1px solid #f6c9c9; color: var(--rouge-texte); padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; max-width: 780px; }
@media (max-width: 700px) { .formulaire { grid-template-columns: 1fr; padding: 20px; } }

/* ---------- Éléments propres à certains portails ---------- */
.onglets-sequence { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.onglets-sequence a { padding: 8px 16px; border-radius: 999px; background: var(--carte); border: 1.5px solid var(--bordure); color: var(--texte-doux); text-decoration: none; font-size: 13px; font-weight: 600; transition: all 0.15s; }
.onglets-sequence a:hover:not(.actif) { border-color: var(--bleu-vif); color: var(--bleu-vif); }
.onglets-sequence a.actif { background: linear-gradient(135deg, var(--bleu), var(--bleu-vif)); color: white; border-color: transparent; box-shadow: 0 6px 14px rgba(47,84,150,0.25); }

.cartes-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.carte-classe {
    display: block; text-decoration: none; background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
    padding: 20px 22px; box-shadow: var(--ombre); position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
}
.carte-classe::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--bleu-vif), #6ee7b7); }
.carte-classe:hover { transform: translateY(-3px); box-shadow: var(--ombre-forte); }
.carte-classe .matiere { font-family: var(--titres); font-size: 16px; font-weight: 700; color: var(--texte); }
.carte-classe .classe { font-size: 13.5px; color: var(--gris); margin-top: 4px; }
.carte-classe .effectif { font-size: 12px; color: var(--gris-clair); margin-top: 10px; }

.cartes-enfants { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.carte-enfant { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); border-top: 4px solid var(--bleu-vif); }
.carte-enfant .nom { font-family: var(--titres); font-size: 16px; font-weight: 700; }
.carte-enfant .classe { font-size: 13px; color: var(--gris); margin: 4px 0 14px; }
.liens-bulletins { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.liens-bulletins a { color: var(--bleu-vif); text-decoration: none; font-weight: 600; }
.liens-bulletins a:hover { text-decoration: underline; }

.solde-positif { color: var(--rouge); font-weight: 700; }
.solde-nul { color: var(--vert); font-weight: 700; }

/* ---------- Bandeau d'accueil (tableaux de bord) ---------- */
.bandeau {
    position: relative; overflow: hidden; border-radius: 20px; padding: 26px 30px; margin-bottom: 26px; color: white;
    background: radial-gradient(600px 300px at 100% 0%, rgba(110,231,183,0.22), transparent 60%),
                linear-gradient(135deg, var(--bleu-fonce) 0%, var(--bleu) 60%, var(--bleu-vif) 100%);
    box-shadow: 0 16px 36px rgba(19, 40, 79, 0.25);
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.bandeau::before { content: ''; position: absolute; inset: 0; opacity: 0.08; pointer-events: none;
    background-image: linear-gradient(white 1px, transparent 1px), linear-gradient(90deg, white 1px, transparent 1px); background-size: 36px 36px;
    mask-image: linear-gradient(90deg, transparent, black 70%); -webkit-mask-image: linear-gradient(90deg, transparent, black 70%); }
.bandeau > * { position: relative; }
.bandeau .texte { flex: 1; min-width: 260px; }
.bandeau h1 { color: white; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.bandeau p { color: #d3e0fa !important; margin-top: 6px; font-size: 14px; max-width: 560px; }
.bandeau .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bandeau .actions a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 11px; text-decoration: none; font-weight: 600; font-size: 13px; color: white; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); transition: background 0.15s; }
.bandeau .actions a:hover { background: rgba(255,255,255,0.22); }

/* ---------- Voile du menu mobile ---------- */
.voile { display: none; }

/* ---------- Écrans moyens et petits ---------- */
@media (max-width: 1000px) {
    .barre-laterale { transform: translateX(-100%); }
    body.menu-ouvert .barre-laterale { transform: none; }
    body.menu-ouvert .voile { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(11, 26, 51, 0.45); }
    .principal { margin-left: 0; }
    .bouton-menu { display: flex; }
    .barre-haut { padding: 12px 18px; }
    main.contenu { padding: 20px 18px 40px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}
/* Emploi du temps sur téléphone : liste jour par jour (grille cachée, affichable) */
.edt-liste { display: none; }
@media (max-width: 700px) {
    .edt-liste { display: block; margin-bottom: 12px; }
    .defile-edt.avec-liste { display: none; }
    .edt-liste:has(.voir-grille-edt:checked) + .defile-edt.avec-liste { display: block; }
    .edt-jour { background: var(--carte); border: 1px solid var(--bordure); border-radius: 14px; box-shadow: var(--ombre); padding: 10px 14px; margin-bottom: 10px; }
    .edt-jour.aujourdhui { border-color: var(--bleu-vif); box-shadow: 0 0 0 3px rgba(61,111,209,.12); }
    .edt-jour .nom-jour { font-family: var(--titres); font-weight: 800; font-size: 15px; margin-bottom: 6px; }
    .edt-jour .nom-jour span { color: var(--bleu-vif); font-size: 12.5px; }
    .edt-ligne { display: flex; gap: 12px; align-items: center; padding: 7px 10px; border-radius: 10px; margin-bottom: 6px; border-left: 4px solid; }
    .edt-ligne .heures { font-weight: 700; font-size: 13px; min-width: 46px; line-height: 1.15; }
    .edt-ligne .heures small, .edt-ligne .quoi small { display: block; font-weight: 400; font-size: 11.5px; color: var(--gris); }
    .edt-ligne .quoi { font-size: 13.5px; }
    .edt-vide { font-size: 12.5px; color: var(--gris); padding: 2px 0 4px; }
    .voir-grille-edt { position: absolute; opacity: 0; }
    .voir-grille-edt-lien { display: inline-block; font-size: 13px; font-weight: 600; color: var(--bleu-vif); cursor: pointer; padding: 6px 0; }
}

.tout-cocher-mobile { display: none; }

a.carte { text-decoration: none; color: inherit; }
.bandeau-abonnement { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 11px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; font-weight: 600; text-decoration: none; background: var(--ambre-fond); color: var(--ambre-texte); border: 1px solid #f0c36d; }
.bandeau-abonnement.en_retard, .bandeau-abonnement.restreint { background: var(--rouge-fond); color: var(--rouge-texte); border-color: #f3b9b9; }
.bandeau-abonnement span { white-space: nowrap; }

/* Recherche instantanée dans un tableau (mobile.js) */
input.filtre-tableau { display: block; width: 100%; max-width: 460px; box-sizing: border-box; padding: 10px 14px; margin: 0 0 12px; border: 1px solid var(--bordure); border-radius: 12px; font-size: 15px; background: var(--carte); }
.filtre-vide { color: var(--gris); font-size: 13.5px; }
tr[hidden] { display: none !important; }

/* Téléphone : les lignes des tableaux simples deviennent des cartes « Intitulé : valeur » (voir mobile.js) */
@media (max-width: 700px) {
    table.en-cartes { display: block; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; white-space: normal; }
    table.en-cartes tbody { display: block; }
    table.en-cartes tr { display: block; background: var(--carte); border: 1px solid var(--bordure); border-radius: 14px; box-shadow: var(--ombre); padding: 8px 14px; margin-bottom: 10px; }
    table.en-cartes tr.entete-tableau { display: none; }
    table.en-cartes tr[style*="--fond-carte"] { background: var(--fond-carte); }
    table.en-cartes td { background: transparent !important; }
    /* Intitulé flottant à gauche, valeur à droite : une cellule à plusieurs éléments (montant + détail) garde son flux */
    table.en-cartes td { display: flow-root; border: 0; padding: 6px 0; text-align: right; white-space: normal; overflow-wrap: anywhere; }
    table.en-cartes td + td { border-top: 1px dashed var(--bordure); }
    table.en-cartes td::before { content: attr(data-label); float: left; max-width: 46%; margin: 2px 14px 0 0; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--gris); }
    table.en-cartes td[data-label=""] { text-align: left; }
    table.en-cartes td[data-label=""]::before { display: none; }
    table.en-cartes td:first-child { text-align: left; font-size: 14.5px; font-weight: 700; color: var(--texte); padding-top: 4px; }
    table.en-cartes td:first-child::before { display: none; }
    table.en-cartes tr.ligne-seule td { display: block; text-align: left; }
    table.en-cartes td form { display: inline; }
    /* Formulaire d'action à plusieurs champs dans une carte (payer, encaisser…) : sous l'intitulé, sur toute la largeur */
    table.en-cartes td.cellule-formulaire { display: block; text-align: left; }
    table.en-cartes td.cellule-formulaire::before { float: none; display: block; max-width: none; margin-bottom: 6px; }
    table.en-cartes td.cellule-formulaire form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
    table.en-cartes tr.carte-a-cocher { position: relative; cursor: pointer; }
    table.en-cartes tr.carte-a-cocher:has(td.case-carte input:checked) { border-color: var(--bleu-vif); box-shadow: 0 0 0 3px rgba(61,111,209,.12); }
    table.en-cartes td.case-carte { position: absolute; top: 10px; right: 12px; padding: 0; border: 0; }
    table.en-cartes td.case-carte input { width: 22px; height: 22px; }
    table.en-cartes td.case-carte + td { text-align: left; font-size: 14.5px; font-weight: 700; color: var(--texte); padding: 4px 34px 6px 0; border-top: 0; }
    table.en-cartes td.case-carte + td::before { display: none; }
    .tout-cocher-mobile { display: inline-flex !important; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 0 0 10px; cursor: pointer; }
    .tout-cocher-mobile input { width: 20px; height: 20px; }
    table.liste-simple { display: table; width: 100%; white-space: normal; }
    main.contenu select { max-width: 100%; }
    .filtres > .champ, .filtres > div { min-width: 0; max-width: 100%; }
    /* Fondateur : le choix de l'établissement prend la place du « Bonjour » et de la date */
    .barre-haut:has(.choix-etablissement) .salut { display: none; }
    .barre-haut .droite:has(.choix-etablissement) { flex: 1; min-width: 0; margin-left: 10px; }
    .barre-haut .choix-etablissement { flex: 1; min-width: 0; margin-right: 0; }
    .barre-haut .choix-etablissement select { width: 100%; max-width: none; }
    a.bandeau-demarrage { flex-wrap: wrap; gap: 6px 14px !important; padding: 14px 16px !important; }
    a.bandeau-demarrage > div:nth-child(2) { flex-basis: calc(100% - 100px) !important; }
    a.bandeau-demarrage > .bouton { flex-basis: 100%; text-align: center; }
    table.en-cartes td.cellule-formulaire > select, table.en-cartes td.cellule-formulaire > input[type=text], table.en-cartes td.cellule-formulaire > textarea { width: 100%; min-width: 0; box-sizing: border-box; }
    main.contenu input[type=search] { min-width: 0 !important; width: 100%; }
    .cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
    .carte { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 14px; }
    .carte .icone-carte { width: 36px; height: 36px; border-radius: 11px; }
    .carte .icone-carte .ic { width: 18px !important; height: 18px !important; }
    .carte .chiffre { font-size: 21px; }
    .carte .libelle { font-size: 12px; margin-top: 2px; }
}
@media (max-width: 600px) {
    .badge-annee { display: none; }
    .salut strong { font-size: 15px; }
    .bandeau { padding: 22px; }
    .bandeau h1 { font-size: 20px; }
}

/* ---------- Impression ---------- */
@media print {
    .barre-laterale, .barre-haut, .voile, a.bouton, button.bouton { display: none !important; }
    .principal { margin-left: 0; }
    main.contenu { padding: 0; }
    table, .carte { box-shadow: none; }
}

/* ---------- Cahier de texte : avancement des programmes ---------- */
.avancement-cours { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.barre-av { flex: 1; min-width: 120px; max-width: 260px; height: 8px; border-radius: 999px; background: var(--fond-doux); overflow: hidden; }
.barre-av span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--bleu-vif), #6ee7b7); }
.barre-av span.retard { background: linear-gradient(90deg, #f59e0b, var(--rouge)); }
.chiffres-av { font-size: 12.5px; color: var(--texte-doux); white-space: nowrap; }
.statut-av { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.statut-av.a_jour { background: var(--vert-fond); color: var(--vert-texte); }
.statut-av.avance { background: var(--bleu-fond); color: var(--bleu); }
.statut-av.retard { background: var(--rouge-fond); color: var(--rouge-texte); }
.statut-av.sans_progression { background: var(--fond-doux); color: var(--gris); }

/* ---------- Emploi du temps ---------- */
table.grille-edt { table-layout: fixed; }
.grille-edt th { text-align: center; }
.grille-edt th.heure, .grille-edt td.heure { width: 96px; text-align: left; }
.grille-edt td { vertical-align: top; padding: 5px; height: 56px; border-bottom: 1px solid var(--bordure); border-left: 1px solid var(--bordure); }
.grille-edt td.heure { font-size: 12px; font-weight: 600; color: var(--texte-doux); white-space: nowrap; border-left: none; padding: 8px 10px; }
.grille-edt td.heure small { display: block; font-weight: 500; color: var(--gris-clair); }
.grille-edt tr.pause td { background: var(--fond-doux); height: auto; padding: 5px 10px; font-size: 11px; color: var(--gris-clair); text-transform: uppercase; letter-spacing: 0.6px; text-align: center; }
.grille-edt tr.pause td.heure { text-align: left; text-transform: none; letter-spacing: 0; }
.cours-edt { border-radius: 10px; padding: 7px 9px; height: 100%; min-height: 44px; font-size: 12px; line-height: 1.35; border-left: 4px solid; color: var(--texte-doux); }
.cours-edt strong { display: block; font-size: 12.5px; color: var(--texte); }
.cours-edt .salle { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--gris); }
.cours-edt.conflit { background: var(--rouge-fond); border-color: var(--rouge); }
.teinte-0 { background: var(--bleu-fond); border-color: #3d6fd1; } .teinte-1 { background: var(--vert-fond); border-color: #059669; }
.teinte-2 { background: var(--ambre-fond); border-color: #d4911f; } .teinte-3 { background: #f3ecfd; border-color: #8b5cf6; }
.teinte-4 { background: var(--rouge-fond); border-color: #db4c6b; } .teinte-5 { background: #e6f6f8; border-color: #0e8fa3; }
.teinte-6 { background: #f1f5e6; border-color: #6a8f1f; } .teinte-7 { background: #fbeee6; border-color: #c2622d; }
.defile-edt { overflow-x: auto; }
.defile-edt table.grille-edt { min-width: 760px; }
@media print { .barre-laterale, .barre-haut, .actions-edt { display: none !important; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.mode-consultation { background: var(--fond-doux); border: 1px solid #c9d8f6; color: var(--bleu); padding: 9px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 12.5px; }

/* ---------- Rubriques et onglets (comptes/navigation.py) ---------- */
.onglets-rubrique { display: flex; gap: 6px; margin: -8px 0 20px; padding: 4px; overflow-x: auto; scrollbar-width: none;
    background: var(--carte); border: 1px solid var(--bordure); border-radius: 14px; box-shadow: var(--ombre); }
.onglets-rubrique::-webkit-scrollbar { display: none; }
.onglets-rubrique a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px;
    font-size: 13px; font-weight: 600; color: var(--gris); text-decoration: none; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.onglets-rubrique a:hover { background: var(--fond-doux); color: var(--accent); }
.onglets-rubrique a.actif { background: var(--bleu-fonce); color: white; }
.onglets-rubrique .pastille { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: white;
    font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center; }
.barre-bas { display: none; }
@media (max-width: 700px) {
    .barre-bas { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--carte);
        border-top: 1px solid var(--bordure); box-shadow: 0 -6px 18px rgba(11, 26, 51, 0.08); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
    .barre-bas a, .barre-bas button { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 6px 2px; border: none; background: none; border-radius: 10px; color: var(--gris); font: inherit; font-size: 10.5px;
        font-weight: 600; text-decoration: none; cursor: pointer; }
    .barre-bas span:not(.pastille) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .barre-bas a.actif { color: var(--accent); background: var(--fond-doux); }
    .barre-bas svg.ic { width: 22px; height: 22px; }
    .barre-bas .pastille { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px;
        border-radius: 999px; background: #e5484d; color: white; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
    body:has(.barre-bas) main.contenu { padding-bottom: 84px; }
    .onglets-rubrique { margin: -4px 0 16px; border-radius: 12px; }
}

/* Passage d'une page à l'autre sans écran blanc : le navigateur garde l'ancienne page jusqu'à ce que la nouvelle soit
   prête, puis passe de l'une à l'autre (Chrome, Edge, Android). Le menu et la barre du haut ne bougent pas. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.12s; }
.barre-laterale { view-transition-name: barre-laterale; }
.barre-haut { view-transition-name: barre-haut; }
.barre-bas { view-transition-name: barre-bas; }
::view-transition-old(barre-laterale), ::view-transition-new(barre-laterale),
::view-transition-old(barre-haut), ::view-transition-new(barre-haut),
::view-transition-old(barre-bas), ::view-transition-new(barre-bas) { animation: none; }

/* ---------- Mode nuit (comptes/static/comptes/theme.js : Auto, Clair ou Sombre) ----------
   Seulement à l'écran : un document imprimé reste toujours clair. */
html { color-scheme: light; }
@media screen {
    html[data-theme="dark"] {
        color-scheme: dark;
        --fond: #0b1220;
        --carte: #131c2e;
        --fond-doux: #19243a;
        --texte: #e6ebf4;
        --texte-doux: #c3cde0;
        --gris: #95a4bd;
        --gris-clair: #6d7d97;
        --bordure: #26334b;
        --bleu: #7ea3ea;
        --bleu-vif: #5aa7ff;
        --accent: #a9c8ff;
        --vert: #34d399;
        --vert-fond: rgba(52, 211, 153, 0.14);
        --vert-texte: #86efc4;
        --rouge: #f87171;
        --rouge-fond: rgba(248, 113, 113, 0.15);
        --rouge-texte: #fca5a5;
        --ambre: #f5b84a;
        --ambre-fond: rgba(245, 184, 74, 0.15);
        --ambre-texte: #fcd38a;
        --violet: #a78bfa;
        --violet-fond: rgba(167, 139, 250, 0.16);
        --bleu-fond: rgba(90, 167, 255, 0.14);
        --bleu-texte: #a9c8ff;
        --ombre: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
        --ombre-forte: 0 12px 30px rgba(0, 0, 0, 0.45);
    }
    html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
        background-color: var(--fond-doux); color: var(--texte); border-color: var(--bordure);
    }
    html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--gris-clair); }
    html[data-theme="dark"] .barre-haut { background: rgba(11, 18, 32, 0.85); border-bottom-color: var(--bordure); }
    html[data-theme="dark"] .bandeau { background: radial-gradient(600px 300px at 100% 0%, rgba(110,231,183,0.16), transparent 60%),
        linear-gradient(135deg, #0f2d5b 0%, #234487 60%, #0057b8 100%); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35); }
    html[data-theme="dark"] a.bouton, html[data-theme="dark"] button.bouton { background: linear-gradient(135deg, #2f5fb8 0%, #1f78e0 100%); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
}
/* Choix du thème (« Mon compte ») et bouton de la barre du haut */
.choix-theme { display: inline-flex; border: 1px solid var(--bordure); border-radius: 999px; overflow: hidden; background: var(--carte); }
.choix-theme button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 14px; border: none; background: transparent;
    color: var(--gris); cursor: pointer; }
.choix-theme button.actif { background: var(--bleu-fonce); color: white; }
.bouton-theme { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--bordure); background: var(--carte);
    color: var(--texte-doux); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.bouton-theme svg.ic { width: 18px; height: 18px; }
.bouton-theme .lune { display: none; }
html[data-theme="dark"] .bouton-theme .soleil { display: none; }
html[data-theme="dark"] .bouton-theme .lune { display: inline; }
