/* Crumb: warm paper, brick red, an editorial serif for food, the system font for controls. */
@font-face { font-family: 'Newsreader'; src: url(fonts/newsreader.woff2) format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url(fonts/newsreader-italic.woff2) format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }

:root {
  --bg: #F4EDE1; --surface: #FFFCF6; --surface2: #EFE6D6; --sunk: #EAE0CE;
  --ink: #26211B; --ink2: #4B4339; --mut: #8A7F6F; --faint: #B5A994;
  --sep: rgba(60, 45, 25, .16); --line: #E4D9C6;
  --accent: #B7392B; --accent-press: #9C2E22; --on-accent: #FFFFFF; --accent-soft: #F3DCD3; --accent-ink: #A8321F;
  --good: #3D7A4B; --danger: #C0352A;
  --bar: rgba(244, 237, 225, .86); --tabbar: rgba(250, 245, 236, .9);
  --scrim: rgba(28, 20, 12, .38);
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .07);
  --shadow-up: 0 -8px 30px rgba(40, 25, 10, .18);
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --kb: 0px;
  --tabh: calc(50px + var(--sb));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110D; --surface: #1F1B16; --surface2: #29241D; --sunk: #0F0D0A;
    --ink: #F2EADD; --ink2: #D8CEBE; --mut: #9C917F; --faint: #6E6556;
    --sep: rgba(255, 240, 215, .13); --line: #342D24;
    --accent: #E0674F; --accent-press: #C9553F; --on-accent: #1A0F0A; --accent-soft: #3B231C; --accent-ink: #F08A72;
    --good: #7FBF8C; --danger: #F07F72;
    --bar: rgba(20, 17, 13, .84); --tabbar: rgba(26, 22, 17, .9);
    --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); overscroll-behavior: none; }
body { font: 17px/1.35 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
input, textarea { -webkit-user-select: text; user-select: text; }
a { color: var(--accent-ink); }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.xs { width: 15px; height: 15px; stroke-width: 2.2; }
.nosel, .tabbar, .bar, .chip, .card, .row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- app frame ---------- */
#app { position: fixed; inset: 0; overflow: hidden; }
.tab { position: absolute; inset: 0; }
.scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(44px + var(--st)) calc(16px + var(--sr)) calc(var(--tabh) + 28px) calc(16px + var(--sl)); }
.wrap { max-width: 1080px; margin: 0 auto; }
.bar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: calc(44px + var(--st)); padding: var(--st) calc(8px + var(--sr)) 0 calc(8px + var(--sl));
  display: flex; align-items: center; gap: 4px; background: transparent; border-bottom: .5px solid transparent; transition: background .2s, border-color .2s; }
.bar.solid { background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--sep); }
.bar-title { position: absolute; left: 90px; right: 90px; bottom: 0; height: 44px; line-height: 44px; text-align: center; font-weight: 600; font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .18s; pointer-events: none; }
.bar.solid .bar-title { opacity: 1; }
.bar .grow { flex: 1; }
.bar-btn { min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; color: var(--accent); border-radius: 22px; font-size: 17px; padding: 0 8px; }
.bar-btn:active { opacity: .45; }
.bar-btn.back { padding-left: 0; }
.bar-btn.back svg { width: 28px; height: 28px; stroke-width: 2.2; }
.bar-btn.round { width: 36px; min-width: 36px; height: 36px; margin: 0 4px; background: rgba(20, 14, 8, .42); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.bar-btn.round svg { width: 20px; height: 20px; stroke-width: 2; }
.bar-btn.strong { font-weight: 600; }

.large { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.large h1 { font: 700 34px/1.12 var(--serif); letter-spacing: -.01em; margin: 0; }
.large .sub { color: var(--mut); font-size: 15px; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--tabh); padding: 0 var(--sr) var(--sb) var(--sl); display: flex;
  background: var(--tabbar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 2px; color: var(--mut); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; }
.tabbar button svg { width: 26px; height: 26px; stroke-width: 1.7; }
.tabbar button[aria-selected="true"] { color: var(--accent); }
.tabbar button[aria-selected="true"] svg { stroke-width: 2.1; }
.tabbar .badge { position: absolute; margin: -2px 0 0 22px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }

/* ---------- controls ---------- */
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--mut); width: 18px; height: 18px; }
.search input { width: 100%; height: 38px; border: 0; border-radius: 10px; padding: 0 34px 0 36px; background: var(--surface2); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--mut); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 4px; top: 3px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--mut); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-16px - var(--sr)) 14px calc(-16px - var(--sl)); padding: 2px calc(16px + var(--sr)) 2px calc(16px + var(--sl)); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--surface); border: .5px solid var(--line); font-size: 15px; color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip svg { width: 16px; height: 16px; stroke-width: 2; }
.chip:active { transform: scale(.97); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border-radius: 13px; font-size: 17px; font-weight: 600; background: var(--accent); color: var(--on-accent); transition: transform .08s, background .12s; }
.btn:active { background: var(--accent-press); transform: scale(.985); }
.btn.block { width: 100%; }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.soft:active { filter: brightness(.96); }
.btn.quiet { background: var(--surface2); color: var(--ink); }
.btn.small { height: 36px; padding: 0 14px; border-radius: 18px; font-size: 15px; }
.btn.danger { background: transparent; color: var(--danger); }
.btn svg { width: 20px; height: 20px; stroke-width: 2.1; }
.link { color: var(--accent-ink); font-size: 15px; font-weight: 600; padding: 8px 4px; display: inline-flex; align-items: center; gap: 4px; }
.link:active { opacity: .5; }

.field { width: 100%; min-height: 46px; border: .5px solid var(--line); border-radius: 11px; padding: 11px 13px; background: var(--surface); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field::placeholder { color: var(--faint); }
textarea.field { resize: none; line-height: 1.45; display: block; }
.label { display: block; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--mut); text-transform: uppercase; margin: 18px 4px 7px; }
.hint { font-size: 13px; color: var(--mut); margin: 6px 4px 0; line-height: 1.4; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .label { margin-top: 18px; }

/* grouped list (Settings style) */
.group-h { font-size: 13px; color: var(--mut); text-transform: uppercase; letter-spacing: .02em; margin: 26px 16px 7px; }
.group { background: var(--surface); border-radius: 12px; overflow: hidden; }
.group + .foot, .foot { font-size: 13px; color: var(--mut); margin: 7px 16px 0; line-height: 1.4; }
.row { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; text-align: left; position: relative; font-size: 17px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: .5px solid var(--sep); }
.row.noicon + .row::before, .group.plain .row + .row::before { left: 16px; }
.row:active { background: var(--surface2); }
.row .ic { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; flex: 0 0 auto; }
.row .ic svg { width: 17px; height: 17px; stroke-width: 2.1; }
.row .ic.alt { background: #7C8B5B; } .row .ic.blue { background: #4F7196; } .row .ic.gold { background: #C79A3A; } .row .ic.gray { background: #8E8676; }
.row .txt { flex: 1; min-width: 0; }
.row .txt small { display: block; font-size: 13px; color: var(--mut); margin-top: 1px; line-height: 1.3; }
.row .val { color: var(--mut); font-size: 16px; white-space: nowrap; }
.row .chev { color: var(--faint); width: 18px; height: 18px; stroke-width: 2.4; }
.row.red { color: var(--danger); }
.row.accent { color: var(--accent-ink); }

/* ---------- recipes grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 18px 14px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px 20px; } }
.card { text-align: left; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card:active .pic { transform: scale(.975); }
.pic { position: relative; aspect-ratio: 4 / 3; border-radius: 13px; overflow: hidden; background: var(--surface2); box-shadow: var(--shadow); transition: transform .12s; }
.pic img, .hero img, .thumb img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.pic .fav { z-index: 2; }
.tile { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255, 250, 240, .95); font: 600 50px/1 var(--serif); }
.tile::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, .18), transparent 60%); }
.tile span { transform: translateY(-2px); }
.pic .fav { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; background: rgba(20, 14, 8, .38); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.pic .fav svg { width: 17px; height: 17px; stroke-width: 2.2; }
.pic .fav.on svg { fill: #fff; }
.card h3 { margin: 0; font: 600 17px/1.22 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 13px; color: var(--mut); margin-top: -3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta b { color: var(--good); font-weight: 600; }
.card .meta b.miss { color: var(--accent-ink); }
.more { grid-column: 1 / -1; justify-self: center; }

.tipcard { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 8px 14px 14px; margin-bottom: 18px; }
.tipcard .tic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tipcard .tic svg { width: 20px; height: 20px; }
.tipcard > div { flex: 1; font-size: 15px; line-height: 1.4; }
.tipcard p { margin: 2px 0 0; color: var(--ink2); }
.tipcard .tx { width: 36px; height: 36px; margin-top: -6px; color: var(--mut); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.empty { text-align: center; padding: 8vh 12px 0; max-width: 420px; margin: 0 auto; }
.empty .art { width: 132px; height: 104px; margin: 0 auto 18px; }
.empty h2 { font: 600 24px/1.2 var(--serif); margin: 0 0 8px; }
.empty p { color: var(--mut); margin: 0 0 22px; line-height: 1.45; font-size: 16px; }
.empty .btn { margin: 0 4px 10px; }
.nomatch { grid-column: 1 / -1; text-align: center; color: var(--mut); padding: 40px 0; }

/* ---------- pushed page (recipe) ---------- */
.page { position: fixed; inset: 0; z-index: 20; background: var(--bg); transform: translate3d(100%, 0, 0); visibility: hidden;
  transition: transform .38s cubic-bezier(.2, .85, .25, 1), visibility 0s linear .38s; will-change: transform; }
.page.open { transform: translate3d(0, 0, 0); visibility: visible; transition: transform .38s cubic-bezier(.2, .85, .25, 1), visibility 0s; }
#rBar .bar-title { display: none; }
.page .scroll { padding: 0 0 calc(var(--sb) + 40px); }
/* The list stays still while the recipe page slides over it; only a light shade fades in.
   (Moving the list too made iOS Safari redraw its scrolling content in patches: "tearing".) */
.tabs-dim { position: absolute; inset: 0; }
.page-shade { position: fixed; inset: 0; z-index: 19; background: rgba(20, 12, 4, .16); opacity: 0; pointer-events: none; transition: opacity .38s ease; }
body.pushed .page-shade { opacity: 1; }
#rBar.overhero .bar-btn { width: 36px; min-width: 36px; height: 36px; margin: 0 3px; padding: 0; border-radius: 18px; background: rgba(20, 14, 8, .42); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
#rBar.overhero .bar-btn svg { width: 21px; height: 21px; }
#rBar.overhero .bar-btn.back { margin-left: 6px; }
#rBar.overhero .bar-btn.back span { display: none; }
#rBar.overhero .bar-btn.back svg { width: 24px; height: 24px; margin-left: -2px; }
#rFav.on svg { fill: currentColor; }
.hero { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 52vh; background: var(--surface2); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .tile { font-size: 96px; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(90px + var(--st)); background: linear-gradient(rgba(0, 0, 0, .28), transparent); pointer-events: none; z-index: 2; }
.r-body { padding: 18px calc(20px + var(--sr)) 0 calc(20px + var(--sl)); max-width: 760px; margin: 0 auto; }
.r-body.nohero { padding-top: calc(56px + var(--st)); }
.r-title { font: 700 30px/1.12 var(--serif); letter-spacing: -.01em; margin: 0 0 8px; overflow-wrap: anywhere; }
.r-src { font-size: 15px; color: var(--mut); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.r-src a { color: var(--accent-ink); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.stat { padding: 11px 6px 12px; text-align: center; position: relative; min-width: 0; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; border-left: .5px solid var(--sep); }
.stat .k { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .v { font: 600 19px/1.3 var(--serif); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.none { color: var(--faint); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 2px; margin-top: 1px; }
.stepper button { width: 32px; height: 30px; border-radius: 15px; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.stepper button:active { background: var(--accent-soft); }
.stepper button svg { width: 18px; height: 18px; stroke-width: 2.4; }
.stepper b { font: 600 19px var(--serif); min-width: 30px; }
.macros { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--mut); margin: -8px 0 16px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 8px; }
.sec-h h2 { font: 700 23px/1.2 var(--serif); margin: 0; }
.sec-h .scaled { font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.seg { display: flex; background: var(--surface2); border-radius: 9px; padding: 2px; margin: 2px 0 6px; }
.seg button { flex: 1; height: 30px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ing { list-style: none; margin: 0; padding: 0; }
.ing li { display: flex; gap: 14px; align-items: flex-start; padding: 11px 0; border-bottom: .5px solid var(--sep); font: 400 18.5px/1.4 var(--serif); cursor: pointer; }
.ing li:last-child { border-bottom: 0; }
.ing li .box { width: 22px; height: 22px; border-radius: 11px; border: 1.6px solid var(--faint); flex: 0 0 auto; margin-top: 2px; display: flex; align-items: center; justify-content: center; color: transparent; transition: background .12s, border-color .12s; }
.ing li .box svg { width: 14px; height: 14px; stroke-width: 3; }
.ing li.done { color: var(--mut); }
.ing li.done span { text-decoration: line-through; text-decoration-color: var(--faint); }
.ing li.done .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.ing li b { font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; gap: 14px; padding: 12px 0; font: 400 18.5px/1.5 var(--serif); cursor: pointer; }
.steps li .n { width: 28px; height: 28px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font: 700 15px var(--sans); margin-top: 1px; }
.steps li.done { color: var(--mut); }
.steps li.done .n { background: var(--surface2); color: var(--mut); }
.steps li.head { font: italic 600 19px/1.3 var(--serif); color: var(--accent-ink); padding: 18px 0 2px; cursor: default; }
.steps .tmr { color: var(--accent-ink); font-weight: 600; }
.notes { margin-top: 4px; min-height: 90px; font: 400 17px/1.45 var(--serif); background: var(--surface); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tags .chip { height: 32px; font-size: 14px; }
.tags .chip .x { color: var(--mut); margin-right: -4px; display: flex; }
.tags .chip .x svg { width: 14px; height: 14px; stroke-width: 2.4; }
.tags input { height: 32px; border-radius: 16px; border: 1px dashed var(--faint); background: transparent; padding: 0 14px; font-size: 14px; width: 130px; outline: none; }
.tags input:focus { border-style: solid; border-color: var(--accent); }
.r-foot { text-align: center; color: var(--mut); font-size: 13px; margin: 34px 0 10px; line-height: 1.6; }

/* ---------- plan ---------- */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 14px; }
.weeknav .wk { text-align: center; }
.weeknav .wk b { display: block; font-size: 17px; }
.weeknav .wk span { font-size: 13px; color: var(--mut); }
.weeknav button { width: 44px; height: 44px; border-radius: 22px; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.weeknav button:active { background: var(--accent-soft); }
.days { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 760px) { .days { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.day { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 4px 0 6px; }
.day-h { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px 16px; }
.day-h h3 { margin: 0; font: 600 19px var(--serif); }
.day-h .date { color: var(--mut); font-size: 14px; }
.day-h .today { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: 6px; padding: 2px 6px; }
.day-h .cal { color: var(--mut); font-size: 13px; margin-left: auto; margin-right: 4px; }
.day-h .cal.over { color: var(--danger); }
.day-h .add { margin-left: auto; width: 40px; height: 40px; border-radius: 20px; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.day-h .cal + .add { margin-left: 0; }
.day-h .add:active { background: var(--accent-soft); }
.meal { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; width: 100%; text-align: left; }
.meal:active { background: var(--surface2); }
.meal .thumb { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; position: relative; flex: 0 0 auto; background: var(--surface2); }
.meal .thumb img { width: 100%; height: 100%; object-fit: cover; }
.meal .thumb .tile { font-size: 20px; }
.meal .nm { flex: 1; min-width: 0; font: 500 17px/1.25 var(--serif); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meal .rm { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--faint); border-radius: 20px; }
.meal .rm:active { background: var(--surface2); color: var(--danger); }
.day .none { color: var(--faint); font: italic 16px var(--serif); padding: 4px 16px 8px; }
.plan-acts { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
@media (min-width: 560px) { .plan-acts { grid-template-columns: 1fr 1fr; } }

.promo { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 22px 20px 20px; text-align: center; }
.promo h2 { font: 700 24px/1.2 var(--serif); margin: 8px 0 6px; }
.promo p { color: var(--ink2); margin: 0 0 18px; line-height: 1.45; }
.promo .star { width: 44px; height: 44px; border-radius: 22px; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- shopping ---------- */
.addrow { display: flex; gap: 8px; margin-bottom: 12px; }
.addrow .field { flex: 1; min-height: 44px; padding: 9px 13px; }
.addrow .btn { height: 44px; width: 44px; padding: 0; border-radius: 11px; }
.srcs { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 10px 12px 10px 14px; margin-bottom: 18px; width: 100%; text-align: left; box-shadow: var(--shadow); }
.srcs .txt { flex: 1; min-width: 0; font-size: 15px; color: var(--ink2); }
.srcs .txt b { display: block; font-size: 16px; color: var(--ink); font-weight: 600; }
.srcs .txt span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-h { font: 700 21px var(--serif); margin: 22px 4px 2px; }
.aisle-h { font-size: 13px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; margin: 16px 4px 6px; }
.items { background: var(--surface); border-radius: 12px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 6px 4px 6px 14px; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 48px; right: 0; border-top: .5px solid var(--sep); }
.item .box { width: 24px; height: 24px; border-radius: 12px; border: 1.6px solid var(--faint); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: transparent; }
.item .box svg { width: 14px; height: 14px; stroke-width: 3; }
.item.done .box { background: var(--good); border-color: var(--good); color: #fff; }
.item .t { flex: 1; min-width: 0; font-size: 17px; line-height: 1.3; padding: 6px 0; }
.item .t em { display: block; font-style: normal; font-size: 13px; color: var(--accent-ink); margin-top: 1px; }
.item.done .t { color: var(--mut); text-decoration: line-through; text-decoration-color: var(--faint); }
.item .opt { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; color: var(--faint); flex: 0 0 auto; }
.item .opt:active { background: var(--surface2); color: var(--ink); }
/* swipe to delete */
.sw { position: relative; overflow: hidden; transition: height .2s ease; }
.sw > .item, .sw > .meal { position: relative; z-index: 1; background: var(--surface); }
.sw-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; background: var(--danger); color: #fff; font-size: 15px; font-weight: 600; }
.sw.gone .sw-del { width: 100%; }
.items > .sw + .sw > .item::before { content: ""; position: absolute; top: 0; left: 48px; right: 0; border-top: .5px solid var(--sep); }
/* iOS switch */
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--faint); position: relative; flex: 0 0 auto; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.cart-h { display: flex; align-items: center; justify-content: space-between; margin: 26px 4px 6px; }
.cart-h span { font-size: 13px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.skipped { font-size: 14px; color: var(--mut); margin: 16px 4px 0; line-height: 1.45; }
.skipped button { color: var(--accent-ink); font-weight: 600; font-size: 14px; }

/* ---------- sheets, dialogs, toasts ---------- */
.layer { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .3s; }
.layer.in .scrim { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--st) - 10px); display: flex; flex-direction: column; background: var(--bg);
  border-radius: 14px 14px 0 0; box-shadow: var(--shadow-up); transform: translateY(100%); transition: transform .38s cubic-bezier(.2, .85, .25, 1); padding-bottom: var(--kb); }
.sheet.tall { height: calc(100% - var(--st) - 10px); }
.layer.in .sheet { transform: none; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 560px; margin-left: -280px; bottom: auto; top: 50%; max-height: min(86vh, 820px); border-radius: 16px; transform: translateY(-40%) scale(.98); opacity: 0; transition: transform .28s, opacity .2s; }
  .sheet.tall { height: min(86vh, 820px); }
  .layer.in .sheet { transform: translateY(-50%); opacity: 1; } }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--faint); opacity: .6; margin: 6px auto 0; flex: 0 0 auto; }
.sheet-h { display: flex; align-items: center; min-height: 50px; padding: 0 6px; flex: 0 0 auto; position: relative; touch-action: none; }
.sheet-h h2 { position: absolute; left: 90px; right: 90px; text-align: center; font-size: 17px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.sheet-h .grow { flex: 1; }
.sheet-b { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 16px calc(24px + var(--sb)); }
.sheet-b.flush { padding-left: 0; padding-right: 0; }
.sheet .big-t { font: 700 28px/1.15 var(--serif); margin: 6px 4px 6px; }
.sheet .lede { color: var(--ink2); margin: 0 4px 14px; line-height: 1.45; }

.acts { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--sb)); transform: translateY(120%); transition: transform .32s cubic-bezier(.2, .85, .25, 1); }
@media (min-width: 700px) { .acts { left: 50%; right: auto; width: 400px; margin-left: -200px; } }
.layer.in .acts { transform: none; }
.acts .grp { background: var(--surface); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.acts .title { text-align: center; font-size: 13px; color: var(--mut); padding: 13px 16px 11px; line-height: 1.35; border-bottom: .5px solid var(--sep); }
.acts button { display: block; width: 100%; min-height: 56px; font-size: 19px; color: var(--accent-ink); position: relative; padding: 0 16px; }
.acts button + button::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: .5px solid var(--sep); }
.acts button:active { background: var(--surface2); }
.acts button.red { color: var(--danger); }
.acts button.cancel { font-weight: 600; }

.dialog { position: absolute; left: 50%; top: 50%; width: min(300px, calc(100% - 60px)); transform: translate(-50%, -50%) scale(1.12); opacity: 0; transition: transform .22s, opacity .18s;
  background: var(--surface); border-radius: 16px; text-align: center; overflow: hidden; box-shadow: var(--shadow-up); }
.layer.in .dialog { transform: translate(-50%, -50%); opacity: 1; }
.dialog .dt { font-weight: 600; font-size: 17px; padding: 20px 18px 4px; }
.dialog .dm { font-size: 14px; color: var(--ink2); padding: 0 18px 18px; line-height: 1.4; }
.dialog .dbtns { display: flex; border-top: .5px solid var(--sep); }
.dialog .dbtns button { flex: 1; height: 46px; font-size: 17px; color: var(--accent-ink); }
.dialog .dbtns button + button { border-left: .5px solid var(--sep); font-weight: 600; }
.dialog .dbtns button.red { color: var(--danger); }
.dialog .dbtns button:active { background: var(--surface2); }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 14px); z-index: 60; transform: translate(-50%, 20px); opacity: 0; transition: transform .28s, opacity .2s;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); width: max-content; box-shadow: 0 8px 28px rgba(0, 0, 0, .28); pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: var(--accent-soft); font-weight: 700; font-size: 15px; padding: 4px 2px; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--accent); } }
body.pushed .toast, body.cooking .toast { bottom: calc(var(--sb) + 20px); }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* add sheet */
.opt-card { background: var(--surface); border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.opt-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.opt-card h3 svg { color: var(--accent); width: 20px; height: 20px; }
.opt-card p { margin: 0 0 12px; color: var(--mut); font-size: 14px; line-height: 1.4; }
.urlrow { display: flex; gap: 8px; }
.urlrow .field { flex: 1; min-width: 0; }
.urlrow .btn { height: 46px; padding: 0 16px; }
.status { font-size: 14px; color: var(--ink2); margin: 10px 2px 0; display: flex; gap: 8px; align-items: center; line-height: 1.35; }
.status.err { color: var(--danger); }
.photo-pick { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: var(--surface2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--mut); font-size: 15px; overflow: hidden; position: relative; border: 1px dashed var(--faint); }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick.has { border: 0; }
.photo-pick .chg { position: absolute; right: 10px; bottom: 10px; background: rgba(20, 14, 8, .55); color: #fff; border-radius: 14px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.from { font-size: 14px; color: var(--mut); margin: 10px 4px 0; }

/* picker */
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 16px; width: 100%; text-align: left; min-height: 60px; position: relative; }
.pick + .pick::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: .5px solid var(--sep); }
.pick:active { background: var(--surface2); }
.pick .thumb { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; position: relative; flex: 0 0 auto; background: var(--surface2); }
.pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick .thumb .tile { font-size: 20px; }
.pick .nm { flex: 1; min-width: 0; font: 500 17px/1.25 var(--serif); }
.pick .nm small { display: block; font: 13px var(--sans); color: var(--mut); margin-top: 2px; }
.pick .ck { width: 24px; height: 24px; border-radius: 12px; border: 1.6px solid var(--faint); display: flex; align-items: center; justify-content: center; color: transparent; flex: 0 0 auto; }
.pick .ck svg { width: 14px; height: 14px; stroke-width: 3; }
.pick.on .ck { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick-top { padding: 4px 16px 8px; }

/* paywall */
.pw-hero { text-align: center; padding: 8px 8px 4px; }
.pw-hero .star { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.pw-hero .star svg { width: 34px; height: 34px; fill: #fff; stroke-width: 1.4; }
.pw-hero h2 { font: 700 30px/1.15 var(--serif); margin: 14px 0 6px; }
.pw-hero p { color: var(--ink2); margin: 0; }
.perks { list-style: none; margin: 20px 4px; padding: 0; }
.perks li { display: flex; gap: 12px; padding: 8px 0; font-size: 16px; line-height: 1.35; }
.perks li svg { color: var(--good); width: 22px; height: 22px; stroke-width: 2.4; }
.plans { display: flex; flex-direction: column; gap: 10px; }
.plan { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.plan.on { border-color: var(--accent); }
.plan .ck { width: 22px; height: 22px; border-radius: 11px; border: 1.6px solid var(--faint); flex: 0 0 auto; }
.plan.on .ck { border: 6px solid var(--accent); }
.plan .pt { flex: 1; }
.plan .pt b { display: block; font-size: 17px; }
.plan .pt small { color: var(--mut); font-size: 13px; }
.plan .pp { font-weight: 600; font-size: 17px; white-space: nowrap; }
.plan .save { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--good); color: #fff; border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: 2px; }
.fine { font-size: 12px; color: var(--mut); text-align: center; line-height: 1.5; margin: 14px 8px 0; }
.fine a { color: var(--mut); }

/* ---------- cook mode ---------- */
.cook { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; transform: translateY(100%); visibility: hidden;
  transition: transform .4s cubic-bezier(.2, .85, .25, 1), visibility 0s linear .4s; }
.cook.open { transform: none; visibility: visible; transition: transform .4s cubic-bezier(.2, .85, .25, 1), visibility 0s; }
.cook-top { display: flex; align-items: center; gap: 4px; padding: calc(var(--st) + 4px) calc(8px + var(--sr)) 4px calc(8px + var(--sl)); }
.cook-top .prog { flex: 1; text-align: center; font-size: 15px; font-weight: 600; color: var(--ink2); }
.cook-top .bar-btn.on { background: var(--accent-soft); }
.cook-bar { height: 3px; background: var(--surface2); margin: 4px 20px 0; border-radius: 2px; overflow: hidden; }
.cook-bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.cook-main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; padding: 24px calc(28px + var(--sr)) 24px calc(28px + var(--sl)); }
.cook-name { font: italic 500 16px var(--serif); color: var(--mut); text-align: center; margin-bottom: 18px; }
.cook-sec { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-ink); text-align: center; margin-bottom: 10px; }
.cook-text { font: 400 clamp(26px, 7.4vw, 44px)/1.35 var(--serif); text-align: center; max-width: 820px; margin: 0 auto; }
.cook-tmr { align-self: center; margin-top: 28px; height: 52px; padding: 0 24px; border-radius: 26px; border: 2px solid var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.cook-tmr.run { background: var(--accent); color: var(--on-accent); }
.cook-tmr.done { background: var(--ink); border-color: var(--ink); color: var(--bg); animation: pulse .7s ease 4; }
.cook-tmr svg { width: 20px; height: 20px; stroke-width: 2.2; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.cook-need { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; margin: 18px auto 0; max-width: 620px; }
.cook-need span { font: 500 15px/1.3 var(--sans); color: var(--ink2); background: var(--surface); border: .5px solid var(--line); border-radius: 15px; padding: 5px 11px; }
.cook-away { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.cook-away .away { height: 34px; padding: 0 12px; border-radius: 17px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.cook-away .away.done { background: var(--ink); color: var(--bg); animation: pulse .7s ease 3; }
.cook-nav { display: flex; gap: 10px; padding: 10px calc(16px + var(--sr)) calc(12px + var(--sb)) calc(16px + var(--sl)); }
.cook-nav .btn { height: 56px; border-radius: 16px; font-size: 18px; }
.cook-nav .prev { flex: 0 0 34%; }
.cook-nav .next { flex: 1; }
.cook-ing { position: absolute; left: 0; right: 0; bottom: 0; max-height: 62%; background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-up);
  transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .85, .25, 1); display: flex; flex-direction: column; z-index: 2; }
.cook-ing.open { transform: none; }
.cook-ing .sheet-b { padding-top: 0; }
.eta { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* wide screens: keep reading measure sane */
@media (min-width: 900px) { .scroll .wrap { padding: 0 8px; } }
