/* KanfaScolaire Pro — charte Kanfaservices */
:root {
  --navy: #1B365D; --navy2: #27507F; --navy3: #102A4C; --or: #F2A900; --or-clair: #FFF4D6;
  --fond: #F4F6FA; --clair: #E3EAF4; --ligne: #D5DDE8; --texte: #222B36; --gris: #6B7785;
  --vert: #2E7D32; --rouge: #C62828; --orange: #E07B00; --blanc: #fff;
  --rayon: 10px; --ombre: 0 1px 3px rgba(16, 42, 76, .08), 0 4px 14px rgba(16, 42, 76, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14.5px; color: var(--texte);
       background: var(--fond); line-height: 1.45; }
a { color: var(--navy2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 16.5px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 14.5px; margin: 14px 0 8px; color: var(--navy); }
.sous-titre { color: var(--gris); margin: 0 0 18px; }

/* ---------- structure */
.appli { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.lateral { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marque { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.marque img { width: 38px; height: 38px; border-radius: 8px; background: #fff; object-fit: contain; }
.marque b { display: block; font-size: 16px; letter-spacing: .2px; }
.marque span { font-size: 11px; color: var(--or); }
.lateral nav { padding: 8px 0 16px; flex: 1; }
.lateral .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.55); padding: 14px 18px 4px; }
.lateral nav a { display: block; color: rgba(255,255,255,.88); padding: 7px 18px; border-left: 3px solid transparent; font-size: 14px; }
.lateral nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.lateral nav a.actif { background: rgba(255,255,255,.12); border-left-color: var(--or); color: #fff; font-weight: 600; }
.lateral .pied { font-size: 11px; color: rgba(255,255,255,.5); padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.12); }
.principal { min-width: 0; }
.haut { background: #fff; border-bottom: 1px solid var(--ligne); padding: 10px 26px; display: flex; align-items: center; gap: 16px; }
.haut .etab { flex: 1; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.haut .etab small { color: var(--gris); font-weight: 400; margin-left: 8px; }
.haut .qui { text-align: right; font-size: 13px; line-height: 1.25; }
.haut .qui small { color: var(--gris); }
.contenu { padding: 22px 26px 40px; max-width: 1380px; }

/* ---------- bandeaux */
.bandeau { padding: 9px 26px; font-size: 13.5px; }
.bandeau.demo { background: #FFF4D6; color: #7A5300; border-bottom: 1px solid #F2D58A; }
.bandeau.lecture { background: #FDECEC; color: #8E1C1C; border-bottom: 1px solid #F3C2C2; }
.bandeau.alerte { background: #FFF1DE; color: #8A4B00; border-bottom: 1px solid #F5CD99; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: #EAF6EC; border-color: #B9DFBE; color: #1E5E22; }
.flash.erreur { background: #FDECEC; border-color: #F3C2C2; color: #8E1C1C; }
.flash.info { background: #EAF1FB; border-color: #C3D5EE; color: #1B365D; }

/* ---------- cartes, grilles */
.carte { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; margin-bottom: 18px; }
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px 16px; border-left: 4px solid var(--or); }
.kpi b { display: block; font-size: 26px; color: var(--navy); line-height: 1.1; }
.kpi span { color: var(--gris); font-size: 12.5px; }
.barre { height: 8px; background: var(--clair); border-radius: 6px; overflow: hidden; min-width: 70px; }
.barre i { display: block; height: 100%; background: var(--navy2); }
.barre.complet i { background: var(--vert); }

/* ---------- tableaux */
table.liste { width: 100%; border-collapse: collapse; background: #fff; }
table.liste th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--navy);
                 background: var(--clair); padding: 8px 10px; border-bottom: 1px solid var(--ligne); }
table.liste td { padding: 7px 10px; border-bottom: 1px solid #EDF1F6; vertical-align: middle; }
table.liste tr:hover td { background: #FAFBFD; }
table.liste td.num, table.liste th.num { text-align: center; }
table.liste tr.inactif td { color: #9AA4B1; }
.defile { overflow-x: auto; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--clair); color: var(--navy); }
.badge.vert { background: #E3F2E5; color: var(--vert); }
.badge.rouge { background: #FBE3E3; color: var(--rouge); }
.badge.or { background: var(--or-clair); color: #7A5300; }
.rouge { color: var(--rouge); font-weight: 600; }
.discret { color: var(--gris); font-size: 12.5px; }

/* ---------- formulaires */
form.ligne { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.champ { display: flex; flex-direction: column; gap: 3px; min-width: 120px; }
.champ label { font-size: 12px; color: var(--gris); }
.champ.large { flex: 1 1 260px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=search], select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #C9D3E0; border-radius: 7px; background: #fff; color: var(--texte); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(39, 80, 127, .25); border-color: var(--navy2); }
input[readonly] { background: var(--fond); }
.formulaire { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.formulaire .plein { grid-column: 1 / -1; }
.coche { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
button, .bouton { font: inherit; font-weight: 600; border: 1px solid var(--navy); background: var(--navy); color: #fff; padding: 8px 16px;
                  border-radius: 8px; cursor: pointer; display: inline-block; text-decoration: none; line-height: 1.3; }
button:hover, .bouton:hover { background: var(--navy3); text-decoration: none; }
.bouton.or, button.or { background: var(--or); border-color: var(--or); color: var(--navy); }
.bouton.or:hover, button.or:hover { background: #FFBE2E; }
.bouton.clair, button.clair { background: #fff; color: var(--navy); border-color: #C9D3E0; }
.bouton.clair:hover, button.clair:hover { background: var(--clair); }
button.danger { background: #fff; color: var(--rouge); border-color: #EBC4C4; }
button.danger:hover { background: #FDECEC; }
button.petit, .bouton.petit { padding: 4px 10px; font-size: 13px; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- saisie des notes */
table.saisie input[type=text] { width: 76px; text-align: center; font-size: 15px; font-weight: 600; background: var(--or-clair); }
table.saisie input.obs { width: 100%; text-align: left; font-weight: 400; background: #fff; }
table.saisie input.court { width: 64px; }
table.saisie td.mg { font-weight: 700; text-align: center; width: 80px; }
table.saisie tr.exempt td { color: #9AA4B1; }
table.saisie input.erreur { outline: 2px solid var(--rouge); background: #FDECEC; }

/* ---------- connexion */
.ecran-seul { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #3A6EA5 100%); padding: 20px; }
.boite { background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25); width: 100%; max-width: 420px; overflow: hidden; }
.boite.large { max-width: 640px; }
.boite .tete { background: var(--navy); color: #fff; padding: 22px 26px; display: flex; gap: 14px; align-items: center; }
.boite .tete img { width: 52px; height: 52px; border-radius: 10px; background: #fff; object-fit: contain; }
.boite .tete b { font-size: 21px; display: block; }
.boite .tete span { color: var(--or); font-size: 12.5px; }
.boite .corps { padding: 22px 26px 26px; }
.boite .corps .champ { margin-bottom: 12px; }
.boite .corps input { width: 100%; }
.boite .pied { padding: 10px 26px 16px; color: var(--gris); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .appli { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media print {
  .lateral, .haut, .bandeau, .actions, form { display: none !important; }
  .appli { display: block; }
  .carte { box-shadow: none; }
}

/* fiche élève : photo d'identité */
.fiche-eleve { display: flex; gap: 22px; align-items: flex-start; }
.fiche-eleve .formulaire { flex: 1; }
.photo-bloc { width: 168px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.photo-bloc img, #webcam video { width: 150px; height: 200px; object-fit: cover; border: 1px solid #C9D3E0; border-radius: 6px; background: #F6F8FB; }
#webcam { display: flex; flex-direction: column; gap: 6px; align-items: center; }
#webcam[hidden], .photo-bloc img[hidden] { display: none; }
img.vignette { width: 27px; height: 36px; object-fit: cover; border-radius: 3px; vertical-align: middle; border: 1px solid #C9D3E0; }
@media (max-width: 760px) { .fiche-eleve { flex-direction: column-reverse; align-items: stretch; } .photo-bloc { width: auto; } }
