:root {
  --fond: #f4f5f8;
  --carte: #ffffff;
  --texte: #1d2333;
  --doux: #6b7385;
  --bord: #e2e5ed;
  --accent: #3d5afe;
  --accent-fonce: #2f45c4;
  --vert: #1f9d63;
  --rouge: #d3383f;
  --orange: #d98014;
  --bleu-clair: #eef1ff;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(20, 26, 45, .06), 0 4px 14px rgba(20, 26, 45, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- barre de navigation ---------- */
.entete {
  background: #171c2c;
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.marque { font-weight: 700; padding: 14px 0; white-space: nowrap; }
.marque small { display: block; font-weight: 400; opacity: .6; font-size: 11px; letter-spacing: .04em; }
.entete nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.entete nav a {
  color: #c7cbd8; padding: 8px 12px; border-radius: 7px; font-size: 14px;
}
.entete nav a:hover { background: #262c40; color: #fff; text-decoration: none; }
.entete nav a.actif { background: var(--accent); color: #fff; }
.profil { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c7cbd8; }
.profil .badge-role { background: #262c40; padding: 3px 9px; border-radius: 20px; font-size: 11px; }
.profil form { margin: 0; }
.lien-nu { background: none; border: 0; color: #c7cbd8; cursor: pointer; font: inherit; padding: 0; }
.lien-nu:hover { color: #fff; text-decoration: underline; }

/* ---------- structure ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 26px 20px 70px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
h3 { font-size: 14px; margin: 0 0 10px; color: var(--doux); text-transform: uppercase; letter-spacing: .05em; }
.sous-titre { color: var(--doux); margin: 0 0 22px; }

.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 18px; box-shadow: var(--ombre); margin-bottom: 18px;
}
.grille { display: grid; gap: 18px; }
.grille-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grille-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.entre { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.pile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- chiffres clés ---------- */
.stat { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; }
.stat .valeur { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .libelle { color: var(--doux); font-size: 13px; margin-top: 4px; }
.stat.vert .valeur { color: var(--vert); }
.stat.rouge .valeur { color: var(--rouge); }
.stat.orange .valeur { color: var(--orange); }

/* ---------- formulaires ---------- */
label { display: block; font-size: 13px; color: var(--doux); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 7px;
  font: inherit; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--bord); border-radius: 6px; background: #fff; }
.champ { margin-bottom: 12px; }
.ligne-champs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.bouton {
  display: inline-block; background: var(--accent); color: #fff; border: 0; padding: 9px 16px;
  border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.bouton:hover { background: var(--accent-fonce); text-decoration: none; color: #fff; }
.bouton.secondaire { background: #fff; color: var(--texte); border: 1px solid var(--bord); }
.bouton.secondaire:hover { background: #f0f2f7; color: var(--texte); }
.bouton.danger { background: #fff; color: var(--rouge); border: 1px solid #f0c8ca; }
.bouton.danger:hover { background: var(--rouge); color: #fff; }
.bouton.petit { padding: 5px 10px; font-size: 13px; font-weight: 500; }

/* ---------- tableaux ---------- */
.tableau-enveloppe { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfd; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 2px solid var(--bord); border-bottom: 0; }

/* ---------- pastilles ---------- */
.pastille {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px;
  font-weight: 600; white-space: nowrap;
}
.pastille.present { background: #e2f5ea; color: var(--vert); }
.pastille.absent  { background: #fbe6e7; color: var(--rouge); }
.pastille.retard  { background: #fdf0dc; color: var(--orange); }
.pastille.excuse  { background: #e9ecf6; color: #5a6482; }
.pastille.neutre  { background: #eef0f5; color: var(--doux); }
.puce-cours { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }

/* ---------- messages ---------- */
.message { padding: 11px 14px; border-radius: var(--rayon); margin-bottom: 16px; font-size: 14px; }
.message.ok { background: #e2f5ea; color: #14663f; border: 1px solid #b8e3cb; }
.message.erreur { background: #fbe6e7; color: #92242a; border: 1px solid #f0c1c4; }
.message.info { background: var(--bleu-clair); color: #2a3a9e; border: 1px solid #c9d2ff; }
.vide { color: var(--doux); font-style: italic; padding: 10px 0; }

/* ---------- calendrier ---------- */
.calendrier { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendrier th { text-align: center; padding: 8px 2px; font-size: 12px; }
.calendrier td {
  border: 1px solid var(--bord); vertical-align: top; padding: 4px; height: 84px;
  background: #fff;
}
.calendrier td.hors-mois { background: #fafbfd; }
.calendrier td.week-end { background: #f6f7fa; }
.calendrier td.aujourdhui { outline: 2px solid var(--accent); outline-offset: -2px; }
.num-jour { font-size: 12px; color: var(--doux); font-weight: 600; }
.case-cours {
  display: block; border-radius: 5px; padding: 3px 6px; margin-top: 3px;
  font-size: 11px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.case-cours:hover { text-decoration: none; opacity: .88; color: #fff; }
.case-cours .moment { opacity: .8; font-weight: 500; }
.case-cours.stage { background: #4d5570; }
.case-cours.conge { background: #b9bfcd; color: #454b5c; }

/* ---------- barres de progression ---------- */
.barre { background: #e9ecf3; border-radius: 20px; height: 8px; overflow: hidden; min-width: 90px; }
.barre span { display: block; height: 100%; background: var(--accent); border-radius: 20px; }
.barre.atteint span { background: var(--vert); }

/* ---------- prise de présence ---------- */
.appel td { padding: 7px 10px; }
.choix-statut { display: flex; gap: 4px; flex-wrap: wrap; }
.choix-statut input { position: absolute; opacity: 0; pointer-events: none; }
.choix-statut label {
  margin: 0; padding: 5px 11px; border: 1px solid var(--bord); border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--doux); background: #fff; user-select: none;
  white-space: nowrap;
}
.choix-statut input:checked + label { color: #fff; border-color: transparent; font-weight: 600; }
.choix-statut input[value=present]:checked + label { background: var(--vert); }
.choix-statut input[value=absent]:checked  + label { background: var(--rouge); }
.choix-statut input[value=retard]:checked  + label { background: var(--orange); }
.choix-statut input[value=excuse]:checked  + label { background: #5a6482; }
.choix-statut input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.barre-action {
  position: sticky; bottom: 0; background: var(--carte); border-top: 1px solid var(--bord);
  padding: 12px 18px; margin: 0 -18px -18px; display: flex; gap: 10px; align-items: center;
  border-radius: 0 0 var(--rayon) var(--rayon);
}

/* ---------- connexion ---------- */
.page-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.boite-login { width: 100%; max-width: 380px; }
.boite-login .carte { padding: 26px; }
.aide-login { font-size: 13px; color: var(--doux); margin-top: 16px; line-height: 1.7; }
.aide-login code { background: #eef0f5; padding: 1px 5px; border-radius: 4px; }

.legende { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.legende span { display: flex; align-items: center; gap: 6px; }

@media (max-width: 700px) {
  .calendrier td { height: auto; min-height: 54px; }
  .entete { gap: 10px; }
  .page { padding: 18px 12px 60px; }
}
