/* Cours de France : la feuille de copie.
   Encre bleu nuit sur papier, stylo bleu pour les actions,
   trait de marge rouge et annotations du correcteur pour ce qui demande une action. */

:root {
  --papier: #fbfcfd;
  --encre: #18233a;
  --encre-douce: #566176;
  --stylo: #2747a3;
  --stylo-clair: #e7ecf8;
  --marge: #c8382b;
  --marge-clair: #fbeeec;
  --vert: #2e7a4e;
  --trait: #dce2ea;
  --rayon: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 17px/1.5 "Atkinson Hyperlegible Next", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

main { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }

a { color: var(--stylo); }
:focus-visible { outline: 3px solid var(--stylo); outline-offset: 2px; }

h1 { font-size: 2rem; line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 40px 0 12px; font-weight: 700; }

/* ---- Barre du haut */
.haut {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px; border-bottom: 1px solid var(--trait); background: #fff;
}
.haut .marque { font-weight: 700; color: var(--encre); text-decoration: none; margin-right: auto; }
.haut .qui { color: var(--encre-douce); font-size: 0.95rem; }
.haut form { margin: 0; }

/* ---- Boutons et champs */
button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--stylo); color: #fff; border: 0; border-radius: var(--rayon);
  padding: 11px 18px;
}
button:hover { background: #1d3889; }
button.secondaire { background: #fff; color: var(--stylo); border: 1.5px solid var(--stylo); padding: 8px 14px; }
button.secondaire:hover { background: var(--stylo-clair); }
button.lien { background: none; color: var(--stylo); padding: 0; font-weight: 400; text-decoration: underline; }

label { display: block; font-weight: 600; font-size: 0.95rem; margin: 0 0 14px; }
label small { font-weight: 400; color: var(--encre-douce); }
input, select {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-weight: 400; color: var(--encre);
  padding: 10px 12px; border: 1.5px solid #b9c2cf; border-radius: var(--rayon); background: #fff;
}
input:focus, select:focus { border-color: var(--stylo); outline: none; box-shadow: 0 0 0 3px var(--stylo-clair); }

/* ---- Pages simples (connexion, installation) */
body.seul main { min-height: 100vh; display: grid; place-items: center; }
.carte-seule {
  width: 100%; max-width: 440px; background: #fff;
  border: 1px solid var(--trait); border-left: 3px solid var(--marge);
  border-radius: var(--rayon); padding: 32px;
}
.carte-seule h1 { font-size: 1.6rem; margin-bottom: 6px; }
.carte-seule button { width: 100%; margin-top: 8px; }
.aide { color: var(--encre-douce); margin: 0 0 24px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.erreur { color: var(--marge); background: var(--marge-clair); padding: 10px 12px; border-radius: var(--rayon); }

/* ---- Tableau de bord */
.periode { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin: 16px 0 28px; }
.periode h1 { margin-right: auto; }
.periode h1::first-letter { text-transform: uppercase; }
.periode .discret { margin: 0; font-weight: 400; font-size: 0.85rem; color: var(--encre-douce); }
.periode .discret select { margin-top: 2px; min-width: 170px; }

/* La feuille : une colonne de marge, le trait rouge, puis le contenu */
.feuille { display: grid; grid-template-columns: 250px 1fr; gap: 0; }
.marge { padding: 4px 24px 0 0; border-right: 2px solid var(--marge); }
.marge h2 { color: var(--marge); margin-top: 0; }
.contenu { padding-left: 32px; min-width: 0; }

.annotations { list-style: none; margin: 0; padding: 0; }
.annotations li { color: var(--marge); font-size: 0.92rem; line-height: 1.35; margin-bottom: 14px; }
.annotations strong { display: block; font-weight: 700; }
.rien { color: var(--vert); font-weight: 600; }

.bilan { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-bottom: 1px solid var(--trait); padding-bottom: 20px; }
.bilan div { padding-right: 16px; }
.bilan dt { color: var(--encre-douce); font-size: 0.9rem; }
.bilan dd { margin: 2px 0 0; font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.bilan dd small { display: block; font-size: 0.95rem; font-weight: 600; color: var(--vert); margin-top: 4px; }
.effectifs { color: var(--encre-douce); margin: 14px 0 0; }

.chiffres { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.chiffres th, .chiffres td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--trait); }
.chiffres thead th { font-weight: 600; color: var(--encre-douce); font-size: 0.85rem; }
.chiffres tfoot th, .chiffres tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--encre); }
.chiffres .n { text-align: right; white-space: nowrap; }
.chiffres .taux { white-space: nowrap; width: 180px; padding-left: 20px; }
.jauge { display: inline-block; vertical-align: middle; width: 90px; height: 6px; margin-right: 10px; background: var(--stylo-clair); border-radius: 3px; overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--stylo); }
.neg { color: var(--marge); }
.vide { color: var(--encre-douce); padding: 16px 0; max-width: 60ch; }

/* ---- Téléphone : la marge passe au-dessus, le trait rouge devient horizontal */
@media (max-width: 860px) {
  main { padding: 16px 16px 48px; }
  .feuille { grid-template-columns: 1fr; }
  .marge { border-right: 0; border-bottom: 2px solid var(--marge); padding: 0 0 12px; margin-bottom: 20px; }
  .contenu { padding-left: 0; }
  .bilan { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .bilan dd { font-size: 1.5rem; }
  .chiffres .taux { width: auto; }
  .chiffres .jauge { display: none; }
  .table-defile { overflow-x: auto; }
  .haut .qui { display: none; }
}

@media (max-width: 600px) {
  .par-formation thead th:nth-child(3), .par-formation tbody td:nth-child(3),
  .par-formation thead th:nth-child(5), .par-formation tbody td:nth-child(5),
  .par-formation thead th:nth-child(7), .par-formation tbody td:nth-child(7) { display: none; }
  .par-formation tfoot td:nth-child(2), .par-formation tfoot td:nth-child(4),
  .par-formation tfoot td:nth-child(6) { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Diagnostic */
.diag ul { list-style: none; padding: 0; margin: 16px 0; }
.diag li { padding: 6px 0; border-bottom: 1px solid var(--trait); font-size: 0.95rem; }
.diag li.ok { color: var(--vert); }
.diag li.ko { color: var(--marge); font-weight: 600; }

/* ---- Menu */
.haut .menu { display: flex; gap: 4px; list-style: none; margin: 0 auto 0 24px; padding: 0; }
.haut .marque { margin-right: 0; }
.haut .menu a { display: block; white-space: nowrap; padding: 6px 12px; border-radius: var(--rayon); color: var(--encre-douce); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.haut .menu a:hover { color: var(--encre); background: var(--stylo-clair); }
.haut .menu a[aria-current="page"] { color: var(--stylo); background: var(--stylo-clair); }

/* ---- Pages de gestion */
.entete-page { margin: 16px 0 24px; max-width: 75ch; }
.entete-page h1 { margin-bottom: 8px; }
.compte { font-weight: 400; color: var(--encre-douce); font-size: 1.1rem; margin-left: 6px; }
.periode input[type=search] { min-width: 240px; margin-top: 2px; }
.sous { display: block; color: var(--encre-douce); font-size: 0.85rem; }
.sous.neg { color: var(--marge); }
.liste td { vertical-align: top; }
a.bouton { display: inline-block; font-weight: 600; background: var(--stylo); color: #fff; text-decoration: none; padding: 11px 18px; border-radius: var(--rayon); }
a.bouton.secondaire { background: #fff; color: var(--stylo); border: 1.5px solid var(--stylo); padding: 9.5px 16.5px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Import */
.import { max-width: 760px; }
.import fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.import legend { font-weight: 700; font-size: 1.15rem; margin-bottom: 12px; }
.choix { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 4px; align-items: start; font-weight: 400;
  padding: 16px; border: 1.5px solid var(--trait); border-radius: var(--rayon); background: #fff; margin-bottom: 10px; cursor: pointer; }
.choix:has(input:checked) { border-color: var(--stylo); box-shadow: 0 0 0 3px var(--stylo-clair); }
.choix input { width: auto; margin: 4px 0 0; grid-row: span 4; accent-color: var(--stylo); }
.choix-titre { font-weight: 700; }
.choix-aide, .choix-colonnes { color: var(--encre-douce); font-size: 0.92rem; }
.choix a { font-size: 0.92rem; justify-self: start; }
.depot { background: #fff; border: 1.5px dashed #b9c2cf; border-radius: var(--rayon); padding: 20px; margin-bottom: 20px; }
.depot input[type=file] { border: 0; padding: 8px 0; }
.depot details { margin-top: 12px; }
.depot summary { cursor: pointer; color: var(--stylo); }
.depot textarea { width: 100%; margin-top: 8px; font: 0.9rem/1.4 ui-monospace, Menlo, Consolas, monospace; padding: 10px; border: 1.5px solid #b9c2cf; border-radius: var(--rayon); }
.fichier-info { margin: 6px 0 0; font-weight: 600; color: var(--vert); }
.fichier-info.erreur { color: var(--marge); }

.bilan-import { font-size: 1.15rem; }
.confirmer { display: flex; align-items: center; gap: 20px; margin: 8px 0 24px; }
.apercu .ligne-ko td { background: var(--marge-clair); }
.apercu .messages span { display: block; font-size: 0.88rem; }
.msg-ko { color: var(--marge); font-weight: 600; }
.msg-note { color: var(--encre-douce); }

@media (max-width: 860px) {
  .haut { flex-wrap: wrap; row-gap: 8px; }
  .haut .menu { order: 3; width: 100%; margin: 0 -8px; overflow-x: auto; scrollbar-width: none; }
  .haut .menu { gap: 0; }
  .haut .menu a { padding: 6px 7px; font-size: 0.88rem; }
  .haut form { margin-left: auto; }
}

/* ---- Fiches */
.fil { margin: 12px 0 0; font-size: 0.92rem; }
.fil a { color: var(--encre-douce); }
.fil a::before { content: "‹ "; }
.entete-fiche { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 8px 0 20px; }
.entete-fiche h1 { margin-bottom: 6px; }
.entete-fiche h1::first-letter { text-transform: uppercase; }
.coordonnees { margin: 0; color: var(--encre-douce); max-width: 75ch; }
.barre-actions { display: flex; justify-content: flex-end; margin: 12px 0 -8px; }
.faits { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; margin: 0 0 16px; }
.faits dt { color: var(--encre-douce); font-size: 0.85rem; }
.faits dd { margin: 2px 0 0; font-weight: 600; }
.faits.large { padding: 16px 0; border-top: 1px solid var(--trait); border-bottom: 1px solid var(--trait); }
.bloc { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px 20px; margin-bottom: 14px; }
.bloc-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.bloc-tete h3 { margin: 0; font-size: 1.15rem; }
.sous-titre { font-weight: 400; color: var(--encre-douce); font-size: 0.95rem; margin-left: 6px; }
.en-ligne { display: flex; gap: 8px; align-items: center; margin: 0; }
.en-ligne select { width: auto; margin: 0; padding: 6px 10px; }
button.petit { padding: 6px 10px; }
.actions-bloc { margin: 10px 0 0; }
.annotations a { color: inherit; text-decoration: none; display: block; }
.annotations a:hover strong { text-decoration: underline; }
.groupe .tete-groupe th, .groupe .tete-groupe td { padding-top: 16px; font-weight: 700; border-bottom: 1px solid var(--encre); }
.groupe .tete-groupe th::first-letter { text-transform: uppercase; }
.succes { color: var(--vert); background: #e9f4ee; padding: 10px 12px; border-radius: var(--rayon); font-weight: 600; }

/* États des séances et des inscriptions */
.pastille { display: inline-block; white-space: nowrap; font-size: 0.82rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: var(--encre-douce); }
.p-realisee, .p-regularisee, .p-en_cours, .p-inscrit, .p-terminee { background: #e9f4ee; color: var(--vert); }
.p-incomplete, .p-abandon { background: var(--marge-clair); color: var(--marge); }
.p-planifiee { background: var(--stylo-clair); color: var(--stylo); }
.p-annulee, .p-absence_eleve, .p-annulee { background: #f1f1f1; color: #6b7280; }

/* Traitement d'une séance */
.choix-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.action-seance { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px; display: flex; flex-direction: column; }
.action-seance h3 { margin: 0 0 6px; font-size: 1.05rem; }
.action-seance .aide { margin-bottom: 12px; font-size: 0.92rem; }
.action-seance button { margin-top: auto; align-self: flex-start; }

/* ---- Formulaires de saisie */
.saisie { max-width: 760px; }
.saisie h2 { margin-top: 28px; }
.saisie h2 small { font-weight: 400; color: var(--encre-douce); font-size: 0.9rem; }
.trois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cases { border: 0; padding: 0; margin: 4px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; }
.cases legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }
label.case { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 0 14px; }
.cases label.case { margin: 0; }
label.case input { width: auto; margin: 0; accent-color: var(--stylo); }
.saisie .actions { align-items: center; margin-top: 24px; }

@media (max-width: 700px) {
  .trois, .deux { grid-template-columns: 1fr; gap: 0; }
}
.lien-bas { margin: 18px 0 0; text-align: center; }
