/* Hopital — style commun (bureau, web, mobile) */
:root {
  --primaire: #0F766E;
  --primaire-fonce: #0B3B3A;
  --primaire-clair: #E6F4F2;
  --accent: #F5A623;
  --fond: #F4F6FA;
  --carte: #FFFFFF;
  --bordure: #D7DEE8;
  --texte: #1B2430;
  --discret: #5B6B80;
  --danger: #C62828;
  --succes: #2E7D32;
  --rayon: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 15px; color: var(--texte); background: var(--fond); }
a { color: var(--primaire); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--primaire-fonce); font-weight: 600; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; color: var(--primaire); font-weight: 600; }
h3 { font-size: 1rem; margin: 14px 0 8px; color: var(--primaire-fonce); }
.sous-titre { color: var(--discret); margin: 0 0 18px; }

/* ---------- Structure ---------- */
.appli { display: flex; min-height: 100vh; }
.menu { width: 236px; background: var(--primaire-fonce); color: #BFE0DB; display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.menu .marque { padding: 20px 20px 14px; border-bottom: 1px solid #12524E; }
.menu .marque .logo { font-size: 1.35rem; font-weight: 800; color: #fff; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.menu .marque .logo img { width: 34px; height: 34px; border-radius: 8px; background: #fff; padding: 2px; }
.menu .marque .logo span { color: var(--accent); }
.menu .marque .ecole { font-size: .82rem; color: #9CC9C3; margin-top: 4px; }
.menu nav { padding: 10px 0; flex: 1; }
.menu nav a, .menu nav .bientot { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #BFE0DB; border-left: 4px solid transparent; font-size: .95rem; }
.menu nav a:hover { background: #1C3A66; }
.menu nav a.active { background: var(--primaire); color: #fff; border-left-color: var(--accent); }
.menu nav .groupe { padding: 14px 20px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: #7F95B7; }
.menu nav .bientot { opacity: .45; cursor: default; }
.menu nav .bientot small { margin-left: auto; font-size: .68rem; background: #12524E; padding: 1px 6px; border-radius: 8px; }
.menu .pied { padding: 12px 20px; border-top: 1px solid #12524E; font-size: .82rem; }
.menu .pied .nom { color: #fff; font-weight: 600; }
.ico { width: 20px; text-align: center; }

.appli > .principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barre { background: #fff; border-bottom: 1px solid var(--bordure); padding: 10px 24px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5; }
.barre .espace { flex: 1; }
.barre select { width: auto; }
.btn-menu { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primaire-fonce); padding: 0 6px; }
.contenu { padding: 24px; max-width: 1300px; width: 100%; }

/* ---------- Cartes, grilles ---------- */
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 18px; margin-bottom: 16px; }
.grille { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chiffre { background: #fff; border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 16px 18px; border-top: 4px solid var(--primaire); }
.chiffre .valeur { font-size: 1.9rem; font-weight: 700; color: var(--primaire-fonce); }
.chiffre .libelle { color: var(--discret); font-size: .88rem; }
.chiffre.accent { border-top-color: var(--accent); }
.chiffre.rose { border-top-color: #D81B60; }
.chiffre.vert { border-top-color: var(--succes); }

/* ---------- Formulaires ---------- */
label { display: block; font-size: .82rem; color: var(--discret); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 6px; font: inherit; background: #fff; color: var(--texte); }
input:focus, select:focus, textarea:focus { outline: 2px solid #B9D0F0; border-color: var(--primaire); }
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; }
input:disabled, select:disabled, textarea:disabled { background: #F4F6FA; color: var(--texte); cursor: default; }
.case { display: flex; align-items: center; margin: 8px 0; color: var(--texte); font-size: .95rem; }
.obligatoire::after { content: " *"; color: var(--danger); }
.aide { font-size: .82rem; color: var(--discret); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--bordure); background: #fff; color: var(--primaire-fonce); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #F2F5FA; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.principal { background: var(--primaire); border-color: var(--primaire); color: #fff; font-weight: 600; }
.btn.principal:hover { background: #0C5F59; }
.btn.danger { color: var(--danger); }
.btn.petit { padding: 4px 10px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.outils { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.outils input, .outils select { width: auto; min-width: 160px; }
.outils .espace { flex: 1; }

/* ---------- Tableaux ---------- */
.tableau-conteneur { overflow-x: auto; background: #fff; border: 1px solid var(--bordure); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--primaire-clair); color: var(--primaire-fonce); text-align: left; font-weight: 600; padding: 9px 10px; font-size: .88rem; white-space: nowrap; }
td { padding: 8px 10px; border-top: 1px solid #EEF1F5; font-size: .93rem; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: #F0F8F7; }
td.num, th.num { text-align: right; }
.vide { padding: 30px; text-align: center; color: var(--discret); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: .78rem; background: #EEF1F5; color: var(--discret); }
.badge.vert { background: #E3F2E5; color: var(--succes); }
.badge.rouge { background: #FCE4E4; color: var(--danger); }
.badge.bleu { background: var(--primaire-clair); color: var(--primaire); }
.badge.orange { background: #FFF1DA; color: #A86700; }

/* ---------- Fenêtres (modales) ---------- */
.voile { position: fixed; inset: 0; background: rgba(15, 30, 55, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow-y: auto; }
.fenetre { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.fenetre.large { max-width: 900px; }
.fenetre .tete { padding: 14px 20px; border-bottom: 1px solid var(--bordure); display: flex; align-items: center; }
.fenetre .tete h3 { margin: 0; flex: 1; font-size: 1.1rem; }
.fenetre .tete button { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--discret); }
.fenetre .corps { padding: 6px 20px 18px; }
.fenetre .pied { padding: 12px 20px; border-top: 1px solid var(--bordure); display: flex; gap: 8px; justify-content: flex-end; background: #FAFBFD; border-radius: 0 0 10px 10px; }

/* ---------- Notifications ---------- */
.notifs { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.notif { background: var(--succes); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.2); font-size: .93rem; }
.notif.erreur { background: var(--danger); }
.alerte { padding: 10px 14px; border-radius: 6px; background: #FCE4E4; color: var(--danger); margin: 10px 0; font-size: .92rem; }
.alerte.info { background: var(--primaire-clair); color: var(--primaire-fonce); }
.alerte.ok { background: #E3F2E5; color: var(--succes); }

/* ---------- Pages d'accueil (serveur, connexion, assistant) ---------- */
.accueil { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(135deg, #0B3B3A 0%, #0F766E 100%); }
.accueil .boite { background: #fff; border-radius: 12px; padding: 28px; width: 100%; max-width: 460px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.accueil .boite.large { max-width: 820px; }
.accueil .logo { font-size: 1.8rem; font-weight: 800; color: var(--primaire-fonce); text-align: center; }
.accueil .logo span { color: var(--accent); }
.accueil .logo img { width: 170px; height: auto; display: block; margin: 0 auto 4px; }
.accueil .slogan { text-align: center; color: var(--discret); margin-bottom: 18px; font-size: .9rem; }
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.choix button { border: 2px solid var(--bordure); background: #fff; border-radius: 8px; padding: 12px; cursor: pointer; text-align: left; font: inherit; }
.choix button.actif { border-color: var(--primaire); background: var(--primaire-clair); }
.choix button b { display: block; color: var(--primaire-fonce); }
.choix button small { color: var(--discret); }
.etapes { display: flex; gap: 6px; margin-bottom: 18px; }
.etapes div { flex: 1; height: 5px; border-radius: 3px; background: var(--bordure); }
.etapes div.fait { background: var(--primaire); }

.photo { width: 120px; height: 140px; border: 1px dashed var(--bordure); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #FAFBFD; color: var(--discret); font-size: .8rem; text-align: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.logo-ecole { max-height: 90px; max-width: 200px; }
.chargement { padding: 40px; text-align: center; color: var(--discret); }
.barre-remplissage { height: 8px; background: #EEF1F5; border-radius: 4px; overflow: hidden; min-width: 80px; }
.barre-remplissage div { height: 100%; background: var(--primaire); }
.onglets { display: flex; gap: 4px; border-bottom: 2px solid var(--bordure); margin-bottom: 16px; flex-wrap: wrap; }
.onglets button { background: none; border: none; padding: 9px 16px; cursor: pointer; font: inherit; color: var(--discret); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.onglets button.actif { color: var(--primaire); border-bottom-color: var(--primaire); font-weight: 600; }

/* ---------- Impression ---------- */
.seulement-impression { display: none; }
/* Blocs prévus pour le papier seulement : cachés à l'écran, affichés à l'impression. */
.imprimer-seul { display: none; }
@media print { .imprimer-seul { display: block; } }
.saut-page { page-break-after: always; break-after: page; }
.saut-page:last-child { page-break-after: auto; break-after: auto; }

/* ---------- Bulletin de paie ---------- */
.bp { color: #111; font-size: 11px; page-break-inside: avoid; }
.bp-entete { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 6px; }
.bp-entete img { height: 56px; }
.bp-titre { text-align: center; margin: 10px 0 2px; font-size: 1.25rem; letter-spacing: .5px; }
.bp-periode { text-align: center; margin: 0 0 10px; }
.bp-ident { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid #000; margin-bottom: 10px; }
.bp-ident div { padding: 3px 8px; border-bottom: 1px solid #bbb; }
.bp-ident div:nth-child(odd) { border-right: 1px solid #bbb; }
.bp-ident span { color: #555; display: inline-block; min-width: 118px; }
.bp table { width: 100%; border-collapse: collapse; }
.bp th, .bp td { border: 1px solid #777; padding: 4px 6px; }
.bp th { background: #e8e8e8; text-align: left; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bp td.m, .bp th.m { text-align: right; white-space: nowrap; }
.bp tr.st td { font-weight: 700; background: #f3f3f3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bp .bp-net { margin-top: 10px; border: 2px solid #000; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 1.2rem; font-weight: 800; }
.bp .bp-lettres { margin-top: 4px; font-style: italic; }
.bp .bp-signatures { display: flex; justify-content: space-between; margin-top: 26px; gap: 20px; }
.bp .bp-signatures div { flex: 1; text-align: center; border-top: 1px solid #333; padding-top: 3px; margin-top: 34px; font-size: .9em; }
.bp .bp-mention { margin-top: 10px; font-size: .85em; color: #555; text-align: center; }
.liste-personnel { font-size: 11px; }
.liste-personnel table { width: 100%; border-collapse: collapse; }
.liste-personnel th, .liste-personnel td { border: 1px solid #888; padding: 3px 5px; font-size: inherit; }
.liste-personnel th { white-space: normal; color: #111; }
.bp th, .bp td { font-size: inherit; }
.bp th { color: #111; }
.liste-personnel th { background: #e8e8e8; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.liste-personnel td[style*="text-align:right"], .liste-personnel th[style*="text-align:right"] { white-space: nowrap; }
.livre-paie table { font-size: 9.5px; }
.livre-paie th, .livre-paie td { padding: 3px 4px; font-size: 10px; }
.liste-personnel tr.groupe td { background: #f0f0f0; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* ---------- Notes et bulletins ---------- */
.table-cotes td { padding-top: 4px; padding-bottom: 4px; }
tr.ligne-erreur td { background: #FCE4E4; }
.barre-enregistrer { position: sticky; bottom: 0; background: var(--fond, #F4F6FA); padding: 10px 0; z-index: 5; }
.palmares td.num, .palmares th.num { white-space: nowrap; }
.case-verrou { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.bulletin { background: #fff; color: #111; border: 2px solid #222; padding: 12px 14px; font-size: .78rem; margin-bottom: 18px; page-break-after: always; }
.bulletin:last-child { page-break-after: auto; }
.bulletin .b-entete { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; border-bottom: 2px solid #222; padding-bottom: 6px; }
.bulletin .b-entete img { max-height: 54px; }
.bulletin .b-titre { text-align: center; font-weight: 800; font-size: .95rem; margin: 6px 0; letter-spacing: 1px; }
.bulletin .b-ident { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; margin-bottom: 6px; }
.bulletin table { width: 100%; border-collapse: collapse; }
.bulletin td, .bulletin th { border: 1px solid #444; padding: 2px 4px; text-align: center; }
.bulletin td.cours, .bulletin th.cours { text-align: left; }
.bulletin th { background: #eee; font-size: .72rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bulletin tr.b-max td { background: #f3f3f3; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bulletin tr.b-total td { font-weight: 800; }
.bulletin td.tot { background: #f7f7f7; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bulletin .b-pied { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.bulletin .b-sign { margin-top: 28px; border-top: 1px solid #222; padding-top: 2px; font-size: .7rem; text-align: center; }
@media print { .bulletin { border-width: 1.5px; margin: 0; } }

/* ---------- Licence ---------- */
.bandeau-licence { padding: 9px 24px; font-size: .9rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bandeau-licence a { font-weight: 700; color: inherit; text-decoration: underline; }
.bandeau-licence.essai { background: var(--primaire-clair); color: var(--primaire-fonce); }
.bandeau-licence.alerte-fin { background: #FFF1DA; color: #7A4B00; }
.bandeau-licence.bloque { background: #FCE4E4; color: #8E1B1B; font-weight: 600; }
.code-installation { font-family: monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: 3px; background: var(--primaire-clair); color: var(--primaire-fonce); padding: 6px 16px; border-radius: 8px; }

/* ---------- Présences ---------- */
.grille.compteurs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 820px) { .grille.compteurs .chiffre { padding: 8px 10px; } .grille.compteurs .valeur { font-size: 1.4rem; } }
.presence-choix { display: flex; gap: 4px; }
.presence-choix button { flex: 1; padding: 8px 4px; border: 1px solid var(--bordure); background: #fff; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--discret); }
.presence-choix button.actif.p { background: #E3F2E5; border-color: var(--succes); color: var(--succes); }
.presence-choix button.actif.a { background: #FCE4E4; border-color: var(--danger); color: var(--danger); }
.presence-choix button.actif.r { background: #FFF1DA; border-color: #A86700; color: #A86700; }
.presence-choix button:disabled { cursor: default; opacity: .7; }

/* ---------- Caisse ---------- */
.chiffre .valeur.petite { font-size: 1.25rem; line-height: 1.35; }
a.chiffre { display: block; color: inherit; }
.ligne-total { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--bordure); }
.ligne-total.solde { border-bottom: none; font-size: 1.1rem; padding-top: 8px; }
.eleve-caisse { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.photo.petite { width: 64px; height: 72px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--discret); }

.recus-page { max-width: 760px; }
.recu { position: relative; background: #fff; border: 1px solid #333; border-radius: 6px; padding: 14px 18px; color: #111; font-size: .92rem; overflow: hidden; }
.recu .tampon { position: absolute; top: 38%; left: 18%; transform: rotate(-18deg); font-size: 3.6rem; font-weight: 800; color: rgba(179, 38, 30, .35);
  border: 6px solid rgba(179, 38, 30, .35); padding: 0 20px; border-radius: 10px; pointer-events: none; }
.recu-tete { display: flex; gap: 12px; align-items: flex-start; border-bottom: 2px solid #333; padding-bottom: 8px; }
.recu-tete img { max-height: 64px; max-width: 90px; }
.recu-ecole { flex: 1; font-size: .85rem; }
.recu-ecole b { font-size: 1.05rem; display: block; }
.recu-numero { text-align: right; font-size: .85rem; }
.recu-titre { font-size: 1.4rem; font-weight: 800; letter-spacing: 3px; }
.recu-exemplaire { font-style: italic; color: #555; }
.recu-eleve { padding: 8px 0; border-bottom: 1px solid #ccc; }
.recu-eleve span { color: #555; font-size: .82rem; }
.recu-corps { display: flex; gap: 14px; align-items: flex-start; padding-top: 8px; }
.recu-corps table { flex: 1; border-collapse: collapse; }
.recu-corps td, .recu-corps th { border: 1px solid #999; padding: 4px 8px; }
.recu-corps th { background: #eee; text-align: left; }
.recu-corps tr.total td { font-weight: 800; background: #f5f5f5; }
.recu-qr { text-align: center; width: 112px; }
.recu-qr small { display: block; font-size: .72rem; }
.recu-lettres { margin-top: 8px; font-size: .88rem; }
.recu-infos { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: .85rem; }
.recu-pied { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: .85rem; }
.recu-signature { margin-top: 30px; border-top: 1px solid #333; padding-top: 2px; width: 180px; font-size: .75rem; color: #555; }
.recu-mention { text-align: right; font-size: .72rem; color: #555; }
.recu-coupe { text-align: center; color: #777; margin: 10px 0; overflow: hidden; white-space: nowrap; }

@media print {
  .recus-page { max-width: none; }
  .recu { page-break-inside: avoid; border-radius: 0; }
  .recu-corps th, .recu-corps tr.total td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Marge de page à 0 : le navigateur n'a plus de place pour son en-tête et son pied de page
   (adresse « localhost:5180/caisse », date, titre, numéro de page) ; la marge est remise à l'intérieur, sur chaque page. */
@page { margin: 0; }
@media print {
  .menu, .barre, .outils, .actions, .notifs, .pas-imprimer, .btn { display: none !important; }
  .seulement-impression { display: block; }
  html, body { background: #fff; font-size: 12px; margin: 0; }
  .contenu { padding: 12mm 14mm; max-width: none; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .tableau-conteneur, .carte { border: none; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td, th { border: 1px solid #999; padding: 4px 6px; }
}

/* ---------- Téléphone et petite tablette ---------- */
@media (max-width: 820px) {
  .menu { position: fixed; left: -260px; z-index: 40; transition: left .2s; width: 250px; }
  .menu.ouvert { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .btn-menu { display: block; }
  .barre { padding: 8px 12px; }
  .contenu { padding: 14px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .masquer-mobile { display: none; }
  .outils input, .outils select { min-width: 0; flex: 1 1 140px; }
  .choix { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .accueil .boite { padding: 20px; }
}

.menu nav a.inactif { opacity: .45; cursor: default; }
.menu nav a.inactif:hover { background: none; }
.alerte-medicale { background: #FCE4E4; border-left: 4px solid var(--danger); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }


.menu nav a.inactif { opacity: .45; cursor: default; }
.menu nav a.inactif:hover { background: none; }
.alerte-medicale { background: #FCE4E4; border-left: 4px solid var(--danger); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }


.suivi th, .suivi td { border: 1px solid #000; padding: 4px; text-align: left; vertical-align: top; }
.alerte.paiement { border-left: 4px solid var(--accent); }


@media (max-width: 900px) { .grille-consultation { grid-template-columns: 1fr !important; } }


/* ---------- Monnaies ---------- */
.choix-monnaie { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.choix-monnaie .btn { flex: 1; justify-content: center; }
