:root {
  --vert-fonce: #1f4e3d;
  --vert-profond: #225744;
  --vert-boite: #2a5747;
  --vert: #2ab939;
  --vert-survol: #23a031;
  --jaune: #fdd61f;
  --pale: #eff3ed;
  --pale-2: #e9efe5;
  --texte: #191919;
  --gris: #6d756d;
  --blanc: #fff;
  --rayon: 22px;
  --ombre: 0 10px 30px rgba(31, 78, 61, .10);
  --serif: "Noto Serif", Georgia, serif;
  --sans: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--texte);
  background: var(--pale);
  line-height: 1.55;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.15; }
svg { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  border: 0; border-radius: 999px; cursor: pointer;
  font: 500 .95rem/1 var(--sans); letter-spacing: .06em;
  padding: 1em 1.8em; text-decoration: none;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .6; cursor: wait; }
.bouton.vert { background: var(--vert); color: var(--blanc); box-shadow: 0 8px 20px rgba(42, 185, 57, .35); }
.bouton.vert:hover { background: var(--vert-survol); }
.bouton.jaune { background: var(--jaune); color: var(--vert-fonce); }
.bouton.contour { background: transparent; color: var(--vert-fonce); box-shadow: inset 0 0 0 1.5px var(--vert-fonce); }
.bouton.contour:hover { background: var(--vert-fonce); color: var(--blanc); }
.bouton.discret { background: var(--pale); color: var(--vert-fonce); }
.bouton.discret:hover { background: var(--pale-2); }
.bouton.petit { padding: .75em 1.2em; font-size: .82rem; letter-spacing: .03em; }

/* ---------- Logo ---------- */
.logo {
  display: flex; align-items: center; gap: .45em;
  font: 600 1.6rem var(--serif); color: var(--blanc);
}
.logo svg { width: 1.35em; height: 1.35em; color: var(--vert); }

/* ---------- Connexion ---------- */
.connexion {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(120deg, var(--vert-fonce) 0%, var(--vert-profond) 45%, #8fbaa6 140%);
}
.carte-connexion {
  width: min(420px, 100%); background: var(--blanc); border-radius: var(--rayon);
  padding: 36px 28px; box-shadow: 0 30px 60px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column; gap: 10px;
}
.carte-connexion .logo { color: var(--vert-fonce); margin-bottom: 14px; }
.carte-connexion h1 { font-size: 2rem; color: var(--vert-fonce); }
.carte-connexion p { margin: 0 0 12px; color: var(--gris); }
.carte-connexion label { font-weight: 600; font-size: .9rem; color: var(--vert-fonce); }
.carte-connexion .bouton { margin-top: 8px; }
.erreur { color: #b42318; min-height: 1.2em; font-size: .9rem; margin: 0 !important; }

input, textarea {
  font: 500 1rem var(--sans); color: var(--texte);
  width: 100%; padding: .85em 1em; border-radius: 14px;
  border: 1.5px solid var(--pale-2); background: var(--blanc);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--vert); box-shadow: 0 0 0 4px rgba(42, 185, 57, .15); }
textarea { resize: vertical; }

/* ---------- En-tête ---------- */
.entete {
  background: linear-gradient(115deg, var(--vert-fonce) 0%, var(--vert-profond) 50%, #6d9d88 120%);
  color: var(--blanc);
  padding: 0 20px 34px;
  border-radius: 0 0 34px 34px;
  position: relative; overflow: hidden;
}
.entete::after { /* grande feuille décorative */
  content: ""; position: absolute; right: -90px; bottom: -110px; width: 340px; height: 340px;
  background: radial-gradient(circle closest-side, rgba(42, 185, 57, .28), transparent);
  pointer-events: none; z-index: 0;
}
.barre {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto; padding: 18px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.onglets { display: flex; gap: 4px; background: rgba(255, 255, 255, .1); padding: 4px; border-radius: 999px; }
.onglets button {
  border: 0; background: transparent; color: rgba(255, 255, 255, .85);
  font: 500 .88rem var(--sans); padding: .6em 1em; border-radius: 999px; cursor: pointer;
}
.onglets button[aria-selected="true"] { background: var(--blanc); color: var(--vert-fonce); }

.accroche { max-width: 1180px; margin: 0 auto; padding-top: 10px; position: relative; z-index: 1; }
.surtitre {
  margin: 0 0 6px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  font-size: .78rem; color: var(--vert);
}
.entete .surtitre { color: #9be7a4; }
.accroche h1 { font-size: clamp(2rem, 7vw, 3.6rem); margin-bottom: 18px; }
.accroche h1 strong { font-weight: 700; display: inline-block; position: relative; }
.accroche h1 strong::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; border-radius: 4px; background: var(--vert);
}
.accroche h1 .fin { font-weight: 400; display: block; font-size: .62em; margin-top: .25em; opacity: .95; }
.criteres { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.criteres li {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  padding: .4em .9em; border-radius: 999px; font-size: .82rem; font-family: var(--serif);
}

/* ---------- Contenu ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 26px 16px 40px; }

.resume {
  background: var(--blanc); border-radius: var(--rayon); padding: 18px 20px; margin-bottom: 22px;
  box-shadow: var(--ombre); font-family: var(--serif); color: var(--vert-fonce);
  border-left: 5px solid var(--jaune);
}
.resume.avertissement { border-left-color: #e8a317; }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 22px; }

.plat {
  background: var(--blanc); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre);
  display: flex; flex-direction: column;
  animation: entree .45s ease both;
}
.plat:nth-child(2) { animation-delay: .05s; } .plat:nth-child(3) { animation-delay: .1s; }
.plat:nth-child(4) { animation-delay: .15s; } .plat:nth-child(5) { animation-delay: .2s; }
.plat:nth-child(6) { animation-delay: .25s; }
@keyframes entree { from { opacity: 0; transform: translateY(12px); } }
.plat.change { animation: change .5s ease both; }
@keyframes change { from { opacity: 0; transform: scale(.96); } }

.photo { position: relative; aspect-ratio: 4 / 3; background: var(--pale-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.source {
  position: absolute; top: 14px; left: 14px; padding: .35em .85em; border-radius: 999px;
  font-size: .75rem; font-weight: 600; letter-spacing: .05em; background: var(--blanc); color: var(--vert-fonce);
}
.source.quitoque { background: var(--jaune); }

.contenu { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.contenu h3 { font-size: 1.22rem; color: var(--vert-fonce); }
.infos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.infos li {
  display: inline-flex; align-items: center; gap: .4em; font-size: .8rem; font-weight: 600;
  padding: .4em .75em; border-radius: 999px; background: var(--pale); color: var(--vert-fonce);
}
.infos li.prot { background: #dff5e1; color: #17762a; }
.infos svg { width: 1.05em; height: 1.05em; }
.pourquoi { margin: 0; color: var(--gris); font-size: .92rem; font-family: var(--serif); font-style: italic; flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .bouton { flex: 1; }

.vide {
  text-align: center; padding: 50px 20px; color: var(--gris); max-width: 460px; margin: 0 auto;
}
.vide svg { width: 72px; height: 72px; color: var(--vert); margin-bottom: 10px; }
.vide h2 { color: var(--vert-fonce); margin-bottom: 8px; }

/* ---------- Courses ---------- */
.titre-section { margin-bottom: 18px; }
.titre-section h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); color: var(--vert-fonce); }
.aide { color: var(--gris); margin: 6px 0 0; font-size: .92rem; }
.actions-courses .discret { background: var(--blanc); box-shadow: var(--ombre); }
.actions-courses { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.courses { list-style: none; padding: 0; margin: 0; background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden; }
.courses li { border-bottom: 1px solid var(--pale); }
.courses li:last-child { border-bottom: 0; }
.courses label { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; cursor: pointer; }
.courses input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--vert); flex: none; }
.courses .article { flex: 1; min-width: 0; }
.courses .nom { font-weight: 600; }
.courses .qte { color: var(--vert-fonce); font-family: var(--serif); white-space: nowrap; }
.courses .pour { display: block; font-size: .78rem; color: var(--gris); }
.courses .ligne { display: flex; justify-content: space-between; gap: 10px; }
.courses li.coche .nom, .courses li.coche .qte { text-decoration: line-through; opacity: .45; }

/* ---------- Préférences ---------- */
.prefs { background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 22px 20px; display: grid; gap: 18px; }
.prefs fieldset { border: 0; padding: 0; margin: 0; }
.prefs legend, .prefs label { font-weight: 600; font-size: .9rem; color: var(--vert-fonce); }
.prefs legend { margin-bottom: 8px; }
.prefs small { font-weight: 400; color: var(--gris); }
.prefs label input, .prefs label textarea { margin-top: 6px; }
.champs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.choix-pilules { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-pilules label { cursor: pointer; }
.choix-pilules input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix-pilules span {
  display: inline-block; padding: .65em 1.1em; border-radius: 999px; background: var(--pale);
  font-weight: 500; transition: background .2s, color .2s;
}
.choix-pilules input:checked + span { background: var(--vert-fonce); color: var(--blanc); }
.choix-pilules input:focus-visible + span { box-shadow: 0 0 0 3px rgba(42, 185, 57, .4); }
.compteur { margin: 0; font-family: var(--serif); color: var(--vert-fonce); }

/* ---------- Pied, attente, toast ---------- */
.pied { text-align: center; color: var(--gris); font-size: .8rem; padding: 10px 16px 40px; }
.attente {
  position: fixed; inset: 0; background: rgba(31, 78, 61, .55); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.attente-carte { background: var(--blanc); border-radius: var(--rayon); padding: 30px 34px; text-align: center; max-width: 340px; }
.attente-carte p { margin: 14px 0 0; font-family: var(--serif); color: var(--vert-fonce); }
.roue {
  width: 46px; height: 46px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--pale-2); border-top-color: var(--vert);
  animation: tourne .9s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--vert-fonce); color: var(--blanc); padding: .9em 1.4em; border-radius: 999px;
  font-size: .9rem; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100% - 32px);
}

@media (max-width: 640px) {
  .barre { justify-content: center; }
  .logo { font-size: 1.4rem; }
  .onglets { width: 100%; justify-content: space-between; }
  .onglets button { flex: 1; padding: .65em .4em; }
  #btn-nouvelle { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
