:root {
  --fond: #f7f4ee; --carte: #ffffff; --texte: #1d2621; --doux: #6b746e; --ligne: #e6e1d8;
  --vert: #2f6b4f; --vert-clair: #e3efe7; --orange: #d9772b; --orange-clair: #fbeadb;
  --rouge: #c0413a; --rouge-clair: #f8e0de; --jaune-clair: #fdf4d8;
  --rayon: 16px; --ombre: 0 1px 2px rgba(30,40,30,.06), 0 4px 14px rgba(30,40,30,.06);
  --barre: 64px;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #141816; --carte: #1d2320; --texte: #ecefe9; --doux: #9aa39d; --ligne: #2c3430;
    --vert: #5fb38a; --vert-clair: #1f3329; --orange: #ee9a55; --orange-clair: #3a2a1c;
    --rouge: #ec7a72; --rouge-clair: #3b2220; --jaune-clair: #38321c; --ombre: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--barre) + env(safe-area-inset-bottom) + 24px);
  max-width: 760px; margin: 0 auto; }
h1 { font-size: 26px; margin: 4px 0 14px; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }
h2 small { font-weight: 500; font-size: 14px; color: var(--doux); }
p { margin: 6px 0; }
a { color: var(--vert); }
.doux { color: var(--doux); font-size: 14px; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px;
  border: 1px solid var(--ligne); }
.vide { text-align: center; padding: 28px 16px; color: var(--doux); }
.vide b { display: block; color: var(--texte); font-size: 17px; margin-bottom: 4px; }

/* Barre du bas */
#barre { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--barre) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--carte); border-top: 1px solid var(--ligne);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; z-index: 20; }
#barre a { text-decoration: none; color: var(--doux); display: flex; flex-direction: column; align-items: center;
  font-size: 11px; gap: 2px; }
#barre a .ic { font-size: 21px; line-height: 1; }
#barre a.actif { color: var(--vert); font-weight: 600; }
#plus { justify-self: center; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--vert);
  color: #fff; font-size: 32px; line-height: 1; margin-top: -26px; box-shadow: 0 6px 18px rgba(47,107,79,.4); }

/* Boutons */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
  border-radius: 12px; padding: 13px 16px; font: inherit; font-weight: 600; background: var(--vert); color: #fff;
  cursor: pointer; text-decoration: none; }
.bouton.large { width: 100%; }
.bouton.second { background: var(--vert-clair); color: var(--vert); }
.bouton.leger { background: transparent; color: var(--vert); padding: 8px 4px; }
.bouton.danger { background: var(--rouge-clair); color: var(--rouge); }
.bouton:disabled { opacity: .5; }
.rangee { display: flex; gap: 10px; flex-wrap: wrap; }
.rangee > * { flex: 1; }

/* Pastilles */
.pastille { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; background: var(--vert-clair); color: var(--vert); }
.pastille.orange { background: var(--orange-clair); color: var(--orange); }
.pastille.rouge { background: var(--rouge-clair); color: var(--rouge); }
.pastille.gris { background: var(--ligne); color: var(--doux); }

/* Puces de filtres */
.puces { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce { flex: none; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 14px; }
.puce.on { background: var(--vert); color: #fff; border-color: var(--vert); }

/* Recherche */
.recherche { width: 100%; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  border-radius: 12px; padding: 12px 14px; font: inherit; margin-bottom: 10px; }

/* Cartes de recettes */
.grille { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .grille { grid-template-columns: repeat(3, 1fr); } }
.defile { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.defile::-webkit-scrollbar { display: none; }
@media (min-width: 620px) { .defile { grid-auto-columns: 30%; } }
.rec { background: var(--carte); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre);
  border: 1px solid var(--ligne); text-decoration: none; color: var(--texte); display: flex; flex-direction: column;
  scroll-snap-align: start; }
.rec .img { aspect-ratio: 4/3; background: var(--ligne) center/cover no-repeat; position: relative; }
.rec .img .coin { position: absolute; top: 8px; left: 8px; }
.rec .img .video { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff;
  border-radius: 999px; font-size: 12px; padding: 2px 8px; }
.rec .txt { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 4px; }
.rec .titre { font-weight: 650; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.rec .info { font-size: 12.5px; color: var(--doux); }

/* Liste d'aliments */
.liste { display: flex; flex-direction: column; gap: 8px; }
.aliment { display: flex; align-items: center; gap: 12px; background: var(--carte); border-radius: 14px;
  padding: 12px 14px; border: 1px solid var(--ligne); }
.aliment .nom { font-weight: 600; }
.aliment .sous { font-size: 13px; color: var(--doux); }
.aliment .milieu { flex: 1; min-width: 0; }
.aliment .milieu .nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone-lieu { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 19px;
  background: var(--vert-clair); flex: none; }

/* Stock : onglets */
.segments { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ligne); border-radius: 12px;
  padding: 3px; margin-bottom: 12px; }
.segments button { border: 0; background: transparent; padding: 9px 4px; border-radius: 10px; font: inherit;
  font-size: 13.5px; color: var(--texte); }
.segments button.on { background: var(--carte); font-weight: 650; box-shadow: var(--ombre); }

/* Recette */
.hero { margin: calc(-14px - env(safe-area-inset-top)) -16px 0; aspect-ratio: 16/11; background: var(--ligne) center/cover;
  position: relative; }
.hero .retour, .hero .coeur { position: absolute; top: calc(env(safe-area-inset-top) + 12px); width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #1d2621; font-size: 20px; }
.hero .retour { left: 14px; } .hero .coeur { right: 14px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; }
.ing { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ligne); }
.ing:last-child { border-bottom: 0; }
.ing .pt { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none;
  background: var(--ligne); color: var(--doux); }
.ing.ok .pt { background: var(--vert); color: #fff; }
.ing .q { margin-left: auto; color: var(--doux); font-size: 14px; text-align: right; }
.etape { display: flex; gap: 12px; padding: 10px 0; }
.etape .n { width: 28px; height: 28px; border-radius: 50%; background: var(--vert-clair); color: var(--vert);
  font-weight: 700; display: grid; place-items: center; flex: none; font-size: 14px; }
.video-cadre { position: relative; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; }
.video-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.collant { position: sticky; bottom: calc(var(--barre) + env(safe-area-inset-bottom) + 10px); margin-top: 16px; }

/* Feuille du bas */
#voile { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 30; }
#feuille { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; z-index: 31;
  background: var(--fond); border-radius: 22px 22px 0 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 18px);
  max-width: 760px; margin: 0 auto; animation: monte .22s ease-out; }
#feuille::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--ligne);
  margin: 0 auto 12px; }
@keyframes monte { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.choix { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 1px solid var(--ligne);
  background: var(--carte); color: var(--texte); border-radius: 16px; padding: 14px; font: inherit; margin-bottom: 10px; }
.choix .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 23px;
  background: var(--vert-clair); flex: none; }
.choix b { display: block; }
.choix span.d { font-size: 13.5px; color: var(--doux); }
.choix.principal { border: 2px solid var(--vert); }
.choix.principal .ic { background: var(--vert); color: #fff; }

/* Formulaires */
label.champ { display: block; font-size: 13px; color: var(--doux); margin: 10px 0 4px; }
.saisie, select.saisie { width: 100%; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  border-radius: 10px; padding: 10px 12px; font: inherit; }
.ligne-achat { background: var(--carte); border: 1px solid var(--ligne); border-radius: 14px; padding: 12px;
  margin-bottom: 10px; }
.ligne-achat.off { opacity: .45; }
.ligne-achat .haut { display: flex; gap: 8px; align-items: center; }
.ligne-achat .haut input.nom { flex: 1; font-weight: 600; border: 0; background: transparent; color: var(--texte);
  font: inherit; font-weight: 600; padding: 2px 0; min-width: 0; }
.ligne-achat .bas { display: grid; grid-template-columns: 70px 92px 1fr; gap: 8px; margin-top: 8px; }
.ligne-achat .lieux { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.ligne-achat .lieux button { border: 1px solid var(--ligne); background: transparent; color: var(--texte);
  border-radius: 9px; padding: 7px 2px; font: inherit; font-size: 13px; }
.ligne-achat .lieux button.on { background: var(--vert); color: #fff; border-color: var(--vert); }
.croix { border: 0; background: transparent; color: var(--doux); font-size: 20px; padding: 0 4px; }
.suggestions { background: var(--carte); border: 1px solid var(--ligne); border-radius: 10px; margin-top: 4px; overflow: hidden; }
.suggestions button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--ligne);
  background: transparent; color: var(--texte); padding: 10px 12px; font: inherit; }
.attente { text-align: center; padding: 30px 10px; }
.roue { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--vert-clair); border-top-color: var(--vert);
  animation: tourne 1s linear infinite; margin: 0 auto 14px; }
@keyframes tourne { to { transform: rotate(360deg); } }
.course { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--carte);
  border: 1px solid var(--ligne); border-radius: 14px; }
.course.coche .nom { text-decoration: line-through; color: var(--doux); }
.case { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--ligne); display: grid; place-items: center;
  flex: none; color: #fff; font-size: 15px; }
.course.coche .case { background: var(--vert); border-color: var(--vert); }
.decision { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.decision button { border: 1px solid var(--ligne); background: transparent; color: var(--texte); border-radius: 9px;
  padding: 8px 2px; font: inherit; font-size: 13px; }
.decision button.on { background: var(--vert); color: #fff; border-color: var(--vert); }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--barre) + env(safe-area-inset-bottom) + 18px);
  background: var(--texte); color: var(--fond); padding: 11px 18px; border-radius: 12px; z-index: 40; font-size: 15px;
  max-width: 90vw; text-align: center; }
.connexion { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.connexion .logo { font-size: 54px; }

/* Le suivi sans chiffres : la jauge (plein, ¾, ½, ¼) et les nombres à toucher */
.jauge { display: inline-flex; gap: 2px; vertical-align: -1px; margin-right: 2px; }
.jauge i { width: 6px; height: 12px; border-radius: 2px; background: var(--ligne); display: block; }
.jauge i.on { background: var(--vert); }
.jauge.vide { font-size: 12px; color: var(--doux); height: 12px; line-height: 12px; }
.niveaux { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 4px; }
.niveaux button, .nombres button { border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  border-radius: 12px; font: inherit; font-weight: 650; }
.niveaux button { padding: 10px 2px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 60px;
  justify-content: center; }
.niveaux button .jauge i { width: 7px; height: 16px; }
.nombres { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px; margin-top: 4px; }
.nombres button { height: 48px; }
.niveaux button.on, .nombres button.on { border-color: var(--vert); background: var(--vert-clair); color: var(--vert);
  box-shadow: inset 0 0 0 1px var(--vert); }
.nombres button[data-plus] { color: var(--vert); font-size: 20px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--ligne); border-radius: 10px; overflow: hidden;
  background: var(--carte); flex: none; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--vert); font-size: 22px;
  font-weight: 700; font-family: inherit; }
.stepper .val { min-width: 32px; text-align: center; font-weight: 700; }
.stepper.grand button { width: 52px; height: 52px; }
.moins1 { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--vert); background: var(--vert-clair);
  color: var(--vert); font: inherit; font-weight: 700; font-size: 15px; }
.entame { color: var(--orange); font-weight: 600; }
.decision.deux { grid-template-columns: 1fr 1fr; }
.ligne-achat .bas2 { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ligne-achat .bas2 select, .ligne-achat .bas2 input { flex: 1; min-width: 100px; width: auto; }
#toast button.annuler { margin-left: 8px; border: 0; background: transparent; color: var(--fond); font: inherit;
  font-weight: 700; text-decoration: underline; padding: 0 2px; }
.progression { height: 6px; border-radius: 3px; background: var(--ligne); overflow: hidden; margin: 4px 0 6px; }
.progression div { height: 100%; background: var(--vert); transition: width .25s; }
.carte-lien { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-bottom: 12px; }
.carte-lien .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: var(--vert); color: #fff; flex: none; font-weight: 700; }
.carte-lien.important { border: 2px solid var(--vert); }
.carte-lien .fleche { font-size: 26px; color: var(--vert); }
.course.off { opacity: .45; }
.course.off .nom, .course.off b { text-decoration: line-through; }
.niveaux .jauge.vide { height: 16px; line-height: 16px; align-items: center; font-size: 13px; }
#portions { grid-template-columns: repeat(6, 1fr); }
