/* Espaces connectés · Collège de la Salle (maquette Kora Lab)
   Coque nuit brune comme la vitrine, contenu clair pour lire les données, une couleur par espace. */

@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/libre-franklin-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/libre-franklin-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  --nuit: #1a0f09; --nuit-2: #26150d; --creme: #f3ecdc; --kaki: #cdbb98; --or: #e3a820;
  --encre: #1f140d; --encre-2: #5a4a3e; --fond: #f1ebdf; --papier: #ffffff; --doux: #faf7f1;
  --filet: #e3d9c8; --filet-fort: #bdb09b;
  --vert: #1c6a4c; --vert-fond: #e3f1ea; --ambre-fond: #fbefd5; --rouge: #b23a2e; --rouge-fond: #fbe7e4; --bleu-fond: #e8eff7;
  --accent: #6b4127; --accent-fond: #efe5d6; --accent-vif: #e3a820;
  --police: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rayon: 16px; --barre: 64px; --nav-bas: 70px;
}
body[data-espace="eleve"] { --accent: #1c6a4c; --accent-fond: #e3f1ea; --accent-vif: #3fbf8c; }
body[data-espace="parent"] { --accent: #9a4528; --accent-fond: #f7e8e0; --accent-vif: #e08a5c; }
body[data-espace="enseignant"] { --accent: #1d4e7a; --accent-fond: #e3edf7; --accent-vif: #6aa6e0; }
body[data-espace="administration"] { --accent: #6b4127; --accent-fond: #efe5d6; --accent-vif: #e3a820; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--police); font-size: 16px; line-height: 1.5; color: var(--encre); background: var(--fond); }
body.fiche-ouverte { overflow: hidden; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 1.0625rem; line-height: 1.3; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 0.9375rem; font-weight: 800; margin: 18px 0 8px; }
a { color: var(--accent); text-underline-offset: 3px; font-weight: 600; }
a:hover { color: var(--encre); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
img, svg { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.discret { color: var(--encre-2); }
.petit { font-size: 0.875rem; }
.bas { color: var(--rouge); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evitement:focus { position: fixed; z-index: 99; top: 8px; left: 8px; width: auto; height: auto; clip: auto; background: var(--or); color: var(--nuit); padding: 10px 14px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; border-radius: 6px; }
.icone { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.chargement { padding: 60px 0; color: var(--encre-2); }

/* --- Boutons ------------------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9688rem; text-decoration: none; white-space: nowrap; transition: background-color 200ms ease, border-color 200ms ease, transform 160ms ease; }
.btn:hover { background: var(--encre); border-color: var(--encre); color: #fff; }
.btn:active { transform: scale(0.97); }
.btn .icone { width: 18px; height: 18px; }
.btn-second { background: var(--papier); color: var(--encre); border-color: var(--filet-fort); }
.btn-second:hover { background: var(--accent-fond); border-color: var(--encre); color: var(--encre); }
.btn-petit { min-height: 44px; padding: 0 15px; font-size: 0.9063rem; }
.bouton-icone { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; background: none; border-radius: 12px; color: var(--encre-2); position: relative; transition: background-color 200ms ease, color 200ms ease; }
.bouton-icone:hover { background: var(--accent-fond); color: var(--encre); }
.lien-bouton { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lien-bouton:hover { color: var(--encre); }
.lien-bouton.danger { color: var(--rouge); }
.lien-ligne { background: none; border: 0; padding: 6px 0; min-height: 36px; font-weight: 700; text-align: left; color: var(--encre); text-decoration: underline; text-decoration-color: var(--filet-fort); text-underline-offset: 3px; }
.lien-ligne:hover { color: var(--accent); text-decoration-color: currentColor; }

/* --- Champs ----------------------------------------------------------------------------------- */
.champ { display: grid; gap: 6px; min-width: 0; }
.champ > label, .libelle { font-weight: 700; font-size: 0.9375rem; }
.champ .aide { font-size: 0.8125rem; color: var(--encre-2); }
.champ input:not([type=checkbox]):not([type=radio]):not([type=file]), .champ select, .champ textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--filet-fort); border-radius: 12px; background: var(--papier); transition: border-color 200ms ease; }
.champ textarea { min-height: 96px; resize: vertical; }
.champ input:hover, .champ select:hover, .champ textarea:hover { border-color: var(--encre-2); }
[aria-invalid="true"] { border-color: var(--rouge) !important; }
.grille-champs { display: grid; gap: 16px; }
.vue, .bloc, .fiche-corps { container-type: inline-size; }
@container (min-width: 520px) { .grille-champs.deux { grid-template-columns: 1fr 1fr; } }
.cases { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.cases legend { font-weight: 700; font-size: 0.9375rem; margin-bottom: 8px; padding: 0; width: 100%; }
.cases label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--filet-fort); border-radius: 999px; background: var(--papier); cursor: pointer; font-weight: 600; font-size: 0.9375rem; }
.cases label:has(input:checked) { border-color: var(--accent); background: var(--accent-fond); }
.cases input { width: 18px; height: 18px; accent-color: var(--accent); }
.case-seule { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding-top: 10px; font-size: 0.9375rem; cursor: pointer; }
.case-seule input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.actions-form, .actions-fiche { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 4px; }
.actions-fiche { margin-top: 20px; justify-content: flex-start; }
.erreur-form { grid-column: 1 / -1; }

/* Dépôt de fichiers */
.depot { display: grid; gap: 8px; }
.depot-zone { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border: 1.5px dashed var(--filet-fort); border-radius: 14px; background: var(--doux); cursor: pointer; transition: border-color 200ms ease, background-color 200ms ease; }
.depot-zone:hover { border-color: var(--accent); background: var(--accent-fond); }
.depot input:focus-visible + .depot-zone { outline: 3px solid var(--or); outline-offset: 2px; }
.depot-zone .icone { color: var(--accent); }
.depot-zone b { display: block; font-size: 0.9375rem; }
.depot-zone small { display: block; color: var(--encre-2); font-size: 0.8125rem; }
.depot-liste { display: grid; gap: 6px; }
.depot-liste li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--filet); border-radius: 12px; background: var(--papier); font-size: 0.9375rem; }
.depot-liste li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depot-liste li small { color: var(--encre-2); }
.depot-liste li .icone { width: 18px; height: 18px; color: var(--encre-2); }
.depot-liste li.envoi { color: var(--encre-2); }
.depot-liste li.echec { color: var(--rouge); background: var(--rouge-fond); }
.depot-liste .retirer { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; color: var(--encre-2); }
.depot-liste .retirer:hover { background: var(--rouge-fond); color: var(--rouge); }

/* Fichiers joints */
.fichiers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fichiers:empty { display: none; }
.puce-fichier { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; max-width: 100%; padding: 0 12px; border: 1px solid var(--filet-fort); border-radius: 999px; background: var(--papier); color: var(--encre); font-weight: 600; font-size: 0.875rem; text-decoration: none; transition: border-color 200ms ease, background-color 200ms ease; }
.puce-fichier:hover { border-color: var(--accent); background: var(--accent-fond); color: var(--encre); }
.puce-fichier .icone { width: 16px; height: 16px; color: var(--accent); }
.puce-fichier span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce-fichier small { color: var(--encre-2); font-weight: 500; }

/* --- États et pastilles ------------------------------------------------------------------------- */
.etat { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 0.9375rem; margin-bottom: 14px; }
.etat > .icone { width: 20px; height: 20px; margin-top: 1px; }
.etat.ok { background: var(--vert-fond); color: #124733; }
.etat.attention { background: var(--ambre-fond); color: #5e3800; }
.etat.erreur { background: var(--rouge-fond); color: #7a1d17; }
.etat.info { background: var(--bleu-fond); color: #1d3b5c; }
.pastille { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; line-height: 1.25; white-space: nowrap; background: var(--accent-fond); color: var(--encre); }
.pastille.ok { background: var(--vert-fond); color: #124733; }
.pastille.attention { background: var(--ambre-fond); color: #5e3800; }
.pastille.erreur { background: var(--rouge-fond); color: #7a1d17; }
.pastille.neutre { background: #ece5d8; color: var(--encre-2); }
.compteur { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--rouge); color: #fff; font-size: 0.6875rem; font-weight: 800; line-height: 1; }
.vide { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 18px; color: var(--encre-2); }
.vide .icone { width: 20px; height: 20px; }
.vide .btn { margin-top: 6px; }

/* --- Coque : barre, navigation ------------------------------------------------------------------- */
.app { min-height: 100vh; padding-bottom: calc(var(--nav-bas) + env(safe-area-inset-bottom, 0px)); }
.barre { position: sticky; top: 0; z-index: 30; min-height: var(--barre); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: var(--nuit); color: var(--creme); flex-wrap: wrap; }
.espace-nom { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.jeton { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.espace-nom > span:last-child { min-width: 0; }
.espace-nom b { display: block; font-size: 0.9375rem; line-height: 1.15; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.espace-nom span > span { display: block; font-size: 0.8125rem; color: var(--kaki); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-outils { display: flex; align-items: center; gap: 2px; }
.barre .bouton-icone { color: var(--kaki); }
.barre .bouton-icone:hover { background: rgba(243, 236, 220, 0.1); color: var(--creme); }
.cloche .badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rouge); color: #fff; font-size: 0.6875rem; font-weight: 800; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--nuit); }
.sortie { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 10px; border: 0; background: none; border-radius: 12px; font-weight: 700; font-size: 0.9375rem; color: var(--kaki); }
.sortie:hover { color: var(--creme); background: rgba(243, 236, 220, 0.1); }
.sortie span { display: none; }
.choix-enfant { order: 3; width: 100%; display: flex; gap: 6px; }
.choix-enfant button { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid rgba(243, 236, 220, 0.24); border-radius: 999px; background: transparent; color: var(--creme); font-weight: 700; font-size: 0.9375rem; transition: background-color 200ms ease, border-color 200ms ease; }
.choix-enfant button small { color: var(--kaki); font-weight: 500; }
.choix-enfant button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.choix-enfant button[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.85); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--nuit); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav ul { position: relative; display: flex; }
.nav ul::before { content: ""; position: absolute; top: 9px; height: 32px; width: 58px; border-radius: 16px; background: var(--accent); left: calc((100% / var(--n, 5)) * var(--i, 0) + (100% / var(--n, 5) - 58px) / 2); transition: left 420ms var(--ease); }
.nav li { flex: 1; min-width: 0; position: relative; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 7px; height: var(--nav-bas); padding: 14px 2px 0; color: var(--kaki); text-decoration: none; font-size: 0.6875rem; font-weight: 600; line-height: 1.1; text-align: center; position: relative; transition: color 250ms ease; }
.nav a[aria-current="page"], .nav a:hover { color: var(--creme); }
.nav a .compteur { position: absolute; top: 6px; left: calc(50% + 6px); }
.nav .marque { display: none; }

/* --- Vue ------------------------------------------------------------------------------------------------ */
.vue { max-width: 1120px; margin: 0 auto; padding: 22px 16px 40px; }
.vue:focus, h1[tabindex="-1"]:focus { outline: none; }
.entete-vue { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.entete-vue > div:first-child { min-width: 0; flex: 1 1 320px; }
.entete-vue p { color: var(--encre-2); margin-top: 6px; max-width: 70ch; }
.entete-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.entete-vue .entete-actions { margin-bottom: 0; }
.vue.entree > * { animation: monte 480ms var(--ease) both; }
.vue.entree > *:nth-child(2) { animation-delay: 40ms; }
.vue.entree > *:nth-child(3) { animation-delay: 80ms; }
.vue.entree > *:nth-child(n + 4) { animation-delay: 120ms; }
@keyframes monte { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.bandeau-mdp { margin-bottom: 18px; }

.bloc { background: var(--papier); border: 1px solid var(--filet); border-radius: var(--rayon); margin-top: 16px; overflow: hidden; }
.bloc > header, .entete-bloc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--filet); flex-wrap: wrap; }
.bloc > header small { display: block; color: var(--encre-2); font-size: 0.8125rem; }
.bloc > header a, .bloc > header button { flex: none; }
.bloc .corps, .bloc > .corps { padding: 18px; }
.repli summary { padding: 14px 18px; font-weight: 800; cursor: pointer; min-height: 48px; }
.repli[open] summary { border-bottom: 1px solid var(--filet); }
.colonnes { display: grid; gap: 0 16px; }
.colonnes > * { min-width: 0; }
@media (min-width: 900px) { .colonnes { grid-template-columns: 3fr 2fr; align-items: start; } }
.espace-haut { margin-top: 16px; }

/* Prochain cours */
.prochain { position: relative; overflow: hidden; background: var(--accent); color: #fff; border-radius: 20px; padding: 20px 20px 22px; display: grid; gap: 4px; isolation: isolate; margin-bottom: 4px; }
.prochain::after { content: ""; position: absolute; z-index: -1; right: -34px; top: -30px; width: 190px; height: 190px; opacity: 0.16; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='1.6' d='M32 6l6.3 17.7 19 .2-15.1 11.4 5.4 18.3L32 42.6 16.4 53.6l5.4-18.3L6.7 23.9l19-.2z'/%3E%3C/svg%3E") center / contain no-repeat; animation: tourne 60s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.prochain small { font-size: 0.875rem; opacity: 0.9; font-weight: 600; }
.prochain strong { font-size: clamp(1.75rem, 7vw, 2.25rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.prochain .etiquette { justify-self: start; margin-top: 6px; background: rgba(255, 255, 255, 0.18); padding: 3px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; }

/* Listes */
.lignes > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 13px 18px; border-bottom: 1px solid var(--filet); }
.lignes > li:last-child { border-bottom: 0; }
.lignes.compactes > li { padding: 10px 18px; }
.corps .lignes.compactes > li, .fiche-corps .lignes.compactes > li, .etat .lignes.compactes > li { padding-left: 0; padding-right: 0; }
.fiche-corps .lignes > li { padding-left: 0; padding-right: 0; }
.lignes .principal { min-width: 0; flex: 1 1 220px; }
.lignes .principal b { display: block; font-weight: 700; }
.lignes .principal small { display: block; color: var(--encre-2); font-size: 0.875rem; }
.ligne-icone { display: flex !important; align-items: center; gap: 10px; }
.ligne-icone .icone { color: var(--accent); }
.alertes > li { border-left: 4px solid transparent; }
.alertes > li.erreur { border-left-color: var(--rouge); }
.alertes > li.attention { border-left-color: var(--or); }
.alertes > li.info { border-left-color: var(--accent); }
.actions-ligne { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sous-liste { margin: 10px 0 4px; display: grid; gap: 6px; }
.sous-liste li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.9375rem; }
.ligne-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.note { font-weight: 800; font-size: 1.125rem; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.01em; }
.note small { font-weight: 600; font-size: 0.8125rem; color: var(--encre-2); }
.note.bas { color: var(--rouge); }

/* Chiffres de synthèse */
.synthese { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 4px; }
.synthese div { background: var(--papier); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 14px 16px; }
.synthese dt { font-size: 0.8125rem; color: var(--encre-2); font-weight: 600; }
.synthese dd { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.synthese dd small { font-size: 0.875rem; font-weight: 600; letter-spacing: 0; color: var(--encre-2); }
.synthese dd.petit-dd { font-size: 1.0625rem; letter-spacing: 0; }

/* Relevé de notes */
.onglets { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.onglets button, .onglets a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--filet-fort); border-radius: 999px; background: var(--papier); color: var(--encre); font-weight: 700; font-size: 0.9375rem; text-decoration: none; transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease; }
.onglets [aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.onglets [aria-pressed="true"] .compteur { background: #fff; color: var(--accent); }
.boutons-pdf { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.resume-moy { display: flex; align-items: center; gap: 18px; background: var(--nuit); color: var(--creme); border-radius: 20px; padding: 18px 20px; }
.jauge { width: 96px; height: 96px; flex: none; transform: rotate(-90deg); }
.jauge circle { fill: none; stroke-width: 10; }
.jauge-fond { stroke: rgba(243, 236, 220, 0.14); }
.jauge-val { stroke: var(--accent-vif); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1300ms var(--ease) 150ms; }
.anime .jauge-val { stroke-dashoffset: calc(100 - var(--v) * 100); }
.resume-moy .chiffre { display: block; font-size: 2.25rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.resume-moy .chiffre small { font-size: 1rem; color: var(--kaki); letter-spacing: 0; }
.resume-moy > div > span { display: block; color: var(--kaki); font-size: 0.9375rem; margin-top: 4px; }
.barre-moy { display: block; height: 6px; border-radius: 3px; background: var(--filet); overflow: hidden; min-width: 64px; }
.barre-moy i { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--accent); border-radius: 3px; transform: scaleX(0); transform-origin: left; transition: transform 1000ms var(--ease) 200ms; }
.barre-moy.bas i { background: var(--rouge); }
.anime .barre-moy i { transform: scaleX(1); }
.barre-valeur { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.barre-valeur .barre-moy { flex: 1; height: 8px; border-radius: 4px; }
.barre-valeur b { min-width: 48px; text-align: right; }
.grille-matieres { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 760px) { .grille-matieres { grid-template-columns: 1fr 1fr; } }
.matiere-releve { background: var(--papier); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.matiere-releve header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.matiere-releve h3 { margin: 0; font-size: 1.0625rem; }
.matiere-releve header small { color: var(--encre-2); font-size: 0.8125rem; }
.moy-matiere { text-align: right; }
.moy-matiere small { display: block; color: var(--encre-2); font-size: 0.75rem; }
.evaluations { display: grid; gap: 2px; }
.evaluations li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--filet); font-size: 0.9375rem; }
.evaluations li:last-child { border-bottom: 0; }
.evaluations li b { font-weight: 600; }
.evaluations li small { color: var(--encre-2); font-size: 0.8125rem; margin-left: 6px; }
.evaluations .num { font-weight: 800; }
.appreciation { font-size: 0.9375rem; color: var(--encre-2); font-style: italic; border-left: 3px solid var(--accent-fond); padding-left: 10px; }

/* Tableaux */
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--filet); vertical-align: middle; }
thead th { font-size: 0.8125rem; font-weight: 700; color: var(--encre-2); background: var(--doux); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 700; }
.sous { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--encre-2); line-height: 1.4; }
td.d, th.d { text-align: right; font-variant-numeric: tabular-nums; }
td.num, td.num a { white-space: nowrap; }
tfoot td, tfoot th { font-weight: 800; background: var(--accent-fond); border-bottom: 0; }
.table-saisie textarea { width: 100%; min-width: 220px; min-height: 52px; padding: 8px 10px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); resize: vertical; font-size: 0.9375rem; }
.table-saisie select { min-height: 44px; padding: 0 10px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); max-width: 200px; }
.outils { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.outils .champ { min-width: 160px; flex: 1; }
.outils > .btn, .outils > .onglets { align-self: end; }
.outils > .onglets { margin: 0; }
@media (min-width: 640px) { .outils .champ { flex: 0 1 240px; } }
.statut-conseil { align-self: center; }

/* Semaine d'emploi du temps */
.nav-semaine { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--filet); flex-wrap: wrap; }
.nav-semaine b { flex: 1; text-align: center; font-size: 0.9375rem; min-width: 160px; }
.corps-semaine { padding: 12px; }
.jours-semaine { display: flex; gap: 6px; }
.jours-semaine button { flex: 1; min-width: 0; min-height: 52px; display: grid; place-items: center; gap: 0; padding: 4px 2px; border: 1.5px solid var(--filet-fort); border-radius: 14px; background: var(--papier); font-weight: 700; font-size: 0.875rem; line-height: 1.1; transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease; }
.jours-semaine button small { font-size: 1rem; font-weight: 800; }
.jours-semaine button.aujourdhui { border-color: var(--accent); }
.jours-semaine button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.liste-jour { margin-top: 12px; display: grid; gap: 8px; }
.liste-jour li { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: stretch; }
.liste-jour time { display: grid; align-content: center; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.9375rem; }
.liste-jour time small { color: var(--encre-2); font-weight: 500; font-size: 0.8125rem; }
.liste-jour .sans-cours { display: block; color: var(--encre-2); padding: 12px 0; }
.case-cours { width: 100%; display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid transparent; border-left: 4px solid var(--accent); border-radius: 12px; background: var(--accent-fond); color: var(--encre); min-height: 48px; transition: border-color 200ms ease, transform 160ms ease; }
button.case-cours:hover { border-color: var(--accent); }
button.case-cours:active { transform: scale(0.98); }
.case-cours b { font-weight: 800; font-size: 0.9375rem; line-height: 1.2; }
.case-cours small { color: var(--encre-2); font-size: 0.8125rem; line-height: 1.3; }
.case-cours .etiquette { justify-self: start; margin-top: 4px; font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #fff; color: var(--encre); }
.case-cours.modifie { background: var(--ambre-fond); border-left-color: var(--or); }
.case-cours.modifie.libere, .case-cours.modifie.etude { background: #ece5d8; border-left-color: var(--encre-2); }
.case-cours.modifie.remplacant { background: var(--bleu-fond); border-left-color: #1d4e7a; }
.case-cours.libre { background: var(--doux); border: 1.5px dashed var(--filet-fort); }
.grille-semaine { display: none; }
@media (min-width: 900px) {
  .corps-semaine { display: none; }
  .grille-semaine { display: block; }
  .grille-semaine table { table-layout: fixed; min-width: 760px; }
  .grille-semaine th, .grille-semaine td { padding: 5px; border: 1px solid var(--filet); vertical-align: top; }
  .grille-semaine thead th { text-align: center; font-size: 0.875rem; color: var(--encre); padding: 8px 4px; }
  .grille-semaine thead th small { display: block; color: var(--encre-2); font-weight: 500; }
  .grille-semaine thead th.aujourdhui { background: var(--accent); color: #fff; }
  .grille-semaine thead th.aujourdhui small { color: rgba(255, 255, 255, 0.85); }
  .grille-semaine tbody th { width: 72px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--doux); font-size: 0.875rem; }
  .grille-semaine tbody th small { display: block; color: var(--encre-2); font-weight: 500; }
  .grille-semaine td.aujourdhui { background: #fdfaf3; }
  .grille-semaine td.ferme { background: repeating-linear-gradient(135deg, var(--doux), var(--doux) 6px, #f3ede1 6px, #f3ede1 12px); }
  .grille-semaine tr.pause td, .grille-semaine tr.pause th { background: var(--doux); color: var(--encre-2); font-size: 0.8125rem; text-align: center; padding: 3px; }
  .grille-semaine .case-cours { padding: 7px 8px; min-height: 58px; }
  .grille-semaine.modele { display: block; }
}
.grille-semaine.modele { display: block; }
.grille-semaine.modele table { table-layout: fixed; min-width: 720px; }
.grille-semaine.modele th, .grille-semaine.modele td { padding: 4px; border: 1px solid var(--filet); vertical-align: top; }
.grille-semaine.modele tbody th { width: 64px; font-size: 0.8125rem; background: var(--doux); }
.grille-semaine.modele tbody th small { display: block; font-weight: 500; color: var(--encre-2); }
.grille-semaine.modele tr.pause td, .grille-semaine.modele tr.pause th { text-align: center; color: var(--encre-2); background: var(--doux); font-size: 0.8125rem; }
.grille-semaine.modele td.ferme { background: var(--doux); }
.grille-semaine.modele .case-cours { padding: 6px 8px; min-height: 52px; }

/* Appel */
.appel li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px; border-bottom: 1px solid var(--filet); }
.appel li:last-child { border-bottom: 0; }
.bascule { display: inline-flex; border: 1.5px solid var(--filet-fort); border-radius: 999px; overflow: hidden; flex: none; }
.bascule label { position: relative; min-height: 44px; min-width: 78px; padding: 0 14px; display: grid; place-items: center; font-weight: 700; font-size: 0.875rem; cursor: pointer; transition: background-color 250ms ease, color 250ms ease; }
.bascule input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.bascule label:has(input:checked) { background: var(--vert); color: #fff; }
.bascule label.absent:has(input:checked) { background: var(--rouge); }
.bascule label:has(input:focus-visible) { outline: 3px solid var(--or); outline-offset: -3px; }
.saisie-note { width: 86px; min-height: 44px; padding: 8px 10px; border: 1.5px solid var(--filet-fort); border-radius: 10px; text-align: right; font-variant-numeric: tabular-nums; background: var(--papier); }
.barre-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--filet); }

/* Paiement */
.montant-payer { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.montant-payer small { display: block; font-size: 0.9375rem; font-weight: 500; letter-spacing: 0; color: var(--encre-2); }
fieldset.moyens { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.moyens legend { margin-bottom: 8px; padding: 0; }
.moyens label { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border: 1.5px solid var(--filet-fort); border-radius: 14px; background: var(--papier); cursor: pointer; transition: border-color 200ms ease, background-color 200ms ease; }
.moyens label:has(input:checked) { border-color: var(--accent); background: var(--accent-fond); }
.moyens label b { display: block; }
.moyens label small { color: var(--encre-2); font-size: 0.875rem; }
.moyens input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* Rendez-vous, autorisations */
.rdv-prof + .rdv-prof { margin-top: 18px; }
.rdv-prof h3 { margin: 0 0 8px; }
.rdv-prof h3 small { color: var(--encre-2); font-weight: 500; margin-left: 6px; }
.creneaux { display: flex; flex-wrap: wrap; gap: 8px; }
.creneau { display: grid; gap: 0; min-height: 52px; min-width: 104px; padding: 6px 12px; border: 1.5px solid var(--filet-fort); border-radius: 12px; background: var(--papier); text-align: left; transition: border-color 200ms ease, background-color 200ms ease; }
.creneau:hover { border-color: var(--accent); background: var(--accent-fond); }
.creneau b { font-size: 0.8125rem; }
.creneau span { font-weight: 800; }
.corps-autorisations { padding: 4px 0; }
.autorisation { padding: 16px 18px; border-bottom: 1px solid var(--filet); display: grid; gap: 8px; justify-items: start; }
.autorisation:last-child { border-bottom: 0; }
.autorisation h3 { margin: 0; font-size: 1.0625rem; }
.autorisation p { color: var(--encre-2); }
.autorisation small { color: var(--encre-2); }

/* Calendrier, annonces */
.legende { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--encre-2); font-size: 0.875rem; }
.puce-legende { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); margin-right: -8px; }
.puce-legende.rouge { background: var(--rouge); }
.evt .date-evt { width: 48px; flex: none; text-align: center; border-radius: 12px; background: var(--accent-fond); padding: 6px 0; line-height: 1.1; }
.evt .date-evt b { display: block; font-size: 1.25rem; font-weight: 800; }
.evt .date-evt small { font-size: 0.75rem; color: var(--encre-2); }
.evt.rouge .date-evt { background: var(--rouge); color: #fff; }
.evt.rouge .date-evt small { color: rgba(255, 255, 255, 0.85); }
.evt.rouge .principal b { color: var(--rouge); }
.evt.passe { opacity: 0.55; }
.lignes > li.evt { justify-content: flex-start; }
.annonce { padding: 14px 18px; border-bottom: 1px solid var(--filet); }
.annonce:last-child { border-bottom: 0; }
.annonce p { margin-top: 4px; color: var(--encre-2); }
.annonce small { display: block; margin-top: 6px; color: var(--encre-2); font-size: 0.8125rem; }
.annonce h3 { margin: 0; font-size: 1rem; }

/* Bibliothèque */
.filtres { display: grid; gap: 4px; }
.ligne-filtres { display: flex; flex-wrap: wrap; gap: 10px; }
.ligne-filtres .champ { flex: 1 1 160px; }
.docs li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--filet); flex-wrap: wrap; }
.docs li:last-child { border-bottom: 0; }
.docs .principal { flex: 1 1 260px; min-width: 0; }
.docs .principal b { display: block; }
.docs .principal small { display: block; color: var(--encre-2); font-size: 0.875rem; }
.type-doc { flex: none; width: 92px; text-align: center; padding: 6px 4px; border-radius: 10px; font-size: 0.8125rem; font-weight: 800; background: var(--accent-fond); }
.type-doc.annales { background: var(--rouge-fond); color: #7a1d17; }
.type-doc.exercices { background: var(--ambre-fond); color: #5e3800; }
.type-doc.lecture { background: var(--vert-fond); color: #124733; }
.type-doc.outil { background: var(--bleu-fond); color: #1d3b5c; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--filet-fort); border-radius: 999px; background: var(--papier); font-weight: 600; font-size: 0.875rem; }
.puce small { color: var(--encre-2); }
.puce:hover { border-color: var(--accent); background: var(--accent-fond); }

/* Messagerie */
.messagerie { display: grid; gap: 16px; }
.messagerie .bloc { margin-top: 0; }
.messagerie.avec-fil .liste-fils { display: none; }
.messagerie:not(.avec-fil) .vide-fil { display: none; }
@media (min-width: 900px) {
  .messagerie { grid-template-columns: 320px 1fr; align-items: start; }
  .messagerie.avec-fil .liste-fils { display: block; }
  .messagerie:not(.avec-fil) .vide-fil { display: block; }
  .seulement-mobile { display: none; }
}
.fils li a { display: grid; gap: 1px; padding: 12px 16px; border-bottom: 1px solid var(--filet); text-decoration: none; color: var(--encre); font-weight: 500; border-left: 4px solid transparent; }
.fils li a.actif { background: var(--accent-fond); border-left-color: var(--accent); }
.fils li a.non-lu b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rouge); margin-left: 8px; vertical-align: middle; }
.fils li a span { font-weight: 700; font-size: 0.9375rem; }
.fils li a small { color: var(--encre-2); font-size: 0.8125rem; }
.fils .extrait { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulles { padding: 16px; display: grid; gap: 10px; max-height: 56vh; overflow-y: auto; background: var(--doux); }
.bulles li { display: flex; }
.bulles li > div { max-width: 82%; background: var(--papier); border: 1px solid var(--filet); border-radius: 16px 16px 16px 4px; padding: 10px 14px; }
.bulles li.moi { justify-content: flex-end; }
.bulles li.moi > div { background: var(--accent); color: #fff; border-color: var(--accent); border-radius: 16px 16px 4px 16px; }
.bulles li > div small { display: block; margin-top: 4px; font-size: 0.75rem; opacity: 0.75; }
.bulles .puce-fichier { color: var(--encre); }
.repondre { padding: 14px 16px; display: grid; gap: 10px; border-top: 1px solid var(--filet); }
.repondre textarea { width: 100%; min-height: 80px; padding: 10px 14px; border: 1.5px solid var(--filet-fort); border-radius: 12px; resize: vertical; }

/* Admin */
.table-barres td { min-width: 180px; }
.demande .corps { display: grid; gap: 12px; }
.demande h3 { margin: 4px 0 0; }
.lettre summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.lettre p { color: var(--encre-2); }
.ligne-remplacement { display: grid; gap: 8px; width: 100%; align-items: center; }
.ligne-remplacement select { min-height: 44px; padding: 0 10px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); width: 100%; }
@media (min-width: 760px) { .ligne-remplacement { grid-template-columns: 1.2fr 1fr 1.4fr auto; } }
.infos { display: grid; gap: 12px 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); margin-bottom: 8px; }
.infos > div { min-width: 0; }
.infos dt { font-size: 0.8125rem; color: var(--encre-2); font-weight: 600; }
.infos dd { font-weight: 700; overflow-wrap: anywhere; }

/* --- Fiche (fenêtre) --------------------------------------------------------------------------------- */
.fiche { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
.fiche::backdrop { background: rgba(26, 15, 9, 0.55); }
.fiche[open] { display: flex; align-items: flex-end; justify-content: center; }
.fiche-boite { width: 100%; max-height: 92vh; display: flex; flex-direction: column; background: var(--papier); border-radius: 22px 22px 0 0; animation: glisse 320ms var(--ease) both; }
@keyframes glisse { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.fiche-boite > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--filet); }
.fiche-boite > header h2 { font-size: 1.1875rem; }
.fiche-fermer { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: var(--doux); border-radius: 12px; flex: none; }
.fiche-fermer:hover { background: var(--accent-fond); }
.fiche-corps { padding: 18px 20px 26px; overflow-y: auto; }
.fiche-corps > p { margin-bottom: 12px; }
.fiche-corps h3:first-child { margin-top: 0; }
@media (min-width: 760px) {
  .fiche[open] { align-items: center; }
  .fiche-boite { width: min(620px, 92vw); border-radius: 22px; max-height: 86vh; }
  .fiche.large .fiche-boite { width: min(900px, 94vw); }
}
.menu-plus li a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 6px; border-bottom: 1px solid var(--filet); color: var(--encre); text-decoration: none; font-weight: 700; }
.menu-plus li a .icone { color: var(--accent); }
.menu-plus li a .compteur { margin-left: auto; }
.liste-notifs li a { display: grid; gap: 2px; padding: 12px 6px 12px 14px; border-bottom: 1px solid var(--filet); color: var(--encre); text-decoration: none; font-weight: 500; border-left: 4px solid transparent; }
.liste-notifs li.non-lue a { border-left-color: var(--rouge); background: #fdf8f5; }
.liste-notifs li a span { font-size: 0.9375rem; color: var(--encre-2); }
.liste-notifs li a small { color: var(--encre-2); font-size: 0.75rem; }

/* --- Messages courts ------------------------------------------------------------------------------------ */
.toasts { position: fixed; z-index: 100; left: 12px; right: 12px; bottom: calc(var(--nav-bas) + 12px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--nuit); color: var(--creme); font-weight: 600; font-size: 0.9375rem; box-shadow: 0 10px 30px rgba(26, 15, 9, 0.25); animation: glisse 320ms var(--ease) both; transition: opacity 400ms ease, transform 400ms ease; }
.toast .icone { color: var(--accent-vif); width: 20px; height: 20px; }
.toast.erreur { background: var(--rouge); color: #fff; }
.toast.erreur .icone { color: #fff; }
.toast.part { opacity: 0; transform: translateY(10px); }

/* --- Grand écran : navigation latérale ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  .app { padding-bottom: 0; padding-left: 256px; }
  .barre { padding: 0 24px 0 32px; background: var(--fond); color: var(--encre); border-bottom: 1px solid var(--filet); flex-wrap: nowrap; min-height: 68px; }
  .espace-nom span > span { color: var(--encre-2); }
  .barre .bouton-icone, .sortie { color: var(--encre-2); }
  .barre .bouton-icone:hover, .sortie:hover { color: var(--encre); background: var(--accent-fond); }
  .cloche .badge { box-shadow: 0 0 0 2px var(--fond); }
  .sortie span { display: inline; }
  .choix-enfant { order: 0; width: auto; }
  .choix-enfant button { flex: none; padding: 0 16px; border-color: var(--filet-fort); color: var(--encre); }
  .choix-enfant button small { color: var(--encre-2); }
  .nav { top: 0; right: auto; width: 256px; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
  .nav .marque { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(243, 236, 220, 0.12); color: var(--creme); text-decoration: none; }
  .nav .marque svg { width: 36px; height: 36px; }
  .nav .marque b { display: block; font-weight: 800; font-size: 0.9375rem; line-height: 1.15; }
  .nav .marque span span { display: block; color: var(--kaki); font-size: 0.8125rem; font-weight: 500; }
  .nav ul { flex-direction: column; gap: 2px; }
  .nav ul::before { display: none; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 14px; font-size: 0.9375rem; border-radius: 12px; text-align: left; transition: color 200ms ease, background-color 200ms ease; }
  .nav a .compteur { position: static; margin-left: auto; }
  .nav a[aria-current="page"] { background: rgba(243, 236, 220, 0.08); }
  .nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; background: var(--accent-vif); }
  .nav a:hover { background: rgba(243, 236, 220, 0.05); }
  .vue { padding: 30px 32px 60px; margin: 0; }
  .toasts { left: auto; right: 24px; bottom: 24px; justify-items: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* --- Paramètres de l'établissement ------------------------------------------------------------ */
[hidden] { display: none !important; }
.nav .marque .logo-ecole { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; background: #fff; }
.apercu-logo { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--filet); border-radius: 12px; background: var(--doux); }
.apercu-logo svg, .apercu-logo .logo-ecole { width: 52px; height: 52px; border-radius: 12px; object-fit: contain; flex: none; }
.apercu-logo b { display: block; font-size: 1.0625rem; }
.choix-couleur { display: flex; align-items: center; gap: 12px; }
.choix-couleur input[type=color] { width: 56px; height: 44px; padding: 2px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); cursor: pointer; }
.echantillon { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 0.9375rem; }
.echantillon.refuse { outline: 3px solid var(--rouge); outline-offset: 2px; }
.table-saisie input:not([type=checkbox]):not([type=radio]) { min-height: 44px; padding: 0 10px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); width: 100%; min-width: 120px; }
.table-saisie input[type=number] { min-width: 90px; }
.table-coefs input.coef { min-width: 58px; width: 58px; text-align: center; padding: 0 4px; }
.table-coefs input.code { min-width: 64px; width: 64px; text-transform: uppercase; }
.table-coefs th.c, .table-coefs td.c { text-align: center; white-space: nowrap; }
.seuil { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.9375rem; }
.seuil input { width: 90px !important; min-width: 90px !important; }
form[data-form="param-scolarite"] > .bloc { margin-bottom: 16px; }

/* --- Mise en route d'un nouvel établissement --------------------------------------------------- */
.mise-en-route { list-style: none; padding: 6px 0; counter-reset: etape; }
.mise-en-route li { counter-increment: etape; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 16px; border-top: 1px solid var(--filet); }
.mise-en-route li:first-child { border-top: 0; }
.coche-etape { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--filet-fort); display: grid; place-items: center; font-size: 0.8125rem; font-weight: 800; color: var(--encre-2); }
.coche-etape:empty::before { content: counter(etape); }
.mise-en-route li.fait .coche-etape { background: var(--vert); border-color: var(--vert); color: #fff; }
.mise-en-route li.fait .coche-etape .icone { width: 16px; height: 16px; stroke-width: 2.6; }
.mise-en-route li.fait a { color: var(--encre-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.mise-en-route a { font-weight: 600; }

/* --- Comptabilité ---------------------------------------------------------------------------------- */
.synthese.petite dd { font-size: 1.375rem; }
.grand-chiffre { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.histo { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 150px; margin-bottom: 12px; }
.histo li { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; gap: 2px; }
.histo-barre { align-self: end; height: calc(var(--h) * 100%); min-height: 2px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.histo-val { font-size: 0.75rem; font-weight: 700; }
.histo-lib { font-size: 0.6875rem; color: var(--encre-2); white-space: nowrap; }
tr.annule th, tr.annule td { color: var(--encre-2); text-decoration: line-through; text-decoration-thickness: 1px; }
tr.annule .sous { text-decoration: none; display: block; }
.ligne-reduction { border: 1px solid var(--filet); border-radius: 12px; padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; background: var(--doux); }
.apercu-plan { width: 100%; border-collapse: collapse; }
.apercu-plan th, .apercu-plan td { padding: 8px 4px; border-bottom: 1px solid var(--filet); text-align: left; font-weight: 600; }
.apercu-plan td.d { text-align: right; }
.apercu-plan tr.reduction th, .apercu-plan tr.reduction td { color: var(--vert); font-weight: 500; }
.apercu-plan tr.total th, .apercu-plan tr.total td { font-weight: 800; border-bottom: 2px solid var(--encre); }

/* --- Sélecteur d'élève par le nom --------------------------------------------------------------------- */
.choix-zone { position: relative; }
.choix-liste { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; background: var(--papier); border: 1.5px solid var(--filet-fort); border-radius: 12px; padding: 4px; }
.choix-liste li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.choix-liste li small { color: var(--encre-2); flex: none; }
.choix-liste li[aria-selected="true"], .choix-liste li[data-id]:hover { background: var(--accent-fond); }
.choix-liste li.choix-rien { color: var(--encre-2); cursor: default; }
.choix-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.choix-puces:empty { display: none; }
.choix-puces li { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--accent-fond); font-size: 0.875rem; font-weight: 600; }
.choix-puces .retirer { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--encre-2); }
.choix-puces .retirer .icone { width: 16px; height: 16px; }

/* --- Calendrier mensuel ----------------------------------------------------------------------------------- */
.cal-colonnes { display: grid; gap: 16px; }
@media (min-width: 1024px) { .cal-colonnes { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.cal-bloc { padding: 12px; }
.cal-tete { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-mois { font-size: 1.125rem; flex: 1; text-align: center; }
.cal-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-jsem { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--encre-2); padding: 4px 0; }
.jour-cal { min-height: 52px; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 5px 4px; border: 1px solid var(--filet); border-radius: 10px; background: var(--papier); text-align: left; font: inherit; color: var(--encre); }
.jour-cal:hover { border-color: var(--filet-fort); }
.jour-cal.dehors { background: transparent; color: var(--encre-2); opacity: 0.6; }
.jour-cal.fin-semaine:not(.dehors) { background: var(--doux); }
.jour-cal.auj .num-jour { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.jour-cal.choisi { border: 2px solid var(--accent); }
.num-jour { font-weight: 800; font-size: 0.875rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.pastilles-cal { display: flex; flex-wrap: wrap; gap: 3px; }
.evt-cal { width: 8px; height: 8px; border-radius: 50%; background: var(--filet-fort); }
.evt-cal > span { display: none; }
.evt-cal.rouge, .puce-cal.rouge { background: var(--rouge); }
.evt-cal.bleu, .puce-cal.bleu { background: #1d4e7a; }
.evt-cal.vert, .puce-cal.vert { background: var(--vert); }
.evt-cal.ambre, .puce-cal.ambre { background: #c98a12; }
.evt-cal.neutre, .puce-cal.neutre { background: #8a7a66; }
.evt-plus { font-size: 0.6875rem; font-weight: 700; color: var(--encre-2); line-height: 8px; }
.puce-cal { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; margin-right: 4px; }
.legende .puce-cal { margin-left: 10px; vertical-align: -1px; }
.legende .puce-cal:first-child { margin-left: 0; }
.lignes li.evt { gap: 10px; }
@media (min-width: 768px) {
  .jour-cal { min-height: 88px; }
  .pastilles-cal { flex-direction: column; flex-wrap: nowrap; }
  .evt-cal { width: auto; height: auto; border-radius: 5px; padding: 1px 5px; color: #fff; font-size: 0.6875rem; font-weight: 600; line-height: 1.35; overflow: hidden; }
  .evt-cal > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .evt-cal.neutre { background: #6f6050; }
  .evt-plus { line-height: 1.3; }
}

/* --- Rendez-vous ---------------------------------------------------------------------------------------- */
.interlocuteurs { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.interlocuteurs button { display: grid; gap: 2px; text-align: left; min-height: 56px; padding: 10px 12px; border: 1.5px solid var(--filet-fort); border-radius: 12px; background: var(--papier); font: inherit; color: var(--encre); }
.interlocuteurs button small { color: var(--encre-2); font-size: 0.8125rem; }
.interlocuteurs button:hover { border-color: var(--accent); }
.interlocuteurs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-fond); box-shadow: inset 0 0 0 1px var(--accent); }
.etape-rdv { display: grid; gap: 12px; padding: 14px; border-radius: 12px; background: var(--doux); border: 1px solid var(--filet); }
.cartes-rdv { display: grid; gap: 12px; }
.demande-rdv { border: 1px solid var(--filet); border-radius: 14px; padding: 14px; display: grid; gap: 10px; background: var(--papier); }
.demande-rdv.a-moi { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.demande-rdv header { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.demande-rdv h3 { margin: 0; font-size: 1rem; }
.motif-rdv { font-weight: 600; }
.demande-rdv .icone { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.historique-rdv summary { cursor: pointer; font-size: 0.875rem; font-weight: 700; color: var(--accent); min-height: 32px; }
.historique-rdv ul { display: grid; gap: 4px; font-size: 0.875rem; padding-top: 4px; }
.historique-rdv small { color: var(--encre-2); }
.ligne-date { align-items: end; }

/* --- Boutique ----------------------------------------------------------------------------------------------- */
.titre-section { font-size: 1.25rem; margin: 26px 0 12px; }
.articles { padding: 4px 0; }
.article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; border-top: 1px solid var(--filet); min-height: 52px; }
.article:first-child { border-top: 0; }
.article .case-seule { padding-top: 6px; flex: 1; }
.article .case-seule span small, .article.tenue small { display: block; color: var(--encre-2); font-size: 0.8125rem; font-weight: 400; }
.article .prix { font-weight: 700; white-space: nowrap; }
.article.tenue { flex-wrap: wrap; padding: 10px 16px; }
.choix-tenue { display: flex; align-items: center; gap: 8px; }
.choix-tenue select, .choix-tenue input { min-height: 44px; border: 1.5px solid var(--filet-fort); border-radius: 10px; background: var(--papier); padding: 0 8px; }
.choix-tenue input { width: 70px; }
.liste-simple { list-style: disc; padding: 6px 0 0 20px; }
.panier { position: sticky; bottom: calc(var(--nav-bas) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 14px 12px 18px; border-radius: 16px; background: var(--nuit); color: var(--creme); }
@media (min-width: 1024px) { .panier { bottom: 12px; } }
.panier span { display: block; font-size: 0.8125rem; color: var(--kaki); }
.panier b { font-size: 1.375rem; letter-spacing: -0.02em; }
.retrait { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 12px; background: var(--doux); border: 1px dashed var(--filet-fort); }
.retrait b { display: block; font-size: 1.25rem; letter-spacing: 0.04em; }
.retrait small { display: block; color: var(--encre-2); }
.qr-retrait { width: 84px; height: 84px; flex: none; background: #fff; }
.qr-retrait svg { width: 100%; height: 100%; }
@media print {
  .barre, .nav, .onglets, .outils, .entete-vue, .toasts { display: none !important; }
  .app { padding: 0; }
  .fiche-prepa { break-inside: avoid; border: 1px solid #999; margin-bottom: 8px; }
}

/* --- Saisie des notes --------------------------------------------------------------------------------- */
.saisie-outils { display: grid; gap: 8px; margin: 12px 0; }
.stats-saisie { font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.saisie-note[aria-invalid="true"] { border-color: var(--rouge) !important; background: var(--rouge-fond) !important; }

/* --- Observations, annonces à confirmer ------------------------------------------------------------------- */
.choix-obs label.positif input:checked + span { border-color: var(--vert); background: var(--vert-fond); }
.choix-obs label.negatif input:checked + span { border-color: #c98a12; background: var(--ambre-fond); }
.obs-appel { margin-left: 4px; color: var(--encre-2); }
.appel li { flex-wrap: wrap; }
.annonce.a-confirmer { border-left: 4px solid var(--accent); padding-left: 12px; }
.annonce .btn { margin-top: 8px; }
.lecture { display: block; margin-top: 4px; color: var(--encre-2); }

/* --- Documents, journal ------------------------------------------------------------------------------------- */
.doc-officiel { align-items: center; }
tr.refus th, tr.refus td { background: var(--rouge-fond); }

/* --- Rôles, salles ------------------------------------------------------------------------------------------- */
fieldset.droits { border: 0; padding: 0; margin: 0; }
.occupations { display: flex; flex-wrap: wrap; gap: 6px; }
.occupation { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--doux); border: 1px solid var(--filet); font-size: 0.875rem; }
.occupation.resa { background: var(--accent-fond); border-color: var(--accent); }
.table-occupation th[scope=row] { width: 30%; }

/* --- Préparation des commandes ---------------------------------------------------------------------------- */
.liste-prepa { padding: 4px 0; }
.liste-prepa li { border-top: 1px solid var(--filet); }
.liste-prepa li:first-child { border-top: 0; }
.case-prepa { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 18px; cursor: pointer; }
.case-prepa input { width: 22px; height: 22px; flex: none; accent-color: var(--vert); cursor: pointer; }
.case-prepa span { flex: 1; }
.case-prepa input:checked + span { color: var(--encre-2); text-decoration: line-through; }
.pied-prepa { display: flex; justify-content: flex-end; padding: 10px 18px 16px; border-top: 1px solid var(--filet); }

/* --- Marges intérieures des cadres : aucun texte ne touche le bord ----------------------------------------- */
.bloc > p, .bloc > h3 { padding: 0 18px; margin: 14px 0; }
.bloc > dl.infos { padding: 18px; margin: 0; }
.bloc > form:not(.corps) { padding: 18px; }
.bloc > .etat { margin: 14px 18px; }
.bloc > .actions-ligne, .bloc > .actions-form { padding: 12px 18px; margin: 0; }
.bloc > details { padding: 0 18px 14px; }
.bloc > details > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.bloc > .grille-champs { padding: 18px; }
.lignes .principal, .lignes .principal b, .lignes .principal small { overflow-wrap: anywhere; }
.lignes > li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
th, td { overflow-wrap: normal; }
th[scope=row] { min-width: 140px; }
.entete-vue h1 { overflow-wrap: anywhere; }
.synthese div { min-width: 0; }
.synthese dd { overflow-wrap: anywhere; }
.histo-val { white-space: nowrap; font-size: 0.6875rem; }
.histo-lib { font-size: 0.625rem; }


/* --- Débordements sur téléphone ---------------------------------------------------------------------------- */
/* Les textes réservés aux lecteurs d'écran restent dans leur cadre (sinon la page défile de côté). */
.defile, .bloc, .champ, .depot { position: relative; }
/* Une colonne de grille ne s'élargit jamais au-delà de son cadre à cause d'un nom long ou d'une puce. */
.grille-champs > *, .depot > *, .depot-liste > *, .sous-liste > *, .grille-matieres > *, .matiere-releve > *, .evaluations > *,
.liste-jour > *, .messagerie > *, .bulles > *, .repondre > *, .demande .corps > *, .ligne-remplacement > *, .cal-colonnes > *,
.etape-rdv > *, .cartes-rdv > *, .demande-rdv > *, .saisie-outils > *, .autorisation > *, .filtres > *, .ligne-reduction > *,
fieldset.moyens > *, .champ > * { min-width: 0; }
.fichiers { min-width: 0; }
.puce-fichier { min-width: 0; }
.champ input[type=file] { width: 100%; max-width: 100%; min-height: 48px; padding: 6px; border: 1.5px dashed var(--filet-fort); border-radius: 12px; background: var(--doux); font-size: 0.875rem; cursor: pointer; }
.champ input[type=file]::file-selector-button { min-height: 36px; margin-right: 12px; padding: 0 14px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--papier); color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.btn { max-width: 100%; }
@media (max-width: 479px) {
  .btn { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
  .entete-actions .btn { flex: 1 1 auto; }
}

/* Histogramme : colonnes qui ne débordent pas ; dans un cadre étroit, barres horizontales lisibles. */
.histo { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.histo li { min-width: 0; }
@container (max-width: 440px) {
  .histo { grid-template-columns: minmax(0, 1fr); height: auto; gap: 8px; }
  .histo li { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto; align-items: center; height: auto; text-align: left; gap: 10px; }
  .histo-lib { order: 1; font-size: 0.8125rem; }
  .histo-barre { order: 2; align-self: center; height: 10px; width: calc(var(--h) * 100%); min-width: 2px; border-radius: 3px; }
  .histo-val { order: 3; font-size: 0.8125rem; }
}

/* --- Animations complémentaires (désactivées si l'appareil demande moins de mouvement) --------------------- */
.histo-barre { transform-origin: bottom; transform: scaleY(0); transition: transform 900ms var(--ease); }
.anime .histo-barre { transform: none; }
.histo li:nth-child(2) .histo-barre { transition-delay: 40ms; } .histo li:nth-child(3) .histo-barre { transition-delay: 80ms; }
.histo li:nth-child(4) .histo-barre { transition-delay: 120ms; } .histo li:nth-child(5) .histo-barre { transition-delay: 160ms; }
.histo li:nth-child(6) .histo-barre { transition-delay: 200ms; } .histo li:nth-child(7) .histo-barre { transition-delay: 240ms; }
.histo li:nth-child(8) .histo-barre { transition-delay: 280ms; }
@container (max-width: 440px) { .histo-barre { transform-origin: left; transform: scaleX(0); } .anime .histo-barre { transform: none; } }
.toast { animation: monte 320ms var(--ease) both; }
.btn:active:not([disabled]) { transform: scale(0.98); }
.case-prepa span { transition: color 250ms ease; }
.lignes > li { transition: background-color 200ms ease; }
