@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --fond: #F6F4EF;
  --texte: #1E1C19;
  --discret: #5E5A52;
  --carte: #FFFFFF;
  --trait: #D9D5CB;
  --erreur: #A8260A;
  --orange: #A8460A;
  --matin: #F9D3DA;
  --soir: #D7EAB8;
  --nuit: #CBDDF6;
  --repos: #ECE9E2;
  --autre: #FBE98F;
  --creche: #E3D9F6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

main {
  max-width: 430px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px 40px;
}

h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 4px; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }
ul { margin: 0; padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 8px; }

.discret { color: var(--discret); }
.petit { font-size: 12px; }
.gras { font-weight: 600; }
.gros { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.etiquette { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin: 8px 0 4px; }
.titre-liste { margin-top: 28px; }

label { display: block; font-weight: 600; margin: 20px 0 8px; }

input[type="text"], input[type="password"], input[type="date"] {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  font: inherit;
  color: var(--texte);
  background: var(--carte);
  border: 1.5px solid var(--trait);
  border-radius: 12px;
}

:focus-visible { outline: 3px solid var(--texte); outline-offset: 2px; }

button, .bouton {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 52px;
  border-radius: 12px;
  cursor: pointer;
}

button:disabled { opacity: .45; cursor: not-allowed; }

.principal { background: var(--texte); color: #FFFFFF; border: 0; }
.secondaire { background: transparent; color: var(--texte); border: 1.5px solid var(--texte); }
.lien { background: transparent; border: 0; color: var(--texte); text-decoration: underline; width: auto; min-height: 48px; line-height: 1.2; margin-top: 8px; padding: 0 4px; }
.retour { text-decoration: none; margin: 0 0 4px -4px; }

.carte {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0;
}
.carte p { margin: 0 0 8px; }
.carte.nouveau { background: #FFFDF5; }
.carte.conflit { border-color: var(--orange); }
.carte label { margin-top: 12px; }

.erreur { color: var(--erreur); font-weight: 600; margin: 12px 0 0; }

.bandeau {
  background: var(--autre);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
}

.liste li { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.liste li p { margin: 0; }
.liste.simple li { background: transparent; border: 0; padding: 4px 0; margin: 0; font-size: 14px; }

.alertes { margin: 12px 0; }
.alertes li { background: var(--autre); border: 1.5px dashed var(--orange); border-radius: 12px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }

/* Grille de 4 semaines */
.grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 16px 0 8px; }
.entete-jour { text-align: center; font-size: 12px; font-weight: 700; color: var(--discret); }
.case-jour {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 58px; margin: 0; padding: 4px 0; line-height: 1.15;
  border: 1.5px solid transparent; border-radius: 10px; color: var(--texte); font-weight: 400;
}
.case-jour .num { font-size: 12px; font-weight: 600; }
.case-jour .lettre { font-size: 18px; font-weight: 700; }
.case-jour .mini-creche { font-size: 11px; background: var(--creche); border-radius: 6px; padding: 0 3px; }
.case-jour .mini-creche.vide { background: transparent; }
.case-jour.ferie { border-color: var(--texte); }

.t-matin { background: var(--matin); }
.t-soir { background: var(--soir); }
.t-nuit { background: var(--nuit); }
.t-repos { background: var(--repos); }
.t-conge { background: var(--repos); border-color: var(--discret); }
.t-autre { background: var(--autre); border-style: dashed; border-color: var(--orange); }
.t-creche { background: var(--creche); }

.legende { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 8px; font-size: 12px; }
.legende li { display: flex; align-items: center; gap: 6px; }
.puce { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 8px; font-weight: 700; font-size: 12px; border: 1.5px solid transparent; }
.puce.ferie { border-color: var(--texte); }

/* Récapitulatif */
.totaux { display: flex; gap: 12px; margin: 16px 0; }
.total { flex: 1; background: var(--carte); border: 1px solid var(--trait); border-radius: 16px; padding: 14px; }
.total.t-creche { background: var(--creche); border-color: transparent; }
.total p { margin: 0; font-size: 13px; }
.total .chiffre { font-size: 36px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.semaine { margin: 14px 0; }
.rangee { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini { display: block; text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; border-radius: 6px; min-height: 26px; }
.mini.vide { background: transparent; color: var(--discret); font-weight: 400; }
.mini.t-conge, .mini.t-repos { background: var(--repos); }

.case { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; }
.case input { width: 24px; height: 24px; flex: none; }
details { margin-top: 8px; font-size: 14px; }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

/* Feuille du bas */
#voile { position: fixed; inset: 0; background: rgba(30, 28, 25, .45); z-index: 10; }
#feuille {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-width: 430px; margin: 0 auto; max-height: 90vh; overflow-y: auto;
  background: var(--fond); border-radius: 20px 20px 0 0; padding: 20px 16px max(20px, env(safe-area-inset-bottom));
}
.choix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#feuille-creche { grid-template-columns: repeat(2, 1fr); }
.choix-bouton { margin: 0; min-height: 48px; line-height: 1.2; background: var(--carte); color: var(--texte); border: 1.5px solid var(--trait); padding: 0 6px; }
.choix-bouton.t-matin { background: var(--matin); }
.choix-bouton.t-soir { background: var(--soir); }
.choix-bouton.t-nuit { background: var(--nuit); }
.choix-bouton.t-repos, .choix-bouton.t-conge { background: var(--repos); }
.choix-bouton.t-autre { background: var(--autre); }
.choix-bouton[aria-pressed="true"] { border: 3px solid var(--texte); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.deux button { margin: 0; }

[hidden] { display: none !important; }

/* Sélection de plusieurs jours */
#selection-bascule { margin-top: 8px; }
#selection-bascule[aria-pressed="true"] { background: var(--texte); color: #FFFFFF; }
.case-jour.selectionne { outline: 3px solid var(--texte); outline-offset: -3px; }
.case-jour[aria-pressed="true"]::after { content: "✓"; font-size: 11px; font-weight: 700; }
.barre-selection {
  position: sticky; bottom: 0; z-index: 5; margin: 12px -16px 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--fond); border-top: 1.5px solid var(--trait); box-shadow: 0 -6px 12px rgba(30, 28, 25, .06);
}
.barre-selection p { margin: 0 0 8px; }
.barre-selection .choix { grid-template-columns: repeat(5, 1fr); }
.barre-selection .choix-bouton { font-size: 13px; padding: 0 2px; }
.choix-bouton:disabled { opacity: .5; }

/* Horaire de crèche personnalisé et PDF */
#feuille-perso { margin-top: 8px; }
#feuille-perso label { margin: 8px 0 4px; font-size: 14px; }
input[type="time"] { width: 100%; min-height: 52px; padding: 0 14px; font: inherit; color: var(--texte); background: var(--carte); border: 1.5px solid var(--trait); border-radius: 12px; }
.carte.pdf { background: var(--creche); border-color: transparent; }
.carte.pdf button { margin-top: 10px; }

textarea { width: 100%; padding: 12px 14px; font: inherit; line-height: 1.4; color: var(--texte); background: var(--carte); border: 1.5px solid var(--trait); border-radius: 12px; resize: vertical; }
.carte.pdf input[type="text"], .carte.pdf textarea { background: #FFFFFF; }

.deux-choix { grid-template-columns: repeat(2, 1fr); }

/* Photo lue et cases à vérifier */
.miniature { display: block; width: 100%; height: auto; margin: 12px 0; border: 1px solid var(--trait); border-radius: 12px; background: #FFFFFF; }
.etapes { list-style: none; margin: 8px 0 12px; padding: 0; }
.etapes li { padding: 8px 0; border-bottom: 1px solid var(--trait); font-weight: 600; }
.etapes li.attente { color: var(--discret); font-weight: 400; }
.etapes li.en-cours { color: var(--texte); }
.etapes li.fait { color: var(--texte); }
.etapes li.echec { color: var(--erreur); }
.case-jour.a-preciser { border: 2px dashed var(--orange); }
.case-jour.a-verifier { border: 2px dashed rgba(168, 70, 10, .55); }
