/* Gainz — mobile d'abord, clair et sombre. Palette reprise du point quotidien. */
:root {
  --fond: #FCFCFB; --carte: #FFFFFF; --texte: #2E2C27; --discret: #6B6A63; --ligne: #E7E5DF;
  --accent: #C6613F; --accent-doux: #F6E6DF; --danger: #B3261E; --ok: #2E7D4F;
  --rayon: 14px; --onglets: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #1B1A18; --carte: #252420; --texte: #EDEBE6; --discret: #A3A19A; --ligne: #3A3833;
          --accent: #E07B57; --accent-doux: #3A2A23; --danger: #F2827A; --ok: #6CC093; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--discret); margin: 1.2rem 0 .4rem; }
h2 small { font-weight: normal; margin-left: .3rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: .7rem 1rem; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .5; }
input, select { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--ligne);
  border-radius: 10px; padding: .7rem .8rem; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; margin: .8rem 0; font-size: .9rem; color: var(--discret); }
label input, label select { margin-top: .3rem; }
.principal { background: var(--accent); color: #fff; font-weight: 600; }
.secondaire { background: var(--accent-doux); color: var(--texte); }
.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.large { display: block; width: 100%; margin: .8rem 0; }
.discret { color: var(--discret); font-size: .88rem; }
.erreur { color: var(--danger); }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 1rem 1.1rem; margin: .8rem 0; }
.vide { color: var(--discret); text-align: center; padding: 2rem 1rem; }

/* écrans de connexion */
.centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.connexion { width: 100%; max-width: 380px; }
.connexion .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto .5rem; }
.connexion h1 { text-align: center; margin-bottom: .5rem; }
.connexion .principal { width: 100%; margin-top: .6rem; }
.etapes { padding-left: 1.2rem; } .etapes li { margin: .5rem 0; }
.lien-fort { font-weight: 600; }
.cle { display: inline-block; margin-top: .3rem; padding: .3rem .5rem; background: var(--accent-doux); border-radius: 6px;
  font-size: .95rem; letter-spacing: .05em; user-select: all; -webkit-user-select: all; word-break: break-all; }

/* structure de l'appli */
.appli { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + .8rem) 1rem
  calc(var(--onglets) + env(safe-area-inset-bottom) + 1.5rem); }
.entete { display: flex; align-items: center; justify-content: space-between; margin: .3rem 0 .8rem; }
.pastille { font-size: .78rem; padding: .25rem .6rem; border-radius: 99px; background: var(--accent-doux); color: var(--discret); }
.pastille.alerte { background: #FCE8C3; color: #7A4B00; }
.onglets { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--carte); border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.onglets a { flex: 1; text-align: center; text-decoration: none; color: var(--discret); font-size: .72rem; padding: .45rem 0 .5rem; }
.onglets a span { display: block; font-size: 1.35rem; line-height: 1.3; filter: grayscale(1); opacity: .7; }
.onglets a.actif { color: var(--accent); font-weight: 600; }
.onglets a.actif span { filter: none; opacity: 1; }

/* courses */
.ajout { display: flex; gap: .5rem; position: sticky; top: 0; z-index: 5; background: var(--fond); padding: .4rem 0; }
.ajout button { width: 3.2rem; font-size: 1.4rem; padding: 0; }
.article { display: flex; align-items: center; gap: .6rem; background: var(--carte); border: 1px solid var(--ligne);
  border-radius: 12px; padding: .55rem .5rem .55rem .6rem; margin: .35rem 0; }
.article .case { width: 2rem; height: 2rem; flex: none; border-radius: 50%; border: 2px solid var(--accent); background: transparent;
  color: #fff; padding: 0; font-weight: 700; }
.article.coche .case { background: var(--ok); border-color: var(--ok); }
.article .texte { flex: 1; min-width: 0; cursor: pointer; }
.article .nom { font-weight: 500; }
.article .qte { color: var(--accent); font-weight: 600; margin-left: .2rem; white-space: nowrap; }
.article .detail { color: var(--discret); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article.coche .nom { text-decoration: line-through; color: var(--discret); }
.article .plus { background: transparent; color: var(--discret); font-size: 1.2rem; padding: .3rem .5rem; }
.panier { opacity: .85; }
.voile { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; z-index: 20; }
.feuille { background: var(--fond); width: 100%; border-radius: 18px 18px 0 0; padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); }
.feuille h3 { margin-top: .2rem; }

/* recettes */
.recherche { margin-bottom: .6rem; }
.filtres { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; }
.puce { background: var(--carte); border: 1px solid var(--ligne); border-radius: 99px; padding: .35rem .8rem; font-size: .85rem; white-space: nowrap; color: var(--texte); }
.puce.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.recette { display: flex; gap: .8rem; align-items: center; text-decoration: none; color: var(--texte); background: var(--carte);
  border: 1px solid var(--ligne); border-radius: 12px; padding: .7rem .8rem; margin: .45rem 0; }
.recette .emoji { font-size: 1.8rem; }
.recette .corps { display: flex; flex-direction: column; min-width: 0; }
.recette .nom { font-weight: 600; }
.recette .meta { color: var(--discret); font-size: .82rem; }
.fiche .retour { text-decoration: none; display: inline-block; margin: .2rem 0 .6rem; }
.fiche h1 { font-size: 1.4rem; line-height: 1.25; }
.fiche .meta { color: var(--discret); font-size: .85rem; margin: .3rem 0 .8rem; }
.portions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--carte); border: 1px solid var(--ligne);
  border-radius: 12px; padding: .6rem .8rem; }
.portions strong { font-size: 1.2rem; min-width: 1.5rem; text-align: center; }
.portions .puce { margin-left: auto; }
.rond { width: 2.2rem; height: 2.2rem; border-radius: 50%; padding: 0; background: var(--accent-doux); color: var(--texte); font-size: 1.2rem; }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { border-bottom: 1px solid var(--ligne); }
.ingredients label { display: flex; gap: .7rem; align-items: flex-start; margin: 0; padding: .55rem 0; color: var(--texte); font-size: 1rem; }
.ingredients input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; flex: none; accent-color: var(--accent); }
.ingredients .sous-titre { color: var(--discret); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding: .8rem 0 .2rem; border: 0; }
.contenu { margin-top: 1rem; }
.contenu ol, .contenu ul { padding-left: 1.3rem; }
.contenu li { margin: .45rem 0; }

/* mode cuisine : gros texte, l'écran reste allumé */
body.mode-cuisine .fiche { font-size: 1.25rem; }
body.mode-cuisine .contenu ol li { margin: 1rem 0; }
body.mode-cuisine .onglets { display: none; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--onglets) + env(safe-area-inset-bottom) + 1rem);
  background: var(--texte); color: var(--fond); padding: .7rem 1.1rem; border-radius: 12px; font-size: .9rem; z-index: 30;
  max-width: 90vw; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
