/* Design tokens — crèche « Les Fées Féliciennes » (handoff haute-fidélité) */
:root {
  /* Couleurs */
  --fond: #f4eee1;
  --surface: #fffdf7;
  --bord: #e7dfcd;
  --bord-2: #e9e1cf;
  --bord-3: #f0e9d9;
  --separateur: #f6f0e2;
  --encre: #2e2a23;
  /* Gris chauds assombris pour atteindre WCAG AA (>=4.5:1) sur la surface
     claire, tout en gardant la gradation d'origine. Les codes allergènes
     (--sec-4) sont une info de sécurité : ils doivent rester lisibles. */
  --sec-1: #6a6150;
  --sec-2: #6f6653;
  --sec-3: #746a57;
  --sec-4: #756b57;
  --sec-5: #756b57;
  --sec-6: #756b57;
  --sauge: #6F8F6A;
  --sauge-fonce: #465e42;
  --sauge-fond: #eef2e7;
  --terra: #C05B3C;
  --terra-texte: #A84E33;
  --terra-fond: #f7e8e0;
  --terra-fond-2: #fbf1ea;
  --cuisine-entete: #f3efe2;
  --stat-fond: #f7f3e8;
  --pilule-bord: #d9d0bc;
  --box-bord: #c9bfa8;
  --zone-depot-bord: #cfc4a9;
  --zone-depot-fond: #fbf8ef;
  --barre-fond: #ece5d2;
  --sombre-texte-2: #b7ae99;

  /* Typographies */
  --serif: "Cormorant Garamond", "Georgia", serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Rayons */
  --r-carte: 14px;
  --r-rangee: 10px;
  --r-zone: 12px;
  --r-box: 6px;
  --r-pilule: 999px;

  /* Ombres */
  --ombre-sticky: 0 10px 28px rgba(46, 42, 35, .28);
  --ombre-segment: 0 1px 4px rgba(46, 42, 35, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; margin: 0; }

a { color: inherit; }

button { font-family: inherit; cursor: pointer; }

.surtitre {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--sec-3);
  font-weight: 600;
}

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--r-carte);
}

.pilule {
  border-radius: var(--r-pilule);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tabular { font-variant-numeric: tabular-nums; }

/* Badges pictos qualité : vraie image du fichier Excel + libellé optionnel */
.picto-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: -4px;
  margin-left: 5px;
}
.picto-badge img {
  height: 17px;
  width: auto;
  border-radius: 3px;
  display: block;
}

/* Codes allergènes après le nom d'un plat */
.allergenes {
  font-size: 10.5px;
  color: var(--sec-4);
  white-space: nowrap;
}

/* Sélecteur de semaine — partagé par les écrans admin et cuisine */
.barre-semaines {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--sec-2);
}
.barre-semaines label { font-weight: 600; }
.barre-semaines select {
  font: 600 12.5px var(--sans);
  color: var(--encre);
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--r-pilule);
  padding: 7px 12px;
  min-height: 36px;
}

/* Confirmation d'un geste irréversible — commune à tous les écrans.
   En page plutôt qu'en dialogue natif : voir la note en tête de
   confirmation.js (les dialogues natifs sont parfois neutralisés). */
.voile-confirmation {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(46, 42, 35, .46);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.voile-confirmation[hidden] { display: none; }

.boite-confirmation {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre-sticky);
  width: 100%;
  max-width: 470px;
  padding: 22px 24px 20px;
}
.boite-confirmation h2 { font-size: 23px; margin-bottom: 12px; }

.lignes-confirmation {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.lignes-confirmation li {
  position: relative;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sec-1);
}
.lignes-confirmation li::before {
  content: "•";
  position: absolute;
  left: 5px;
  color: var(--sauge);
  font-weight: 700;
}
.lignes-confirmation li.alerte { color: var(--terra-texte); font-weight: 600; }
.lignes-confirmation li.alerte::before { content: "⚠"; left: 2px; font-size: 11px; }

.actions-confirmation {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.bouton-confirmer {
  border: 0;
  border-radius: var(--r-rangee);
  background: var(--encre);
  color: #f6f1e6;
  font-size: 13.5px;
  font-weight: 700;
  min-height: 44px;
  padding: 0 20px;
}
.bouton-confirmer.danger { background: var(--terra); }
.bouton-annuler {
  border: 1px solid var(--pilule-bord);
  background: var(--surface);
  color: var(--encre);
  border-radius: var(--r-pilule);
  font-size: 12.5px;
  font-weight: 700;
  min-height: 44px;
  padding: 0 16px;
}
.bouton-confirmer:focus-visible, .bouton-annuler:focus-visible {
  outline: 2px solid var(--sauge);
  outline-offset: 2px;
}

/* Messages flash */
.flash {
  background: var(--terra-fond-2);
  border: 1px solid var(--terra);
  color: var(--terra-texte);
  border-radius: var(--r-zone);
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* Notifications toast — retour transitoire, commun à tous les écrans (toast.js).
   Haut-centré : ne recouvre pas les barres collées en bas (validation parent,
   publication brouillon). Succès : sauge, s'efface seul. Erreur : terracotta,
   reste jusqu'au clic. Sans JavaScript, ce sont les bandeaux .flash qui parlent. */
.pile-toasts {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;                     /* au-dessus de la confirmation (z-index 100) */
  width: 100%;
  max-width: 440px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;             /* le conteneur ne bloque pas la page… */
}
.toast {
  pointer-events: auto;             /* …mais le toast reçoit bien le clic */
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-left: 4px solid var(--sauge);
  border-radius: var(--r-zone);
  box-shadow: var(--ombre-sticky);
  padding: 11px 12px 11px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--encre);
  opacity: 0;                       /* entrée / sortie animées */
  transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.entre  { opacity: 1; transform: translateY(0); }
.toast.sortie { opacity: 0; transform: translateY(-8px); }

.toast.succes {
  border-left-color: var(--sauge);
  background: var(--sauge-fond);
  color: var(--sauge-fonce);
}
.toast.erreur {
  border-left-color: var(--terra);
  background: var(--terra-fond-2);
  color: var(--terra-texte);
}

.toast-texte { flex: 1; min-width: 0; }
.toast-fermer {
  flex: none;
  border: 0;
  background: none;
  color: inherit;
  opacity: .7;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  margin: -2px -2px 0 0;
  cursor: pointer;
}
.toast-fermer:hover { opacity: 1; }
.toast-fermer:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.entre, .toast.sortie { transform: none; transition: opacity .12s ease; }
}
