/* Rencontres parents-maîtresses : feuille de style unique.
   Mobile d'abord, aucun CDN, aucune police externe. Ossature et palette
   reprises du foyer de mini-sites (ménage, travaux, paniers, agenda, portail) :
   neutres stone, bleu sarcelle sauge du logo pour l'identité, brun terre cuite
   pour ce qui reste à faire. Titres en Cormorant Garamond auto-hébergée, comme
   le site de l'école.

   DEUX FAMILLES DE COULEUR, PAS UNE DE PLUS. Le bleu porte l'identité et tout
   ce qui est acquis (bandeau, titres, rendez-vous pris) ; le brun porte ce qui
   attend (créneau à choisir, familles sans rendez-vous). Aucun vert, aucun
   rouge d'alarme : une famille qui n'a pas encore choisi n'a rien fait de mal. */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/cormorant-garamond-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("fonts/cormorant-garamond-italic-latin.woff2") format("woff2");
}

:root {
  --bg:#fafaf9; --card:#ffffff; --ink:#1c1917; --ink-2:#292524;
  --muted:#78716c; --muted-2:#8a837d; --line:#e7e5e4; --line-2:#d6d3d1;
  --brand:#235b5b; --brand-2:#1b4949; --brand-clair:#b6d8d8;
  --brand-deco:#83b9b9; --brand-bg:#f2fafa; --brand-fonce:#1f5252;
  --entete:#92b6b6; --entete-tx:#123833; --entete-sous:#16453c;
  --terre:#a9762f; --terre-bg:#f8f1e6; --terre-tx:#5c4327; --terre-ln:#e3d2b6;
  --terre-fort:#ecdcc0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}
body.fige { overflow: hidden; }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }
button, input { font-family: inherit; }
.serif { font-family: "Cormorant Garamond", Georgia, serif; }

.chargement { padding: 40vh 0 0; text-align: center; color: var(--muted-2); }

/* ---- En-tête de marque : il défile, il ne colle pas -------------------- */

header.app {
  background: var(--entete); color: var(--entete-tx);
  padding: calc(16px + env(safe-area-inset-top)) 20px 15px;
  display: flex; align-items: center; gap: 12px;
}
header.app .logo {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.55);
}
header.app h1 {
  margin: 0; font-size: 21px; line-height: 1.15; font-weight: 600; min-width: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
}
header.app h1 .sub {
  display: block; color: var(--entete-sous); font-size: 14px;
  font-style: italic; font-weight: 400;
}
/* Retour au portail : pastille ronde au coin haut-gauche, la place où l'on
   cherche un retour sur téléphone. Le lien porte le code du portail. */
header.app .retour {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.72); color: var(--entete-sous);
  border: 1px solid rgba(255,255,255,.8); text-decoration: none;
}
header.app .retour span { font-size: 25px; line-height: 1; margin-top: -3px; }
header.app .retour:active { background: #ffffff; }

/* ---- Onglets ----------------------------------------------------------- */

nav.tabs {
  display: flex; position: sticky; top: 0; z-index: 10;
  background: rgba(250,250,249,.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
nav.tabs button {
  flex: 1; padding: 14px 4px; font-size: 14px; font-weight: 600; min-height: 48px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: #57534e; cursor: pointer; min-width: 0;
  transition: color .15s, border-color .15s;
}
nav.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

main { flex: 1; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }

h2.sec {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px; font-weight: 600; margin: 0 0 4px; color: var(--brand);
}
p.hint { color: #57534e; font-size: 13px; margin: 2px 0 14px; }

/* ---- Bandeau de la réunion choisie ------------------------------------- */

.reunion {
  background: var(--terre-bg); border: 1px solid var(--terre-ln);
  border-radius: 16px; padding: 14px 16px; margin-bottom: 16px;
}
.reunion .quand {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 21px; font-weight: 600; color: var(--terre-tx); line-height: 1.2;
}
.reunion .ou { color: #6b5a48; font-size: 13.5px; margin-top: 3px; }
.reunion .bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.75); overflow: hidden; margin-top: 12px; }
.reunion .bar > span { display: block; height: 100%; background: var(--terre); transition: width .4s ease; }
.reunion .compte { color: #6b5a48; font-size: 12.5px; margin-top: 6px; }
.reunion.passee { opacity: .6; }

/* Sélecteur de réunion : n'apparaît qu'à partir de deux dates ouvertes. */
.choix-reunion { display: flex; gap: 8px; margin-bottom: 14px; }
.choix-reunion button {
  flex: 1; min-height: 44px; padding: 9px 10px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: #44403c;
  font-size: 13.5px; font-weight: 600; line-height: 1.25;
}
.choix-reunion button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- Choix de la famille ----------------------------------------------- */

input.search {
  width: 100%; padding: 14px 16px; font-size: 16px; border: 1px solid var(--line-2);
  border-radius: 12px; background: #fff; outline: none; margin-bottom: 12px; color: var(--ink);
}
input.search:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-bg); }

.pick {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 6px; font-size: 16px;
  cursor: pointer; min-height: 52px; color: var(--ink); font-weight: 600;
  overflow-wrap: anywhere; transition: background .1s;
}
.pick:active { background: #f5f5f4; }
.pick .qui { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }

.me-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.me-head .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #57534e; }
.me-head .name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px; font-weight: 600; color: var(--brand); margin-top: 1px; overflow-wrap: anywhere;
}
.link {
  background: none; border: none; color: var(--brand-2); font-size: 13px;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
  /* 48 px de haut minimum : c'est une vraie cible tactile, pas un lien de bas
     de page. Le remplissage vertical fait le travail sans grossir le texte. */
  padding: 14px 0; min-height: 48px; flex-shrink: 0;
}

/* ---- Les cartes « une classe, un rendez-vous » -------------------------- */

.rdvs { list-style: none; margin: 0; padding: 0; }
.rdvs li { margin-bottom: 10px; }
button.classe {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 52px 1fr auto; gap: 0 13px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 15px; min-height: 74px; color: var(--ink);
  transition: border-color .15s, background .15s, transform .08s;
}
button.classe:active { transform: scale(.99); }
button.classe .icone {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line-2);
  box-shadow: 0 1px 4px rgba(28,25,23,.07);
  display: flex; align-items: center; justify-content: center;
}
button.classe .icone img { width: 40px; height: 40px; object-fit: contain; }
button.classe .texte { min-width: 0; }
button.classe .nom {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px; font-weight: 600; color: var(--brand); line-height: 1.2;
}
button.classe .enfant { font-size: 13px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
button.classe .heure { font-size: 14.5px; font-weight: 700; color: var(--brand-2); margin-top: 3px; }
button.classe .heure.vide { color: var(--terre-tx); font-weight: 600; }
button.classe .fl { color: var(--line-2); font-size: 22px; line-height: 1; }

/* Rendez-vous pris : la carte passe au bleu pâle. À prendre : le brun. */
button.classe.pris { border-color: var(--brand-clair); background: var(--brand-bg); }
button.classe.pris .fl { color: var(--brand-deco); }
button.classe.libre { border-color: var(--terre-ln); background: var(--terre-bg); }
button.classe.libre .fl { color: var(--terre-ln); }
button.classe.complet { background: #f5f5f4; }
button.classe:disabled { cursor: default; opacity: .75; }

.vide-etat {
  border: 1px dashed var(--line-2); border-radius: 14px; padding: 22px 18px;
  text-align: center; color: var(--muted); font-size: 14px;
}

.notice { border-radius: 12px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; border: 1px solid; }
.notice.info { background: var(--brand-bg); color: var(--brand-2); border-color: var(--brand-clair); }
.notice.warn { background: var(--terre-bg); color: var(--terre-tx); border-color: var(--terre-ln); }

/* ---- Panneau du bas : la grille des créneaux d'une classe --------------- */

.sheet-fond { position: fixed; inset: 0; background: rgba(28,25,23,.5); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; margin: 0 auto; max-width: 560px;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto; box-shadow: 0 -10px 34px rgba(0,0,0,.22);
}
.sheet .poignee { width: 42px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px; font-weight: 600; color: var(--brand); margin: 0 0 2px;
}
.sheet .sous { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }

/* Deux colonnes d'horaires : de quoi lire l'heure ET l'état sans zoomer. */
.creneaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
button.slot {
  min-height: 62px; padding: 9px 11px; border: 2px solid var(--line); border-radius: 13px;
  background: #fff; color: var(--ink); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: transform .08s;
}
button.slot:active { transform: scale(.97); }
button.slot .h { font-family: "Cormorant Garamond", Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1.1; }
/* L'état double la couleur par du texte : la couleur seule ne peut pas être le
   seul signal (daltonisme, écran au soleil). */
button.slot .etat { font-size: 11.5px; font-weight: 700; }
button.slot .etat.libre { color: var(--muted); font-weight: 500; font-style: italic; }
button.slot.pris { border-color: var(--line-2); background: #f5f5f4; color: var(--muted); cursor: default; }
button.slot.pris .etat { color: #57534e; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.slot.conflit { border-color: var(--terre-ln); background: var(--terre-bg); color: var(--terre-tx); cursor: default; }
button.slot.conflit .etat { color: var(--terre-tx); }
button.slot.mien { border-color: var(--brand-deco); background: var(--entete); color: var(--entete-tx); }
button.slot.mien .etat { color: var(--entete-sous); }
button.slot:disabled { cursor: default; }

.sheet .annuler {
  width: 100%; margin-top: 14px; min-height: 50px; padding: 13px;
  border-radius: 12px; border: 1px solid var(--line-2); background: #fff;
  color: #44403c; font-size: 15px; font-weight: 600; cursor: pointer;
}
.sheet .annuler:active { background: #f5f5f4; }
.spin { display:inline-block; width:14px; height:14px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; vertical-align:-2px; animation:spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ---- Planning : la grille, classe par classe --------------------------- */

details.classe-plan {
  border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 0 14px; margin-bottom: 10px;
}
details.classe-plan > summary {
  list-style: none; cursor: pointer; padding: 13px 0; min-height: 50px;
  display: flex; align-items: center; gap: 10px;
}
details.classe-plan > summary::-webkit-details-marker { display: none; }
details.classe-plan > summary::after { content: "▾"; margin-left: auto; color: var(--muted-2); }
details.classe-plan[open] > summary::after { content: "▴"; }
details.classe-plan summary .nom {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px; font-weight: 600; color: var(--brand);
}
.chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px solid; white-space: nowrap; flex-shrink: 0;
}
.chip.reste { background: var(--terre-bg); color: var(--terre-tx); border-color: var(--terre-ln); }
.chip.plein { background: var(--brand-bg); color: var(--brand-2); border-color: var(--brand-clair); }

ul.grille { list-style: none; margin: 0; padding: 0 0 12px; }
ul.grille li {
  display: flex; align-items: baseline; gap: 10px;
  border-top: 1px solid var(--line); padding: 8px 2px; font-size: 14px;
}
ul.grille li:first-child { border-top: none; }
ul.grille .h { font-weight: 700; color: #44403c; flex-shrink: 0; min-width: 96px; }
ul.grille .q { min-width: 0; overflow-wrap: anywhere; }
ul.grille .q.vide { color: var(--muted-2); font-style: italic; }
ul.grille li.mien { background: var(--brand-bg); border-radius: 8px; }
ul.grille li.mien .q { color: var(--brand-2); font-weight: 700; }

/* ---- Suivi : qui n'a pas encore choisi --------------------------------- */

li.miss {
  background: var(--terre-bg); border: 1px solid var(--terre-ln); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px; list-style: none;
}
li.miss .nom { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; display: block; }
li.miss .quoi { font-size: 13px; color: #6b5a48; margin: 2px 0 8px; overflow-wrap: anywhere; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 8px 6px; border-radius: 12px; font-size: 13px; font-weight: 600;
  text-decoration: none; line-height: 1.25; overflow-wrap: anywhere;
}
.contact a.tel { background: #fff; color: var(--brand-2); border: 1px solid var(--line-2); }
.contact a.tel:active { background: #f5f5f4; }
.contact a.wa { background: #047857; color: #fff; }
.contact a.wa:active { background: #065f46; }

a.export {
  display: block; text-align: center; text-decoration: none;
  min-height: 48px; padding: 13px; border-radius: 12px; margin-top: 6px;
  border: 1px solid var(--line-2); background: #fff; color: var(--brand-2);
  font-size: 14.5px; font-weight: 600;
}

/* ---- Porte d'accès ------------------------------------------------------ */

.porte { padding: 34px 22px; text-align: center; }
.porte h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600; font-size: 26px; color: var(--brand-fonce); margin: 0 0 6px;
}
.porte .hint { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.porte form { display: flex; gap: 10px; max-width: 340px; margin: 0 auto; }
.porte input {
  flex: 1; min-width: 0; font-size: 17px; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--card);
}
.porte button {
  font-size: 16px; font-weight: 700; padding: 12px 20px; min-height: 48px;
  background: var(--brand); color: #fff; border: none; border-radius: 12px; cursor: pointer;
}
.porte .erreur {
  color: var(--terre-tx); background: var(--terre-bg); border: 1px solid var(--terre-ln);
  border-radius: 10px; padding: 8px 12px; font-size: 14px; max-width: 340px; margin: 14px auto 0;
}

.panne { text-align: center; color: var(--muted); padding: 30px 20px; }

/* ---- Pied -------------------------------------------------------------- */

footer {
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center; color: var(--muted-2); font-size: 13px;
}
footer .filet {
  width: 74px; height: 2px; border-radius: 1px;
  background: var(--brand-deco); margin: 0 auto 12px;
}
