/* ============================================================
   Menu — système de design « appli mobile » (esprit iOS)
   Téléphone d'abord : listes groupées, cartes arrondies sans bordure, barre d'onglets flottante,
   fenêtres en tiroir, animations douces. Ordinateur : barre latérale épurée, contenu centré.
   ============================================================ */

@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --bg: #f2f2f7;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f9;
  --surface-3: #ececf1;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --sep: rgba(60, 60, 67, .12);
  --border: rgba(60, 60, 67, .1);
  --border-strong: rgba(60, 60, 67, .2);
  --text: #111114;
  --text-2: #3c3c43;
  --muted: #6e6e76;
  --faint: #a1a1aa;
  --accent: #ff5a36;
  --accent-2: #ff8a3d;
  --accent-hover: #f04a26;
  --accent-soft: #fff0eb;
  --accent-fill: rgba(255, 90, 54, .14);
  --on-accent: #ffffff;
  --grad: linear-gradient(135deg, #ff8a3d 0%, #ff5a36 55%, #f43f5e 100%);
  --pos: #16a34a; --pos-soft: #e7f8ee;
  --neg: #e5484d; --neg-soft: #fdecec;
  --warn: #d97706; --warn-soft: #fff4e0;
  --info: #0a84ff; --info-soft: #e6f2ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -12px rgba(0, 0, 0, .12);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .35);
  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --tab-h: 64px;
  --top-h: 56px;
  --side: 260px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* Teintes « cuisine » des plats */
  --t-coral-1: #ffe4d9; --t-coral-2: #ffc2a6; --t-coral-ink: #9a3412;
  --t-basil-1: #dcf5e1; --t-basil-2: #a9e5b6; --t-basil-ink: #166534;
  --t-berry-1: #fde0ec; --t-berry-2: #f7b6d2; --t-berry-ink: #9d174d;
  --t-ocean-1: #dbeeff; --t-ocean-2: #a9d4fb; --t-ocean-ink: #075985;
  --t-saffron-1: #fff0c7; --t-saffron-2: #ffd978; --t-saffron-ink: #92400e;
  --t-neutral-1: #eeeef3; --t-neutral-2: #dcdce4; --t-neutral-ink: #3c3c43;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #1c1c1e;
  --surface: #1c1c1e;
  --surface-2: #242427;
  --surface-3: #2c2c2e;
  --fill: rgba(118, 118, 128, .24);
  --fill-2: rgba(118, 118, 128, .16);
  --sep: rgba(84, 84, 88, .55);
  --border: rgba(84, 84, 88, .45);
  --border-strong: rgba(120, 120, 128, .55);
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #98989f;
  --faint: #636366;
  --accent: #ff6a45;
  --accent-hover: #ff7d5c;
  --accent-soft: rgba(255, 106, 69, .16);
  --accent-fill: rgba(255, 106, 69, .2);
  --pos: #30d158; --pos-soft: rgba(48, 209, 88, .16);
  --neg: #ff453a; --neg-soft: rgba(255, 69, 58, .16);
  --warn: #ff9f0a; --warn-soft: rgba(255, 159, 10, .16);
  --info: #0a84ff; --info-soft: rgba(10, 132, 255, .16);
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .8);
  --t-coral-1: #3b2018; --t-coral-2: #5c2c1c; --t-coral-ink: #ffb495;
  --t-basil-1: #132c1b; --t-basil-2: #1d4a2b; --t-basil-ink: #8fe3a5;
  --t-berry-1: #351628; --t-berry-2: #57203f; --t-berry-ink: #f9a8cc;
  --t-ocean-1: #11263a; --t-ocean-2: #1a3d5e; --t-ocean-ink: #95cdf8;
  --t-saffron-1: #33270d; --t-saffron-2: #554215; --t-saffron-ink: #fcd571;
  --t-neutral-1: #232326; --t-neutral-2: #303034; --t-neutral-ink: #d1d1d6;
  color-scheme: dark;
}
.tint-coral   { --t1: var(--t-coral-1);   --t2: var(--t-coral-2);   --ink: var(--t-coral-ink); }
.tint-basil   { --t1: var(--t-basil-1);   --t2: var(--t-basil-2);   --ink: var(--t-basil-ink); }
.tint-berry   { --t1: var(--t-berry-1);   --t2: var(--t-berry-2);   --ink: var(--t-berry-ink); }
.tint-ocean   { --t1: var(--t-ocean-1);   --t2: var(--t-ocean-2);   --ink: var(--t-ocean-ink); }
.tint-saffron { --t1: var(--t-saffron-1); --t2: var(--t-saffron-2); --ink: var(--t-saffron-ink); }
.tint-neutral { --t1: var(--t-neutral-1); --t2: var(--t-neutral-2); --ink: var(--t-neutral-ink); }
.tint-empty   { --t1: var(--accent-soft); --t2: var(--accent-fill); --ink: var(--accent); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: calc(var(--top-h) + 16px); }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); min-height: 100dvh; -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01', 'ss03'; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
kbd { font: 600 11px var(--font); color: var(--faint); border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 6px; }
.ic { width: 20px; height: 20px; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }
.cost { color: var(--pos); font-weight: 700; letter-spacing: .5px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Coquille ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: .5px solid transparent; transition: border-color .2s; }
body.scrolled .topbar { border-bottom-color: var(--sep); }
.top-left { position: relative; display: flex; align-items: center; min-width: 0; height: 100%; }
.top-left .brand { transition: opacity .2s, transform .2s; }
.top-title { position: absolute; left: 0; white-space: nowrap; font-weight: 700; font-size: 17px; letter-spacing: -.01em; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
body.scrolled .top-title { opacity: 1; transform: none; }
body.scrolled .top-left .brand { opacity: 0; transform: translateY(-6px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 18px; letter-spacing: -.02em; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fill-2); color: var(--text); cursor: pointer; transition: transform .15s var(--ease), background .15s; flex-shrink: 0; }
.icon-btn:active { transform: scale(.9); }
.icon-btn .ic { width: 19px; height: 19px; }
.avatar-btn { padding: 0; border: 0; background: none; cursor: pointer; }
.view { width: 100%; max-width: 1080px; margin: 0 auto; padding: 4px 16px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; outline: none; }
.view > * { animation: rise .35s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .03s; } .view > *:nth-child(3) { animation-delay: .06s; } .view > *:nth-child(4) { animation-delay: .09s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 90px 0; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--fill); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.desktop-only { display: none !important; }

/* Barre d'onglets flottante */
.tabbar { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--tab-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 0 6px; border-radius: 24px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent); backdrop-filter: saturate(1.8) blur(24px); -webkit-backdrop-filter: saturate(1.8) blur(24px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .25), 0 0 0 .5px var(--border); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--faint); font-size: 10.5px; font-weight: 600; cursor: pointer; text-decoration: none; transition: color .15s, transform .15s var(--ease); }
.tab:active { transform: scale(.9); }
.tab .ic { width: 24px; height: 24px; }
.tab[aria-current="page"], .tab.active { color: var(--accent); }
.tab[aria-current="page"] .ic { stroke-width: 2.4; }
.tab .count { position: absolute; top: 0; left: calc(50% + 6px); }
.tab-add { justify-self: center; width: 52px; height: 52px; border-radius: 18px; border: 0; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 10px 22px -8px var(--accent); cursor: pointer; transition: transform .15s var(--ease); }
.tab-add:active { transform: scale(.9) rotate(90deg); }
.tab-add .ic { width: 26px; height: 26px; stroke-width: 2.6; }

/* Fiche recette sur téléphone : la couverture porte ses propres boutons */
@media (max-width: 959px) {
  body[data-route="recette"] .topbar { display: none; }
  body[data-route="recette"] .view { padding-top: 0; }
  body[data-route="recette"] .recipe-page { margin-top: 0; }
  body[data-route="recette"] .recipe-cover { padding-top: env(safe-area-inset-top); height: calc(300px + env(safe-area-inset-top)); }
  body[data-route="recette"] .cover-back, body[data-route="recette"] .cover-actions { top: calc(14px + env(safe-area-inset-top)); }
  .page-actions .btn-primary:not(.keep-label) span { display: none; }
  .page-actions .btn-primary:not(.keep-label) { width: 44px; padding: 0; }
  .btn-row.plan-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .btn-row.plan-actions .btn span { overflow: hidden; text-overflow: ellipsis; }
  .btn-row.plan-actions .btn .ic { width: 17px; height: 17px; }
  /* En-têtes : le titre prend toute la largeur, les actions passent dessous */
  .page-head { align-items: flex-start; }
  .page-head > .page-head-main { flex: 1 1 100%; }
  .page-head > .page-head-main:has(+ .page-actions .btn-primary:not(.keep-label):only-child) { flex: 1 1 0; }
  /* Ajout d'article aux courses : le libellé sur sa propre ligne */
  #extra-form { flex-wrap: wrap; }
  #extra-form .input:first-child { flex: 1 1 100%; }
  #extra-form .aisle-input { flex: 1 1 auto !important; }
  .btn-row.plan-actions .btn { padding: 0 8px; font-size: 14px; gap: 5px; }
}

/* ---------- Ordinateur ---------- */
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh; padding: 22px 14px 16px; background: var(--bg-elev); border-right: .5px solid var(--sep); }
  .sidebar .brand { padding: 2px 10px 18px; }
  .side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .nav-title { font-size: 12px; font-weight: 650; color: var(--faint); padding: 14px 12px 6px; }
  .nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-weight: 560; transition: background .12s; }
  .nav-link:hover { background: var(--fill-2); }
  .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
  .nav-link .count { margin-left: auto; }
  .nav-cta { margin: 6px 4px 12px; }
  .side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: .5px solid var(--sep); }
  .side-foot .user-name { flex: 1; font-weight: 600; }
  .tabbar, .mobile-only { display: none !important; }
  .desktop-only { display: inline-flex !important; }
  .topbar { padding: 0 32px; }
  .view { padding: 8px 32px 64px; gap: 26px; }
  .search-trigger { display: flex; align-items: center; gap: 10px; width: 380px; height: 40px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--fill-2); color: var(--muted); cursor: pointer; font-size: 14.5px; }
  .search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 959px) {
  .search-trigger { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--fill-2); display: grid; place-items: center; color: var(--text); padding: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger .ic { width: 19px; height: 19px; }
}

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-top: 6px; }
.page-head-main { min-width: 0; flex: 1; }
.page-kicker { color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.page-kicker::first-letter { text-transform: uppercase; }
.page-title { font-size: 34px; font-weight: 800; letter-spacing: -.035em; line-height: 1.08; }
.page-sub { color: var(--muted); margin-top: 6px; font-size: 15px; }
.page-actions, .page-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 16px; color: var(--accent); margin-bottom: -10px; }
.back .ic { width: 22px; height: 22px; margin-left: -6px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 21px; font-weight: 750; letter-spacing: -.02em; padding: 0 2px; }
.section-title .small { font-weight: 600; font-size: 15px; }
.subhead { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 4px 8px; text-transform: uppercase; letter-spacing: .03em; }
.hint-line { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; padding: 0 4px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack:empty { display: none; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 720px; width: 100%; }
.grid { display: grid; gap: 18px; align-items: start; }
.grid.cols-main { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .grid.cols-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 18px; border-radius: 14px; border: 0; background: var(--fill); color: var(--text);
  font-weight: 620; font-size: 15px; white-space: nowrap; cursor: pointer; text-decoration: none !important; transition: transform .15s var(--ease), background .15s, filter .15s; }
.btn:hover { background: color-mix(in srgb, var(--fill) 100%, var(--text) 4%); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { background: var(--grad); color: var(--on-accent); box-shadow: 0 8px 18px -10px var(--accent); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-danger-soft { background: var(--neg-soft); color: var(--neg); }
.btn-danger-text { color: var(--neg) !important; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-sm .ic { width: 17px; height: 17px; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-light { background: rgba(255, 255, 255, .94); color: #111114; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .18); }
.btn-light:hover { background: #fff; }
.btn-glass { background: rgba(255, 255, 255, .32); color: var(--ink, var(--text)); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, .5); }
:root[data-theme="dark"] .btn-glass { background: rgba(255, 255, 255, .1); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; font-size: inherit; }

/* ---------- Cartes & listes groupées ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-like { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head > div:first-child { min-width: 0; flex: 1; }
.card-actions .btn-ghost { padding: 0 6px; }
.card-title { font-size: 18px; font-weight: 720; letter-spacing: -.015em; }
.card-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; color: var(--text); text-decoration: none !important; position: relative; }
.row + .row::before { content: ''; position: absolute; top: 0; right: 0; left: 4px; border-top: .5px solid var(--sep); }
.row:has(> .food-tile, > .avatar, > .date-badge, > .tx-check) + .row::before { left: 56px; }
.row.soft { opacity: .65; }
.row.done { opacity: .5; }
a.row, .row[role="button"], .as-btn { cursor: pointer; transition: background .12s; border-radius: 12px; }
a.row:active, .row[role="button"]:active, .as-btn:active { background: var(--fill-2); }
.as-btn { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .muted, .row-main > span { font-size: 13.5px; color: var(--muted); }
.row-act { display: inline-flex; gap: 4px; }
.chev { color: var(--faint); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: var(--muted); padding: 30px 16px; }
.empty p { max-width: 420px; }
div.empty::before { content: '🍽️'; font-size: 44px; }

/* ---------- Pastilles, segments, badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; border: 0; background: var(--fill-2); color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 14px; transition: transform .12s var(--ease), background .12s; white-space: nowrap; }
.chip:active { transform: scale(.95); }
.chip .ic { width: 15px; height: 15px; }
.chip.on { background: var(--text); color: var(--bg); }
:root[data-theme="dark"] .chip.on { background: var(--text); color: #000; }
.seg { display: inline-flex; padding: 3px; background: var(--fill); border-radius: 12px; gap: 2px; }
.seg > * { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; transition: background .15s; }
.seg .on { background: var(--bg-elev); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }
.seg.tabs { align-self: flex-start; }
.count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--neg); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; }
.count.soft { background: var(--fill); color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--fill-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 650; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-weight: 700; color: var(--text-2); flex-shrink: 0; font-size: 14px; }
.avatar[style*="--c"] { background: var(--c); color: #fff; }
.avatar.xs { width: 22px; height: 22px; font-size: 11px; }
.bar { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .4s var(--ease); }
.bar-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 8px; }
.meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 13px; }
.meta .ic { width: 14px; height: 14px; }
.meta .sep { color: var(--faint); }
.date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 44px; height: 44px; border-radius: 12px; background: var(--fill-2); font-size: 11px; color: var(--muted); line-height: 1.05; text-transform: lowercase; }
.date-badge b { font-size: 17px; color: var(--text); font-weight: 750; }
.date-badge.sm { min-width: 38px; height: 38px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); padding-left: 2px; }
.field-hint { font-size: 12.5px; color: var(--muted); padding-left: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) { .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid.cols-icon { grid-template-columns: 76px minmax(0, 1fr); }
.input { width: 100%; height: 46px; padding: 0 14px; border-radius: 13px; border: 1.5px solid transparent; background: var(--fill-2); color: var(--text); outline: none; font-size: 16px; transition: border-color .15s, background .15s; }
.input:focus { border-color: var(--accent); background: var(--surface); }
textarea.input { height: auto; padding: 11px 14px; resize: vertical; }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.input-sm { height: 38px; font-size: 14.5px; padding: 0 12px; width: auto; }
.emoji-input { text-align: center; font-size: 22px; }
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search-box .input { padding-left: 40px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; min-width: 120px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input, .tx-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.tx-check { display: grid; place-items: center; cursor: pointer; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-opt { cursor: pointer; }
.tag-opt input { position: absolute; opacity: 0; }
.tag-opt span { display: inline-flex; padding: 7px 13px; border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--fill-2); color: var(--text-2); transition: background .12s; }
.tag-opt input:checked + span { background: var(--text); color: var(--bg); }
.tag-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch i { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); }
.swatch input:checked + i { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.form-error { margin: 0 20px; padding: 11px 14px; border-radius: 12px; background: var(--neg-soft); color: var(--neg); font-size: 14px; font-weight: 550; }
.stack .form-error, .stack-sm .form-error { margin: 0; }
details summary { cursor: pointer; }

/* ---------- Fenêtres en tiroir ---------- */
.modal { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; color: var(--text); }
.modal[open] { display: grid; place-items: end center; }
.modal::backdrop { background: rgba(0, 0, 0, .38); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { position: relative; width: 100vw; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg-elev); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); animation: sheet .32s var(--ease); padding-top: 10px; }
.modal-card::before { content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 3px; background: var(--fill); }
@keyframes sheet { from { transform: translateY(100%); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 6px; }
.modal-head h2 { font-size: 20px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.modal-head h2 .ic { color: var(--accent); }
.modal-head .btn { border-radius: 50%; width: 34px; height: 34px; background: var(--fill-2); color: var(--muted); }
.modal-body { padding: 10px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); }
.modal-foot .btn { flex: 1 1 auto; height: 50px; border-radius: 15px; font-size: 16px; }
.modal-foot .spacer { display: none; }
body:has(dialog[open]) { overflow: hidden; }
@media (min-width: 700px) {
  .modal[open] { place-items: center; }
  .modal-card { width: min(560px, calc(100vw - 32px)); border-radius: 26px; animation: pop .25s var(--ease); padding-top: 4px; }
  .modal-card::before { display: none; }
  .modal-card.sm { width: min(440px, calc(100vw - 32px)); }
  .modal-foot .btn { flex: 0 0 auto; height: 44px; }
  .modal-foot .spacer { display: block; }
  @keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } }
}

/* Menu « Plus » */
.sheet-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 85dvh; overflow-y: auto;
  background: var(--bg-elev); border-radius: 26px 26px 0 0; transform: translateY(105%); transition: transform .32s var(--ease); box-shadow: var(--shadow-lg); }
body.menu-open .sheet { transform: none; }
body.menu-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 20px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sheet-link { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 18px; background: var(--fill-2); color: var(--text); font-weight: 650; text-decoration: none !important; }
.sheet-link .ic { width: 24px; height: 24px; color: var(--accent); }
.sheet-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sheet-link .count { position: absolute; top: 12px; right: 12px; }
.nav-group { display: flex; flex-direction: column; gap: 8px; }
.sheet .nav-title { font-size: 13px; font-weight: 650; color: var(--muted); padding: 4px 4px 0; }
.sheet-foot { display: flex; justify-content: center; padding-top: 6px; }
@media (min-width: 960px) { .sheet, .sheet-backdrop { display: none; } }

/* Notification */
.toast { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translate(-50%, -30px); z-index: 200; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 99px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-weight: 600; max-width: calc(100vw - 32px); transition: opacity .25s, transform .35s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-ic { display: grid; color: var(--pos); }
.toast.error .toast-ic { color: var(--neg); }

/* ---------- Vignettes de plats ---------- */
.food-tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; font-size: 25px; line-height: 1;
  background: linear-gradient(140deg, var(--t1, var(--fill)), var(--t2, var(--fill))); color: var(--ink, var(--muted)); }
.food-tile .ic { width: 21px; height: 21px; }
.food-tile.xs { width: 32px; height: 32px; border-radius: 10px; font-size: 17px; }
.food-tile.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 21px; }
.food-tile.lg { width: 66px; height: 66px; border-radius: 20px; font-size: 36px; }

/* ---------- Accueil ---------- */
.notice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--grad); color: #fff; text-decoration: none !important; box-shadow: 0 14px 30px -16px var(--accent); }
.notice:active { transform: scale(.98); }
.notice .row-main b, .notice .row-main span { color: inherit; }
.notice .row-main span { opacity: .88; font-size: 13.5px; }
.notice-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); }

.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel::-webkit-scrollbar { display: none; }
.meal-card { position: relative; flex: 0 0 82%; max-width: 380px; scroll-snap-align: start; scroll-margin-left: 16px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-height: 250px; padding: 20px; border-radius: 26px;
  background: radial-gradient(120% 120% at 100% 0%, var(--t2), var(--t1)); color: var(--ink); overflow: hidden; text-decoration: none !important; transition: transform .2s var(--ease); border: 0; text-align: left; cursor: pointer; font: inherit; }
.meal-card:active { transform: scale(.97); }
.meal-card .mc-emoji { position: absolute; right: -6px; top: 4px; font-size: 118px; line-height: 1; transform: rotate(-8deg); filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .18)); }
.meal-card .mc-when { align-self: flex-start; margin-bottom: auto; padding: 5px 11px; border-radius: 99px; background: rgba(255, 255, 255, .62); font-size: 13px; font-weight: 700; color: var(--ink); }
:root[data-theme="dark"] .meal-card .mc-when { background: rgba(0, 0, 0, .3); }
.meal-card .mc-title { font-size: 24px; font-weight: 800; letter-spacing: -.025em; line-height: 1.12; max-width: 85%; }
.meal-card .mc-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 650; opacity: .85; }
.meal-card.empty { background: var(--surface); color: var(--muted); border: 2px dashed var(--border-strong); justify-content: center; align-items: center; text-align: center; gap: 10px; }
.meal-card.empty .mc-plus { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.meal-card.empty .mc-plus .ic { width: 26px; height: 26px; }
.meal-card.empty .mc-when { position: absolute; top: 18px; left: 18px; background: var(--fill-2); color: var(--text-2); }
.meal-card.empty b { color: var(--text); font-size: 17px; }
.meal-card.pending { background: var(--warn-soft); color: var(--warn); }
@media (min-width: 960px) { .carousel { margin: 0; padding: 4px 0 10px; } .meal-card { flex-basis: 320px; } }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ws-day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 12px; border-radius: 18px; color: var(--text); text-decoration: none !important; transition: background .15s; }
.ws-day:active { background: var(--fill-2); }
.ws-day.today { background: var(--accent-soft); }
.ws-day.past { opacity: .45; }
.ws-name { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; }
.ws-day.today .ws-name { color: var(--accent); }
.ws-num { font-size: 19px; font-weight: 750; line-height: 1; }
.ws-day.today .ws-num { color: #fff; background: var(--grad); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.ws-meal { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(140deg, var(--t1), var(--t2)); }
.ws-meal.empty { background: var(--fill-2); }
.ws-meal.pending { background: var(--warn-soft); color: var(--warn); font-weight: 800; font-size: 15px; }
.week-actions { margin-top: 14px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.shortcut { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 120px; padding: 16px; border-radius: 22px; border: 0; text-align: left; cursor: pointer; font: inherit;
  background: linear-gradient(150deg, var(--t1), var(--t2)); color: var(--ink); text-decoration: none !important; transition: transform .18s var(--ease); }
.shortcut:active { transform: scale(.96); }
.shortcut b { font-weight: 750; font-size: 16px; margin-top: auto; letter-spacing: -.01em; }
.shortcut small { opacity: .8; font-size: 13px; font-weight: 550; }
.shortcut-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .6); }
:root[data-theme="dark"] .shortcut-ico { background: rgba(255, 255, 255, .08); }
.shortcut-ico .ic { width: 22px; height: 22px; }

/* ---------- Recettes ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .input { width: auto; flex: none; height: 38px; font-size: 14px; font-weight: 600; border-radius: 99px; padding: 0 32px 0 14px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .filter-row, .chips.scroll-x { margin: 0; padding: 0; flex-wrap: wrap; } }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .rgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1200px) { .rgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rcard { display: flex; flex-direction: column; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; overflow: hidden; transition: transform .2s var(--ease); }
.rcard:active { transform: scale(.97); }
.rcard-cover { position: relative; aspect-ratio: 1 / .78; display: grid; place-items: center; background: radial-gradient(110% 110% at 30% 15%, var(--t1), var(--t2)); color: var(--ink); }
.rcard-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .18)); transition: transform .3s var(--ease); }
@media (hover: hover) { .rcard:hover .rcard-emoji { transform: scale(1.1) rotate(-5deg); } }
.cover-badge, .cover-time { position: absolute; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .86); color: #111114; backdrop-filter: blur(6px); }
:root[data-theme="dark"] .cover-badge, :root[data-theme="dark"] .cover-time { background: rgba(0, 0, 0, .45); color: #f5f5f7; }
.cover-badge { top: 9px; left: 9px; color: #15803d; }
.cover-time { bottom: 9px; right: 9px; }
.cover-badge .ic, .cover-time .ic { width: 13px; height: 13px; }
.rcard-body { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px 14px; }
.rcard-title { font-weight: 700; font-size: 15px; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-meta { font-size: 13px; color: var(--muted); }
.recipe-row { cursor: pointer; }
.recipe-row .row-main > span { white-space: normal; }

/* Fiche recette : couverture pleine largeur, contenu qui la recouvre */
.recipe-page { display: flex; flex-direction: column; margin: -4px -16px 0; }
.recipe-cover { position: relative; height: 300px; display: grid; place-items: center; background: radial-gradient(110% 120% at 30% 10%, var(--t1), var(--t2)); color: var(--ink); overflow: hidden; }
.recipe-cover::after { content: ''; position: absolute; width: 360px; height: 360px; border-radius: 50%; background: rgba(255, 255, 255, .25); right: -120px; bottom: -160px; }
:root[data-theme="dark"] .recipe-cover::after { background: rgba(255, 255, 255, .04); }
.recipe-cover-emoji { font-size: 140px; line-height: 1; filter: drop-shadow(0 20px 26px rgba(0, 0, 0, .22)); transform: rotate(-6deg); position: relative; z-index: 1; margin-top: -20px; }
.cover-back { position: absolute; z-index: 2; top: 14px; left: 14px; }
.cover-actions { position: absolute; z-index: 2; top: 14px; right: 14px; display: flex; gap: 8px; }
.cover-back, .cover-actions .icon-btn { background: rgba(255, 255, 255, .7); color: #111114; backdrop-filter: blur(10px); }
:root[data-theme="dark"] .cover-back, :root[data-theme="dark"] .cover-actions .icon-btn { background: rgba(0, 0, 0, .45); color: #fff; }
.recipe-sheet { position: relative; z-index: 3; margin-top: -32px; padding: 24px 16px 0; border-radius: 30px 30px 0 0; background: var(--bg); display: flex; flex-direction: column; gap: 18px; }
.recipe-sheet .hero-kicker { color: var(--accent); }
.recipe-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.recipe-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 6px; }
.recipe-facts > div { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.recipe-facts > div + div { border-left: .5px solid var(--sep); }
.recipe-facts dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.recipe-facts dd { margin: 0; font-weight: 750; font-size: 15px; }
.recipe-cta { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.recipe-cta .btn { height: 50px; border-radius: 16px; }
.recipe-cols { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .recipe-page { margin: 0; }
  .recipe-cover { height: 340px; border-radius: 30px; }
  .recipe-sheet { margin: -48px 24px 0; padding: 26px 26px 0; border-radius: 28px; }
  .recipe-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
}
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--fill-2); border-radius: 99px; padding: 3px; }
.stepper b { min-width: 64px; text-align: center; font-size: 15px; }
.stepper .icon-btn { width: 34px; height: 34px; background: var(--bg-elev); font-size: 18px; font-weight: 700; box-shadow: var(--shadow-sm); }
.ings { list-style: none; padding: 0; display: flex; flex-direction: column; }
.ings li { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 4px; cursor: pointer; }
.ings li + li::before { content: ''; position: absolute; top: 0; left: 4px; right: 0; border-top: .5px solid var(--sep); }
.ings li::after { content: ''; order: -1; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; transition: all .15s; }
.ings li.done::after { background: var(--pos) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat; border-color: var(--pos); }
.ings .qty { width: 104px; flex-shrink: 0; font-weight: 750; color: var(--accent); }
.ings li.staple { color: var(--muted); }
.ings li.done .grow, .ings li.done .qty { opacity: .45; text-decoration: line-through; }
.ings .grow { flex: 1; }
.steps { list-style: none; counter-reset: step; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { counter-increment: step; position: relative; padding: 12px 12px 12px 54px; border-radius: 16px; cursor: pointer; line-height: 1.55; background: var(--surface-2); transition: background .15s; }
.steps li::before { content: counter(step); position: absolute; left: 12px; top: 11px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; }
.steps li.done { color: var(--faint); background: transparent; }
.steps li.done::before { content: '✓'; background: var(--pos); }

.ing-row { display: grid; grid-template-columns: 70px 112px minmax(0, 1fr) 40px; gap: 6px; margin-bottom: 8px; align-items: center; }
.ing-row .aisle { grid-column: 1 / 4; height: 40px; font-size: 14px; }
@media (min-width: 960px) { .ing-row { grid-template-columns: 76px 120px minmax(0, 1fr) 200px 40px; } .ing-row .aisle { grid-column: auto; height: 46px; } }
.step-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; margin-bottom: 8px; align-items: start; }
.sticky-actions { position: sticky; bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom)); z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 10px; border-radius: 20px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent); backdrop-filter: blur(16px); box-shadow: var(--shadow-lg); }
@media (min-width: 960px) { .sticky-actions { bottom: 18px; } }

/* ---------- Planning ---------- */
.day-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; scroll-snap-type: x proximity; }
.day-pills::-webkit-scrollbar { display: none; }
.day-pill { flex: 0 0 auto; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; padding: 9px 0 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); border: 0; cursor: pointer; font: inherit; transition: transform .15s var(--ease); }
.day-pill:active { transform: scale(.94); }
.day-pill span { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; }
.day-pill b { font-size: 19px; font-weight: 800; }
.day-pill i { display: flex; gap: 3px; }
.day-pill i::before, .day-pill i::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--fill); }
.day-pill[data-l="1"] i::before, .day-pill[data-d="1"] i::after { background: var(--accent); }
.day-pill.today { background: var(--grad); color: #fff; box-shadow: 0 10px 20px -12px var(--accent); }
.day-pill.today span { color: rgba(255, 255, 255, .85); }
.day-pill.today i::before, .day-pill.today i::after { background: rgba(255, 255, 255, .45); }
.day-pill.today[data-l="1"] i::before, .day-pill.today[data-d="1"] i::after { background: #fff; }
@media (min-width: 960px) { .day-pills { margin: 0; padding: 2px 0 4px; } }
.board { display: flex; flex-direction: column; gap: 14px; }
.board-row { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: calc(var(--top-h) + 16px); }
.board-row.past { opacity: .55; }
.board-day { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; }
.bd-name { font-size: 20px; font-weight: 780; letter-spacing: -.02em; }
.bd-date { color: var(--muted); font-weight: 600; font-size: 15px; }
.bd-today { margin-left: auto; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; align-self: center; }
.board-cells { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--surface); border-radius: 22px; padding: 8px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .board-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.board-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 4px; }
.cell-label { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 2px 4px; }
.cell-more { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--fill-2); color: var(--accent); display: grid; place-items: center; cursor: pointer; }
.cell-more .ic { width: 16px; height: 16px; }
.meal { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px 8px 8px; border-radius: 16px; border: 0; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; text-decoration: none !important; font: inherit; transition: transform .15s var(--ease), background .15s; }
.meal:active { transform: scale(.98); }
.meal.cooked { opacity: .6; }
.meal.pending { background: var(--warn-soft); }
.meal.pending .meal-text small { color: var(--warn); font-weight: 650; }
.meal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meal-text b { font-weight: 650; font-size: 15px; line-height: 1.3; }
.meal-text small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-done { color: var(--pos); display: grid; }
.slot-add { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 56px; border-radius: 16px; border: 1.5px dashed var(--border-strong); background: transparent; color: var(--muted); font-weight: 620; font-size: 14.5px; cursor: pointer; font: inherit; transition: all .15s; }
.slot-add:hover, .slot-add:active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.slot-add .ic { width: 18px; height: 18px; }
.board-row.past .slot-add { display: none; }
.board-row.past .board-cell:not(:has(.meal)) { display: none; }
.board-row.past .board-cells:not(:has(.meal)) { display: none; }
.month-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-head { text-align: center; font-size: 12px; font-weight: 650; color: var(--muted); padding: 6px 0; text-transform: uppercase; }
.mcell { min-height: 92px; background: var(--surface); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 3px; color: var(--text); text-decoration: none !important; overflow: hidden; }
.mcell.out { background: transparent; color: var(--faint); }
.mcell.today .mcell-day { background: var(--grad); color: #fff; }
.mcell-day { align-self: flex-start; min-width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.mcell-meal { font-size: 12px; padding: 3px 6px; border-radius: 8px; background: var(--fill-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell-more { font-size: 11px; color: var(--muted); }
@media (max-width: 700px) { .mcell { min-height: 56px; padding: 4px; } .mcell-meal { padding: 0; background: none; font-size: 15px; } .mcell-meal span { display: none; } }

/* ---------- Sondages & propositions ---------- */
.poll-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 900px) { .poll-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.poll .card-title { display: flex; align-items: center; gap: 8px; }
.poll .card-title .ic { color: var(--accent); }
.poll.closed { opacity: .75; }
.poll-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.poll-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px 8px 8px; border-radius: 16px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; font: inherit; transition: transform .15s var(--ease), border-color .15s; }
.poll-opt:active:not(:disabled) { transform: scale(.98); }
.poll-opt:disabled { cursor: default; }
.poll-opt > *:not(.poll-fill) { position: relative; }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-fill); transition: width .45s var(--ease); }
.poll-opt.mine { border-color: var(--accent); }
.poll-opt.mine .poll-n { color: var(--accent); }
.poll-opt.win { border-color: var(--pos); }
.poll-opt.win .poll-fill { background: var(--pos-soft); }
.poll-label { flex: 1; min-width: 0; font-weight: 650; }
.poll-who { display: inline-flex; gap: 2px; }
.poll-n { font-weight: 800; min-width: 18px; text-align: right; font-size: 16px; }
.proposal { display: flex; flex-direction: column; gap: 12px; }
.proposal.refusee, .proposal.retiree { opacity: .65; }
.prop-head { display: flex; align-items: center; gap: 12px; }
.prop-head .row-main b { white-space: normal; font-size: 16px; font-weight: 700; }
.prop-title { color: var(--text); }
.proposal > p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.answers { display: flex; flex-wrap: wrap; gap: 6px; }
.answer { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 99px; background: var(--fill-2); font-size: 13.5px; font-weight: 600; }
.answer .ic { width: 14px; height: 14px; }
.answer.yes { background: var(--pos-soft); color: var(--pos); }
.answer.no { background: var(--neg-soft); color: var(--neg); }
.answer-wait { display: grid; color: var(--faint); }
.proposal .btn-row .btn:not(.btn-sm) { flex: 1; }

/* ---------- On mange quoi ? ---------- */
.ideas-tabs { align-self: stretch; display: flex; }
.ideas-tabs > * { flex: 1; justify-content: center; padding: 9px 12px; }
@media (min-width: 960px) { .ideas-tabs { align-self: flex-start; } }
.assistant { display: flex; flex-direction: column; gap: 12px; }
.q { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.q-head { display: flex; align-items: center; gap: 10px; }
.q-head h2 { font-size: 18px; font-weight: 750; }
.q-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.q-hint { color: var(--muted); font-size: 13px; }
.q .search-box .input { height: 44px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 46px; padding: 0 16px; border-radius: 14px; border: 2px solid transparent; background: var(--fill-2); color: var(--text); font: inherit; font-weight: 650; font-size: 15px; cursor: pointer; transition: transform .12s var(--ease), background .15s, border-color .15s; }
.opt:active { transform: scale(.95); }
.opt.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chosen-ings { margin-bottom: 2px; }
.idea-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 760px) { .idea-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.idea { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-height: 230px; padding: 18px; border-radius: 26px;
  background: radial-gradient(120% 120% at 100% 0%, var(--t2), var(--t1)); color: var(--ink); animation: rise .4s var(--ease) both; }
.idea:nth-child(2) { animation-delay: .05s; } .idea:nth-child(3) { animation-delay: .1s; }
.idea-top { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none !important; }
.idea-emoji { font-size: 72px; line-height: 1; align-self: flex-end; margin: -6px -4px 4px 0; transform: rotate(-8deg); filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .18)); }
.idea-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.idea-meta { font-weight: 650; font-size: 13.5px; opacity: .85; }
.idea-why { font-size: 13px; opacity: .75; }
.idea-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.idea-actions .btn { height: 46px; }
.section-title .btn { font-size: 14px; letter-spacing: 0; }

.deck-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.deck { position: relative; width: 100%; max-width: 380px; height: 470px; }
.swipe-card { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; border-radius: 30px; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  background: radial-gradient(120% 100% at 50% 0%, var(--t1), var(--t2)); color: var(--ink); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .35);
  transform: translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * .05)); transition: transform .3s var(--ease); cursor: grab; }
.swipe-card:not(.top) { pointer-events: none; }
.swipe-card.top:active { cursor: grabbing; }
.swipe-emoji { position: absolute; top: 36px; left: 50%; transform: translateX(-50%) rotate(-6deg); font-size: 150px; line-height: 1; filter: drop-shadow(0 20px 26px rgba(0, 0, 0, .22)); pointer-events: none; }
.swipe-body { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 22px; background: rgba(255, 255, 255, .72); backdrop-filter: blur(12px); }
:root[data-theme="dark"] .swipe-body { background: rgba(0, 0, 0, .35); }
.swipe-kicker { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }
.swipe-title { font-size: 25px; font-weight: 800; letter-spacing: -.025em; line-height: 1.12; }
.swipe-text { font-size: 14px; opacity: .8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.swipe-facts { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.swipe-facts > span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .6); }
:root[data-theme="dark"] .swipe-facts > span { background: rgba(255, 255, 255, .08); }
.swipe-facts .ic { width: 14px; height: 14px; }
.stamp { position: absolute; top: 26px; z-index: 2; padding: 6px 14px; border-radius: 12px; border: 3px solid; font-weight: 900; font-size: 22px; text-transform: uppercase; letter-spacing: .04em; pointer-events: none; }
.stamp.like { left: 22px; color: var(--pos); border-color: var(--pos); transform: rotate(-12deg); opacity: var(--like, 0); background: rgba(255, 255, 255, .8); }
.stamp.nope { right: 22px; color: var(--neg); border-color: var(--neg); transform: rotate(12deg); opacity: var(--nope, 0); background: rgba(255, 255, 255, .8); }
.deck-actions { display: flex; align-items: center; gap: 22px; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--bg-elev); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .35); transition: transform .15s var(--ease); }
.round:active:not(:disabled) { transform: scale(.88); }
.round:disabled { opacity: .35; cursor: default; }
.round .ic { width: 28px; height: 28px; stroke-width: 2.6; }
.round.nope { color: var(--neg); }
.round.like { color: #fff; background: var(--grad); }
.round.like .ic { fill: currentColor; }
.round.undo { width: 46px; height: 46px; color: var(--muted); }
.round.undo .ic { width: 22px; height: 22px; }
.deck-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; border-radius: 30px; border: 2px dashed var(--border-strong); padding: 24px; }
.deck-end span { font-size: 56px; }
.deck-end b { font-size: 20px; }

/* ---------- Courses ---------- */
.shop-controls { display: flex; flex-direction: column; gap: 14px; }
.shop-controls .range { flex-wrap: wrap; }
.qty-input { width: 84px !important; flex: none !important; min-width: 0 !important; }
.aisle-input { width: auto !important; flex: none !important; min-width: 0 !important; }
.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (min-width: 900px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.shop .card-head { margin-bottom: 4px; }
.shop-list { list-style: none; padding: 0; display: flex; flex-direction: column; }
.shop-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.shop-row + .shop-row::before { content: ''; position: absolute; top: 0; left: 36px; right: 0; border-top: .5px solid var(--sep); }
.shop-row .row-main span { white-space: normal; }
.shop-check { display: grid; place-items: center; cursor: pointer; }
.shop-check input { appearance: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; transition: all .15s; margin: 0; }
.shop-check input:checked { background: var(--pos) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; border-color: var(--pos); }
.shop-row .qty { color: var(--accent); font-weight: 700; margin-left: 4px; }
.shop-row.done b, .shop-row.done .qty { color: var(--faint); text-decoration: line-through; }

/* ---------- Divers ---------- */
.meal-recipe { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-list.scroll, .scroll { max-height: 42dvh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 14px; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; transition: background .12s; }
.pick:hover, .pick:active { background: var(--fill-2); }
.pick-text { display: flex; flex-direction: column; min-width: 0; }
.pick-text b { font-weight: 650; }
.quick.in-sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 10px; min-height: 104px; padding: 14px; border-radius: 20px; border: 0; background: var(--fill-2); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; text-align: left; transition: transform .15s var(--ease); }
.quick-btn:active { transform: scale(.96); }
.quick-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; }
.alert.danger { background: var(--neg-soft); color: var(--neg); }
.alert.info { background: var(--pos-soft); color: var(--pos); }
.alert > div { flex: 1; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 16px; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 650; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(60rem 30rem at 0% -10%, #ffe2d3, transparent 60%), radial-gradient(40rem 24rem at 110% 110%, #ffd9e2, transparent 60%), var(--bg); }
:root[data-theme="dark"] .login-page { background: radial-gradient(60rem 30rem at 0% -10%, #3a1d12, transparent 60%), radial-gradient(40rem 24rem at 110% 110%, #3a1424, transparent 60%), var(--bg); }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.login-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.login-brand img { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 14px 30px -12px rgba(255, 90, 54, .55); margin-bottom: 12px; }
.login-brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.login-brand p { color: var(--muted); }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: 26px; background: var(--bg-elev); box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 20px; }
.login-passkey { width: 100%; height: 54px; font-size: 16.5px; border-radius: 16px; }
.login-hint { text-align: center; font-size: 13.5px; color: var(--muted); }
.login-foot { text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- Impression de la liste de courses ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .sheet, .sheet-backdrop, .no-print, .toast, .desktop-only { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .view > * { animation: none; }
  .card { box-shadow: none; padding: 4px 0; break-inside: avoid; }
  .shop-grid { display: block; }
  .shop-row .muted { display: none; }
  body { background: #fff; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
