/* ============================================================
   Popote — feuille de style
   Même grammaire que Reps : toutes les couleurs sont des tokens
   posés ici, redéfinis pour le thème clair (qui suit iOS). Un seul
   accent, « tomate », dont le reste se déduit en color-mix.
   ============================================================ */

:root {
  --accent:     #FF7A45;
  --accent-ink: #1F0A00;
  --accent-tx:  #FF9A6E;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);

  --bg:      #000000;
  --card:    #141518;
  --card-2:  #1C1D21;
  --fill:    rgba(255,255,255,.07);
  --fill-2:  rgba(255,255,255,.11);
  --line:    rgba(255,255,255,.09);
  --hair:    rgba(255,255,255,.08);

  --tx:      #F2F3F5;
  --tx-2:    rgba(242,243,245,.58);
  --tx-3:    rgba(242,243,245,.32);

  --bar:       rgba(12,12,14,.72);
  --bar-solid: #0C0C0E;
  --sheet:     rgba(26,27,31,.86);
  --sheet-solid: #1A1B1F;
  --toast:     rgba(40,41,46,.94);
  --scrim:     rgba(0,0,0,.55);

  --green: #30D158; --orange: #FF9F0A; --red: #FF453A;
  --red-tx: #FF8A80;

  --sh-card: 0 1px 0 rgba(255,255,255,.04) inset;
  --sh-sheet: 0 -20px 60px rgba(0,0,0,.6);

  --r-xl: 28px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 52px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --accent-tx: color-mix(in srgb, var(--accent) 60%, #2A0E00);
    --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);

    --bg:     #F2F2F7;
    --card:   #FFFFFF;
    --card-2: #FFFFFF;
    --fill:   rgba(118,118,128,.12);
    --fill-2: rgba(118,118,128,.18);
    --line:   rgba(0,0,0,.08);
    --hair:   rgba(0,0,0,.08);

    --tx:   #14161A;
    --tx-2: rgba(20,22,26,.58);
    --tx-3: rgba(20,22,26,.34);

    --bar:   rgba(248,248,250,.74);
    --bar-solid: #F7F7F9;
    --sheet: rgba(250,250,252,.9);
    --sheet-solid: #FAFAFC;
    --toast: rgba(30,31,35,.94);
    --scrim: rgba(0,0,0,.25);
    --red-tx: #C9271C;

    --sh-card: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.04);
    --sh-sheet: 0 -12px 40px rgba(0,0,0,.14);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--tx);
  font: 100%/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:where(input, textarea) { font-size: max(1rem, 16px); }   /* pas de zoom iOS au focus */
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
      stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }

/* Retour tactile commun : sur l'appui, instantané. */
.meal, .pick-row, .rec-card, .tile-btn, .primary-btn, .ghost-btn, .icon-btn, .add-btn,
.g-main, .tab, .sync-pill, .week-label, .stepper button, .emoji-quick button, .head-btn, .g-del {
  transition: transform .12s ease-out, background-color .15s, opacity .15s;
  touch-action: manipulation;
}
:is(.meal, .pick-row, .rec-card, .tile-btn, .primary-btn, .ghost-btn, .g-main):active { transform: scale(.975); }
:is(.icon-btn, .add-btn, .stepper button, .emoji-quick button, .sync-pill, .g-del):active { transform: scale(.9); }
:is(.head-btn, .tab):active { opacity: .55; }

/* ── Squelette ─────────────────────────────────────────────── */

.app { height: 100%; max-width: 620px; margin: 0 auto; position: relative; }
.pages, .page { position: absolute; inset: 0; }
.page-scroll {
  height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 18px) 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
  overscroll-behavior-y: contain;
}

/* Barre du haut : invisible tant que le grand titre est à l'écran,
   puis matériau translucide + petit titre, comme iOS. */
.page-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  height: calc(var(--safe-t) + 44px); padding-top: var(--safe-t);
  display: grid; place-items: center;
  pointer-events: none;
  background: transparent; border-bottom: .5px solid transparent;
  transition: background-color .2s, border-color .2s;
}
.page-bar-title { font-weight: 600; font-size: 1.0625rem; opacity: 0; transform: translateY(4px);
                  transition: opacity .2s, transform .2s; }
.page.scrolled .page-bar {
  background: var(--bar); border-bottom-color: var(--hair);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.page.scrolled .page-bar-title { opacity: 1; transform: none; }

.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 2px 6px; }
.big-title { font-size: 2.125rem; line-height: 1.1; letter-spacing: -.022em; font-weight: 800; margin: 0; }
.big-sub { margin: 0 2px 12px; color: var(--tx-2); font-size: .9375rem; }

/* ── Pastille de synchro ── */
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--fill); color: var(--tx-2);
  font-size: .8125rem; font-weight: 600; letter-spacing: .01em;
}
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--tx-3); }
.sync-pill[data-tone="ok"] i   { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.sync-pill[data-tone="busy"] i { background: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
.sync-pill[data-tone="warn"] i { background: var(--orange); }
.sync-pill[data-tone="bad"] i  { background: var(--red); }
@keyframes pulse { to { opacity: .3; } }

/* ── Boutons génériques ── */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent-tx); background: var(--fill);
}
.tile-btn {
  width: 100%; margin-top: 12px; min-height: 52px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--accent-tx); font-weight: 600; background: var(--accent-soft);
}
.tile-btn svg { width: 20px; height: 20px; }
.primary-btn {
  min-height: 50px; padding: 0 20px; border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.ghost-btn {
  min-height: 46px; padding: 0 18px; border-radius: var(--r-md);
  background: var(--fill); color: var(--accent-tx); font-weight: 600;
}
.ghost-btn.danger { color: var(--red-tx); }
.wide { width: 100%; margin-top: 10px; }
.head-btn { min-width: 64px; min-height: 44px; color: var(--accent-tx); font-size: 1.0625rem; text-align: left; }
.head-btn:last-child { text-align: right; }
.head-btn.strong { font-weight: 700; }
.head-btn:disabled { color: var(--tx-3); }
.chip {
  flex: none; font-size: .75rem; font-weight: 600; padding: 4px 9px; border-radius: 99px;
  color: var(--accent-tx); background: var(--accent-soft);
}
.empty-note { color: var(--tx-2); text-align: center; padding: 28px 12px; margin: 0; }

.search {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; margin: 10px 0 14px;
  border-radius: 12px; background: var(--fill); color: var(--tx-2);
}
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--tx); }
.search input::placeholder { color: var(--tx-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }

/* ── Semaine ───────────────────────────────────────────────── */

.week-nav { display: flex; align-items: center; gap: 10px; margin: 12px 0 16px; }
.week-label { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 4px; border-radius: 12px; }
.week-range { font-weight: 700; font-size: 1.0625rem; letter-spacing: -.01em; }
.week-rel { font-size: .8125rem; color: var(--tx-2); }

.days { display: flex; flex-direction: column; gap: 8px; }
.day { display: flex; align-items: stretch; gap: 10px; }
.day-date {
  flex: none; width: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1;
}
.dow { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tx-2); }
.dnum { font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.day.today .dow { color: var(--accent-tx); }
.day.today .dnum {
  color: var(--accent-ink); background: var(--accent);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.0625rem; margin-top: 2px;
}
.day-date.small { width: 40px; }

.meal {
  flex: 1; min-width: 0; min-height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--r-lg); text-align: left;
  background: var(--card); box-shadow: var(--sh-card);
}
.meal.empty {
  justify-content: center; gap: 6px; color: var(--tx-3); font-weight: 600; font-size: .9375rem;
  background: transparent; box-shadow: none; border: 1.5px dashed var(--line);
}
.meal.empty svg { width: 18px; height: 18px; }
.day.today .meal:not(.empty) { box-shadow: var(--sh-card), inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.meal-emoji {
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.5rem; background: var(--fill);
}
.meal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.meal-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-main small { color: var(--tx-2); font-size: .8125rem; margin-top: 2px; }

/* ── Recettes ──────────────────────────────────────────────── */

.rec-list, .pick-list { display: flex; flex-direction: column; gap: 8px; }
.rec-card, .pick-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 66px;
  border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-card); text-align: left;
}
.rec-emoji {
  flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-size: 1.625rem; background: var(--fill);
}
.pick-row { background: var(--fill); box-shadow: none; }
.pick-row.current { background: var(--accent-soft); }
.pick-row .meal-emoji { background: var(--card-2); }
.tick { color: var(--accent-tx); }

/* ── Épicerie ──────────────────────────────────────────────── */

.progress { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; margin: 0 2px 16px; }
.progress span {
  display: block; height: 100%; border-radius: inherit; background: var(--accent);
  transform-origin: left; transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.add-row { display: flex; gap: 8px; margin-bottom: 18px; }
.add-row input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--r-md);
  border: 0; outline: 0; background: var(--card); box-shadow: var(--sh-card);
}
.add-row input::placeholder { color: var(--tx-3); }
.add-row input:focus { box-shadow: 0 0 0 2px var(--accent); }
.add-btn {
  flex: none; width: 46px; height: 46px; border-radius: var(--r-md);
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
}

.aisle { margin-bottom: 18px; }
.aisle-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 6px 6px; font-weight: 700; font-size: .9375rem;
}
.aisle-head small { color: var(--tx-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.aisle-card { border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-card); overflow: hidden; }
.g-row { display: flex; align-items: center; }
.g-row + .g-row { border-top: .5px solid var(--hair); }
.g-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-align: left; min-height: 56px; }
.g-main:active { transform: none; background: var(--fill); }
.check {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--tx-3); display: grid; place-items: center;
  transition: background-color .15s, border-color .15s;
}
.check svg { width: 15px; height: 15px; stroke-width: 3; color: var(--accent-ink); opacity: 0; transition: opacity .12s; }
.g-row.done .check { background: var(--accent); border-color: var(--accent); }
.g-row.done .check svg { opacity: 1; }
.g-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.g-text b { font-weight: 500; }
.g-text b::first-letter { text-transform: uppercase; }
.g-text small { color: var(--tx-3); font-size: .75rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-qty { flex: none; color: var(--tx-2); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.g-row.done .g-text b { color: var(--tx-3); text-decoration: line-through; text-decoration-color: var(--tx-3); }
.g-row.done .g-qty { color: var(--tx-3); }
.g-del { flex: none; width: 44px; height: 44px; margin-right: 4px; display: grid; place-items: center; color: var(--tx-3); }
.g-del svg { width: 18px; height: 18px; }
.groc-foot { display: flex; gap: 8px; margin-top: 4px; }
.groc-foot .ghost-btn { flex: 1; }

.empty-state { text-align: center; padding: 40px 24px; color: var(--tx-2); }
.empty-state b { display: block; color: var(--tx); font-size: 1.0625rem; margin: 8px 0 4px; }
.empty-state p { margin: 0 auto; max-width: 30ch; font-size: .9375rem; }
.empty-emoji { font-size: 2.75rem; }

/* ── Barre d'onglets ───────────────────────────────────────── */

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(var(--safe-b) + 4px);
  background: var(--bar); border-top: .5px solid var(--hair);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.tab {
  position: relative; flex: 1; max-width: 140px; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--tx-3); font-size: .6875rem; font-weight: 600; letter-spacing: .01em;
}
.tab svg { width: 25px; height: 25px; stroke-width: 1.8; }
.tab[aria-current="page"] { color: var(--accent-tx); }
.tab-badge {
  position: absolute; top: 4px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .6875rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}

/* ── Feuille du bas ────────────────────────────────────────── */

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 620px; margin: 0 auto; max-height: calc(100dvh - var(--safe-t) - 24px);
  display: flex; flex-direction: column;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--sheet); box-shadow: var(--sh-sheet);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  transform: translate3d(0,100%,0); will-change: transform;
}
.grabber {
  position: absolute; top: 6px; left: 50%; width: 38px; height: 5px; margin-left: -19px;
  border-radius: 99px; background: var(--tx-3); pointer-events: none;
}
.sheet-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px 6px; touch-action: none; cursor: grab;
}
.sheet-title { font-weight: 700; font-size: 1.0625rem; text-align: center; flex: 1; min-width: 0;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(var(--safe-b) + 24px);
}
.sheet-sub { color: var(--tx-2); margin: 0 2px 12px; }
.sheet .search { margin-top: 4px; }

/* Détail de recette */
.rd-hero { text-align: center; padding: 4px 8px 14px; }
.rd-emoji { font-size: 3.5rem; line-height: 1; display: block; }
.rd-hero h2 { margin: 10px 0 4px; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.018em; font-weight: 800; }
.rd-hero p { margin: 0; color: var(--tx-2); }
.rd-actions { display: flex; gap: 8px; margin-bottom: 20px; }
.rd-actions > * { flex: 1; }
.rd-sec { margin-bottom: 22px; }
.rd-sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rd-sec h3 { margin: 0 2px; font-size: 1.1875rem; letter-spacing: -.01em; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--fill); border-radius: 99px; padding: 3px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-2); color: var(--accent-tx);
}
.stepper button:disabled { color: var(--tx-3); }
.stepper svg { width: 16px; height: 16px; stroke-width: 2.4; }
.stepper span { min-width: 88px; text-align: center; font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ing-list { list-style: none; margin: 0; padding: 4px 14px; border-radius: var(--r-lg); background: var(--card-2); }
.ing-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.ing-list li + li { border-top: .5px solid var(--hair); }
.ing-dot { font-size: .95rem; width: 22px; text-align: center; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 8px 2px; line-height: 1.5; }
.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8125rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-tx); margin-top: 1px;
}

/* Éditeur */
.editor .field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .8125rem; font-weight: 600; color: var(--tx-2); margin: 0 4px 6px; }
.field em { font-style: normal; font-weight: 500; color: var(--tx-3); }
.field input, .field textarea {
  width: 100%; border: 0; outline: 0; border-radius: var(--r-md);
  background: var(--card-2); padding: 12px 14px; line-height: 1.45;
  box-shadow: var(--sh-card);
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.emoji-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.emoji-input {
  flex: none; width: 64px; height: 64px; border-radius: 18px; border: 0; outline: 0;
  text-align: center; font-size: 2rem !important; background: var(--card-2); box-shadow: var(--sh-card);
}
.emoji-quick { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.emoji-quick::-webkit-scrollbar { display: none; }
.emoji-quick button { flex: none; width: 40px; height: 40px; border-radius: 12px; font-size: 1.375rem; }
.ing-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 16px; }
.prev-chip { font-size: .8125rem; padding: 4px 10px; border-radius: 99px; background: var(--fill); color: var(--tx-2); }

/* Réglages */
.set-h { font-size: .8125rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tx-2); margin: 10px 4px 8px; }
.set-h ~ .set-h { margin-top: 28px; }
.set-card { border-radius: var(--r-lg); background: var(--card-2); padding: 2px 14px; }
.set-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; }
.set-line + .set-line { border-top: .5px solid var(--hair); }
.set-line span { color: var(--tx-2); }
.code { font-size: .75rem; letter-spacing: .02em; text-align: right; white-space: nowrap; }
.set-line > span { flex: none; }
.note { color: var(--tx-2); font-size: .875rem; margin: 10px 4px; }
.note.center { text-align: center; color: var(--tx-3); margin-top: 24px; }
.sheet .add-row { margin-top: 10px; }
.sheet .add-row input { background: var(--card-2); }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 22px);
  display: flex; align-items: center; gap: 14px;
  max-width: min(92vw, 420px); padding: 10px 10px 10px 18px; min-height: 48px;
  border-radius: 99px; background: var(--toast); color: #F2F3F5;
  box-shadow: 0 12px 34px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: .9375rem; font-weight: 500;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 16px) scale(.96);
  transition: opacity .2s ease, transform .35s cubic-bezier(.2,.9,.25,1);
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast button { flex: none; padding: 7px 14px; border-radius: 99px; background: rgba(255,255,255,.12); color: #FFB08C; font-weight: 700; }
.toast:not(:has(button)) { padding-right: 18px; }

/* ══ v2 ═══════════════════════════════════════════════════════ */

/* ── Filtres ── */
.filters {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: -4px -16px 14px; padding: 2px 16px;
}
.filters::-webkit-scrollbar { display: none; }
.filters.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.fchip {
  flex: none; height: 34px; padding: 0 13px; border-radius: 99px;
  background: var(--fill); color: var(--tx-2); font-size: .875rem; font-weight: 600;
  transition: transform .12s ease-out, background-color .15s, color .15s;
}
.fchip:active { transform: scale(.94); }
.fchip.on { background: var(--accent); color: var(--accent-ink); }

.tile-row { display: flex; gap: 8px; }
.tile-row .tile-btn { flex: 1; }

/* ── Vignettes photo ── */
.has-photo { padding: 0; overflow: hidden; }
.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stars-inline { color: var(--orange); letter-spacing: .02em; }

/* ── Détail : photo, étoiles, notes ── */
.rd-photo {
  margin: -2px -16px 14px; aspect-ratio: 16 / 10; overflow: hidden;
  mask-image: linear-gradient(#000 70%, transparent);
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
}
.rd-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rd-photo + .rd-hero { margin-top: -40px; position: relative; }
.rd-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.stars { display: flex; justify-content: center; gap: 2px; margin-top: 10px; }
.stars button {
  width: 40px; height: 40px; font-size: 1.625rem; line-height: 1; color: var(--fill-2);
  transition: color .15s;
}
.stars button.on { color: var(--orange); }
.stars.big button { width: 52px; height: 52px; font-size: 2.25rem; }
.cook-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 8px; }
.note-box {
  width: 100%; border: 0; outline: 0; border-radius: var(--r-md); resize: vertical;
  background: var(--card-2); padding: 12px 14px; line-height: 1.45; box-shadow: var(--sh-card);
}
.note-box:focus { box-shadow: 0 0 0 2px var(--accent); }
.source-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* ── Import ── */
.how { margin: 0 0 14px; padding: 0 0 0 22px; color: var(--tx-2); font-size: .9375rem; }
.how li { margin-bottom: 6px; }
.how b { color: var(--tx); }
#im-paste { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; }

/* ── Éditeur : photo ── */
.photo-pick { margin-bottom: 14px; }
.photo-pick img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-lg); display: block; }
.photo-empty {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 64px; cursor: pointer;
  border-radius: var(--r-lg); border: 1.5px dashed var(--line); color: var(--tx-2); font-weight: 600;
}
.photo-actions { display: flex; gap: 8px; margin-top: 8px; }
.photo-btn {
  flex: 1; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  background: var(--fill); color: var(--accent-tx); font-weight: 600; font-size: .9375rem;
}

/* ── Épicerie : budget, prix, garde-manger ── */
.budget {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 1px;
  margin: -6px 2px 16px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--sh-card);
}
.budget span { color: var(--tx-2); font-size: .9375rem; }
.budget b { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.budget small { grid-column: 1 / -1; color: var(--tx-3); font-size: .75rem; }
.g-side {
  flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  padding: 0 14px 0 6px; text-align: right; line-height: 1.25; min-width: 72px;
}
.g-side:active { background: var(--fill); }
.g-price { font-size: .75rem; color: var(--tx-2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.g-price.none { color: var(--accent-tx); opacity: .75; }
.g-row.done .g-price { color: var(--tx-3); }
.g-row .g-del { margin-left: -8px; }
.groc-foot { flex-wrap: wrap; }
.groc-foot .ghost-btn { padding: 0 10px; font-size: .9375rem; }
.groc-foot #groc-pantry { flex: 1 1 100%; }

.pantry-toggle { width: 100%; text-align: left; color: var(--tx-2); }
.pantry-toggle small { display: inline-flex; align-items: center; gap: 2px; }
.pantry-toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.pantry.open .pantry-toggle svg { transform: rotate(90deg); }
.pantry-row .g-main { cursor: default; }
.pantry-row .g-text b { color: var(--tx-2); }
.ghost-mini {
  flex: none; margin-right: 10px; height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--fill); color: var(--accent-tx); font-size: .8125rem; font-weight: 600;
}
.pantry-list { margin-top: 12px; background: var(--card-2); }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.toggle-row + .toggle-row { border-top: .5px solid var(--hair); }

/* Interrupteur façon iOS, à partir d'une vraie case à cocher. */
.switch {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 51px; height: 31px; border-radius: 99px; background: var(--fill-2); position: relative;
  transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .28s cubic-bezier(.3,1.4,.5,1);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* Prix */
.field > .money-input { display: flex; align-items: center; gap: 10px; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.money-input input { font-size: 1.5rem !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-input b { font-size: 1.375rem; color: var(--tx-2); }

/* ── Mode cuisine ── */
.cook {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: var(--bg); padding: calc(var(--safe-t) + 6px) 0 calc(var(--safe-b) + 12px);
}
.cook-top { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.cook-x { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
button.cook-x { background: var(--fill); color: var(--tx-2); }
.cook-title { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.cook-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-title span { font-size: .8125rem; color: var(--tx-2); }
.cook-dots { display: flex; justify-content: center; gap: 5px; margin: 12px 0 4px; }
.cook-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--fill-2); transition: width .25s, background-color .25s; }
.cook-dots i.on { width: 18px; background: var(--accent); }
.cook-timers { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px 12px 0; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 14px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent-tx);
}
.timer-pill b { font-variant-numeric: tabular-nums; font-size: 1.0625rem; }
.timer-pill small { color: var(--tx-2); font-size: .75rem; max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-pill button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--tx-2); }
.timer-pill button svg { width: 16px; height: 16px; }
.timer-pill.rang { background: var(--accent); color: var(--accent-ink); animation: ring .5s ease-in-out infinite alternate; }
.timer-pill.rang small, .timer-pill.rang button { color: var(--accent-ink); }
@keyframes ring { to { transform: scale(1.05); } }

.cook-viewport { flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.cook-track { display: flex; height: 100%; will-change: transform; }
.cook-slide {
  flex: 0 0 100%; min-width: 0; overflow-wrap: anywhere; height: 100%; overflow-y: auto; padding: 24px 24px 16px;
  display: flex; flex-direction: column;
}
.cook-kicker { margin: 0 0 14px; color: var(--accent-tx); font-weight: 700; font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; }
.cook-step { margin: 0; font-size: clamp(1.5rem, 6.4vw, 2.125rem); line-height: 1.35; letter-spacing: -.012em; font-weight: 600; }
.timer-chip {
  display: inline-flex; align-items: center; padding: 0 12px; margin: 2px 0; border-radius: 99px; height: 1.6em;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .8em; vertical-align: .08em;
  transition: transform .12s ease-out;
}
.timer-chip:active { transform: scale(.94); }
.cook-ing { list-style: none; margin: 0; padding: 0; }
.cook-ing button {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 2px; text-align: left;
  font-size: 1.1875rem; border-bottom: .5px solid var(--hair);
}
.cook-ing button.done { color: var(--tx-3); text-decoration: line-through; }
.cook-ing button.done .check { background: var(--accent); border-color: var(--accent); }
.cook-ing button.done .check svg { opacity: 1; }
.cook-end { align-items: center; justify-content: center; text-align: center; gap: 4px; }
.cook-end h2 { margin: 10px 0 0; font-size: 2rem; letter-spacing: -.02em; }
.cook-end p { margin: 0 0 6px; color: var(--tx-2); }
.cook-end .primary-btn { margin-top: 22px; min-width: 200px; }
.cook-emoji { font-size: 4rem; line-height: 1; }
.cook-nav { display: flex; gap: 10px; padding: 8px 16px 0; }
.cook-nav .ghost-btn { flex: 1; }
.cook-nav .primary-btn { flex: 2; }
.cook-nav button:disabled { opacity: .35; }

/* ── Accessibilité ─────────────────────────────────────────── */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
  .toast { transform: translate(-50%, 0); }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar, .page.scrolled .page-bar { background: var(--bar-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .sheet { background: var(--sheet-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(128,128,128,.6); --hair: rgba(128,128,128,.5); --tx-3: var(--tx-2); }
}


/* ── v4 : liste bilingue, fiche article ── */
.g-en { font-weight: 400; color: var(--tx-2); }
.g-row.done .g-en { color: var(--tx-3); }
.learned-fr { font-weight: 600; color: var(--tx); }
.learned-fr::first-letter { text-transform: uppercase; }
#set-learned .set-line span { color: var(--tx-2); }

/* ══ v5 : passe de finition, mode magasin, bilan, import par capture ══ */

:root { --chart: #E8612C; }
.page-scroll { scrollbar-width: none; }
.page-scroll::-webkit-scrollbar { display: none; }

/* ── Semaine : résumé, jours passés, jours vides plus discrets ── */
.week-nav { margin-bottom: 6px; }
.week-sum { margin: 0 0 14px; text-align: center; color: var(--tx-2); font-size: .875rem; font-variant-numeric: tabular-nums; }
.week-sum b { color: var(--tx); font-weight: 700; }
.day.past .meal:not(.empty) { opacity: .6; }
.day.past .dnum, .day.past .dow { color: var(--tx-3); }
.meal.empty {
  min-height: 52px; justify-content: flex-start; padding-left: 16px;
  border: 0; background: color-mix(in srgb, var(--fill) 70%, transparent);
}
.meal.empty svg { color: var(--accent-tx); }
.day.past .meal.empty { opacity: .55; }

/* ── Recettes : grille de cartes ── */
.tile-row.top { margin: 4px 0 2px; }
.tile-row.top .tile-btn { margin-top: 0; min-height: 46px; }
.rec-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rec-list > .empty-note { grid-column: 1 / -1; }
.rec-card {
  position: relative; flex-direction: column; align-items: stretch; gap: 0;
  padding: 0; min-height: 0; overflow: hidden; text-align: left;
}
.rec-thumb {
  display: grid; place-items: center; aspect-ratio: 4 / 3; font-size: 3rem;
  background: radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--fill);
}
.rec-thumb.has-photo { background: var(--fill); }
.rec-info { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; line-height: 1.25; }
.rec-info b {
  font-weight: 650; font-size: .9375rem; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rec-info small { color: var(--tx-2); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-badge {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 99px;
  font-size: .6875rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* ── Épicerie : résumé avec anneau ── */
.groc-hero {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px 16px; margin: 0 0 10px; border-radius: var(--r-lg);
  background: var(--card); box-shadow: var(--sh-card);
}
.ring { width: 48px; height: 48px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--fill-2); stroke-width: 5; }
.ring .ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 100;
                   transition: stroke-dasharray .5s cubic-bezier(.2,.8,.2,1), opacity .2s; }
.ring .ring-fill.zero { opacity: 0; }
.hero-left { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.hero-left b { font-size: 1.125rem; font-weight: 750; letter-spacing: -.01em; }
.hero-left small, .hero-budget small { color: var(--tx-2); font-size: .75rem; }
.hero-budget { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.2; }
.hero-budget b { font-size: 1.125rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.shop-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 18px; }
.shop-btn svg { width: 20px; height: 20px; }

/* ── Import par capture ── */
.import-src { display: flex; gap: 8px; margin: 0 0 14px; }
.import-src .ghost-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; cursor: pointer; }
.import-src svg { width: 20px; height: 20px; }
#im-paste { margin: 0; }
.import-src .busy { opacity: .45; pointer-events: none; }
.ocr-bar { position: relative; margin: -4px 0 14px; padding: 10px 14px; border-radius: var(--r-md); background: var(--accent-soft); overflow: hidden; }
.ocr-bar span { position: relative; z-index: 1; color: var(--accent-tx); font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ocr-bar i { position: absolute; inset: 0; background: var(--accent-soft); transform-origin: left; transform: scaleX(0); transition: transform .3s ease-out; }

/* ── Mode magasin ── */
.shop {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  max-width: 620px; margin: 0 auto;
  background: var(--bg); padding: calc(var(--safe-t) + 6px) 0 0;
}
.shop-top { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.shop-count { font-variant-numeric: tabular-nums; }
.shop-progress { height: 4px; margin: 10px 16px 0; border-radius: 99px; background: var(--fill); overflow: hidden; }
.shop-progress span { display: block; height: 100%; background: var(--accent); transform-origin: left;
                      transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.shop-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 24px; scrollbar-width: none; }
.shop-aisle { margin-bottom: 20px; }
.shop-aisle h3 { margin: 0 6px 8px; font-size: 1rem; font-weight: 750; display: flex; gap: 6px; align-items: baseline; }
.shop-aisle h3 small { color: var(--tx-3); font-weight: 600; }
.shop-card { border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-card); overflow: hidden; }
.shop-row { position: relative; --p: 0; }
.shop-row + .shop-row .shop-item { border-top: .5px solid var(--hair); }
.shop-under {
  position: absolute; inset: 0; display: flex; align-items: center; padding-left: 22px;
  background: color-mix(in srgb, var(--green) calc(var(--p) * 100%), var(--fill-2));
  color: #fff;
}
.shop-under svg { width: 28px; height: 28px; stroke-width: 3; transform: scale(calc(.6 + var(--p) * .4)); }
.shop-item {
  position: relative; width: 100%; display: flex; align-items: center; gap: 14px;
  min-height: 68px; padding: 12px 16px; text-align: left; background: var(--card);
  touch-action: pan-y; will-change: transform;
}
.shop-item .check { width: 28px; height: 28px; }
.shop-item .check svg { width: 17px; height: 17px; }
.shop-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.shop-name b { font-size: 1.1875rem; font-weight: 600; letter-spacing: -.01em; }
.shop-name b::first-letter { text-transform: uppercase; }
.shop-name small { color: var(--tx-2); font-size: .8125rem; margin-top: 2px; }
.shop-qty { flex: none; font-size: 1.0625rem; font-weight: 600; color: var(--tx-2); font-variant-numeric: tabular-nums; text-align: right; max-width: 45%; }
.shop-row.done .check { background: var(--accent); border-color: var(--accent); }
.shop-row.done .check svg { opacity: 1; }
.shop-row.done .shop-name b { color: var(--tx-3); text-decoration: line-through; }
.shop-row.done .shop-name small, .shop-row.done .shop-qty { color: var(--tx-3); }
.shop-aisle.cart .shop-item { min-height: 56px; }
.shop-aisle.cart .shop-name b { font-size: 1rem; }
.shop-hint { margin: 0; padding: 10px 16px calc(var(--safe-b) + 12px); text-align: center; font-size: .8125rem; color: var(--tx-3); border-top: .5px solid var(--hair); }
.shop-done { text-align: center; padding: 40px 20px 30px; }
.shop-done span { font-size: 3.5rem; line-height: 1; }
.shop-done b { display: block; font-size: 1.5rem; letter-spacing: -.015em; margin: 12px 0 4px; }
.shop-done p { color: var(--tx-2); margin: 0 0 20px; }
.shop-done .primary-btn { min-width: 200px; }

/* ── Bilan ── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 24px; }
.stat { padding: 14px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-card); display: flex; flex-direction: column; gap: 4px; }
.stat small { color: var(--tx-2); font-size: .8125rem; line-height: 1.2; }
.stat b { font-size: 1.625rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bl-sec { margin-bottom: 24px; }
.bl-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 6px 8px; }
.bl-head h3 { margin: 0; font-size: 1.1875rem; letter-spacing: -.01em; }
.bl-head small { color: var(--tx-3); font-size: .8125rem; font-weight: 600; }
.bl-card { border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-card); padding: 14px 12px 12px; }
.bl-card.list { padding: 2px 0; }
.bchart { display: block; width: 100%; height: auto; overflow: visible; stroke: none; }
.bchart text, .bchart path, .bchart rect { stroke: none; }
.bchart .base { stroke: var(--line); stroke-width: 1; }
.bchart .hit { fill: transparent; }
.bchart path { fill: var(--chart); opacity: .5; transition: opacity .15s; }
.bchart .bar.sel path { opacity: 1; }
.bchart text { font: 600 10px/1 -apple-system, system-ui, "Segoe UI", sans-serif; text-anchor: middle; fill: var(--tx-3); font-variant-numeric: tabular-nums; }
.bchart .val { fill: var(--tx-2); }
.bchart .bar.sel .val, .bchart .bar.sel .lab { fill: var(--tx); font-weight: 700; }
.bchart .bar { cursor: pointer; outline: none; }
.bl-detail { margin: 10px 4px 0; text-align: center; font-size: .875rem; color: var(--tx-2); font-variant-numeric: tabular-nums; }
.bl-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; transition: background-color .15s; }
.bl-row + .bl-row { border-top: .5px solid var(--hair); }
.bl-row:active { background: var(--fill); }
.bl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; line-height: 1.2; }
.bl-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-main small { color: var(--tx-2); font-size: .8125rem; }
.bl-track { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.bl-track i { display: block; height: 100%; border-radius: 99px; background: var(--chart); transform-origin: left; }
.bl-n { flex: none; min-width: 24px; text-align: right; font-weight: 750; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.bl-add { flex: none; font-size: .8125rem; font-weight: 700; color: var(--accent-tx); padding: 6px 12px; border-radius: 99px; background: var(--accent-soft); }
.bl-card.hist { padding: 12px 14px 6px; margin-bottom: 10px; }
.bl-card.hist header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.bl-card.hist header small { color: var(--tx-2); font-variant-numeric: tabular-nums; font-size: .875rem; }
.hist-row { width: 100%; display: flex; gap: 12px; padding: 6px 0; text-align: left; align-items: baseline; }
.hist-day { flex: none; width: 34px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--tx-3); }
.hist-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--tx); }

@media (prefers-reduced-transparency: reduce) {
  .rec-badge { background: rgba(0,0,0,.75); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
