:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface-2: #f3ece4;
  --text: #2b2420;
  --muted: #7a6d64;
  --line: #e7ddd3;
  --accent: #c4532c;
  --accent-ink: #ffffff;
  --accent-soft: #f8e3d9;
  --ok: #3f7d4e;
  --ok-soft: #e1f0e4;
  --warn: #9a6a00;
  --warn-soft: #fbf0d4;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1613;
    --surface: #24201c;
    --surface-2: #2e2924;
    --text: #f1ebe5;
    --muted: #a99b90;
    --line: #3a332d;
    --accent: #e57a52;
    --accent-ink: #1a1613;
    --accent-soft: #3d2a21;
    --ok: #7cc28d;
    --ok-soft: #22352a;
    --warn: #e2b54f;
    --warn-soft: #3a3020;
    --danger: #ff8a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-wrap: break-word;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Layout */
.container { max-width: 1040px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 680px; margin: 0 auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.1rem; }
.topnav { display: none; gap: 4px; margin-left: auto; align-items: center; }
.topnav a:not(.btn) { color: var(--muted); padding: 6px 12px; border-radius: 999px; }
.topnav a.active:not(.btn) { color: var(--text); background: var(--surface-2); }
.who {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: .75rem; color: var(--muted);
}
.bottomnav a.active { color: var(--accent); }
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; }
  .who { margin-left: 8px; }
  .bottomnav { display: none; }
}

/* Controls */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 10px; min-height: 44px;
}
.btn-small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--accent); }
.btn-plain, button.btn-plain { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-danger, button.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  min-height: 44px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
form.inline { display: inline; }

.flash {
  background: var(--ok-soft); color: var(--ok); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; font-weight: 500;
}
.notice { overflow-wrap: anywhere; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.notice p { margin: 0 0 6px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}

/* Chips & badges */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: .82rem;
  background: var(--surface-2); color: var(--text); border: 1px solid transparent; white-space: nowrap;
}
a.chip:hover { border-color: var(--line); }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-validated { background: var(--ok-soft); color: var(--ok); }
.badge-to_test { background: var(--accent-soft); color: var(--accent); }
.badge-rejected { background: var(--surface-2); color: var(--muted); }
.badge-season { background: var(--ok-soft); color: var(--ok); }
.badge-offseason { background: var(--surface-2); color: var(--muted); }
.stars { color: #e0a100; letter-spacing: 1px; }
.scroll-x { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-x > * { flex: none; }  /* pills keep their width and the row scrolls, instead of squeezing them */
.scroll-x::-webkit-scrollbar { display: none; }

/* Recipe list */
.filters { display: grid; gap: 10px; margin-bottom: 16px; }
.search { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
.rcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.rcard .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); object-fit: cover; width: 100%; }
.thumb-empty { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 2rem; }
.rcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rcard .title { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Recipe detail */
.hero { border-radius: var(--radius); overflow: hidden; background: var(--surface-2); margin: 0 -16px 16px; }
.hero img { width: 100%; max-height: 380px; object-fit: cover; }
@media (min-width: 760px) { .hero { margin: 0 0 16px; } }
.facts { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 8px 0; }
.facts strong { color: var(--text); }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.ingredients .qty { min-width: 74px; font-weight: 600; }
.steps { padding-left: 0; list-style: none; counter-reset: step; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 40px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
@media (min-width: 900px) { .recipe-cols { display: grid; grid-template-columns: 340px 1fr; gap: 32px; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.review { border-top: 1px solid var(--line); padding: 10px 0; }
.rating-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.rating-input input { display: none; }
.rating-input label { font-size: 1.9rem; color: var(--line); cursor: pointer; margin: 0; }
.rating-input input:checked ~ label, .rating-input label:hover, .rating-input label:hover ~ label { color: #e0a100; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block; vertical-align: -3px;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
details.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
details.box summary { cursor: pointer; font-weight: 600; }
.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (min-width: 560px) { .months { grid-template-columns: repeat(6, 1fr); } }
.months label { font-weight: 400; display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; margin: 0; font-size: .85rem; }
.months input { width: auto; min-height: 0; }

/* Plan */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.weeknav h1 { margin: 0; font-size: 1.25rem; text-align: center; }
.days { display: grid; gap: 12px; }
@media (min-width: 900px) { .days { grid-template-columns: repeat(7, 1fr); gap: 8px; } }
.day h3 { margin: 0 0 6px; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day.today h3 { color: var(--accent); }
.slot {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; margin-bottom: 8px;
}
@media (min-width: 900px) { .slot { grid-template-columns: 1fr; } .slot .sthumb { width: 100%; height: 80px; } }
.slot .sthumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.slot .label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.slot .name { font-weight: 600; line-height: 1.25; color: var(--text); display: block; }
.slot .tools { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.slot .tools button, .slot .tools .btn { min-height: 30px; padding: 3px 8px; font-size: .78rem; font-weight: 500; }
.slot.locked { border-color: var(--accent); }
.slot.cooked { opacity: .65; }

/* Groceries */
.glist { list-style: none; padding: 0; margin: 0; }
.glist li { border-bottom: 1px solid var(--line); }
.glist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; font-weight: 400; margin: 0; cursor: pointer; }
.glist input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--accent); }
.glist .from { display: block; font-size: .78rem; color: var(--muted); }
.sticky-actions {
  position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--bg);
  padding: 12px 0; display: flex; gap: 8px; flex-wrap: wrap;
}
@media (min-width: 760px) { .sticky-actions { bottom: 0; } }

.login { max-width: 380px; margin: 10vh auto 0; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 12px; }

.count { display: inline-block; min-width: 1.3em; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.5; text-align: center; vertical-align: 1px; }
.bottomnav a { position: relative; }
.bottomnav .count { position: absolute; top: 2px; left: calc(50% + 6px); }

.gear { margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.gear.active, .gear:hover { color: var(--accent); background: var(--accent-soft); }
.gear svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gear + .who { margin-left: 4px; }
@media (min-width: 760px) { .gear { margin-left: 8px; } }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
.status-on { color: var(--ok); font-weight: 600; }
.status-off { color: var(--muted); font-weight: 600; }

.gtools { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.gtools .chips { display: flex; gap: 6px; }
.gtools .chip { cursor: pointer; font: inherit; }
.ggroup { margin-top: 14px; }
.gtitle { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 1rem; margin: 0 0 2px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.gtitle a { color: var(--text); }
.link-btn { background: none; border: 0; padding: 4px 0; min-height: 0; color: var(--accent); font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

.cands { list-style: none; padding: 0; margin: 0; }
.cands li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cands img, .cands .thumb-empty { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); display: grid; place-items: center; }
.cand-body { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.cand-title { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.cand-body .btn, .cand-body button { white-space: nowrap; flex: none; }

.bottomnav a { font-size: .7rem; }
.shelf { margin-top: 18px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 10px; -webkit-overflow-scrolling: touch; }
.tile { flex: 0 0 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; }
.tile img, .tile .thumb-empty { width: 150px; height: 100px; object-fit: cover; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.6rem; }
.tile-title { color: var(--text); font-weight: 600; font-size: .9rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.tile form button, .tile .btn { width: 100%; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; width: min(560px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-size: .92rem; overflow-wrap: anywhere; transition: opacity .5s, transform .5s; }
.toast a { color: var(--bg); font-weight: 700; text-decoration: underline; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 760px) { .toasts { bottom: 24px; } }
.queue { padding-left: 1.4em; margin: 6px 0 14px; }
.queue li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.queue a { color: var(--text); }
.triage { display: flex; flex-direction: column; gap: 6px; }
.triage-actions { display: flex; gap: 6px; }
.triage-actions form:first-child { flex: 1; }
.triage-actions button { width: 100%; white-space: nowrap; }
.count[hidden] { display: none; }

.chip-type { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip-mood { background: var(--ok-soft); color: var(--ok); }
.chip-check { display: inline-flex; margin: 0; font-weight: 400; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { padding: 5px 11px; border-radius: 999px; font-size: .85rem; background: var(--surface-2); border: 1px solid transparent; white-space: nowrap; }
.chip-check input:checked + span { background: var(--accent); color: var(--accent-ink); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-gen { margin: 8px 0 12px; }
textarea.links { min-height: 0; resize: none; overflow: hidden; line-height: 1.4; }

.thermomix { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 10px 0 12px; padding: 12px 14px;
  border-radius: var(--radius); background: linear-gradient(135deg, #0f7a43, #13a35a); color: #fff; }
.thermomix .small { color: rgba(255,255,255,.85); }
.tm-logo { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: #0f7a43; font-weight: 800; letter-spacing: .5px; }
.thermomix > div:nth-child(2) { flex: 1; min-width: 180px; }
.tm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.thermomix .btn, .thermomix button { background: #fff; color: #0f7a43; border-color: #fff; }
.thermomix .btn-plain { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.5); }
.tm-badge { font-size: .68rem; font-weight: 800; color: #fff; background: #13a35a; border-radius: 6px; padding: 1px 5px; }
.rcard .source { font-size: .78rem; }
.tools .on { background: var(--accent-soft); color: var(--accent); }
.src-icon { display: inline-block; width: 16px; height: 16px; border-radius: 3px; vertical-align: -3px; object-fit: contain; }
.source { display: inline-flex; align-items: center; gap: 5px; }
.book-tile { color: var(--text); text-decoration: none; }
.tile-label { align-self: flex-start; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }

/* Login and Réglages › Comptes */
.who-pick .chip-check span { padding: 9px 18px; font-size: 1rem; }
.people { list-style: none; margin: 0 0 12px; padding: 0; }
.people > li { border-top: 1px solid var(--line, rgba(0,0,0,.08)); padding: 10px 0; }
.people > li:first-child { border-top: 0; }
.person { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.person .who-name { flex: 1; min-width: 120px; font-weight: 600; }
.people details { margin-top: 8px; }
.people details summary { cursor: pointer; font-size: .9rem; color: var(--muted, #777); }
.people details form { margin-top: 8px; }
