:root {
  --bg: #12161C;
  --bg2: #171C24;
  --card: #1C232C;
  --ink: #F3F4F6;
  --muted: #9AA3AE;
  --line: #2B333D;
  --accent: #7AA2FF;
  --accent-ink: #0B1220;
  --accent-2: #253044;
  --gold: #E6B84A;
  --warn: #E6B84A;
  --warn-bg: #2B2416;
  --bad: #E06A6A;
  --ok: #3DDC97;
  --radius: 16px;
  --tap: 46px;
  --font: 16px;
  --title: 26px;
  --shadow: 0 8px 24px rgba(0,0,0,.22);
}
body.light {
  --bg: #F3EEE6;
  --bg2: #EDE7DD;
  --card: #FFFcf7;
  --ink: #1A1D22;
  --muted: #5C6570;
  --line: #E4DDD3;
  --accent: #2A4A78;
  --accent-ink: #fff;
  --accent-2: #E8EEF6;
  --warn-bg: #FFF4DC;
  --shadow: 0 8px 20px rgba(40,30,10,.08);
}
body.big { --font: 19px; --title: 28px; --tap: 52px; }
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(1200px 420px at 10% -10%, #1b2740 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font);
  line-height: 1.38;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1 { margin: 2px 0 6px; font-size: var(--title); font-weight: 750; letter-spacing: -0.03em; }
.lede { color: var(--muted); margin: 0 0 16px; font-size: 0.86em; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
}
.brand {
  font-weight: 800; letter-spacing: -0.03em;
  display: flex; align-items: center; gap: 8px;
}
.brand::before {
  content: ""; width: 10px; height: 10px; border-radius: 99px;
  background: linear-gradient(180deg, #9CBCFF, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.tools { display: flex; gap: 6px; }
.topbar button {
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; min-height: 34px; padding: 4px 12px; font-size: 0.82em;
}
.wrap { max-width: 540px; margin: 0 auto; padding: 4px 16px 22px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 14px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.pad { padding: 14px 16px; }
.pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; }
.pill {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 4px 10px; text-align: center;
  box-shadow: var(--shadow);
}
.pill span { display: block; color: var(--muted); font-size: 0.7em; letter-spacing: .02em; }
.pill b { font-size: 1.35em; font-weight: 800; letter-spacing: -0.03em; }
.row { display: flex; gap: 8px; align-items: center; }
.addbar { display: flex; gap: 8px; margin: 8px 0 10px; }
.addbar input { flex: 1; }
label { display: block; font-size: 0.76em; color: var(--muted); margin: 8px 0 4px; font-weight: 650; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--bg2); color: var(--ink);
}
textarea { min-height: 76px; }
.btn {
  min-height: var(--tap); padding: 8px 14px; border: 0; border-radius: 13px;
  background: var(--accent); color: #fff; font-weight: 750;
  flex: 0 0 auto;
}
.btn.secondary { background: var(--accent-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--muted); border: 0; min-height: 36px; padding: 4px 8px; font-weight: 650; }
.btn.wide { width: 100%; }
.chips { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; min-height: 34px;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.item {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.check {
  width: 26px; height: 26px; flex: 0 0 26px;
  border: 2px solid color-mix(in srgb, var(--muted) 70%, var(--line));
  border-radius: 8px; background: transparent;
}
.item.done .check {
  background: var(--ok); border-color: var(--ok);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-width='2.2' d='M3 8.5 6.5 12 13 4'/></svg>");
  background-size: 14px; background-repeat: no-repeat; background-position: center;
}
.item.done .name { text-decoration: line-through; color: var(--muted); }
.item.late { background: var(--warn-bg); margin: 0 -10px; padding: 12px 10px; border-radius: 12px; border-bottom: 0; }
.muted { color: var(--muted); }
.warnbox {
  color: var(--warn); margin: 0 0 12px; font-size: 0.94em;
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 28%, var(--line));
  border-radius: 14px; padding: 11px 13px;
}
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 92%, #000);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(12px);
}
.nav button { background: none; border: 0; padding: 9px 2px 8px; color: var(--muted); font-size: 11px; }
.nav button span { display: block; font-size: 18px; margin-bottom: 1px; }
.nav button.on { color: var(--accent); font-weight: 800; }
.toast {
  position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 14px; z-index: 40; white-space: nowrap;
  box-shadow: var(--shadow);
}
.tag { display: inline-block; background: var(--gold); color: #1A1A1A; border-radius: 999px; padding: 1px 7px; font-size: 0.68em; font-weight: 800; vertical-align: 1px; }
.tag.late { background: var(--bad); color: #fff; }
.menu-btn {
  display: block; width: 100%; text-align: left;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; margin-bottom: 8px;
  font-weight: 700; box-shadow: var(--shadow);
}
ol { margin: 8px 0; padding-left: 20px; }
.callout { color: var(--muted); font-size: 0.9em; margin-top: 12px; }
.hidden { display: none !important; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qty { width: 56px; flex: 0 0 56px; text-align: center; }
.stepper { display: flex; gap: 4px; }
.stepper .btn.ghost { min-width: 36px; border: 1px solid var(--line); border-radius: 10px; }
.store-h { color: var(--muted); font-size: 0.72em; font-weight: 800; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .06em; }
.ago { font-size: 0.78em; color: var(--muted); }
.undo { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 16px; right: 16px; z-index: 45;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 10px 12px; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow); }
.undo b { flex: 1; font-weight: 700; }
.name { font-weight: 650; }
.meal-kicker { font-size: 0.72em; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.meal-name { font-size: 1.12em; font-weight: 750; }
