:root {
  --bg: #f6f4ee; --card: #fff; --ink: #1d2420; --muted: #66706a; --line: #e4e0d6;
  --brand: #1f7a4d; --brand-2: #2e9b63; --brand-soft: #e3f3ea; --accent: #f2a93b;
  --bad: #c8412f; --bad-soft: #fbe7e3; --warn-soft: #fff4dc;
  --r: 16px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(30,40,30,.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111513; --card: #1a201c; --ink: #e8ece9; --muted: #9aa59e; --line: #2b332e;
    --brand: #3fbf7f; --brand-2: #5fd497; --brand-soft: #1d3428; --bad: #ff7a66; --bad-soft: #3a211d; --warn-soft: #33291a;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, calc((100% - 980px) / 2 + 16px)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo { font-size: 1.4rem; }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.foot { color: var(--muted); font-size: .8rem; padding-top: 24px; padding-bottom: 40px; text-align: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--brand); }
h2 { margin: 4px 0 6px; font-size: clamp(1.35rem, 4vw, 1.8rem); line-height: 1.2; }
.sub { margin: 0 0 18px; color: var(--muted); }
.note { color: var(--muted); font-size: .92rem; margin: 12px 0 0; }

/* ---------- Assistant ---------- */
.wizard { padding-top: 16px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .3s; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: .8rem; font-weight: 700; color: var(--muted); padding: 0; }
.dot.done { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.dot.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.step .body { min-height: 120px; }

.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.grid.stores { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 640px) { .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
.opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 12px 10px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; text-align: center; transition: transform .1s, border-color .15s, background .15s; }
.opt:hover { border-color: var(--brand-2); }
.opt:active { transform: scale(.98); }
.opt.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.opt-e { font-size: 1.6rem; line-height: 1; }
.opt-t { font-weight: 700; }
.opt-d { font-size: .82rem; color: var(--muted); }
.opt.store { flex-direction: row; justify-content: flex-start; min-height: 58px; gap: 10px; text-align: left; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.st-lab { display: flex; flex-direction: column; }
.st-lab small { color: var(--muted); }
.st-ctl { display: flex; align-items: center; gap: 8px; }
.st-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--brand); background: var(--card); color: var(--brand); font-size: 1.4rem; font-weight: 700; line-height: 1; padding: 0; }
.st-val { min-width: 2ch; text-align: center; font-size: 1.5rem; font-weight: 800; }

.check { display: flex; gap: 10px; align-items: center; margin-top: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.check.big { padding: 14px; border: 2px solid var(--line); border-radius: 14px; font-weight: 700; }

.money-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.money { width: 140px; font-size: 1.8rem; font-weight: 800; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.money-u { color: var(--muted); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--brand); }

.search { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.dis-g h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-size: .92rem; }
.chip:hover { border-color: var(--bad); }
.chip.no { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; font-weight: 600; }

.wnav { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%); }
.count { margin: 0; font-size: .85rem; font-weight: 600; color: var(--brand); text-align: center; }
.count.low { color: var(--bad); }

.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; white-space: nowrap; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); }
.btn.ghost { background: var(--card); border: 1.5px solid var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--brand); }
.btn.small { padding: 8px 12px; font-size: .88rem; border-radius: 10px; }

@media (max-width: 520px) {
  .card { padding: 18px 14px; }
  .wnav .count { order: -1; flex-basis: 100%; }
  .wnav { flex-wrap: wrap; }
  .wnav .btn { flex: 1; }
}

/* ---------- Résultats ---------- */
.result { padding-top: 18px; }
.res-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: 2fr repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi.wide { grid-column: 1 / -1; }
@media (min-width: 760px) { .kpi.wide { grid-column: auto; } }
.kpi-l { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi-v { font-size: 1.35rem; font-weight: 800; }
.kpi-v small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.kpi-v.good { color: var(--brand); }
.kpi-v.bad { color: var(--bad); }
.kpi-s { font-size: .78rem; color: var(--muted); }
.gauge { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 4px 0; }
.gauge-in { height: 100%; background: var(--brand); border-radius: 99px; }
.gauge.over .gauge-in { background: var(--bad); }
.warns { margin-bottom: 12px; }
.warn { background: var(--warn-soft); border-radius: 12px; padding: 10px 14px; margin: 0 0 8px; font-size: .92rem; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 5px; }
.tab { flex: 1; border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tab.on { background: var(--brand); color: #fff; }
.hide-screen { display: none; }

.menu { display: grid; gap: 12px; }
@media (min-width: 760px) { .menu { grid-template-columns: 1fr 1fr; align-items: start; } }
.rcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.rtop { display: flex; gap: 12px; align-items: center; }
.remoji { font-size: 2.2rem; width: 56px; height: 56px; flex: none; display: grid; place-items: center; background: var(--brand-soft); border-radius: 14px; }
.slot { margin: 0; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.rtitle h3 { margin: 2px 0 0; font-size: 1.08rem; line-height: 1.25; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 8px; font-size: .9rem; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .74rem; padding: 3px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.tag.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.tag.eq { border: 1px dashed var(--line); background: none; }
.ractions { display: flex; gap: 8px; margin-top: 12px; }
.rdetail { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rdetail h4 { margin: 8px 0; font-size: .95rem; }
.ings { list-style: none; padding: 0; margin: 0; }
.ings li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.ings .q { font-weight: 700; white-space: nowrap; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 6px; }
.adapt { background: var(--brand-soft); border-radius: 10px; padding: 4px 12px; margin: 10px 0; font-size: .88rem; }
.adapt p { margin: 6px 0; }

.shop-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.shop-top p { margin: 0; }
.rayon { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; }
.rayon.pantry { border-style: dashed; }
.rayon h3 { margin: 0 0 6px; font-size: 1rem; display: flex; justify-content: space-between; gap: 8px; }
.rayon h3 .muted { font-weight: 600; font-size: .88rem; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { border-top: 1px solid var(--line); }
.lines label { display: flex; align-items: center; gap: 12px; padding: 10px 2px; cursor: pointer; }
.lines input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.ln { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lname { font-weight: 600; }
.lq { font-size: .84rem; color: var(--muted); }
.lp { font-weight: 700; white-space: nowrap; }
.lines li.done .lname, .lines li.done .lp { text-decoration: line-through; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: .9rem; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media print {
  .top, .foot, .tabs, .actions, .ractions, .warns, .toast, .wnav, .dots, .progress { display: none !important; }
  body { background: #fff; color: #000; }
  .hide-screen { display: block; }
  .rdetail[hidden] { display: block !important; }
  .rcard, .rayon, .kpi { box-shadow: none; break-inside: avoid; }
  .menu { grid-template-columns: 1fr 1fr; }
  .tab-shop { break-before: page; }
}
