/* Supper Board - warm, light, mobile-first. System fonts only (no external requests). */
:root {
  --bg: #fbf6ef;
  --card: #ffffff;
  --ink: #2c2420;
  --ink-2: #6f625a;
  --ink-3: #a3958b;
  --line: #eee3d6;
  --accent: #c2593f;      /* terracotta */
  --accent-soft: #f7e3da;
  --sage: #5d8a68;
  --sage-soft: #e3efe4;
  --mustard: #e8b04b;
  --mustard-soft: #fbefd5;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .07);
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tabbar-h: 62px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: url(icon.svg) center/cover; flex: none; }
.topbar h1 { margin: 0; font: 600 20px/1.1 var(--serif); letter-spacing: -.01em; }
.topbar .sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-select { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 10px; font-size: 13px; max-width: 46%; }

.demo-banner {
  margin: 4px 16px 0; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600;
  background: var(--mustard-soft); color: #7a5410; border: 1px dashed #e2c07a; text-align: center; letter-spacing: .01em;
}

main { padding: 8px 16px 0; max-width: 760px; margin: 0 auto; outline: none; }
.section-title { font: 600 24px/1.15 var(--serif); margin: 18px 2px 4px; letter-spacing: -.01em; }
.section-sub { color: var(--ink-2); margin: 0 2px 14px; font-size: 14px; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 20px; }
.empty strong { display: block; font: 600 19px var(--serif); color: var(--ink); margin-bottom: 6px; }

/* ---------- Pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.sage { background: var(--sage-soft); color: var(--sage); }
.pill.mustard { background: var(--mustard-soft); color: #8a5f12; }
.pill.grey { background: #f1ebe4; color: var(--ink-2); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--ink-2); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Meal cards (This week) ---------- */
.meal {
  display: block; text-decoration: none; color: inherit; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; transition: transform .15s ease;
}
.meal:active { transform: scale(.985); }
.meal .photo { position: relative; aspect-ratio: 16 / 10; background: #efe5d9; }
.meal .photo img { width: 100%; height: 100%; object-fit: cover; }
.night {
  position: absolute; left: 12px; top: 12px; background: rgba(255,255,255,.94); color: var(--ink); border-radius: 12px;
  padding: 6px 10px; font-size: 12px; font-weight: 700; line-height: 1.15; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.night b { display: block; font: 600 20px/1 var(--serif); color: var(--accent); }
.meal .body { padding: 14px 16px 16px; }
.meal h3 { margin: 0 0 2px; font: 600 19px/1.2 var(--serif); }
.meal .subtitle { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 2px 14px; }

/* ---------- Option cards (Vote) ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.opt { position: relative; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.opt.chosen { outline: 2.5px solid var(--sage); }
.opt .photo { aspect-ratio: 4 / 3; background: #efe5d9; }
.opt .photo img { width: 100%; height: 100%; object-fit: cover; }
.opt .body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.opt h3 { margin: 0; font: 600 15px/1.25 var(--serif); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.opt .ribbon { position: absolute; top: 8px; right: 8px; }
.votes { display: flex; gap: 6px; margin-top: auto; }
.voter { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 8px 3px 3px; border-radius: 999px; background: #f4eee7; color: var(--ink-3); }
.voter .av { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; background: #cbbfb4; }
.voter.yes { background: var(--sage-soft); color: var(--sage); }
.voter.yes .av { background: var(--sage); }
.tally { display: flex; gap: 8px; margin: 0 2px 14px; flex-wrap: wrap; }

/* ---------- Library ---------- */
.filters { position: sticky; top: calc(env(safe-area-inset-top) + 58px); z-index: 5; background: var(--bg); padding: 6px 0 10px; }
.search { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 11px 14px 11px 38px; font-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3958b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 18px; }
.search:focus, .filter-row select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.filter-row { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row select { flex: 1 0 auto; min-width: 0; max-width: 46%; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 12px; font-size: 14px; -webkit-appearance: none; appearance: none; }
.filter-row select.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.count { color: var(--ink-3); font-size: 13px; margin: 2px 2px 8px; }
.row { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; margin-bottom: 10px; text-decoration: none; color: inherit; content-visibility: auto; contain-intrinsic-size: auto 92px; }
.row img, .row .ph { width: 92px; height: 76px; object-fit: cover; border-radius: 10px; flex: none; background: #efe5d9; }
.row .txt { min-width: 0; flex: 1; }
.row h3 { margin: 0 0 4px; font: 600 15px/1.25 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumbs { display: inline-flex; gap: 4px; }
.thumb { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.thumb.up { background: var(--sage-soft); color: var(--sage); }
.thumb.down { background: #f6e1dc; color: #a2412b; }
.more { display: block; width: 100%; margin: 6px 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600; color: var(--accent); }

/* ---------- Shopping ---------- */
.order-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.order-card .k { color: var(--ink-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.order-card .v { font-weight: 600; font-size: 15px; }
.progress { height: 6px; background: #efe5d9; border-radius: 999px; overflow: hidden; margin: 4px 2px 6px; }
.progress i { display: block; height: 100%; width: 0; background: var(--sage); border-radius: inherit; transition: width .25s ease; }
.progress-row { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: 13px; margin: 0 2px 10px; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 6px 0; cursor: pointer; }
.aisle { margin-bottom: 14px; }
.aisle h3 { margin: 0 2px 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.aisle h3.cupboard { color: #8a5f12; }
.list { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.check:first-child { border-top: 0; }
.check input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 1px 0 0; flex: none; border: 2px solid #d7cabd; border-radius: 7px; display: grid; place-items: center; background: #fff; transition: all .15s; }
.check input:checked { background: var(--sage); border-color: var(--sage); }
.check input:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check .t { flex: 1; min-width: 0; }
.check .name { font-weight: 600; }
.check .amt { color: var(--ink-2); font-weight: 500; }
.check .for { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.check .flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.check:has(input:checked) .name, .check:has(input:checked) .amt { text-decoration: line-through; color: var(--ink-3); }

/* ---------- Recipe sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .hero { position: relative; aspect-ratio: 16 / 11; background: #efe5d9; max-height: 52vh; width: 100%; }
.sheet .hero img { width: 100%; height: 100%; object-fit: cover; }
.sheet .back { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); box-shadow: 0 2px 10px rgba(0,0,0,.15); font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.sheet .content { max-width: 760px; margin: -22px auto 0; position: relative; background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 18px calc(40px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 4px; font: 600 26px/1.15 var(--serif); letter-spacing: -.01em; }
.sheet .subtitle { margin: 0 0 12px; color: var(--ink-2); }
.sheet h4 { font: 600 19px var(--serif); margin: 24px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.sheet h4 small { font: 500 13px var(--sans); color: var(--ink-3); }
.wake { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 16px 0 4px; padding: 13px; border-radius: 14px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 700; cursor: pointer; }
.wake.on { background: var(--accent); color: #fff; }
.wake-note { text-align: center; color: var(--ink-3); font-size: 12px; margin: 4px 0 0; min-height: 1em; }
.rate-box { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rate-box .r { background: var(--card); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 13px; flex: 1 1 140px; }
.rate-box .r b { display: block; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 14px 14px 14px 52px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer; transition: opacity .2s; }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 13px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.steps li.done { opacity: .5; }
.steps li.done::before { content: "✓"; background: var(--sage); color: #fff; }
.source { display: block; text-align: center; margin-top: 20px; font-size: 13px; color: var(--ink-3); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, #fff 90%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active svg { stroke-width: 2.2; }

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