/* Young Serif (OFL), auto-hébergée : aucune requête vers un tiers. Une seule graisse (400) : les titres ne sont jamais mis en gras. Sous-ensemble latin (accents français, œ, «», ’, …). */
@font-face {
  font-family: 'Young Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/young-serif-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
:root {
  --bg: #f3f7ee;
  --card: #ffffff;
  --ink: #232820;
  --muted: #5d6556;
  --line: #d9e2cf;
  --green: #2a6548;
  --green-soft: #dcebdd;
  --tomato: #c24427;
  --tomato-soft: #fbe6e0;
  --sun: #f0b23e;
  --sun-soft: #fdf1d4;
  --sun-ink: #7a5300;
  --blue: #3f7ea6;
  --blue-soft: #e0eef7;
  --on-accent: #ffffff;
  --panel: #2a6548; /* le panneau du résumé : champ vert plein ; plus sombre en thème sombre pour ne pas éblouir */
  --on-panel: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(35, 50, 25, .07), 0 8px 24px rgba(35, 50, 25, .08);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --field: #747d68; /* bordure des champs : ≥ 3:1 sur fond et sur carte (WCAG 1.4.11) */
  --c-p: #d9573b;
  --c-g: #b87a06;
  --c-l: #3f7ea6;
  /* Aucune police externe : piles système (rien à télécharger, fonctionne hors ligne, aucune requête vers un tiers). */
  --font-display: 'Young Serif', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b17; --card: #27261f; --ink: #f2eee4; --muted: #a8a496; --line: #3a382e;
    --green: #7cc59e; --green-soft: #26372e; --tomato: #f57a58; --tomato-soft: #3d2a24;
    --sun: #f2c566; --sun-soft: #3a3320; --sun-ink: #f2c566; --blue: #7fb6d8; --blue-soft: #243340;
    --on-accent: #10130f;
    --panel: #245b44; --on-panel: #f2eee4;
    --field: #7a7766; --c-p: #f08468; --c-g: #f2c566; --c-l: #7fb6d8;
    --shadow: 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; } /* sans cela, .badge ou .btn (display défini) restent visibles malgré l'attribut */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; font-variant-numeric: lining-nums; line-height: 1.15; margin: 0; text-wrap: balance; }
p, li { text-wrap: pretty; }
::placeholder { color: var(--muted); opacity: 1; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 20; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.alerte { position: sticky; top: 0; z-index: 12; margin: 0; padding: 10px 16px; background: var(--tomato); color: var(--on-accent); font-weight: 700; text-align: center; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--green-soft); color: var(--ink); }
input, select { caret-color: var(--green); accent-color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }
#main:focus { outline: none; }
#main h2:focus { outline: none; }

/* ───────── En-tête ───────── */
.top { max-width: 1180px; margin: 0 auto; padding: 22px 16px 0; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brand .logo { background: var(--green); color: var(--on-accent); border-radius: 16px; width: 56px; height: 56px; display: grid; place-items: center; box-shadow: var(--shadow); }
.brand .logo .ico { width: 32px; height: 32px; stroke-width: 1.75; }
.brand h1 { font-size: 36px; color: var(--green); }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 16px; min-height: 44px; font-weight: 700; color: var(--muted); border-radius: 10px 10px 0 0; position: relative; top: 2px; border-bottom: 3px solid transparent; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); background: var(--card); }
.badge { display: inline-block; background: var(--green); color: var(--on-accent); border-radius: 999px; font-size: 13px; line-height: 1.5; min-width: 22px; text-align: center; padding: 0 7px; margin-left: 4px; }

main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 80px; }
.view-title { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.view-title h2 { font-size: 30px; }
.view-title p { margin: 4px 0 0; color: var(--muted); max-width: 60ch; }
.view-title p .ico { color: var(--green); }
.view-title .toolbar { margin: 0; }

/* ───────── Boutons ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--green); background: var(--green); color: var(--on-accent); padding: 10px 18px; min-height: 44px; border-radius: 12px; font-weight: 700; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.14); }
.btn:active { transform: none; box-shadow: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost:disabled { color: var(--muted); border-color: var(--field); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.tomato { background: var(--tomato); border-color: var(--tomato); color: var(--on-accent); }
.btn.small { padding: 6px 14px; min-height: 44px; font-size: 14px; border-radius: 10px; }
summary.btn { list-style: none; cursor: pointer; }
summary.btn::-webkit-details-marker { display: none; }
.link { border: 0; background: none; padding: 0 4px; min-height: 44px; font-weight: 700; color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--green-soft); color: var(--green); }
.icon-btn[aria-pressed="true"] { background: var(--sun-soft); color: var(--sun-ink); }
.act { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 12px; color: var(--muted); font-size: 14px; font-weight: 700; }
.act .ico { width: 20px; height: 20px; }
.act:hover { background: var(--green-soft); color: var(--green); }
.act[aria-pressed="true"] { background: var(--sun-soft); color: var(--sun-ink); }

/* Panneau replié sous un bouton (Sauvegarder, Exporter) */
.pop { position: relative; }
.pop-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; width: max-content; min-width: 240px; max-width: min(340px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; }
.pop-panel label { font-weight: 700; font-size: 14px; }
.pop-hint { margin: 0; font-size: 13px; color: var(--sun-ink); background: var(--sun-soft); border-radius: 8px; padding: 6px 10px; }
.pop-panel.menu { padding: 6px; gap: 0; min-width: 200px; }
.pop-panel.menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; min-height: 44px; padding: 0 12px; border-radius: 10px; font-weight: 600; text-align: left; }
.pop-panel.menu button:hover { background: var(--green-soft); color: var(--green); }

/* ───────── Cartes / formulaires ───────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; align-items: start; }
.card h3 { font-size: 20px; margin-bottom: 14px; color: var(--green); }
.field { display: block; margin-bottom: 12px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.field > span, .field > .lbl, .field > legend { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; padding: 0; }
.field small { color: var(--muted); font-weight: 400; font-size: 13px; }
.field small.field-err { display: block; color: var(--tomato); font-weight: 700; margin-top: 4px; }
input[type=number], input[type=text], select { width: 100%; padding: 9px 12px; min-height: 44px; border-radius: 10px; border: 2px solid var(--field); background: var(--bg); }
input[aria-invalid="true"] { border-color: var(--tomato); }
input:focus, select:focus { border-color: var(--green); outline: none; }
input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--field); background: var(--bg); font-size: 14px; font-weight: 600; }
.chip input:checked + span { background: var(--green-soft); border-color: var(--green); color: var(--green); }
/* L'état coché ne repose pas que sur la couleur : une coche apparaît devant le libellé. */
.chip input:checked + span::before { content: ''; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; }
.chip input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.kcal-box { background: var(--sun-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.kcal-box b { font-size: 20px; font-weight: 800; }
.aide { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.aide summary, .summary-more summary { cursor: pointer; font-weight: 700; color: var(--green); min-height: 44px; display: flex; align-items: center; }
.aide summary::before, .placard summary::before, .summary-more summary::before { content: ''; flex: none; width: 7px; height: 7px; margin: 0 12px 0 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.aide[open] > summary::before, .placard[open] > summary::before, .summary-more[open] > summary::before { transform: rotate(45deg); }
.aide .field, .aide .lbl { color: var(--ink); }
.notes { margin-top: 18px; }
.info { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.criteres { margin: 0; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.aide p { margin: 4px 0 0; max-width: 60ch; }
.kcal-box .recap { flex-basis: 100%; color: var(--sun-ink); font-size: 13px; }
.fold > .row2, .fold > .field, .fold > p { margin-top: 8px; }
.note { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 14px; background: var(--sun-soft); color: var(--sun-ink); max-width: 80ch; }
.notes .note { margin-bottom: 8px; }
.cta-bar { margin-top: 22px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 2; }
.cta-bar .btn { font-size: 18px; padding: 12px 26px; min-height: 52px; }
.err { color: var(--tomato); font-weight: 700; max-width: 60ch; }
.cta-hint { color: var(--muted); font-size: 14px; }

/* ───────── Planning ───────── */
/* Le résumé : le seul champ plein de la vue. Le temps de cuisine (la promesse) en grand, le rythme de la semaine à côté. */
.summary { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px 40px; margin-bottom: 12px; padding: 24px 28px; background: var(--panel); color: var(--on-panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary p { margin: 0; }
.summary .hero { display: flex; align-items: center; gap: 16px; }
.summary .hero b { font-family: var(--font-display); font-variant-numeric: lining-nums; font-weight: 400; font-size: clamp(56px, 9vw, 84px); line-height: .85; letter-spacing: -.02em; }
.summary .hero span { font-size: 18px; line-height: 1.2; font-weight: 600; }
.sum-sub { margin-top: 12px !important; font-size: 14px; opacity: .92; max-width: 44ch; }
.rythme { display: flex; align-items: flex-end; gap: 8px; }
.rb { display: grid; grid-template-rows: auto 72px auto; justify-items: center; align-items: end; gap: 4px; width: 44px; color: inherit; text-decoration: none; font-size: 13px; line-height: 1; }
.rb .v { font-weight: 700; font-variant-numeric: lining-nums; opacity: .85; }
.rb .rbar { display: flex; align-items: flex-end; width: 100%; height: 72px; }
.rb .rbar i { display: block; width: 100%; background: currentColor; opacity: .5; border-radius: 8px 8px 3px 3px; transition: opacity .2s var(--ease), transform .2s var(--ease); transform-origin: bottom; }
/* Un jour long (+15 % sur la moyenne) : jaune, comme la pastille de sa carte. */
.rb.long .rbar i { background: var(--sun); opacity: 1; }
.rb.long .v { opacity: 1; }
.rb:hover .rbar i, .rb:focus-visible .rbar i { opacity: 1; }
.rb:hover .rbar i { transform: scaleY(1.04); }
.rb .j { font-weight: 800; opacity: .9; padding-bottom: 2px; }
.rb:focus-visible { outline: 3px solid var(--on-panel); outline-offset: 2px; border-radius: 8px; }
.menus { display: flex; flex-direction: column; }
.menus > .summary-more, .menus > .lecture, .menus > .note, .menus > .legende-mn { flex: none; }
.legende-mn { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.legende-mn span { display: inline-flex; align-items: center; gap: 6px; }
.legende-mn .mn-demo { display: inline-block; width: 20px; height: 14px; border-radius: 5px; }
.mn-demo.vite { background: var(--green); }
.mn-demo.moyen { background: var(--green-soft); box-shadow: inset 0 0 0 2px var(--green); }
.mn-demo.limite { background: var(--sun-soft); box-shadow: inset 0 0 0 2px var(--sun); }
.frise-demo { display: inline-flex; gap: 3px; width: 56px; height: 8px; flex: none; transform: translateY(-.1em); }
.frise-demo i { flex: 1; background: var(--green); border-radius: 999px; }
.frise-demo i:nth-child(2) { flex: 1.6; }
.summary-more { margin-bottom: 12px; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.summary-more[open] { padding-bottom: 14px; }
.sm-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.lecture { margin-bottom: 16px; }
.macros { flex: 1 1 300px; min-width: 240px; max-width: 520px; align-self: center; }
.macros .legend { margin-top: 6px; font-size: 13px; }
.note.stale { display: flex; align-items: baseline; gap: 10px; background: var(--sun-soft); }
.note.stale .link { color: var(--sun-ink); }
.fin { display: flex; justify-content: center; margin-top: 24px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.day { scroll-margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.day > h3 { padding: 14px 16px 8px; background: var(--card); color: var(--ink); font-size: 24px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
/* Le temps de cuisine du jour : la promesse « rapide », en pastille pleine sur chaque carte ; jaune quand le jour est nettement plus chargé que la moyenne. */
.day-time { font-family: var(--font-body); font-size: 15px; font-weight: 800; color: var(--on-accent); background: var(--green); border-radius: 999px; padding: 4px 14px 4px 11px; display: inline-flex; align-items: center; gap: 6px; }
.day-time.long { background: var(--sun); color: #2b1d00; }
/* Frise du jour : une barre segmentée par repas, sa longueur est le temps du jour rapporté à trois repas au maximum. */
.day.long > h3 { background: var(--sun-soft); }
.frise-row { display: flex; align-items: center; gap: 10px; margin: 0 16px 6px; }
.frise-row small { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: lining-nums; }
.frise { flex: 1; min-width: 0; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.frise > div { display: flex; gap: 3px; height: 100%; }
.frise i { background: var(--green); border-radius: 999px; min-width: 6px; }

/* Un repas : bloc de minutes (le temps en vedette), nom, détails, puis les deux actions avec leurs libellés. La ligne entière ouvre la recette. */
.meal { position: relative; padding: 12px 14px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 2px 14px; align-items: start; }
.meal:hover { background: var(--bg); }
.meal .mn { grid-row: 1 / span 2; width: 56px; height: 56px; border-radius: 14px; display: grid; place-content: center; text-align: center; font-family: var(--font-display); line-height: 1; }
.meal .mn b { font-size: 26px; font-weight: 400; font-variant-numeric: lining-nums; }
.meal .mn small { font: 700 12px/1 var(--font-body); margin-top: 3px; }
.mn.vite { background: var(--green); color: var(--on-accent); }
.mn.moyen { background: var(--green-soft); color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.mn.limite { background: var(--sun-soft); color: var(--sun-ink); box-shadow: inset 0 0 0 2px var(--sun); }
.meal-txt { min-width: 0; display: grid; gap: 3px; padding-top: 1px; }
.meal .name { display: block; font-family: var(--font-display); font-weight: 400; font-size: 19px; background: none; border: 0; text-align: left; padding: 0; line-height: 1.2; overflow-wrap: anywhere; cursor: pointer; text-underline-offset: 4px; text-wrap: balance; }
.meal .name::after { content: ''; position: absolute; inset: 0; }
.meal:hover .name { color: var(--green); text-decoration: underline; }
.meal .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 1px 10px; }
.meal .meta > span { display: inline-flex; align-items: center; gap: 4px; }
.meal .em { font-size: 16px; line-height: 1; }
.meal .slot { font-weight: 700; color: var(--ink); }
.meal .kept { color: var(--sun-ink); font-weight: 700; }
.meal .tag { justify-self: start; margin-top: 3px; }
.meal .acts { grid-column: 2; position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; margin: 0 0 -6px -10px; }
.day footer { margin-top: auto; padding: 12px 16px; background: var(--bg); border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.day .tot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.day .tot b { font-size: 16px; font-weight: 800; }
.lecture ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; max-width: 70ch; }
.lecture li { display: flex; gap: 10px; align-items: baseline; }
.lecture li .ico { color: var(--green); transform: translateY(.2em); }
.lecture .mn-demo { display: inline-grid; place-items: center; width: 34px; height: 28px; border-radius: 9px; background: var(--green); color: var(--on-accent); font-family: var(--font-display); font-size: 16px; flex: none; transform: translateY(.3em); }
.entree .day { animation: monter .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes monter { from { opacity: 0; transform: translateY(14px); } }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.bar i:nth-child(1) { background: var(--c-p); } .bar i:nth-child(2) { background: var(--c-g); } .bar i:nth-child(3) { background: var(--c-l); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend b { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.macro-line { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tag { display: inline-block; font-size: 13px; padding: 1px 9px; border-radius: 999px; font-weight: 700; }
.tag.warn { background: var(--sun-soft); color: var(--sun-ink); }

.empty { text-align: center; padding: 56px 20px; background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .big { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.empty .big .ico { width: 34px; height: 34px; stroke-width: 1.75; }
.empty p { color: var(--muted); max-width: 440px; margin: 8px auto 18px; }
.empty-acts { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }

/* ───────── Courses ───────── */
.progress-row { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.progress-txt { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 11ch; }
.progress-txt b { font-size: 18px; font-weight: 800; }
.progress-txt .fini-ico { color: var(--green); }
.meter { flex: 1 1 140px; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .35s var(--ease); }
.shop { columns: 320px; column-gap: 18px; }
.aisle { break-inside: avoid; margin-bottom: 18px; }
.aisle h3 { font-size: 17px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.aisle h3 small { color: var(--muted); font-family: var(--font-body); font-weight: 600; }
.aisle ul { list-style: none; margin: 0; padding: 0; }
.aisle li label { display: flex; align-items: center; gap: 12px; padding: 11px 0; min-height: 44px; border-bottom: 1px solid var(--line); cursor: pointer; }
.aisle li input { width: 22px; height: 22px; accent-color: var(--green); flex: none; margin: 0; }
.aisle li .q { margin-left: auto; font-weight: 700; color: var(--muted); white-space: nowrap; }
.aisle li.done .n { text-decoration: line-through; color: var(--muted); }
.placard { margin-top: 6px; padding-top: 14px; border-top: 2px solid var(--line); }
.placard summary { cursor: pointer; display: flex; align-items: center; gap: 0; min-height: 44px; }
.placard summary span { margin-left: auto; padding-left: 10px; }
.placard summary h3 { margin: 0; }
.placard summary span { font-size: 13px; color: var(--muted); }

/* ───────── Sauvegardes ───────── */
.saves { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.save-card h3 { color: var(--ink); margin-bottom: 4px; }
.save-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.save-card .acts { display: flex; gap: 8px; }

/* ───────── Modale ───────── */
dialog { border: 0; border-radius: 20px; padding: 0; max-width: 560px; width: calc(100% - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(30, 20, 5, .5); }
.dlg { padding: 24px; position: relative; }
.dlg h2 { font-size: 24px; margin: 4px 48px 6px 0; }
.dlg .x { position: absolute; top: 10px; right: 10px; }
.dlg .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.dlg .em { font-size: 40px; line-height: 1.2; }
.pill { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700; }
.dlg h3 { margin: 16px 0 6px; font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--green); }
.dlg ul, .dlg ol { margin: 0; padding-left: 20px; }
.dlg li { margin-bottom: 4px; }
/* Autres idées pour ce repas : trois alternatives à choisir, sans tirage au sort. */
.dlg ul.alts { padding: 0; list-style: none; display: grid; gap: 8px; }
.dlg .alts li { margin: 0; }
.alt { width: 100%; min-height: 56px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); text-align: left; }
.alt .nom { font-family: var(--font-display); font-size: 17px; line-height: 1.2; display: grid; gap: 3px; }
.alt .delta { font: 600 13px/1.2 var(--font-body); color: var(--muted); }
.alt .det { color: var(--green); font-weight: 800; font-size: 14px; white-space: nowrap; }
.alt:hover { border-color: var(--green); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-weight: 700; opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s .25s; z-index: 10; }
.toast.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 8px 6px; min-height: 44px; }
.toast button:focus-visible { outline-color: var(--bg); }
body.a-cta .toast { bottom: 96px; } /* au-dessus de la barre « Générer mes menus » */

@media (hover: none) { .btn:hover { transform: none; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

.tab-ico { display: none; }

@media (max-width: 560px) {
  :root { --nav-h: 64px; }
  .top { padding-top: 16px; }
  .brand { margin-bottom: 0; }
  .brand .logo { width: 44px; height: 44px; border-radius: 14px; }
  .brand .logo .ico { width: 26px; height: 26px; }
  .brand h1 { font-size: 28px; }
  .brand p { display: none; } /* le slogan cède la place au contenu : le titre de la page d'accueil suffit */
  /* Navigation à portée du pouce : barre fixe en bas, icône + libellé. */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--card); border: 0; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabs button { top: 0; min-height: var(--nav-h); padding: 8px 2px; font-size: 13px; border-radius: 0; border-bottom: 0; border-top: 3px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; line-height: 1.2; }
  .tabs button[aria-selected="true"] { border-top-color: var(--green); border-bottom-color: transparent; background: var(--green-soft); }
  .tab-ico { display: block; width: 22px; height: 22px; }
  main { padding-bottom: calc(var(--nav-h) + 40px); }
  .cta-bar { bottom: var(--nav-h); }
  .toast { bottom: calc(var(--nav-h) + 16px); }
  body.a-cta .toast { bottom: calc(var(--nav-h) + 88px); }
  .view-title h2 { font-size: 26px; }
  .view-title { margin-bottom: 14px; }
  .cta-bar { margin-inline: -16px; padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--line); } /* vraie barre : le formulaire ne passe plus sous le bouton */
  .tabs .badge { position: absolute; top: 5px; left: calc(50% + 8px); margin: 0; min-width: 18px; padding: 0 5px; font-size: 12px; line-height: 1.45; }
  /* Résumé : le chiffre en grand, le rythme de la semaine pleine largeur dessous. */
  .summary { gap: 16px; padding: 18px 16px; }
  .summary .hero b { font-size: 60px; }
  .rythme { width: 100%; justify-content: space-between; gap: 4px; }
  .rb { width: auto; flex: 1 1 0; max-width: 48px; grid-template-rows: auto 48px auto; }
  .rb .rbar { height: 48px; }
  /* Le premier repas passe avant les explications ; « Voir la liste de courses » reste sous le pouce, collée au-dessus des onglets. */
  .menus > .legende-mn { order: 1; }
  .menus > .days { order: 2; }
  .menus > .fin { order: 3; position: sticky; bottom: var(--nav-h); z-index: 2; margin: 14px -16px 0; padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--line); }
  .menus > .fin .btn { width: 100%; font-size: 17px; min-height: 52px; }
  .menus > .summary-more, .menus > .lecture { order: 5; }
  .menus > .summary-more { margin-top: 14px; }
  .view-title .toolbar > .pri { display: none; }
  body.a-fin .toast { bottom: calc(var(--nav-h) + 88px); }
  .sm-body { display: block; }
  .macros { min-width: 0; }
  /* Le jour reste visible pendant qu'on parcourt ses repas. */
  .day > h3 { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
  .meal { padding-inline: 12px; gap: 2px 12px; }
  /* Courses : le compteur et « Tout décocher » sur une ligne, la jauge pleine largeur dessous. */
  .progress-row { gap: 8px 12px; }
  .progress-row .btn { margin-left: auto; }
  .progress-row .meter { order: 3; flex: 1 1 100%; }
  .view-title .toolbar { width: 100%; position: relative; }
  .view-title .toolbar > * { flex: 1 1 calc(50% - 5px); }
  .view-title .toolbar > .btn, .view-title .toolbar > .pop > summary { padding-inline: 10px; gap: 6px; white-space: nowrap; }
  .view-title .toolbar > .pri { flex-basis: 100%; }
  .view-title .toolbar > .pop { position: static; } /* le panneau s'ancre sur toute la largeur de la barre */
  .pop > summary { width: 100%; }
  .pop-panel { left: 0; right: 0; width: auto; max-width: none; }
  .pop-panel.menu { min-width: 0; }
}

@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #333; --line: #bbb; --field: #666; --green: #1f4d37; --green-soft: #eee; }
  body { background: #fff; color: #000; }
  .alerte, .skip { display: none !important; }
  .top, .toolbar, .view-title .btn, .toast, .cta-bar, .no-print, .progress-row { display: none !important; }
  .card, .day { box-shadow: none; }
  .summary { background: #fff; color: #000; border: 1px solid #000; box-shadow: none; }
  .day-time, .day-time.long, .mn.vite, .mn.moyen, .mn.limite { background: #fff; color: #000; border: 1px solid #000; box-shadow: none; }
  .frise i, .rb .rbar i { background: #000; }
  .day.long > h3 { background: #fff; }
  .rythme, .fin, .act { display: none !important; }
  .aisle li input { accent-color: #000; }
}
