:root { --bg:#fafaf7; --card:#fff; --ink:#1b1b1b; --muted:#666; --line:#e4e2dc; --accent:#1f6f4a; --accent-ink:#fff;
        --warn:#b45309; --bad:#b91c1c; --good:#15803d; --chip:#eef2ee; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#141414; --card:#1f1f1f; --ink:#ececec; --muted:#a3a3a3; --line:#333; --accent:#3ea56f; --accent-ink:#0b1f14; --chip:#263229; }
}
* { box-sizing:border-box; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--ink);
       font-size:16px; line-height:1.35; padding-bottom:70px; }
a { color:var(--accent); text-decoration:none; }
/* Header, main and bottom nav share one 720px column so desktop shows a single phone-width app. */
header.top { position:sticky; top:0; background:var(--bg); padding:10px 14px 6px; border-bottom:1px solid var(--line); z-index:5;
             display:flex; align-items:center; gap:10px; max-width:720px; margin:0 auto; }
header.top h1 { font-size:18px; margin:0; flex:1; }
header.top form { margin:0; }
header.top input[type=date] { font-size:14px; padding:4px 6px; border:1px solid var(--line); border-radius:8px; background:var(--card); color:var(--ink); }
main { padding:12px 14px; max-width:720px; margin:0 auto; }
h2 { font-size:15px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); margin:18px 0 8px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:12px; margin-bottom:10px; scroll-margin-top:64px; }   /* #anchors land below the sticky header */
.card.link { display:block; color:inherit; }
.row { display:flex; align-items:center; gap:10px; }
.row .grow { flex:1; min-width:0; }
.title { font-weight:600; }
.sub { color:var(--muted); font-size:14px; }
.price { font-weight:700; font-size:18px; white-space:nowrap; }
.unit { color:var(--muted); font-size:13px; }
.chip { display:inline-block; font-size:12px; padding:2px 8px; border-radius:999px; background:var(--chip); color:var(--ink); margin:2px 4px 0 0; }
.chip.good { background:#dcfce7; color:#14532d; } .chip.bad { background:#fee2e2; color:#7f1d1d; } .chip.warn { background:#fef3c7; color:#78350f; }
.chip.muted { color:var(--muted); }
.fine { color:var(--muted); font-size:12px; font-style:italic; margin-top:4px; }   /* the ad's own fine print, verbatim */
@media (prefers-color-scheme: dark) { .chip.good{background:#14532d;color:#dcfce7} .chip.bad{background:#7f1d1d;color:#fee2e2} .chip.warn{background:#78350f;color:#fef3c7} }
.badge { font-size:12px; font-weight:600; padding:2px 6px; border-radius:6px; background:var(--chip); white-space:nowrap; }
button, .btn { font:inherit; font-size:15px; padding:10px 14px; border-radius:10px; border:1px solid var(--line); background:var(--card); color:var(--ink); cursor:pointer; min-height:44px; }
button.primary, .btn.primary { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:600; }
button.danger { background:var(--bad); color:#fff; border-color:var(--bad); }
button.small { min-height:36px; padding:6px 10px; font-size:14px; }
input[type=number], input[type=text], select, textarea { font:inherit; padding:9px 10px; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--ink); min-height:44px; }
input[type=number] { width:80px; text-align:center; }
form.inline { display:inline-flex; gap:6px; align-items:center; margin:0; }
.stepper { display:inline-flex; align-items:center; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.stepper button { border:0; border-radius:0; min-width:44px; }
.stepper input { border:0; border-radius:0; width:56px; min-height:44px; }
nav.bottom { position:fixed; bottom:0; left:50%; transform:translateX(-50%); width:100%; max-width:720px; background:var(--card);
             border-top:1px solid var(--line); display:flex; z-index:5; }
@media (min-width: 721px) { nav.bottom { border-left:1px solid var(--line); border-right:1px solid var(--line); border-radius:12px 12px 0 0; } }
nav.bottom a { flex:1; text-align:center; padding:10px 4px 12px; font-size:12px; color:var(--muted); }
nav.bottom a.active { color:var(--accent); font-weight:600; }
nav.bottom a span { display:block; font-size:20px; }
.total { font-size:20px; font-weight:700; }
.muted { color:var(--muted); }
.small { font-size:13px; }
.done { opacity:.55; }
.done .title, .done .sub, .done .price, .done .unit { text-decoration:line-through; }   /* not the boxes you can still edit */
details summary { cursor:pointer; color:var(--accent); padding:6px 0; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.err { color:var(--bad); font-weight:600; }
.search { width:100%; margin-bottom:8px; }
label.opt { display:flex; gap:8px; align-items:center; padding:6px 0; }
.hdr-note { font-size:13px; color:var(--muted); margin:0 0 10px; }
select, input[type=text] { max-width:100%; min-width:0; }
label.opt select, label.opt input[type=text] { flex:1; }
button.primary { white-space:nowrap; }
.card form.row > .grow { min-width:0; }
a.chip { text-decoration:underline; text-decoration-style:dotted; }
button.linkbtn { background:none; border:0; padding:0; min-height:0; color:var(--accent); font:inherit; font-size:14px; text-decoration:underline; cursor:pointer; }

/* Store-page plan facets: one tap-sized pill per box plan, the active one filled. */
.facets { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 12px; }
.facets a.chip { margin:0; padding:6px 12px; font-size:13px; line-height:20px; border:1px solid var(--line);
                 text-decoration:none; white-space:nowrap; }
.facets a.chip b { font-weight:600; opacity:.7; }
.facets a.chip[aria-current] { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.facets a.chip[aria-current] b { opacity:.8; }

/* Home header gear: seldom used, so a glyph beside the date picker rather than a nav slot. */
a.gear { font-size:20px; line-height:1; padding:6px 2px; text-decoration:none; }
label.opt.stack { align-items:flex-start; }
label.opt.stack input[type=checkbox] { margin-top:4px; width:20px; height:20px; flex:none; }
.hidden-note { margin:-4px 0 8px; }

/* On-hand page: plain boxes and one Save, pinned above the bottom nav; edited rows are outlined. */
input.qtybox { width:80px; text-align:center; flex:none; }
.savebar { position:sticky; bottom:88px; background:var(--card); border:1px solid var(--line); border-radius:12px;
           padding:8px 8px 8px 12px; margin:10px 0; z-index:4; box-shadow:0 2px 10px rgba(0,0,0,.08); }
form.has-changes .savebar { border-color:var(--accent); }
form.has-changes #dirty { color:var(--accent); font-weight:600; }
.card.dirty { border-color:var(--accent); }
/* The list's Pick items mode and the Shop <store> page use the same bar. */
.savebar button + button { margin-left:6px; }
/* Shop page: the price box takes a decimal keypad; the row wraps on narrow phones instead of clipping. */
.buyrow { flex-wrap:wrap; }
.pricewrap { display:inline-flex; align-items:center; gap:4px; }
input.pricebox { width:88px; text-align:right; flex:none; }
/* A submit button that only exists so Enter saves instead of pressing the first row's ✓ Got it. */
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; padding:0; margin:-1px; min-height:0; }
/* A value put back after a reload that would otherwise have discarded it (see base.html). */
.restored { border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.msg { font-size:14px; }
