/* Feuille de style unique, structurée avec des variables CSS.
   Compatible Safari 15 : pas d'imbrication native, pas de container queries, pas de color-mix(). */
:root {
  --couleur-fond: #faf7f2;
  --couleur-texte: #2b2b2b;
  --couleur-ok: #1b6e3c;
  --couleur-ko: #a12622;
  --rayon: 12px;
  --espace: 16px;
}

* { box-sizing: border-box; }

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

.page-centree {
  max-width: 32rem;
  margin: 0 auto;
  padding: var(--espace);
  padding-left: max(var(--espace), env(safe-area-inset-left));
  padding-right: max(var(--espace), env(safe-area-inset-right));
}

/* Page de diagnostic /safari15-test */
.diag { list-style: none; padding: 0; }
.diag li { margin-bottom: 8px; word-break: break-word; }
.diag-info { color: var(--couleur-texte); }
/* Garde-fou : affiché par le serveur, retiré par le script de la page quand il s'exécute. */
.bandeau-garde-fou { margin: 0; padding: 12px var(--espace); background: #fbeeed; border-bottom: 3px solid var(--couleur-ko); color: var(--couleur-ko); font-weight: 700; }
.diag-ok { color: var(--couleur-ok); }
.diag-ko { color: var(--couleur-ko); }
.diag-sondes .sonde-dvh { height: 100vh; height: 100dvh; visibility: hidden; position: absolute; }

/* ---- Palette d'accent : une couleur par enfant (avatar, jauge) -------------------------
   --accent : fond ; --accent-texte : texte posé dessus (contraste AA vérifié par
   test/palette_test.rb) ; --accent-bord : liseré, pour que l'avatar reste visible sur le fond de page. */
.accent-ocean      { --accent: #1f5f8b; --accent-texte: #ffffff; --accent-bord: #174868; }
.accent-forest     { --accent: #2e6b3f; --accent-texte: #ffffff; --accent-bord: #23502f; }
.accent-terracotta { --accent: #b04a2a; --accent-texte: #ffffff; --accent-bord: #85381f; }
.accent-plum       { --accent: #7b3f76; --accent-texte: #ffffff; --accent-bord: #5c2f58; }
.accent-sunflower  { --accent: #f2c230; --accent-texte: #1f1f1f; --accent-bord: #8a6a00; }
.accent-rose       { --accent: #c2416a; --accent-texte: #ffffff; --accent-bord: #8f2f4d; }
.accent-slate      { --accent: #4a5a6a; --accent-texte: #ffffff; --accent-bord: #37444f; }
.accent-teal       { --accent: #17696b; --accent-texte: #ffffff; --accent-bord: #0f4f50; }

/* ---- Variables et éléments communs ---- */
:root {
  --couleur-carte: #ffffff;
  --couleur-bord: #d9d2c5;
  --couleur-lien: #1f5f8b;
  --ombre: 0 1px 3px rgba(0, 0, 0, 0.12);
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 var(--espace); }
a { color: var(--couleur-lien); }
.aide { color: #5a5a5a; margin-top: 0; }

/* ---- Messages flash ---- */
.flash {
  max-width: 32rem;
  margin: var(--espace) auto 0;
  padding: 12px var(--espace);
  border-radius: var(--rayon);
  border: 2px solid var(--couleur-bord);
  background: var(--couleur-carte);
}
.flash-alert { border-color: var(--couleur-ko); color: var(--couleur-ko); }
.flash-notice { border-color: var(--couleur-ok); color: var(--couleur-ok); }

/* ---- En-tête et menu avatar ---- */
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--espace);
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(var(--espace), env(safe-area-inset-left));
  padding-right: max(var(--espace), env(safe-area-inset-right));
  background: var(--couleur-carte);
  box-shadow: var(--ombre);
}
.entete-titre { font-weight: 700; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-texte);
  border: 2px solid var(--accent-bord);
  font-weight: 700;
  font-size: 1rem;
}

.menu-avatar { position: relative; }
.menu-avatar summary { list-style: none; cursor: pointer; border-radius: 50%; }
.menu-avatar summary::-webkit-details-marker { display: none; }
.menu-avatar summary:focus-visible { outline: 3px solid var(--couleur-lien); outline-offset: 2px; }
.menu-avatar-contenu {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 10;
  min-width: 17rem;
  padding: 8px;
  background: var(--couleur-carte);
  border: 1px solid var(--couleur-bord);
  border-radius: var(--rayon);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.menu-avatar-nom { margin: 4px 8px 8px; font-weight: 700; }
.menu-form { margin: 0; }
.menu-lien {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--couleur-texte);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-lien:hover, .menu-lien:focus-visible { background: var(--couleur-fond); }

/* ---- Formulaires ---- */
.carte-connexion { padding-top: 15vh; padding-top: 15dvh; }
.formulaire { display: flex; flex-direction: column; gap: var(--espace); }
.champ { display: flex; flex-direction: column; gap: 4px; }
.champ label { font-weight: 600; }
.champ input[type="text"], .champ input[type="password"] {
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--couleur-bord);
  border-radius: 8px;
  background: var(--couleur-carte);
  font: inherit;
  font-size: 16px; /* 16 px minimum : évite le zoom automatique d'iOS */
}
.champ input:focus-visible { outline: 3px solid var(--couleur-lien); outline-offset: 1px; }
.champ-case { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
.champ-case input { width: 24px; height: 24px; }
.champ-erreur input { border-color: var(--couleur-ko); }
.erreur { margin: 0; color: var(--couleur-ko); font-weight: 600; }
.erreur::before { content: "⚠ "; }

.bouton {
  min-height: 48px;
  padding: 10px 20px;
  border: 0;
  border-radius: var(--rayon);
  background: var(--couleur-lien);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.bouton:focus-visible { outline: 3px solid var(--couleur-texte); outline-offset: 2px; }
.lien-secondaire { align-self: center; padding: 12px; }

/* ---- Back-office (bureau d'abord, utilisable sur tablette) ---- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.nav-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--espace);
  padding: 0 var(--espace);
  background: var(--couleur-carte);
  border-bottom: 1px solid var(--couleur-bord);
}
.nav-admin a, .nav-desactive {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--couleur-texte);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.nav-admin a:hover { border-bottom-color: var(--couleur-bord); }
.nav-admin a[aria-current="page"] { font-weight: 700; border-bottom-color: var(--couleur-lien); }
.nav-admin a:focus-visible { outline: 3px solid var(--couleur-lien); outline-offset: -3px; }
.nav-desactive { color: #6b6b6b; cursor: not-allowed; }
.nav-desactive small { margin-left: 6px; font-style: italic; }

.page-admin { padding: var(--espace); } /* pleine largeur : aucune place perdue (CLAUDE.md §7.1, back-office) */
.entete-page { margin-bottom: var(--espace); display: flex; align-items: center; justify-content: space-between; gap: var(--espace); flex-wrap: wrap; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }

.cartes-stat { display: flex; flex-wrap: wrap; gap: var(--espace); margin-bottom: var(--espace); }
.carte-stat {
  display: flex; flex-direction: column; gap: 4px; min-width: 12rem; padding: var(--espace);
  background: var(--couleur-carte); border: 1px solid var(--couleur-bord); border-radius: var(--rayon);
  box-shadow: var(--ombre); color: var(--couleur-texte); text-decoration: none;
}
.carte-stat strong { font-size: 2rem; line-height: 1.1; }
.carte-stat:focus-visible, .carte-stat:hover { border-color: var(--couleur-lien); }

.bandeau-aide, .bandeau-info {
  padding: 10px var(--espace); margin: 0 0 var(--espace);
  background: #eef3f7; border: 1px solid #c9d6e0; border-radius: var(--rayon);
}
.bandeau-aide p { margin: 4px 0; }
.avertissement {
  margin: 4px 0 0; padding: 8px 12px; border-left: 4px solid var(--couleur-ko);
  background: #fbeeed; border-radius: 4px;
}

.tableau-conteneur { overflow-x: auto; background: var(--couleur-carte); border: 1px solid var(--couleur-bord); border-radius: var(--rayon); }
.tableau { width: 100%; border-collapse: collapse; }
.tableau th, .tableau td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--couleur-bord); vertical-align: middle; }
.tableau th { background: #f3efe7; white-space: nowrap; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau td.nombre { text-align: right; }
.tableau td.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tableau td.actions form { margin: 0; }
.avatar-ligne .avatar { width: 32px; height: 32px; font-size: 0.85rem; vertical-align: middle; }

.statut { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--couleur-bord); white-space: nowrap; }
.statut-actif { color: var(--couleur-ok); border-color: var(--couleur-ok); }
.statut-avenir { color: #7a4f00; border-color: #7a4f00; }
.statut-inactif { color: #4a4a4a; border-color: #8a8a8a; }

.pastille {
  display: inline-block; width: 20px; height: 20px; vertical-align: middle; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--accent-bord);
}

.bouton-secondaire { background: var(--couleur-carte); color: var(--couleur-lien); border: 2px solid var(--couleur-lien); }
.bouton-danger { background: var(--couleur-carte); color: var(--couleur-ko); border: 2px solid var(--couleur-ko); }
a.bouton { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tableau .bouton { min-height: 44px; padding: 6px 14px; font-weight: 600; }

fieldset.champ { border: 1px solid var(--couleur-bord); border-radius: var(--rayon); padding: 12px var(--espace); margin: 0; }
fieldset.champ legend { font-weight: 700; padding: 0 6px; }
.choix { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.choix input[type="radio"], .choix input[type="checkbox"] { width: 22px; height: 22px; }
.liste-enfants { margin: 0 0 8px 32px; }
.pastilles-couleur { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-couleur { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 2px solid transparent; border-radius: var(--rayon); cursor: pointer; }
.choix-couleur input { width: 18px; height: 18px; }
.choix-couleur input:checked + .pastille { outline: 3px solid var(--couleur-texte); outline-offset: 2px; }
.choix-couleur:focus-within { border-color: var(--couleur-lien); }

.pastilles-jours { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px 32px; }
.pastille-jour-wrap { position: relative; }
.pastille-jour-wrap input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.pastille-jour {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 2px solid var(--couleur-bord); border-radius: 50%; background: var(--couleur-carte); font-weight: 600; cursor: pointer;
}
.pastille-jour-wrap input:checked + .pastille-jour { background: var(--couleur-lien); border-color: var(--couleur-lien); color: #ffffff; }
.pastille-jour-wrap input:focus-visible + .pastille-jour { outline: 3px solid var(--couleur-texte); outline-offset: 2px; }

.dates { display: flex; flex-wrap: wrap; gap: var(--espace); }
.champ input[type="date"] { min-height: 48px; padding: 10px 12px; border: 2px solid var(--couleur-bord); border-radius: 8px; background: var(--couleur-carte); font: inherit; font-size: 16px; }
.champ select { min-height: 48px; padding: 10px 12px; border: 2px solid var(--couleur-bord); border-radius: 8px; background: var(--couleur-carte); font: inherit; font-size: 16px; }

.apercu { display: block; padding: 12px var(--espace); background: #f7f4ee; border: 1px dashed var(--couleur-bord); border-radius: var(--rayon); }
.apercu-dates { margin: 0 0 8px; padding-left: 20px; }
.apercu-vide { color: #5a5a5a; font-style: italic; }
.apercu-audience { margin: 0; font-weight: 600; }

.actions-formulaire { display: flex; align-items: center; gap: var(--espace); flex-wrap: wrap; }
.bloc { margin-top: 32px; padding-top: var(--espace); border-top: 1px solid var(--couleur-bord); }
.etiquette { font-weight: 600; }
.valeur-verrouillee { margin: 0; padding: 10px 12px; background: #eeebe4; border-radius: 8px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--espace); }
.details dt { font-weight: 600; }
.details dd { margin: 0; }

/* ---- Tabulator dans les listes du back-office ---- */
.tableau-conteneur .tabulator { border: 0; font-size: 16px; background: var(--couleur-carte); }
.tabulator .tabulator-header .tabulator-col { background: #f3efe7; }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
  min-height: 36px; padding: 4px 8px; font-size: 16px; border: 1px solid var(--couleur-bord); border-radius: 6px;
}
.tabulator .tabulator-cell { padding: 8px 10px; white-space: normal; }
.tabulator .tabulator-cell form { margin: 0; display: inline-block; }
.tabulator .tabulator-cell .bouton { min-height: 40px; padding: 4px 12px; font-weight: 600; margin-right: 6px; }
.tabulator .tabulator-cell a.bouton { display: inline-flex; }

/* =====================================================================================================
   Écrans de l'enfant (téléphone) : écran du jour, historique, avatar.
   Cible de conception : 414×617 px visibles (iPhone 7 Plus) ; contrôles 375×550 et 360×800 (CLAUDE.md §7.2).
   Pas de nesting CSS, pas de :has(), pas de container queries (Safari 15.6).
   ===================================================================================================== */
:root {
  --ligne-fond: #ffffff;
  --ligne-bord: #8a8577;
  --cercle-bord: #6f6a5e;
  --fait-fond: #e8f3ea;
  --fait-texte: #14532d;
  --fait-bord: #1b6e3c;
  --bravo-texte: #1b6e3c;
  --erreur-fond: #fbeeed;
  --erreur-texte: #8f1d1a;
  --toast-fond: #2b2b2b;
  --toast-texte: #ffffff;
  --info-fond: #e3eef7;
  --info-texte: #1f4e79;
  --texte-secondaire: #595959;
  --piste-jauge: #e6e0d5;
}

/* Sans le script (classe js absente ou retirée après une erreur), les lignes sont grisées : elles ne répondent pas. */
html:not(.js) .liste-jour { opacity: 0.6; }
html:not(.js) .ligne-icone { border-style: dashed; }
.js .bandeau-garde-fou { display: none; }
html.inerte .liste-jour { pointer-events: none; opacity: 0.6; }

/* Écran du jour : la zone visible est comptée au pixel (100vh, puis 100dvh là où il existe). */
body.page-jour {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-jour .entete { flex: none; min-height: 56px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
body.page-jour .entete-titre { font-size: 20px; font-weight: 700; margin: 0; }
body.page-jour .bandeau-garde-fou { flex: none; }
.jour { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.progression {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 32px;
  padding: 0 var(--espace);
  padding-left: max(var(--espace), env(safe-area-inset-left));
  padding-right: max(var(--espace), env(safe-area-inset-right));
}
progress.jauge {
  flex: 1;
  height: 12px;
  border: 1px solid var(--accent-bord);
  border-radius: 6px;
  background: var(--piste-jauge);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
progress.jauge::-webkit-progress-bar { background: var(--piste-jauge); }
progress.jauge::-webkit-progress-value { background: var(--accent); }
progress.jauge::-moz-progress-bar { background: var(--accent); }
.compteur { flex: none; min-width: 56px; text-align: right; font-size: 16px; font-weight: 700; }
.compteur-bravo { color: var(--bravo-texte); }

.liste-jour {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 6px var(--espace);
  padding-left: max(var(--espace), env(safe-area-inset-left));
  padding-right: max(var(--espace), env(safe-area-inset-right));
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Les lignes se partagent la hauteur : 44 px au moins, 64 px au plus ; la liste défile seule au-delà. */
.ligne-item { flex: 1 1 0; min-height: 44px; max-height: 64px; }

.ligne {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 0 14px;
  overflow: hidden;
  border: 2px solid var(--ligne-bord);
  border-radius: 14px;
  background: var(--ligne-fond);
  color: var(--couleur-texte);
  font: inherit;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
  /* Appui long : ni menu contextuel ni loupe ni sélection de texte sur iOS (le préfixe -webkit- est indispensable). */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ligne:focus-visible { outline: 3px solid var(--couleur-lien); outline-offset: 2px; }
.ligne-fait { background: var(--fait-fond); border-color: var(--fait-bord); border-left-width: 6px; }
.ligne-icone {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--cercle-bord);
  border-radius: 50%;
  font-weight: 700;
}
.ligne-fait .ligne-icone { background: var(--fait-bord); border-color: var(--fait-bord); color: #ffffff; }
.ligne-texte { min-width: 0; display: flex; flex-direction: column; }
.ligne-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ligne-fait .ligne-nom { font-weight: 400; }
.ligne-sous { font-size: 16px; color: var(--texte-secondaire); }
.ligne-etat { flex: none; margin-left: auto; font-size: 16px; font-weight: 600; color: var(--fait-texte); }

/* Jauge de l'appui long : elle se remplit de gauche à droite en 600 ms. */
.jauge-appui {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--accent);
  opacity: 0.25;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left;
}
.ligne.appui .jauge-appui { transform: scaleX(1); transition: transform 600ms linear; }
.ligne.appui { border-color: var(--accent-bord); }
.ligne.appui-simple { border-color: var(--accent-bord); }

/* Réduire les animations : pas de jauge animée, mais un changement d'état statique dès l'appui
   (contour épais + fond teinté) pour que l'enfant sache que son appui est pris en compte. */
@media (prefers-reduced-motion: reduce) {
  .ligne.appui .jauge-appui {
    transition: none;
    transform: scaleX(0);
  }
  .ligne.appui {
    outline: 4px solid var(--accent-bord);
    outline-offset: -4px;
    background: var(--info-fond);
  }
}

.jour-vide { flex: none; padding: 24px var(--espace) 8px; text-align: center; }
.jour-vide-titre { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.jour-vide-sous { margin: 0; font-size: 16px; color: var(--texte-secondaire); }

.bandeau-jour-passe {
  flex: none;
  min-height: 52px;
  padding: 6px var(--espace);
  background: var(--info-fond);
  color: var(--info-texte);
  font-size: 16px;
}
.bandeau-jour-passe p { margin: 0; font-weight: 700; }
.bandeau-jour-passe a { display: inline-block; padding: 12px 0; margin: -12px 0; color: var(--info-texte); }

.bandeau-alerte {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 6px var(--espace);
  background: var(--erreur-fond);
  color: var(--erreur-texte);
  font-size: 16px;
  font-weight: 700;
}
.bouton-mini {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--erreur-texte);
  border-radius: 12px;
  background: var(--ligne-fond);
  color: var(--erreur-texte);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

/* Message en bas de l'écran : indice « Maintiens pour valider », erreurs, messages du serveur (même emplacement). */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
  padding: 12px 16px;
  border: 2px solid var(--toast-fond);
  border-radius: 12px;
  background: var(--toast-fond);
  color: var(--toast-texte);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 150ms;
}
.toast-visible { opacity: 1; visibility: visible; }
.toast-erreur { border-color: var(--erreur-texte); background: var(--erreur-fond); color: var(--erreur-texte); }

body.page-jour .menu-avatar-contenu { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; }
.menu-avatar-contenu { width: 272px; min-width: 0; }

/* Historique /jours : 7 lignes de 56 px. */
.page-jours { padding: 8px var(--espace) var(--espace); }
.lien-aujourdhui { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.liste-jours { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.jour-lien {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 14px;
  border: 2px solid var(--ligne-bord);
  border-radius: 14px;
  background: var(--ligne-fond);
  color: var(--couleur-texte);
  text-decoration: none;
}
.jour-nom { flex: 1; min-width: 0; font-weight: 600; }
.jour-compteur { font-weight: 700; }
.jour-etat { flex: none; min-width: 112px; text-align: right; font-size: 16px; }
.jour-etat-complet { color: var(--fait-texte); font-weight: 600; }

/* Avatar : photo ou initiales. */
.avatar-photo { object-fit: cover; padding: 0; }
.avatar-grand { width: 96px; height: 96px; font-size: 2rem; }
.avatar-apercu { display: flex; justify-content: center; margin-bottom: var(--espace); }


/* =====================================================================================================
   Back-office sur laptop (CLAUDE.md §7.1, §8) : viewport de référence 1526 × 718 ; contrôles 1920 × 950 et
   1280 × 600. Aucune place perdue : pleine largeur (marges de 10 px), barre d'une ligne de 40 px, boutons de
   32 px à la souris (44 px au doigt), UN SEUL mécanisme de défilement vertical à la fois.
   ===================================================================================================== */
body.admin {
  --marge-admin: 10px;
  --haut-barre: 40px;
  --haut-bouton: 32px;
  font-size: 15px;
  line-height: 1.35;
}
@media (pointer: coarse) { body.admin { --haut-bouton: 44px; --haut-barre: 48px; } }

.barre-admin {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--haut-barre); padding: 0 var(--marge-admin);
  background: var(--couleur-carte); border-bottom: 1px solid var(--couleur-bord); box-shadow: var(--ombre);
}
body.admin .nav-admin { flex-wrap: nowrap; gap: 0 18px; padding: 0; border: 0; background: none; height: 100%; }
body.admin .nav-admin a { min-height: var(--haut-barre); height: 100%; }
body.admin .barre-admin .avatar { width: 30px; height: 30px; font-size: 0.8rem; }
body.admin .barre-admin .menu-avatar summary { display: block; line-height: 0; }

body.admin .page-admin { padding: 8px var(--marge-admin) 12px; }
body.admin h1 { font-size: 1.25rem; line-height: 1.2; margin: 0; }
body.admin .page-admin > h1 { margin-bottom: 8px; }
body.admin .entete-page { justify-content: flex-start; gap: 6px 12px; margin-bottom: 8px; }
body.admin .entete-page h1 { margin-right: auto; }
body.admin .aide { margin: 0 0 6px; }
body.admin h2 { font-size: 1rem; margin: 0 0 4px; }
body.admin .flash { max-width: none; margin: 6px var(--marge-admin) 0; padding: 6px 12px; border-width: 1px; }

body.admin .bouton,
body.admin .tableau .bouton,
body.admin .tabulator .tabulator-cell .bouton {
  min-height: var(--haut-bouton); padding: 2px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1.2;
}
body.admin .bouton-secondaire, body.admin .bouton-danger { border-width: 1px; }
body.admin .lien-secondaire { padding: 4px 8px; }
body.admin .tabulator .tabulator-cell .bouton { margin-right: 6px; }

/* Aide repliable (Attributions) */
body.admin .bandeau-aide { padding: 4px 10px; margin: 0 0 6px; }
body.admin .bandeau-aide summary { cursor: pointer; font-weight: 600; }
body.admin .bandeau-aide p { margin: 4px 0; }

/* ---- Tableaux (Tabulator) ---- */
body.admin .tableau-conteneur { overflow: visible; background: none; border: 0; border-radius: 0; }
body.admin .tabulator { border: 1px solid var(--couleur-bord); font-size: 14px; background: var(--couleur-carte); }
body.admin .tabulator .tabulator-header .tabulator-col { background: #f3efe7; }
body.admin .tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 4px 6px; }
body.admin .tabulator .tabulator-header .tabulator-col .tabulator-col-title { white-space: nowrap; overflow: visible; text-overflow: clip; }
body.admin .tabulator .tabulator-header .tabulator-col .tabulator-header-filter { margin-top: 2px; }
body.admin .tabulator .tabulator-header .tabulator-col .tabulator-header-filter input,
body.admin .tabulator .tabulator-header .tabulator-col .tabulator-header-filter select {
  width: 100%; min-height: 0; height: 30px; padding: 2px 6px; font: inherit; font-size: 14px;
  border: 1px solid var(--couleur-bord); border-radius: 6px; background: var(--couleur-carte);
}
body.admin .tabulator .tabulator-cell { padding: 3px 8px; white-space: normal; }
body.admin .tabulator .tabulator-row { min-height: 0; }
body.admin .tabulator .tabulator-cell .avatar-ligne .avatar { width: 24px; height: 24px; font-size: 0.7rem; }

/* Listes courtes (Enfants, Activités, Attributions) : la PAGE défile (navigateur), la ligne de titres est
   collante. Aucune hauteur bornée, aucun défilement interne ; les débordements de Tabulator sont levés pour que
   « position: sticky » ait pour repère le défilement de la page. */
body.admin [data-data-table-mode-value="page"] .tabulator,
body.admin [data-data-table-mode-value="page"] .tabulator .tabulator-tableholder,
body.admin [data-data-table-mode-value="page"] .tabulator .tabulator-tableholder .tabulator-table { overflow: visible; }
body.admin [data-data-table-mode-value="page"] .tabulator .tabulator-header { position: sticky; top: 0; z-index: 5; overflow: visible; }
body.admin [data-data-table-mode-value="page"] .tabulator .tabulator-header .tabulator-headers { overflow: visible; }

/* Suivi : la page ne défile pas ; le tableau occupe la hauteur restante et SEUL son corps défile. */
body.admin-plein-ecran { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.admin-plein-ecran .barre-admin { flex: none; }
body.admin-plein-ecran .flash { flex: none; }
.page-suivi { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding-bottom: 8px; }
.page-suivi .entete-page, .compteurs-suivi { flex: none; }
.zone-tableau { position: relative; flex: 1 1 0; min-height: 0; }
.zone-tableau > [data-listing-target="holder"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.entete-suivi { flex-wrap: nowrap; align-items: center; }
.entete-suivi h1 { flex: none; margin-right: 8px; }
.entete-suivi .raccourcis { display: flex; gap: 6px; }
.entete-suivi .periode { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.entete-suivi .periode label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.entete-suivi .periode input[type="date"] { min-height: var(--haut-bouton); padding: 2px 6px; font-size: 14px; border-width: 1px; border-radius: 6px; }
.entete-suivi .bouton { white-space: nowrap; }
.compteurs-suivi { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; min-height: 24px; margin-bottom: 6px; }
.compteur-fait strong { color: var(--couleur-ok); }
.compteur-non-fait strong { color: var(--couleur-ko); }
.compteur-aide { color: #5a5a5a; }
.erreur-export { margin: 0 0 6px; }
.statut-ko { color: var(--couleur-ko); border-color: var(--couleur-ko); }
.mention-hp { font-size: 0.85em; font-style: italic; color: #4a4a4a; white-space: nowrap; }
body.admin .tabulator .tabulator-row.ligne-suivi-non-fait { background: #fbeeed; }
body.admin .tabulator .tabulator-row.ligne-suivi-fait { background: #eef6f0; }

/* ---- Formulaire d'attribution : deux colonnes sur écran large ---- */
body.admin .formulaire { gap: 8px; }
body.admin .choix { min-height: var(--haut-bouton); gap: 8px; }
body.admin .choix input[type="radio"], body.admin .choix input[type="checkbox"] { width: 18px; height: 18px; }
body.admin .champ select, body.admin .champ input[type="date"], body.admin .champ input[type="text"] {
  min-height: var(--haut-bouton); padding: 2px 8px; font-size: 14px; border-width: 1px; border-radius: 6px;
}
body.admin fieldset.champ { padding: 4px 10px 6px; }
body.admin .liste-enfants, body.admin .pastilles-jours { margin: 0 0 4px 26px; gap: 6px; }
body.admin .pastille-jour-wrap input { width: var(--haut-bouton); height: var(--haut-bouton); }
body.admin .pastille-jour { width: var(--haut-bouton); height: var(--haut-bouton); }
body.admin .apercu { padding: 6px 10px; }
body.admin .apercu-dates { margin: 0 0 4px; }
body.admin .dates { gap: 8px 16px; }
.deux-colonnes { display: block; }
.colonne-regle, .colonne-apercu { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 1100px) {
  .deux-colonnes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px 24px; align-items: start; }
  .colonne-regle { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 16px; align-items: start; }
  .colonne-regle > .champ:first-child, .colonne-regle > .dates { grid-column: 1 / -1; }
}
body.admin .liste-enfants { display: flex; flex-wrap: wrap; gap: 0 16px; } /* cases en ligne : la liste ne s'allonge pas avec le nombre d'enfants */
.chargement { position: absolute; top: 16px; left: 0; right: 0; margin: 0; text-align: center; font-weight: 600; color: #4a4a4a; }
.chargement.erreur { color: var(--couleur-ko); }
.bouton:disabled { opacity: 0.7; cursor: progress; }
