/* ══════════════════════════════════════════════════════════════════════
   Pantrilo — feuille de style

   Trois règles tiennent tout le reste :

   1. **Tout est en rem.** Le réglage de taille agit sur la racine, donc sur
      le texte, les boutons et les espacements ensemble. Un bouton ne se met
      jamais à toucher son voisin parce qu'on a agrandi le texte.
   2. **La couleur double un mot, elle ne le remplace jamais.** « à acheter »
      est écrit, l'ambre ne fait que le répéter. Rien n'est perdu en
      monochrome, ni pour qui distingue mal les teintes.
   3. **La mise en page se réorganise au lieu de déborder.** Aucun
      défilement horizontal, du téléphone à l'écran large, de 100 % à 200 %.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --echelle: 1;
  font-size: calc(16px * var(--echelle));

  /* ── espace ── */
  --e1: 0.25rem;
  --e2: 0.5rem;
  --e3: 0.75rem;
  --e4: 1rem;
  --e5: 1.5rem;
  --e6: 2rem;
  --rayon: 0.75rem;
  --rayon-s: 0.4rem;
  /* La cible tactile minimale recommandée, en unités qui suivent l'échelle. */
  --touche: 2.75rem;

  /* ── couleurs, thème clair ── */
  --fond: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --surface-3: #e6e2d8;
  --encre: #1a1c20;
  --encre-douce: #565c66;
  --trait: #ddd8cd;
  --trait-fort: #c2bcae;

  --accent: #245b45;
  --accent-encre: #ffffff;
  --accent-doux: #e3efe8;

  --ok: #2f6b4f;
  --ok-fond: #e3efe8;
  --info: #2b5b8a;
  --info-fond: #e2ecf6;
  --attention: #8a5a12;
  --attention-fond: #f8eeda;
  --alerte: #963232;
  --alerte-fond: #fae5e3;
  --neutre-fond: var(--surface-2);

  /* Les trois macronutriments. Une teinte par nutriment, la même partout :
     la barre de répartition, le nom sous le chiffre, la légende. Chacune a
     été mesurée à 4,5:1 au moins sur les trois fonds de carte — elles
     peuvent donc porter du texte, pas seulement des barres. */
  --m-p: #1f6382;
  --m-c: #8a5a12;
  --m-f: #7245a0;

  --ombre: 0 1px 2px rgba(20, 20, 18, 0.06), 0 4px 12px rgba(20, 20, 18, 0.05);
  --focus: 0 0 0 0.1875rem var(--accent-doux), 0 0 0 0.0625rem var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #14161a;
    --surface: #1c1f24;
    --surface-2: #23272e;
    --surface-3: #2b3038;
    --encre: #eceef1;
    --encre-douce: #a3abb6;
    --trait: #2f343c;
    --trait-fort: #454c57;

    --accent: #7fc9a3;
    --accent-encre: #10231b;
    --accent-doux: #1e3a2d;

    --ok: #7fc9a3;
    --ok-fond: #1c3428;
    --info: #86b9e8;
    --info-fond: #16293a;
    --attention: #e5b768;
    --attention-fond: #3a2f16;
    --alerte: #f09a92;
    --alerte-fond: #3a1f1d;

    --m-p: #7fc2e0;
    --m-c: #e5b768;
    --m-f: #c3a4e8;

    --ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
    --focus: 0 0 0 0.1875rem var(--accent-doux), 0 0 0 0.0625rem var(--accent);
  }
}

:root[data-theme="sombre"] {
  --fond: #14161a;
  --surface: #1c1f24;
  --surface-2: #23272e;
  --surface-3: #2b3038;
  --encre: #eceef1;
  --encre-douce: #a3abb6;
  --trait: #2f343c;
  --trait-fort: #454c57;

  --accent: #7fc9a3;
  --accent-encre: #10231b;
  --accent-doux: #1e3a2d;

  --ok: #7fc9a3;
  --ok-fond: #1c3428;
  --info: #86b9e8;
  --info-fond: #16293a;
  --attention: #e5b768;
  --attention-fond: #3a2f16;
  --alerte: #f09a92;
  --alerte-fond: #3a1f1d;

  --m-p: #7fc2e0;
  --m-c: #e5b768;
  --m-f: #c3a4e8;

  --ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
}

/* Contraste renforcé : noirs et blancs francs, traits épaissis, aucun gris
   décoratif. Se cumule avec le thème choisi. */
:root[data-contraste="fort"] {
  --fond: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --surface-3: #e4e4e4;
  --encre: #000000;
  --encre-douce: #2b2b2b;
  --trait: #000000;
  --trait-fort: #000000;
  --accent: #00402a;
  --accent-encre: #ffffff;
  --accent-doux: #d8e8e0;
  --ok: #00402a;
  --info: #003a6b;
  --attention: #5a3600;
  --alerte: #7a0000;
  --m-p: #003a6b;
  --m-c: #5a3600;
  --m-f: #4a1070;
  --ombre: none;
}

:root[data-contraste="fort"][data-theme="sombre"] {
  --fond: #000000;
  --surface: #000000;
  --surface-2: #141414;
  --surface-3: #1f1f1f;
  --encre: #ffffff;
  --encre-douce: #e0e0e0;
  --trait: #ffffff;
  --trait-fort: #ffffff;
  --accent: #8ff0c0;
  --accent-encre: #000000;
  --accent-doux: #102b1f;
  --ok: #8ff0c0;
  --info: #9ccdff;
  --attention: #ffd27f;
  --alerte: #ff9e94;
  --m-p: #9ccdff;
  --m-c: #ffd27f;
  --m-f: #dcb8ff;
}

@media (prefers-color-scheme: dark) {
  :root[data-contraste="fort"]:not([data-theme="clair"]) {
  --fond: #000000;
  --surface: #000000;
  --surface-2: #141414;
  --surface-3: #1f1f1f;
  --encre: #ffffff;
  --encre-douce: #e0e0e0;
  --trait: #ffffff;
  --trait-fort: #ffffff;
  --accent: #8ff0c0;
  --accent-encre: #000000;
  --accent-doux: #102b1f;
  --ok: #8ff0c0;
  --info: #9ccdff;
  --attention: #ffd27f;
  --alerte: #ff9e94;
  --m-p: #9ccdff;
  --m-c: #ffd27f;
  --m-f: #dcb8ff;
}
}

:root[data-contraste="fort"] .carte,
:root[data-contraste="fort"] .bouton,
:root[data-contraste="fort"] .champ,
:root[data-contraste="fort"] .pastille {
  border-width: 0.125rem;
}

* { box-sizing: border-box; }

/* `hidden` doit gagner contre toute règle d'affichage : un sélecteur de
   classe est plus spécifique que le `[hidden]` du navigateur, et un
   `display: grid` posé plus bas laissait l'écran de chargement par-dessus
   l'application, indéfiniment. */
[hidden] { display: none !important; }
details:not([open]) > :not(summary) { display: none; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--fond);
  color: var(--encre);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

/* Personne ne devrait avoir à subir une animation qu'il n'a pas demandée. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--rayon-s);
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; }
h1 { font-size: 1.375rem; letter-spacing: -0.015em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--e3); }
p:last-child { margin-bottom: 0; }

.saut {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-encre);
  padding: var(--e3) var(--e4);
  z-index: 100;
  border-radius: 0 0 var(--rayon-s) 0;
}
.saut:focus { left: 0; }

/* ══════════════════ chargement ══════════════════ */

.chargement {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--fond);
  z-index: 50;
  padding: var(--e5);
}
.chargement-boite { text-align: center; max-width: 26rem; }
.chargement-icone { width: 4rem; height: 4rem; margin-bottom: var(--e4); }
.chargement-marque {
  font-size: 2.25rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  margin-bottom: var(--e2);
}
.chargement-mot { color: var(--encre-douce); }
.chargement-signature { margin-bottom: var(--e5); }

.marque {
  display: inline-flex;
  align-items: center;
  gap: var(--e2);
  min-height: var(--touche);
  color: var(--encre);
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.marque:hover { color: var(--accent); }
.marque-icone { flex: none; width: 2.25rem; height: 2.25rem; }
.bienvenue-marque {
  border-left: 0.25rem solid var(--accent);
  padding: var(--e3) var(--e4);
  margin-bottom: var(--e4);
  background: var(--accent-doux);
  border-radius: 0 var(--rayon-s) var(--rayon-s) 0;
}
.bienvenue-marque p { margin: 0; }
.signature-marque { font-size: 1.125rem; font-weight: 650; letter-spacing: -0.02em; }
.bienvenue-marque .petit { margin-top: var(--e2); }

/* ══════════════════ structure ══════════════════ */

#application {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.entete {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(0.5rem);
  border-bottom: 0.0625rem solid var(--trait);
  padding: var(--e3) var(--e4);
  padding-top: max(var(--e3), env(safe-area-inset-top));
}
.entete-ligne {
  display: flex;
  align-items: center;
  gap: var(--e3);
  flex-wrap: wrap;
  max-width: 60rem;
  margin: 0 auto;
}
.entete-titre { flex: 1 1 8rem; min-width: 0; }
.entete-titre .sous { color: var(--encre-douce); font-size: 0.8125rem; }

.contenu {
  flex: 1;
  padding: var(--e4);
  padding-bottom: var(--e6);
  max-width: 60rem;
  margin: 0 auto;
  width: 100%;
}
.contenu:focus { outline: none; }

.entete-outils { flex: 0 1 auto; }
/* Sur petit écran agrandi, l'en-tête doit défiler pour laisser lire le contenu. */
@media (max-width: 40rem) {
  :root[data-affichage="grand"] .entete { position: static; }
}
.affichage-symbole { font-size: 1rem; font-weight: 650; letter-spacing: -0.04em; }
.menu-personnel .bouton { justify-content: flex-start; }
body.modale-ouverte { overflow: hidden; }
.champ[aria-invalid="true"] { border-color: var(--alerte); }
.erreur-champ:empty, [data-erreur]:empty { display: none; }
.erreur-champ { display: block; margin-top: var(--e1); }
form[aria-busy="true"] { cursor: progress; }
form[aria-busy="true"] button[type="submit"] { opacity: 0.8; }

.planning-selecteur { margin-bottom: var(--e4); }
.planning-jours { display: flex; flex-wrap: wrap; gap: var(--e1); margin-block: var(--e3); }
.planning-jour-choix { flex: 1 1 2.75rem; min-width: 0; display: flex; flex-direction: column; gap: var(--e1); padding: var(--e2) var(--e1); }
.planning-jour-libelle { font-size: 0.8125rem; font-weight: 650; }
.planning-jour-compte { font-size: 0.75rem; font-weight: 400; }
.planning-jour-choix[aria-current="date"] { border-bottom: 0.1875rem solid var(--accent); }
.planning-resume { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
.parcours-explorer { display: flex; justify-content: center; margin-top: var(--e4); }

/* Cinq accès quotidiens ; à grande échelle, ils peuvent passer à la ligne. */
.onglets {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: var(--e1);
  padding: var(--e2);
  padding-bottom: max(var(--e2), env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--fond) 92%, transparent);
  backdrop-filter: blur(0.5rem);
  border-top: 0.0625rem solid var(--trait);
}
.onglet {
  flex: 1 1 3.4rem;
  min-width: 0;
  min-height: var(--touche);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  padding: var(--e1) var(--e1);
  border: 0.0625rem solid transparent;
  border-radius: var(--rayon-s);
  background: none;
  color: var(--encre-douce);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.onglet:hover { background: var(--surface-2); }
.onglet[aria-current="page"] {
  background: var(--accent-doux);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 650;
}
.onglet svg { width: 1.25rem; height: 1.25rem; flex: none; }
.onglet-nom {
  overflow-wrap: anywhere;
  line-height: 1.3;
  max-width: 100%;
}

.badge {
  position: absolute;
  top: 0.125rem;
  right: 0.5rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-encre);
  font-size: 0.6875rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.badge.attention { background: var(--attention); color: #fff; }
:root[data-theme="sombre"] .badge.attention,
:root:not([data-theme="clair"]) .badge.attention { color: #24190a; }

/* ══════════════════ cartes et blocs ══════════════════ */

.carte {
  background: var(--surface);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon);
  padding: var(--e4);
  box-shadow: var(--ombre);
  margin-bottom: var(--e4);
}
.carte-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e3);
  flex-wrap: wrap;
  margin-bottom: var(--e3);
}
.carte-tete h2, .carte-tete h3 { min-width: 0; }

.pile { display: flex; flex-direction: column; gap: var(--e3); }
.rangee { display: flex; gap: var(--e2); flex-wrap: wrap; align-items: center; }
.rangee-fin { margin-left: auto; }
.grille {
  display: grid;
  gap: var(--e3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.titre-section {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 650;
  color: var(--encre-douce);
  margin: var(--e5) 0 var(--e2);
}
.titre-section:first-child { margin-top: 0; }

.doux { color: var(--encre-douce); }
.petit { font-size: 0.8125rem; }
.chiffre { font-variant-numeric: tabular-nums; }
.centre { text-align: center; }

.vide {
  text-align: center;
  color: var(--encre-douce);
  padding: var(--e5) var(--e4);
  border: 0.0625rem dashed var(--trait-fort);
  border-radius: var(--rayon);
}
.vide strong { display: block; color: var(--encre); margin-bottom: var(--e1); }

/* ══════════════════ boutons ══════════════════ */

.bouton {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  align-items: center;
  justify-content: center;
  gap: var(--e2);
  min-height: var(--touche);
  padding: var(--e2) var(--e4);
  border: 0.0625rem solid var(--trait-fort);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--encre);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.bouton:hover { background: var(--surface-2); }
.bouton:active { transform: translateY(0.0625rem); }
.bouton[disabled] { opacity: 0.45; cursor: not-allowed; }
.bouton svg { width: 1.125rem; height: 1.125rem; flex: none; }

.bouton.principal {
  background: var(--accent);
  color: var(--accent-encre);
  border-color: var(--accent);
  font-weight: 650;
}
.bouton.principal:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--encre));
}
.bouton.discret { border-color: transparent; background: none; }
.bouton.discret:hover { background: var(--surface-2); }
.bouton.danger { color: var(--alerte); border-color: var(--alerte); }
.bouton.large { width: 100%; }
.bouton.petit { min-height: 2.25rem; padding: var(--e1) var(--e3); font-size: 0.875rem; }

.icone-bouton {
  min-width: var(--touche);
  min-height: var(--touche);
  padding: var(--e2);
  display: inline-grid;
  place-items: center;
  border: 0.0625rem solid var(--trait-fort);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--encre);
  cursor: pointer;
}
.icone-bouton:hover { background: var(--surface-2); }
.icone-bouton svg { width: 1.25rem; height: 1.25rem; }

/* Les trois gestes du quotidien, à un seul appui. */
.gestes {
  display: grid;
  gap: var(--e2);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  margin-bottom: var(--e4);
}
.geste {
  display: flex;
  align-items: center;
  gap: var(--e3);
  padding: var(--e3) var(--e4);
  min-height: 3.5rem;
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--encre);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--ombre);
}
.geste:hover { border-color: var(--accent); }
.geste svg { width: 1.5rem; height: 1.5rem; flex: none; color: var(--accent); }
.geste-texte { min-width: 0; }
.geste-titre { font-weight: 650; }
.geste-sous { font-size: 0.8125rem; color: var(--encre-douce); }

/* ══════════════════ champs ══════════════════ */

.groupe-champ { display: flex; flex-direction: column; gap: var(--e1); }
.groupe-champ label { font-weight: 550; font-size: 0.875rem; }
/* La mention d'appoint sous un champ — et ailleurs : elle sert aussi à
   expliquer une rangée entière, pas seulement une saisie. */
.aide { font-size: 0.8125rem; color: var(--encre-douce); }

/* Une quantité et son unité collées, pour qu'on lise « 150 g » et non un
   nombre orphelin à côté d'un mot. */
.saisie-quantite {
  display: inline-flex;
  align-items: center;
  gap: var(--e1);
  flex: none;
}
.saisie-quantite .champ { width: 5rem; text-align: right; }
.saisie-quantite .unite { font-size: 0.8125rem; color: var(--encre-douce); }

.champ {
  width: 100%;
  min-height: var(--touche);
  padding: var(--e2) var(--e3);
  border: 0.0625rem solid var(--trait-fort);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--encre);
  font: inherit;
}
.champ:focus-visible { border-color: var(--accent); }
textarea.champ { min-height: 5rem; resize: vertical; }

.champ-erreur { border-color: var(--alerte); }
.message-erreur {
  color: var(--alerte);
  font-size: 0.875rem;
  display: flex;
  gap: var(--e2);
  align-items: flex-start;
}

/* Une liste de choix : gros, cliquables, lisibles. */
.choix { display: flex; flex-direction: column; gap: var(--e2); }
.choix-option {
  display: flex;
  gap: var(--e3);
  align-items: flex-start;
  padding: var(--e3);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon-s);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.choix-option:hover { border-color: var(--trait-fort); background: var(--surface-2); }
.choix-option > :not(.coche) { min-width: 0; overflow-wrap: anywhere; }
.choix-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-doux);
  box-shadow: inset 0 0 0 0.0625rem var(--accent);
}
.choix-option .coche {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  margin-top: 0.125rem;
  border-radius: 999px;
  border: 0.125rem solid var(--trait-fort);
  display: grid;
  place-items: center;
}
.choix-option[aria-pressed="true"] .coche {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-encre);
}
.choix-nom { font-weight: 600; }
.choix-desc { font-size: 0.8125rem; color: var(--encre-douce); }

.segments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--e1);
  padding: var(--e1);
  background: var(--surface-2);
  border-radius: var(--rayon-s);
}
.segment {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 2.25rem;
  padding: var(--e1) var(--e3);
  border: 0.0625rem solid transparent;
  border-radius: calc(var(--rayon-s) - 0.125rem);
  background: none;
  color: var(--encre-douce);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}
.segment[aria-pressed="true"] {
  background: var(--surface);
  color: var(--encre);
  font-weight: 650;
  border-color: var(--trait);
}

/* ══════════════════ jauges de macros ══════════════════ */

.jauges { display: flex; flex-direction: column; gap: var(--e3); }
.jauge-tete {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e2);
  font-size: 0.875rem;
}
.jauge-nom { font-weight: 550; }
.jauge-valeur { font-variant-numeric: tabular-nums; color: var(--encre-douce); }
.jauge-piste {
  height: 0.625rem;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--e1);
}
.jauge-barre {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.jauge-barre.depasse { background: var(--attention); }
.jauge-kcal .jauge-piste { height: 0.875rem; }
.jauge-kcal .jauge-nom { font-size: 1rem; }

/* ══════════════════ le bloc de macros ══════════════════

   Le chiffre pour lequel on ouvre une fiche de recette. Il était écrit en
   `petit doux` — la taille et la couleur des mentions secondaires — sous la
   liste des ingrédients ; il passe au corps des titres, en tête de carte.

   La barre de répartition dit d'où viennent les calories : 663 kcal ne
   distingue pas une assiette de pâtes d'un morceau de fromage, « 45 % de
   glucides » si. Les pourcentages sont écrits en toutes lettres dans la
   légende juste dessous — la couleur double le mot, comme partout. */

.macros {
  display: flex;
  flex-direction: column;
  gap: var(--e3);
}

/* La carte qui ne porte que ça. Le filet d'accent la désigne comme le
   premier chiffre à lire, avant les ingrédients. */
.carte-macros { border-left: 0.1875rem solid var(--accent); }

.macros-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e2);
  flex-wrap: wrap;
}
.macros-total { margin: 0; display: flex; align-items: baseline; gap: var(--e1); }
.macros-kcal {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.macros-unite { font-size: 1.0625rem; font-weight: 650; }
.macros-quoi {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: var(--e2);
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--encre-douce);
}
.macros-jour {
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-radius: var(--rayon-s);
  padding: 0.0625rem var(--e2);
}

.macros-trio {
  display: grid;
  /* Trois colonnes tant qu'elles tiennent, puis une pile — jamais un
     débordement horizontal, y compris à 200 % de zoom. La borne est réglée
     pour que les trois tiennent sur la largeur d'un téléphone : à 6,5rem,
     « Lipides » partait seul sur une deuxième ligne. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr));
  gap: var(--e2);
}
.macro {
  padding: var(--e2) var(--e3);
  background: var(--surface-2);
  border: 0.0625rem solid var(--trait);
  border-top-width: 0.1875rem;
  border-radius: var(--rayon-s);
}
.macro.p { border-top-color: var(--m-p); }
.macro.c { border-top-color: var(--m-c); }
.macro.f { border-top-color: var(--m-f); }
.macro-valeur {
  display: block;
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.macro-unite { font-size: 0.875rem; font-weight: 600; }
.macro-nom {
  display: block;
  font-size: 0.8125rem;
  font-weight: 650;
}
.macro.p .macro-nom { color: var(--m-p); }
.macro.c .macro-nom { color: var(--m-c); }
.macro.f .macro-nom { color: var(--m-f); }

.macros-energie { display: flex; flex-direction: column; gap: var(--e2); }
.macros-barre {
  display: flex;
  height: 0.625rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.macros-part { display: block; min-width: 0; }
/* Un filet entre les segments : leurs luminances sont proches, et sans
   frontière visible la barre se lirait comme un seul bloc en monochrome. */
.macros-part + .macros-part { border-left: 0.125rem solid var(--surface); }
.macros-part.p { background: var(--m-p); }
.macros-part.c { background: var(--m-c); }
.macros-part.f { background: var(--m-f); }

.macros-legende {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--e1) var(--e3);
  font-size: 0.8125rem;
  color: var(--encre-douce);
  font-variant-numeric: tabular-nums;
}
.macros-legende-mot { font-weight: 650; color: var(--encre); }
.macros-cle { display: inline-flex; align-items: baseline; gap: var(--e1); }
.macros-cle::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 0.125rem;
  flex: none;
  align-self: center;
}
.macros-cle.p::before { background: var(--m-p); }
.macros-cle.c::before { background: var(--m-c); }
.macros-cle.f::before { background: var(--m-f); }

/* Version de carte : le même bloc, plus serré. */
.macros.compact { gap: var(--e2); }
/* Sur une carte, la place est comptée : les trois pavés doivent tenir sur
   une ligne, sinon « Lipides » part tout seul sous les deux autres. */
.macros.compact .macros-trio {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.25rem), 1fr));
}
.macros.compact .macros-kcal { font-size: 1.625rem; }
.macros.compact .macros-unite { font-size: 0.9375rem; }
.macros.compact .macro { padding: var(--e1) var(--e2); }
.macros.compact .macro-valeur { font-size: 1.0625rem; }
.macros.compact .macro-nom { font-size: 0.75rem; }
.macros.compact .macros-barre { height: 0.375rem; }

:root[data-contraste="fort"] .macro { border-width: 0.125rem; border-top-width: 0.25rem; }
:root[data-contraste="fort"] .macros-part + .macros-part {
  border-left-color: var(--fond);
  border-left-width: 0.1875rem;
}

.compteur-jour {
  display: flex;
  align-items: baseline;
  gap: var(--e2);
  flex-wrap: wrap;
}
.compteur-grand {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ══════════════════ pastilles d'état ══════════════════ */

.pastille {
  display: inline-flex;
  align-items: center;
  gap: var(--e1);
  padding: 0.125rem var(--e2);
  border-radius: 999px;
  border: 0.0625rem solid transparent;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
}
.pastille::before {
  content: "";
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}
.pastille.pret { color: var(--ok); background: var(--ok-fond); }
.pastille.a-cuisiner { color: var(--info); background: var(--info-fond); }
.pastille.a-acheter { color: var(--attention); background: var(--attention-fond); }
.pastille.manquant { color: var(--alerte); background: var(--alerte-fond); }
.pastille.mange { color: var(--encre-douce); background: var(--neutre-fond); }
.pastille.mange::before { background: none; content: "✓"; width: auto; height: auto; }
.pastille.passe { color: var(--encre-douce); background: var(--neutre-fond); }
.pastille.fait { color: var(--ok); background: var(--ok-fond); }
.pastille.a-faire { color: var(--info); background: var(--info-fond); }
.pastille.retard { color: var(--alerte); background: var(--alerte-fond); }

.etiquette {
  display: inline-block;
  max-width: 100%;
  padding: 0.0625rem var(--e2);
  border-radius: var(--rayon-s);
  background: var(--surface-2);
  color: var(--encre-douce);
  font-size: 0.75rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ══════════════════ listes ══════════════════ */

.liste { display: flex; flex-direction: column; gap: var(--e2); }
.ligne {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e3);
  padding: var(--e2) var(--e3);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon-s);
  background: var(--surface);
  min-height: var(--touche);
}
.ligne-corps { flex: 1 1 10rem; min-width: 0; }
.ligne-nom { font-weight: 550; overflow-wrap: anywhere; }
.ligne-detail { font-size: 0.8125rem; color: var(--encre-douce); overflow-wrap: anywhere; }
.ligne-actions { display: flex; flex-wrap: wrap; gap: var(--e1); flex: 0 1 auto; max-width: 100%; min-width: 0; }

.puces { display: flex; flex-wrap: wrap; gap: var(--e2); }
.puce {
  display: inline-flex;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: var(--e2);
  min-height: 2.5rem;
  padding: var(--e1) var(--e3);
  border: 0.0625rem solid var(--trait-fort);
  border-radius: 999px;
  background: var(--surface);
  color: var(--encre);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.puce:hover { border-color: var(--accent); background: var(--accent-doux); }
.puce .kcal { color: var(--encre-douce); font-variant-numeric: tabular-nums; }

/* Cases à cocher des courses : la cible est toute la ligne. */
.coche-ligne {
  display: flex;
  align-items: flex-start;
  gap: var(--e3);
  width: 100%;
  padding: var(--e2) var(--e3);
  min-height: var(--touche);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon-s);
  background: var(--surface);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.coche-ligne:hover { background: var(--surface-2); }
.coche-case {
  width: 1.375rem;
  height: 1.375rem;
  flex: none;
  margin-top: 0.125rem;
  border: 0.125rem solid var(--trait-fort);
  border-radius: 0.3rem;
  display: grid;
  place-items: center;
  color: transparent;
}
.coche-ligne[aria-pressed="true"] .coche-case {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-encre);
}
.coche-ligne[aria-pressed="true"] .ligne-nom {
  text-decoration: line-through;
  color: var(--encre-douce);
}

/* ══════════════════ semaine ══════════════════ */

.semaine-barre {
  display: flex;
  align-items: center;
  gap: var(--e2);
  margin-bottom: var(--e4);
  flex-wrap: wrap;
}
.jours { display: flex; flex-direction: column; gap: var(--e3); }

.jour {
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  overflow: hidden;
}
.jour.aujourdhui { border-color: var(--accent); box-shadow: inset 0 0 0 0.0625rem var(--accent); }
.jour.passe { opacity: 0.72; }
.jour-tete {
  display: flex;
  align-items: baseline;
  gap: var(--e3);
  padding: var(--e3) var(--e4);
  background: var(--surface-2);
  border-bottom: 0.0625rem solid var(--trait);
  flex-wrap: wrap;
}
.jour-nom { font-weight: 650; }
.jour-chiffres { margin-left: auto; font-size: 0.8125rem; color: var(--encre-douce); }
.creneaux { display: flex; flex-direction: column; }
.creneau {
  display: flex;
  gap: var(--e3);
  padding: var(--e2) var(--e4);
  border-bottom: 0.0625rem solid var(--trait);
  align-items: flex-start;
  flex-wrap: wrap;
}
.creneau:last-child { border-bottom: none; }
.creneau-nom {
  flex: 0 0 5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--encre-douce);
  font-weight: 650;
  padding-top: 0.6rem;
}
.creneau-corps { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; gap: var(--e1); }
.repas {
  display: flex;
  align-items: center;
  gap: var(--e2);
  flex-wrap: wrap;
  padding: var(--e2);
  border-radius: var(--rayon-s);
  background: var(--surface-2);
}
.repas-nom { flex: 1 1 8rem; min-width: 0; font-weight: 550; overflow-wrap: anywhere; }

/* ══════════════════ graphiques ══════════════════ */

/* Un SVG en largeur 100 % rétrécit quand l'échelle monte, parce que les
   marges en rem grandissent autour de lui : le texte des axes devenait plus
   petit quand on agrandissait tout le reste. D'où une largeur plancher en
   rem, dans un conteneur qui défile. */
.graphique { overflow-x: auto; margin: 0 calc(-1 * var(--e2)); padding: 0 var(--e2); }
.graphique svg { display: block; min-width: 20rem; width: 100%; height: auto; }
.graphique text { fill: var(--encre-douce); font-size: 0.6875rem; }
.graphique .trace { fill: none; stroke: var(--accent); stroke-width: 0.125rem; }
.graphique .grille-axe { stroke: var(--trait); stroke-width: 0.0625rem; }
.graphique .point { fill: var(--accent); }

.histo { display: flex; align-items: flex-end; gap: var(--e1); height: 5rem; overflow-x: auto; }
.histo-jour { flex: 1 0 2.3rem; display: flex; flex-direction: column; align-items: center; gap: var(--e1); }
.histo-barre {
  width: 100%;
  border-radius: var(--rayon-s) var(--rayon-s) 0 0;
  background: var(--surface-3);
  min-height: 0.25rem;
}
.histo-barre.ok { background: var(--ok); }
.histo-barre.bas { background: var(--info); }
.histo-barre.haut { background: var(--attention); }
.histo-nom { font-size: 0.6875rem; color: var(--encre-douce); white-space: nowrap; }

.verres { display: flex; flex-wrap: wrap; gap: var(--e1); }
.verre {
  width: 1.125rem;
  height: 1.5rem;
  border: 0.125rem solid var(--trait-fort);
  border-radius: 0.125rem 0.125rem 0.375rem 0.375rem;
}
.verre.plein { background: var(--info); border-color: var(--info); }

/* ══════════════════ feuille modale ══════════════════ */

.calque {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 10, 12, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 40rem) {
  .calque { align-items: center; padding: var(--e4); }
}
.feuille {
  background: var(--surface);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon) var(--rayon) 0 0;
  width: 100%;
  max-width: 34rem;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding: var(--e4);
  padding-bottom: max(var(--e4), env(safe-area-inset-bottom));
  box-shadow: 0 -0.5rem 2rem rgba(0, 0, 0, 0.2);
}
@media (min-width: 40rem) {
  .feuille { border-radius: var(--rayon); }
}
.feuille-tete {
  display: flex;
  align-items: center;
  gap: var(--e3);
  margin-bottom: var(--e4);
  position: sticky;
  top: calc(-1 * var(--e4));
  background: var(--surface);
  padding-top: var(--e1);
  z-index: 1;
}
.feuille-tete h2 { flex: 1; min-width: 0; }

/* ══════════════════ messages ══════════════════ */

.annonce {
  position: fixed;
  left: 50%;
  bottom: calc(var(--hauteur-navigation, 4.5rem) + 0.75rem);
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: var(--e3) var(--e4);
  border-radius: var(--rayon);
  background: var(--encre);
  color: var(--fond);
  box-shadow: var(--ombre);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.annonce.visible { opacity: 1; transform: translateX(-50%) translateY(-0.25rem); }
.annonce.refus { background: var(--alerte); color: #fff; }

.bandeau {
  display: flex;
  gap: var(--e3);
  align-items: flex-start;
  padding: var(--e3) var(--e4);
  border: 0.0625rem solid var(--trait);
  border-left-width: 0.25rem;
  border-radius: var(--rayon-s);
  background: var(--surface);
  margin-bottom: var(--e4);
}
.bandeau.info { border-left-color: var(--info); background: var(--info-fond); }
.bandeau.attention { border-left-color: var(--attention); background: var(--attention-fond); }
.bandeau.alerte { border-left-color: var(--alerte); background: var(--alerte-fond); }
.bandeau-corps { flex: 1; min-width: 0; }
.bandeau-titre { font-weight: 650; }

/* ══════════════════ mise en route ══════════════════ */

.parcours {
  max-width: 34rem;
  margin: 0 auto;
  padding: var(--e4) 0 var(--e6);
}
/* Les jalons du parcours : cliquables une fois franchis. La cible tactile
   fait la hauteur d'un doigt même si le trait, lui, reste fin. */
.parcours-jalons {
  display: flex;
  gap: var(--e1);
  margin-bottom: var(--e5);
}
.jalon {
  flex: 1;
  min-width: 0;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
}
.jalon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0.375rem;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.2s ease;
}
.jalon:not([disabled])::after { background: var(--accent); }
.jalon[aria-current="step"]::after {
  background: var(--accent);
  height: 0.625rem;
  box-shadow: 0 0 0 0.125rem var(--accent-doux);
}
.jalon[disabled] { cursor: default; }
.jalon:not([disabled]):hover::after { background: color-mix(in srgb, var(--accent) 80%, var(--encre)); }
.parcours-etape { font-size: 0.75rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--encre-douce); font-weight: 650; margin-bottom: var(--e2); }
.parcours h1 { margin-bottom: var(--e2); }
.parcours-chapeau { font-size: 1.0625rem; color: var(--encre-douce); margin-bottom: var(--e4); }
.parcours-points { list-style: none; padding: 0; margin: 0 0 var(--e5); display: flex;
  flex-direction: column; gap: var(--e2); }
.parcours-points li { display: flex; gap: var(--e3); align-items: flex-start; }
.parcours-points li::before {
  content: "";
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
}
.parcours-actions {
  display: flex;
  gap: var(--e2);
  flex-wrap: wrap;
  padding-top: var(--e4);
  border-top: 0.0625rem solid var(--trait);
}
.parcours-actions .bouton.principal { flex: 1 1 12rem; }

.recap { display: flex; flex-direction: column; gap: var(--e2); }
.recap-ligne {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--e3);
  padding: var(--e2) 0;
  border-bottom: 0.0625rem solid var(--trait);
}
.recap-ligne:last-child { border-bottom: none; }
.recap-ligne > * { min-width: 0; overflow-wrap: anywhere; }
.recap-valeur { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ══════════════════ divers ══════════════════ */

.tableau { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tableau th, .tableau td { padding: var(--e2); text-align: left; border-bottom: 0.0625rem solid var(--trait); }
.tableau td.n, .tableau th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tableau-conteneur { overflow-x: auto; }

details.repli { border: 0.0625rem solid var(--trait); border-radius: var(--rayon-s); background: var(--surface); }
details.repli > summary {
  padding: var(--e3) var(--e4);
  cursor: pointer;
  font-weight: 550;
  min-height: var(--touche);
  display: flex;
  align-items: center;
}
details.repli > summary::marker { color: var(--encre-douce); }
details.repli > .repli-corps { padding: 0 var(--e4) var(--e4); }

.etapes-cuisine { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--e2); counter-reset: etape; }
.etape-cuisine {
  display: flex;
  gap: var(--e3);
  padding: var(--e3);
  border: 0.0625rem solid var(--trait);
  border-radius: var(--rayon-s);
  background: var(--surface);
  align-items: flex-start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.etape-cuisine::before {
  counter-increment: etape;
  content: counter(etape);
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--encre-douce);
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 700;
}
.etape-cuisine[aria-pressed="true"] { background: var(--surface-2); }
.etape-cuisine[aria-pressed="true"]::before { background: var(--accent); color: var(--accent-encre); content: "✓"; }
.etape-cuisine[aria-pressed="true"] .etape-texte { color: var(--encre-douce); text-decoration: line-through; }

@media (min-width: 48rem) {
  .contenu { padding: var(--e5) var(--e4); }
  .creneau-nom { flex-basis: 6rem; }
}
