:root {
  --bg: #faf6f0; --panel: #ffffff; --ink: #2b2420; --muted: #7a6e65; --line: #e8dfd3;
  --accent: #b4532a; --accent-ink: #ffffff; --accent-soft: #f6e4da; --good: #3d7a4f; --warn: #b7791f; --bad: #b3261e;
  --chip: #f1e9de; --tip: #2a7a74; --tip-soft: #e4f3f0; --tip-line: #a9d6cf; --shadow: 0 1px 2px rgba(60,40,20,.08), 0 4px 14px rgba(60,40,20,.06);
  --radius: 12px; --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1613; --panel: #251f1b; --ink: #f1e9df; --muted: #a39587; --line: #3a312a;
    --accent: #e0805a; --accent-ink: #1a1613; --accent-soft: #3a2a21; --chip: #332a23; --tip: #7fcfc4; --tip-soft: #1b2e2b; --tip-line: #2f5751;
    --good: #7fc392; --warn: #e3b25a; --bad: #f08b84; --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 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.25rem; padding: .6rem 1rem;
  padding-top: calc(.6rem + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font: 700 1.25rem var(--serif); color: var(--accent); text-decoration: none; white-space: nowrap; }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; }
#nav a { color: var(--ink); text-decoration: none; padding: .35rem .7rem; border-radius: 999px; font-size: .95rem; }
#nav a:hover { background: var(--chip); }
#nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.getapp { margin-left: auto; white-space: nowrap; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: .35rem .8rem; font-size: .9rem; cursor: pointer; }
.getapp:hover { background: var(--chip); }
.getapp ~ .acct { margin-left: 0; }   /* the button takes the push to the right; the account link sits next to it */
.getapp-box { display: grid; justify-items: center; gap: .8rem; text-align: center; max-width: 22rem; }
.getapp-box img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 6px; }
.getapp-box p { margin: 0; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .72rem; padding: .05rem .45rem; margin-left: .15rem; }
@media (max-width: 720px) {
  .topbar { gap: .5rem; flex-direction: column; align-items: stretch; }
  #nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #nav a { white-space: nowrap; }
  .getapp { position: absolute; top: .55rem; right: 1rem; margin: 0; }
}

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 4rem; padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.7rem; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: .45rem .95rem; cursor: pointer; text-decoration: none; color: var(--ink); font-size: .93rem; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: .2rem .65rem; font-size: .83rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.clearable { position: relative; display: block; flex: 1; min-width: 12rem; }
.clearable > input { width: 100%; padding-right: 2.3rem; }
.clear-x { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 1.7rem; height: 1.7rem; border: 0; border-radius: 50%;
  background: var(--line); color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.clear-x:hover { background: var(--accent-soft); color: var(--ink); }
.clear-x[hidden] { display: none; }
.scratch-link .clearable { min-width: 0; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 8rem; resize: vertical; line-height: 1.45; }
label.field, div.field { display: block; margin-bottom: .8rem; }
label.field > span, div.field > span { display: block; font-size: .83rem; color: var(--muted); margin-bottom: .2rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } }

.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: .12rem .65rem; font-size: .8rem; border: 1px solid transparent; }
button.chip { cursor: pointer; }
button.chip.on, .chip.on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.panel > h2 { font-size: 1.15rem; margin-bottom: .6rem; }

.stars { display: inline-flex; gap: 1px; }
.stars button { border: 0; background: none; padding: 0 1px; font-size: 1.15rem; color: var(--line); cursor: pointer; line-height: 1; }
.stars button.on { color: #e0a526; }
.stars.static button { cursor: default; pointer-events: none; font-size: .95rem; }

/* recipe list */
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-bottom: .8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card .pic { aspect-ratio: 16/10; background: linear-gradient(135deg, var(--accent-soft), var(--chip)); display: grid; place-items: center;
  font: 700 2.6rem var(--serif); color: var(--accent); background-size: cover; background-position: center; }
.card .body { padding: .75rem .9rem .9rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card h3 { font-size: 1.05rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* recipe view */
.recipe { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; grid-template-areas: "ing summary" "ing dirs"; gap: 1.2rem; align-items: start; }
.recipe .ing { grid-area: ing; position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow-y: auto; overscroll-behavior: contain; }   /* scrolls on its own, beside the directions */
.recipe .summary { grid-area: summary; }
.recipe .dirs { grid-area: dirs; }
@media (max-width: 860px) {
  .recipe { grid-template-columns: 1fr; grid-template-areas: "summary" "ing" "dirs"; }
  .recipe .ing { position: static; max-height: 55vh; }   /* still its own scroll box above the directions */
}
.summary h1 { font-size: 2rem; margin-bottom: .4rem; }
.source-link { margin: 0 0 .6rem; font-weight: 600; overflow-wrap: anywhere; }
.print-only { display: none; }
@media print { .print-only { display: inline; font-weight: 400; } }
.hero { width: 100%; max-height: 320px; object-fit: cover; border-radius: 10px; margin-bottom: .9rem; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; margin: .9rem 0; }
.meta div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .4rem .7rem; }
.meta b { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.ing-tools { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.ing-tools input[type=number] { width: 4.8rem; padding: .3rem .5rem; }
.ing ul { list-style: none; margin: 0 0 .8rem; padding: 0; }
.ing li label { display: flex; gap: .55rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); cursor: pointer; align-items: flex-start; }
.ing li input { margin-top: .35rem; accent-color: var(--accent); }
.ing li.skip span { color: var(--muted); text-decoration: line-through; }
.ing h4 { margin: .9rem 0 .2rem; font-family: var(--serif); color: var(--accent); }
.directions { counter-reset: step; }
.step { counter-increment: step; display: flex; gap: .8rem; margin-bottom: .9rem; }
.step::before { content: counter(step); flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; display: grid; place-items: center; font-size: .9rem; margin-top: .1rem; }
.dir-head { font: 700 1.05rem var(--serif); margin: 1.1rem 0 .5rem; color: var(--accent); }
.notes { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: .7rem .9rem; margin-top: 1rem; }
.history { margin: .5rem 0 0; padding: 0; list-style: none; font-size: .88rem; color: var(--muted); }

/* grocery */
.g-item { display: flex; gap: .7rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); align-items: flex-start; }
.g-item input { margin-top: .3rem; accent-color: var(--accent); width: 1.15rem; height: 1.15rem; }
.g-item .txt { flex: 1; }
.g-item.done .name { text-decoration: line-through; color: var(--muted); }
.g-item .for { font-size: .82rem; color: var(--muted); }
.g-item .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.group-head { margin: 1.1rem 0 .2rem; font: 700 1rem var(--serif); color: var(--accent); }

/* freezer */
.f-table { width: 100%; border-collapse: collapse; }
.f-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.f-table td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.age.warn { color: var(--warn); font-weight: 600; }
.age.bad { color: var(--bad); font-weight: 600; }
.pick.have { background: color-mix(in srgb, var(--warn) 14%, transparent); border-radius: 6px; padding: .25rem .35rem !important; }
.qty-step { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.qty-step .btn { min-width: 2rem; justify-content: center; font-weight: 700; }
.qty-step .qty { min-width: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.qty.out { color: var(--bad); font-weight: 700; }
tr.out b { color: var(--muted); }
.cook-card .pct { font-weight: 700; color: var(--muted); white-space: nowrap; }
.cook-card .pct.hi { color: var(--good); }
.cook-card .body { display: grid; gap: .3rem; }
.smart-summary { margin: 0 0 .8rem; padding: .5rem .7rem; border-radius: 8px; background: var(--accent-soft); }
.versions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: -.2rem 0 .5rem; }
.ask-log { max-height: 45vh; overflow: auto; display: grid; gap: .5rem; }
.ask-q { justify-self: end; background: var(--accent-soft); padding: .4rem .7rem; border-radius: 10px 10px 2px 10px; max-width: 85%; }
.ask-a { background: var(--chip); padding: .5rem .7rem; border-radius: 10px 10px 10px 2px; max-width: 92%; line-height: 1.45; }
.sugg { align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.aisle-order { margin: .3rem 0 0; padding-left: 1.4rem; max-height: 40vh; overflow: auto; }
.aisle-order li { display: flex; justify-content: space-between; align-items: center; padding: .2rem 0; }
/* cook mode */
.cook { max-width: 900px; margin: 0 auto; display: grid; gap: 1rem; }
.cook-top { display: flex; align-items: center; gap: .8rem; }
.cook-title { flex: 1; font: 600 1.05rem var(--serif); display: grid; }
.cook-progress { height: 6px; border-radius: 3px; background: var(--chip); position: relative; overflow: hidden; }
.cook-progress::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p, 0); background: var(--accent); transition: width .25s; }
.cook-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.8rem; min-height: 45vh; display: grid; align-content: center; gap: 1.2rem; touch-action: pan-y; box-shadow: var(--shadow); }
.cook-step { font-size: clamp(1.4rem, 3.4vw, 2.3rem); line-height: 1.45; }
.cook-ings { display: grid; gap: .3rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.cook-ing { font-size: clamp(1rem, 2.2vw, 1.3rem); text-align: left; background: none; border: 0; padding: .1rem 0; color: inherit; font-family: inherit; cursor: pointer; }
.cook-ing.crossed { text-decoration: line-through; color: var(--muted); }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: .8rem; }
.btn.big { font-size: 1.2rem; padding: .9rem 1rem; justify-content: center; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); }
.cook-heard { min-height: 1.4em; }
.prep-list { display: grid; gap: .25rem; }
.prep-item, .prep-step { align-items: flex-start; padding: .3rem 0; border-bottom: 1px solid var(--line); gap: .6rem; }
.prep-time { min-width: 4.8rem; font-variant-numeric: tabular-nums; }
.prep-step.off { color: var(--muted); }
.frozen-box { margin: .6rem 0; padding: .55rem .7rem; border-radius: 8px; background: var(--accent-soft); display: grid; gap: .25rem; }
.bags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.bag { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.bag.on { border-color: var(--brand, #b4532a); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #b4532a) 35%, transparent); font-weight: 600; }
.dot { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; padding: .3rem 0; }
.checks .check { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; cursor: pointer; }
.have-tag { display: block; font-size: .78rem; font-weight: 600; color: var(--warn); }
.kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
@media (max-width: 720px) {
  .f-table thead { display: none; }
  .f-table, .f-table tbody, .f-table tr, .f-table td { display: block; width: 100%; }
  .f-table tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .f-table td { border: 0; padding: .1rem .3rem; }
}

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal .dow { padding: .4rem; text-align: center; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 104px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; background: transparent; text-align: left;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; border-top: 0; border-left: 0; border-radius: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: var(--accent-soft); }
.cal .day.out { opacity: .45; }
.cal .day .n { font-size: .8rem; color: var(--muted); }
.cal .day.today .n { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .45rem; align-self: flex-start; font-weight: 700; }
.pill { font-size: .75rem; line-height: 1.25; padding: .1rem .35rem; border-radius: 6px; background: var(--accent-soft); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--accent); }
.pill.cooked { background: color-mix(in srgb, var(--good) 18%, transparent); border-left-color: var(--good); }
.pill.item { background: transparent; border: 1px dashed var(--line); border-left: 3px dashed var(--muted, #888); color: var(--muted, inherit); }
.pill.s-breakfast { border-left-color: #d9a21b; } .pill.s-lunch { border-left-color: #3b86b8; } .pill.s-snack { border-left-color: #8a6bbf; }
@media (max-width: 720px) { .cal .day { min-height: 70px; } .pill { font-size: .65rem; padding: 0 .2rem; } }
.plan-row { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.plan-row .t { flex: 1; min-width: 0; }
.plan-row select { width: auto; flex: none; padding: .3rem .5rem; font-size: .85rem; }
.plan-row.cooked .t a, .plan-row.cooked .t span.ttl { text-decoration: line-through; color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; gap: .5rem; }
.suggest button { text-align: left; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--ink); width: min(520px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20,12,6,.5); }
dialog .dlg { padding: 1.2rem; max-height: 85vh; overflow: auto; }
dialog h2 { font-size: 1.25rem; margin-bottom: .8rem; }
dialog .actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

#toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); color: #fff; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.4rem; text-align: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

@media print {
  .topbar, .no-print, #toast, .recipe .ing input[type=checkbox] { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .recipe { grid-template-columns: 1fr; grid-template-areas: "summary" "ing" "dirs"; }
  .recipe .ing { position: static; max-height: none; overflow: visible; }
}

/* ---- interactive recipe ---- */
.timer-link { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 .5rem; cursor: pointer; font-size: .9em; white-space: nowrap; }
.timer-link:hover { background: var(--accent); color: var(--accent-ink); }
.step { cursor: pointer; border-radius: 10px; padding: .3rem .4rem; margin-left: -.4rem; transition: background .15s; }
.step.current { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.step.current::before { background: var(--accent); color: var(--accent-ink); }
.step .txt { flex: 1; }
.inline-img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; margin: .5rem 0; }
.scaled { color: var(--accent); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin: -.4rem 0 .9rem; }
.thumbs > img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.thumbs > img:hover { border-color: var(--accent); }
.thumb { display: flex; flex-direction: column; gap: .3rem; }
.thumb img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; }
.ing-tools select { width: auto; padding: .3rem .5rem; font-size: .85rem; }

#pins { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .4rem 1rem; background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.pin { display: inline-flex; align-items: center; gap: .25rem; background: var(--panel); border-radius: 999px; padding: .1rem .2rem .1rem .7rem; font-size: .88rem; border: 1px solid var(--line); }
.pin button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; }
#timers { position: fixed; right: .8rem; bottom: calc(.8rem + env(safe-area-inset-bottom)); z-index: 40; display: flex; flex-direction: column; gap: .4rem; max-width: 70vw; }
.timer { display: flex; align-items: center; gap: .6rem; background: var(--ink); color: var(--bg); border-radius: 12px; padding: .5rem .8rem; box-shadow: var(--shadow); }
.timer b { font: 700 1.2rem ui-monospace, Menlo, monospace; }
.timer span { font-size: .8rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer.done { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
.timer button { border: 0; background: none; color: inherit; font-size: 1.2rem; cursor: pointer; }
@keyframes pulse { 50% { opacity: .65; } }

/* ---- nutrition label ---- */
.nutrition { border: 2px solid var(--ink); border-radius: 6px; padding: .5rem .8rem; max-width: 300px; margin-bottom: .6rem; background: var(--bg); }
.nutrition h3 { font: 900 1.7rem var(--sans); border-bottom: 1px solid var(--ink); margin: 0 0 .2rem; }
.nl-sub { font-size: .8rem; border-bottom: 8px solid var(--ink); padding-bottom: .3rem; }
.nl-big { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 4px solid var(--ink); padding: .2rem 0; font-weight: 700; }
.nl-big b { font-size: 2rem; line-height: 1; }
.nl-row { border-bottom: 1px solid var(--line); padding: .15rem 0; font-size: .92rem; }
.nl-row.indent { padding-left: 1.2rem; }

/* ---- misc ---- */
#login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 100; padding: 1rem; }
#login form { width: min(340px, 100%); }
pre.caption { white-space: pre-wrap; font: inherit; background: var(--bg); border-radius: 8px; padding: .6rem .8rem; max-height: 14rem; overflow: auto; }
.dupe { display: flex; gap: .7rem; padding: .5rem 0; border-top: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.dupe input { margin-top: .35rem; accent-color: var(--accent); }
.cal.week .day.tall { min-height: 150px; }
.cal.week .pill { white-space: normal; }
.danger-solid { background: var(--bad); }
hr { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }
.plan-row input[type=checkbox] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }

.row > input[type=text], .row > input[type=url], .row > input[type=search] { flex: 1; width: auto; min-width: 12rem; }
.toolbar > .row { flex-wrap: nowrap; }
.toolbar select { width: auto; }

/* prep plan ingredient check */
.prep-check { margin-bottom: 1rem; padding: .6rem .8rem; border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.prep-check h3 { margin: 0 0 .3rem; }
.chip.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.danger { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

/* sign-in, household setup and the household page */
#onboard { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 100; padding: 1rem; overflow: auto; }
.signin-panel { width: min(380px, 100%); text-align: left; }
.signin-panel h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.signin-panel h3 { margin: .8rem 0 .4rem; }
.help-line { margin-top: .8rem; }
.app-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 1.5rem 1rem 2rem; font-size: .85rem; color: var(--muted); }
.app-foot a { color: var(--muted); }
.app-foot a:hover { color: var(--accent, inherit); }
@media print { .app-foot { display: none; } }
.invite-note { background: var(--accent-soft, #f6e4da); border-radius: 12px; padding: .7rem .9rem; margin: .4rem 0 1rem; }
.invite-note p { margin: .2rem 0; }
.invite-note .code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; }
.btn.signin { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; margin-top: .6rem; font-weight: 600; padding: .7rem 1rem; }
.btn.signin.apple { background: #000; color: #fff; border-color: #000; }
.btn.signin.google { background: #fff; color: #1f1f1f; border-color: #747775; }
@media (prefers-color-scheme: dark) { .btn.signin.apple { background: #fff; color: #000; border-color: #fff; } }
.or { text-align: center; color: var(--muted); margin: .8rem 0 0; font-size: .9rem; }
.acct { margin-left: auto; white-space: nowrap; font-size: .9rem; color: inherit; text-decoration: none; opacity: .85; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { padding: .45rem .4rem; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); text-align: left; vertical-align: middle; }
pre.plain { white-space: pre-wrap; font: inherit; }

/* reviewing a photographed grocery list */
.scan-review { display: grid; gap: .5rem; max-height: 60vh; overflow: auto; min-width: min(30rem, 80vw); }
.scan-row { padding: .35rem .45rem; border-radius: 8px; }
.scan-row .row { flex-wrap: nowrap; }
.scan-row input { flex: 1; min-width: 0; }
.scan-row.flagged { background: color-mix(in srgb, var(--warn) 14%, transparent); outline: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.scan-note { font-size: .8rem; font-weight: 600; color: var(--warn); margin-top: .25rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-family: inherit; }

/* All households: one thin row each, details on click */
.hh-list { margin: .8rem 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.hh-row { display: grid; grid-template-columns: minmax(0, 2fr) 1.3fr .9fr .7fr .7fr 1.1fr 1fr; gap: .8rem; align-items: center; padding: .55rem .9rem; }
.hh-head { border-bottom: 1px solid var(--line); }
.hh + .hh { border-top: 1px solid var(--line); }
a.hh { color: inherit; text-decoration: none; }
a.hh:hover { background: var(--accent-soft); }
.hh-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-yes { color: var(--good); }
.hh-ai-full { color: var(--bad); font-weight: 600; }
.hh-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; margin: 1rem 0 .4rem; }
.hh-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; display: flex; flex-direction: column; }
.hh-stat b { font-size: 1.4rem; }
.hh-ai { display: grid; gap: .3rem; max-width: 34rem; }
.hh-ai-row { display: grid; grid-template-columns: 5.5rem 1fr 3rem; gap: .6rem; align-items: center; }
.hh-ai-row span:last-child { text-align: right; }
.hh-bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.hh-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
@media (max-width: 520px) { .hh-row { grid-template-columns: minmax(0, 1.5fr) 1fr .6fr .65fr .65fr .9fr; gap: .4rem; padding: .5rem .6rem; font-size: .92rem; } .hh-row > :nth-child(6) { display: none; } .hh-head { font-size: .72rem; } .hh-unit { display: none; } }

a.hh-link { color: inherit; text-decoration: none; border-color: var(--accent); }
a.hh-link span { color: var(--accent); }
a.hh-link:hover { background: var(--accent-soft); }
.hh-recipe { display: grid; grid-template-columns: 48px 1fr auto; gap: .8rem; align-items: center; padding: .45rem .9rem; }
.hh-recipe img, .hh-noimg { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--line); display: block; }

/* recipe page: More menu for the less-used actions */
.more-menu { position: relative; display: inline-block; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-list { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 12rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: .3rem; display: flex; flex-direction: column; }
.more-list a, .more-list button { text-align: left; padding: .55rem .8rem; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: none; border-radius: 8px; cursor: pointer; }
.more-list a:hover, .more-list button:hover { background: var(--accent-soft); }
.more-list .danger-text { color: var(--bad); }

.day.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.pill[draggable="true"] { cursor: grab; }
.move-list { max-height: 55vh; overflow: auto; }
.move-to { margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--line); gap: .5rem; flex-wrap: wrap; }
.move-to input[type=date] { width: auto; }
.chip.filter-chip { font-weight: 600; }

/* "Put away what you bought": one row per item with where it goes */
.stock-row { padding: .45rem 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
.stock-row:last-child { border-bottom: 0; }
.stock-row select { flex: none; }
.split-amt { margin-top: .35rem; gap: .35rem; flex-wrap: wrap; }
.start-own .field { margin-top: .2rem; }

/* a new household: starting from scratch */
.scratch { display: grid; gap: 1rem; }
.scratch h2 { margin: 0 0 .3rem; }
.scratch h3 { margin: 0 0 .7rem; }
.scratch-hero { background: var(--accent-soft, #f6e4da); border-color: transparent; }
.scratch-link { margin-top: .8rem; flex-wrap: nowrap; }
.scratch-link input { flex: 1; min-width: 0; }
.scratch-ways { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem 1.2rem; }
.scratch-way { display: flex; gap: .7rem; align-items: flex-start; min-width: 0; }
.scratch-way p { margin: .15rem 0 .25rem; }
.scratch-icon { font-size: 1.35rem; line-height: 1.2; flex: none; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin-top: .7rem; }
.sample { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel); }
.sample:has(input:checked) { border-color: var(--accent); }
.sample .pic { aspect-ratio: 4 / 3; background: var(--accent-soft, #f6e4da) center / cover no-repeat; display: grid; place-items: center; font-size: 2rem; color: var(--muted); }
.sample-body { display: flex; gap: .45rem; align-items: flex-start; padding: .5rem .55rem .6rem; font-size: .9rem; line-height: 1.3; }
.sample-body input { margin-top: .15rem; flex: none; }
.sample-body > span { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.next-steps { position: relative; margin-bottom: 1rem; }
.next-steps h3 { margin: 0 0 .6rem; }
.next-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.next-close { position: absolute; top: .4rem; right: .5rem; border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: .3rem; }
.next-invite { margin: .9rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); }
.next-invite .btn { margin-left: .3rem; }
.starter-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
@media (max-width: 520px) { .scratch-link { flex-wrap: wrap; } .scratch-link .btn { width: 100%; } }
/* intro tips about features: their own calm teal, so they stand apart from the terracotta of the rest of the page */
.next-steps, .scratch-ai, .tip { background: var(--tip-soft); border: 1px solid var(--tip-line); box-shadow: inset 4px 0 0 var(--tip), var(--shadow); }
.next-steps h3, .scratch-ai h3, .tip h3 { color: var(--tip); }
.next-steps .next-close { color: var(--tip); }
.next-steps .btn, .scratch-ai .btn { background: var(--panel); border-color: var(--tip-line); }
.next-steps .btn:hover, .scratch-ai .btn:hover { border-color: var(--tip); }
.next-steps a, .scratch-ai a { color: var(--tip); }
.next-invite { border-top-color: var(--tip-line); }

/* AI features: one look everywhere (✨ in the label, a soft accent tint) */
.btn.ai-btn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ai-btn:hover { border-color: var(--accent); }
.tip h3 { margin: 0 0 .4rem; padding-right: 1.8rem; }

/* Get ready: mise en place + prep timer, on the page */
.prep-panel { position: relative; margin: 1rem 0; background: var(--tip-soft); border: 1px solid var(--tip-line); box-shadow: inset 4px 0 0 var(--tip); }
.summary .prep-panel { margin: 1rem 0 0; }
.prep-panel h3 { margin: 0 0 .6rem; padding-right: 1.8rem; color: var(--tip); }
/* back from cook mode: "Done cooking? Mark as cooked" */
.done-bar { position: relative; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; padding: .55rem 2.4rem .55rem .9rem; border-radius: 10px; background: var(--tip-soft); border: 1px solid var(--tip-line); }
.done-bar .next-close { top: .25rem; }
/* cook mode: every ingredient, any time */
.cook-all { margin: .6rem 0; }
.cook-all > summary { list-style: none; display: inline-flex; }
.cook-all > summary::-webkit-details-marker { display: none; }
.cook-all-list { display: grid; gap: .25rem; margin-top: .6rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); max-height: 40vh; overflow-y: auto; }
.cook-all-head { margin-top: .4rem; font: 700 1rem var(--serif); color: var(--accent); }

/* offline: status in the top bar (offline.js) */
.offline-chip { border: 1px solid var(--line); background: var(--accent-soft); color: var(--ink); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.offline-chip.is-offline { background: var(--panel); border-color: var(--muted); color: var(--muted); }
.offline-chip[hidden] { display: none; }
.g-item .waiting { font-size: .78rem; color: var(--muted); }
@media print { .offline-chip { display: none !important; } }
