/* ═══════════════════════════════════════════════════════════════
   TROLLEY TALLY — styles
   Theme tokens live here. Light = receipt paper; dark = late-night
   dairy run. The yellow "special" sticker is the one loud element.
   ═══════════════════════════════════════════════════════════════ */

/* ── Self-hosted fonts (SIL Open Font License — see fonts/OFL-*.txt) ── */
@font-face { font-family: 'Karla'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/karla-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Karla'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/karla-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/spacemono-400-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/spacemono-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/spacemono-700-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/spacemono-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* The hidden attribute must always win over component display rules
   (e.g. .field {display:block}, .breakdown div {display:flex}). */
[hidden] { display: none !important; }

:root {
  --paper: #faf7f0;          /* receipt paper */
  --card: #ffffff;
  --ink: #22201c;            /* printer ink */
  --ink-soft: #6c675e;
  --line: #e4ddd0;           /* dashed separators */
  --green: #1e6b4e;          /* grocer green — buttons, accents */
  --green-ink: #ffffff;
  --sticker: #ffd84d;        /* special-price yellow */
  --sticker-ink: #22201c;
  --danger: #b3402e;
  --warn: #8f5500;           /* budget heads-up amber (4.5:1+ on white and paper) */
  --up-bg: rgba(179, 64, 46, 0.10);
  --down-bg: rgba(30, 107, 78, 0.12);
  --font-ui: "Karla", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
}
[data-theme="dark"] {
  --paper: #15181a;
  --card: #1e2225;
  --ink: #ece8e1;
  --ink-soft: #9b968c;
  --line: #34393d;
  --green: #4caf87;
  --green-ink: #10241c;
  --sticker: #ffd84d;
  --sticker-ink: #22201c;
  --danger: #e07a68;
  --warn: #f0a640;
  --up-bg: rgba(224, 122, 104, 0.16);
  --down-bg: rgba(76, 175, 135, 0.16);
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-ui);
  transition: background 0.25s, color 0.25s;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }

/* Big touch targets everywhere */
button, input, select { font-family: inherit; font-size: 1rem; min-height: 44px; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ── Header ─────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar__brand {
  display: block; font-weight: 700; letter-spacing: 0.02em; font-size: 1.05rem;
}
.listname {
  border: 0; background: none; color: var(--ink-soft);
  font-size: 0.85rem; padding: 0; min-height: 0; text-align: left;
}
.topbar__actions { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 1.1rem;
}

/* ── Add form ───────────────────────────────────────────────── */
.add { margin: 0 12px 10px; padding: 12px; }
.add__mode { margin-bottom: 8px; }
.add__row { display: flex; gap: 8px; }
.add__row--secondary { margin-top: 8px; flex-wrap: wrap; }
.add input[type="text"] {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); padding: 0 12px;
}
#in-price { flex: 0 0 100px; text-align: right; font-weight: 700; }
#in-note { flex: 1 1 140px; }
.add-btn {
  flex: 0 0 auto; padding: 0 22px;
  background: var(--green); color: var(--green-ink);
  border: 0; border-radius: 10px; font-weight: 700; letter-spacing: 0.02em;
}
.add-btn:active { transform: scale(0.97); }

/* Quantity stepper */
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; border: 0; background: var(--paper); color: var(--ink); font-size: 1.2rem; }
.stepper input { width: 48px; text-align: center; border: 0; background: var(--card); color: var(--ink); }

/* Quick-add switch + settings switches */
.switch { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; }
.switch input { width: 22px; height: 22px; min-height: 0; accent-color: var(--green); }
.switch small { color: var(--ink-soft); display: block; }

/* ── Each / By weight switch + kg/g switch (segmented radios) ── */
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg__opt { flex: 1; position: relative; display: flex; }
/* the real radio covers the whole option (big tap target) but is invisible */
.seg__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; min-height: 0; opacity: 0; cursor: pointer; }
.seg__opt span {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 12px; font-weight: 700; color: var(--ink-soft);
}
.seg__opt + .seg__opt span { border-left: 1px solid var(--line); }
.seg__opt input:checked + span { background: var(--green); color: var(--green-ink); }
.seg__opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: -4px; border-radius: 8px; }
.seg--mode { margin-bottom: 10px; }
.seg--unit { flex: 0 0 auto; }
.seg--unit .seg__opt span { min-width: 44px; padding: 0 8px; font-family: var(--font-mono); }

/* ── "By weight" form ───────────────────────────────────────── */
.weigh { display: flex; flex-direction: column; gap: 8px; }
.weigh__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 8px; }
.weigh__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.weigh__label { font-size: 0.82rem; color: var(--ink-soft); }
.weigh__weight { display: flex; gap: 6px; min-width: 0; }
.weigh input.weigh__num, .edit-grid input.weigh__num { flex: 1 1 auto; min-width: 0; width: 100%; text-align: right; font-weight: 700; }
.weigh__calc { margin: 0; min-height: 1.4em; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }
.weigh__calc.is-ready { color: var(--ink); font-family: var(--font-mono); font-weight: 700; }
.weigh__calc.is-error { color: var(--danger); font-weight: 600; }
.weigh__add { min-height: 48px; width: 100%; }
input[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
.edit-grid .e-weigh, .edit-grid .e-calc { flex: 1 1 100%; }

/* ── The receipt (item list) ────────────────────────────────── */
/* Bottom padding = live height of the fixed totals footer (set by app.js),
   so the last row, Share/export and Clear all can always scroll clear of it. */
.receipt { flex: 1; overflow-y: auto; padding: 0 12px calc(var(--totals-h, 180px) + 24px); }
.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 12px; align-items: center;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line);
  animation: slide-in 0.22s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .item { animation: none; }
}
.item__main { border: 0; background: none; text-align: left; padding: 0; min-height: 0; color: inherit; }
.item__name { font-weight: 600; }
.item__meta { color: var(--ink-soft); font-size: 0.82rem; }
.item__weigh { display: block; color: var(--ink-soft); font-size: 0.8rem; margin-top: 2px; }   /* "0.735 kg @ $4.99/kg" */
.item--weighed .item__meta { display: block; }
.item__line { font-weight: 700; font-size: 1rem; text-align: right; }
.item__remove {
  width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: none; color: var(--ink-soft); font-size: 1.1rem;
}
.item__remove:hover { color: var(--danger); }

/* Inline edit row */
.item--editing { grid-template-columns: 1fr; background: var(--card); border-radius: 12px; padding: 12px; border: 1px solid var(--line); }
.edit-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.edit-grid input[type="text"] {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); padding: 0 12px;
}
.edit-grid .e-name { flex: 1 1 100%; }
.edit-grid .e-price { flex: 1; text-align: right; }
.edit-grid .e-note { flex: 1 1 100%; }
.edit-actions { display: flex; gap: 8px; margin-top: 8px; }
.edit-actions .add-btn { flex: 1; }

/* Empty state */
.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; }
.empty__cart { font-size: 3rem; margin: 0 0 6px; }

.receipt__foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 16px 0; }

.ghost-btn {
  background: none; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); padding: 0 16px;
}
.ghost-btn--danger { color: var(--danger); border-color: var(--danger); }

/* ── Sticky totals + the sticker ────────────────────────────── */
.totals {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: linear-gradient(180deg, transparent, var(--paper) 26%);
  padding: 18px 14px calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.totals__breakdown {
  border: 0; background: none; color: var(--ink-soft);
  display: flex; gap: 8px; align-items: center; font-size: 0.9rem; min-height: 32px;
}
.totals__chev { transition: transform 0.2s; }
.totals__breakdown[aria-expanded="true"] .totals__chev { transform: rotate(180deg); }
.breakdown {
  width: min(360px, 100%); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; font-size: 0.92rem;
}
.breakdown div { display: flex; justify-content: space-between; padding: 3px 0; }

/* The signature: a supermarket "special" price sticker */
.sticker {
  display: flex; align-items: baseline; gap: 14px;
  background: var(--sticker); color: var(--sticker-ink);
  border: 2px dashed rgba(34, 32, 28, 0.55);
  border-radius: 16px;
  padding: 10px 26px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transform: rotate(-1.2deg);
  transition: transform 0.15s ease;
}
.sticker.bump { transform: rotate(-1.2deg) scale(1.05); }
.sticker__label { font-weight: 700; letter-spacing: 0.14em; font-size: 0.8rem; }
.sticker__amount { font-weight: 700; font-size: 2rem; line-height: 1; }

/* ── Sheets (saved lists, settings) ─────────────────────────── */
.veil {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 18, 14, 0.45); backdrop-filter: blur(2px);
  display: grid; place-items: end center;
}
.veil[hidden] { display: none; }
.sheet {
  width: min(480px, 100%); max-height: 80dvh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 12px; font-size: 1.15rem; }
.sheet__actions { display: flex; gap: 8px; margin-bottom: 12px; }
.sheet__actions .add-btn { flex: 1; }
.sheet__close { width: 100%; margin-top: 14px; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 4px; }
.field input[type="text"], .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); padding: 0 12px;
}

/* Saved list rows */
.saved { list-style: none; margin: 0; padding: 0; }
.saved li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.saved .saved__meta { font-size: 0.8rem; color: var(--ink-soft); display: block; }
.saved .saved__btns { display: flex; gap: 6px; }
.saved .saved__btns button {
  border: 1px solid var(--line); background: none; color: var(--ink);
  border-radius: 8px; padding: 0 10px; min-height: 38px; font-size: 0.85rem;
}
.hint { color: var(--ink-soft); font-size: 0.9rem; }

/* ── Undo toast ─────────────────────────────────────────────── */
.toast {
  /* v2.2: stays just above the totals footer, which is taller with the budget meter */
  position: fixed; left: 50%; bottom: max(130px, calc(var(--totals-h, 122px) + 8px)); transform: translateX(-50%);
  z-index: 200; display: flex; gap: 14px; align-items: center;
  background: var(--ink); color: var(--paper);
  border-radius: 12px; padding: 10px 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.toast button { background: none; border: 0; color: var(--sticker); font-weight: 700; min-height: 0; }
.toast[hidden] { display: none; }  /* without this, display:flex overrides the hidden attribute */
.toast--update { top: calc(12px + env(safe-area-inset-top)); bottom: auto; width: max-content; max-width: calc(100% - 24px); }

/* ── Legal links (end of the receipt) ───────────────────────── */
.legal-links { text-align: center; font-size: 0.85rem; color: var(--ink-soft); padding: 4px 0 8px; }
.legal-links a { color: var(--ink-soft); display: inline-block; padding: 12px 6px; }
.legal-links a:hover { color: var(--green); }
/* "How to install" is pointless once you're in the installed app */
@media (display-mode: standalone) { .hide-installed { display: none; } }

/* ── Privacy / terms pages ──────────────────────────────────── */
.legal-page { max-width: 680px; margin: 0 auto; padding: 18px 18px calc(40px + env(safe-area-inset-bottom)); line-height: 1.55; }
.legal-page h1 { font-size: 1.5rem; margin: 8px 0 4px; }
.legal-page h2 { font-size: 1.1rem; margin: 24px 0 6px; }
.legal-page a { color: var(--green); }
.legal-page .draft { background: var(--sticker); color: var(--sticker-ink); border: 2px dashed rgba(34,32,28,.55); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.legal-page .back { display: inline-block; padding: 10px 0; min-height: 44px; }

/* ── Budget alerts + price memory (v2.2) ─────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Budget meter on the totals footer: "$112.40 of $150 · $37.60 left" */
.budget {
  width: min(360px, 100%); min-height: 44px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  padding: 6px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 0.88rem; text-align: left;
}
.budget__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.budget__text { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }   /* wraps rather than hiding "left"/"over" */
.budget__nums { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.budget__bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.budget__fill { display: block; height: 100%; width: 0; background: var(--green); border-radius: 3px; transition: width 0.25s ease, background 0.25s; }
.budget--empty { border-style: dashed; color: var(--ink-soft); }
.budget--empty .budget__text { font-weight: 600; }
.budget--warn { border-color: var(--warn); }
.budget--warn .budget__text { color: var(--warn); }
.budget--warn .budget__fill { background: var(--warn); }
.budget--over { border-color: var(--danger); border-width: 2px; }
.budget--over .budget__text { color: var(--danger); }
.budget--over .budget__fill { background: var(--danger); }
.sticker--warn { border-color: var(--warn); border-style: solid; }
.sticker--over { border-color: var(--danger); border-style: solid; box-shadow: 0 0 0 3px var(--danger), 0 6px 18px rgba(0, 0, 0, 0.18); }
@media (prefers-reduced-motion: reduce) { .budget__fill { transition: none; } }

/* Budget sheet */
.budget-in { font-size: 1.3rem; font-weight: 700; text-align: right; }
.budget-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.budget-chip {
  min-height: 48px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-weight: 700;
}
.budget-chip[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.budget-msg { margin: 8px 0 0; min-height: 1.3em; color: var(--danger); font-weight: 600; font-size: 0.9rem; }
.budget-save { width: 100%; min-height: 48px; margin-top: 6px; }
.budget-remove { width: 100%; margin-top: 8px; }

/* Budget heads-up toast: sits just above the totals footer (and above Undo if both show) */
.toast--budget {
  bottom: calc(var(--totals-h, 180px) + 8px);
  width: max-content; max-width: min(440px, calc(100% - 24px));
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-left: 6px solid var(--warn);
  font-size: 0.95rem; line-height: 1.35;
}
.toast--budget.is-over { border-left-color: var(--danger); }
.toast--budget button { color: var(--green); min-height: 44px; min-width: 44px; padding: 0 6px; }
#toast:not([hidden]) ~ .toast--budget { bottom: calc(var(--totals-h, 180px) + 70px); }

/* Price suggestions under the name box */
.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.suggest__chip {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 44px; max-width: 100%; padding: 4px 14px; line-height: 1.2; text-align: left;
  border: 1px solid var(--line); border-radius: 22px; background: var(--paper); color: var(--ink);
}
.suggest__chip strong { font-family: var(--font-mono); font-size: 0.9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest__chip small { color: var(--ink-soft); font-size: 0.75rem; }
.suggest__chip--exact { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.weigh .suggest { margin-top: 0; }

/* "▲ 40c since 12 Sep" badge on a list item */
.item__change {
  display: block; width: fit-content; margin-top: 4px; padding: 1px 8px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
}
.item__change--up { color: var(--danger); background: var(--up-bg); }
.item__change--down { color: var(--green); background: var(--down-bg); }

/* Budget + price memory section of Settings */
.plus-settings { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 4px; }
.sheet__sub { font-size: 1rem; margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.wide-btn { width: 100%; text-align: left; }
.plus-settings .sheet__actions .ghost-btn { flex: 1; }
.ghost-btn:disabled { opacity: 0.45; cursor: default; }
.pm-list { list-style: none; margin: 0; padding: 0; }
.pm-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pm-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pm-name { overflow-wrap: anywhere; }
.pm-hist { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.pm-forget {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--line); background: none; color: var(--ink-soft);
}
.pm-clear { width: 100%; margin-top: 14px; }

/* ── Wider screens ──────────────────────────────────────────── */
@media (min-width: 700px) {
  .add, .receipt { max-width: 640px; margin-left: auto; margin-right: auto; }
  .receipt { padding-bottom: calc(var(--totals-h, 200px) + 24px); }
  .topbar { max-width: 668px; margin: 0 auto; width: 100%; }
  .veil { place-items: center; }
  .sheet { border-radius: 18px; }
}

/* v2.4.0: feedback link in Settings */
a.feedback-link { display: flex; align-items: center; min-height: 48px; text-decoration: none; margin-bottom: 4px; }
.switch small a { color: inherit; }

/* ── v2.5.0: feedback reply notice + reply view ─────────────── */
.toast--reply { top: calc(12px + env(safe-area-inset-top)); bottom: auto; width: max-content; max-width: calc(100% - 24px);
  border: 0; font: inherit; font-weight: 600; cursor: pointer; min-height: 48px; }
.toast--reply b { color: var(--sticker); }
.replies { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 14px; max-height: 60vh; overflow: auto; }
.reply__mine, .reply__aaron { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.reply__aaron { margin-top: 8px; border-color: var(--green); }
.reply small { color: var(--ink-soft); }
.reply p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── v2.6: Best Deal (stores, compare, split, savings, Chef mode) ── */
.store-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.store-btn { flex: 1; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--green);
  background: var(--paper); color: var(--ink); font: inherit; font-weight: 700; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-btn--empty { border-style: dashed; color: var(--ink-soft); font-weight: 600; }
.store-compare { flex: 0 0 auto; min-height: 44px; }
.store-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.store-chip-wrap { display: inline-flex; }
.store-chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; }
.store-chip[aria-pressed="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); font-weight: 700; }
.store-chip-wrap .store-chip:not(:last-child) { border-radius: 22px 0 0 22px; }
.store-chip__x { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-left: 0; border-radius: 0 22px 22px 0; background: none; color: var(--ink-soft); }
.store-custom { display: flex; gap: 8px; margin-bottom: 8px; }
.store-custom input { flex: 1; min-width: 0; }
.item__deal { display: block; width: fit-content; margin-top: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; color: var(--green-ink); background: var(--green); }
.item__deal--best { color: var(--green); background: var(--down-bg); }
.item__chef { display: block; margin-top: 3px; font-size: 0.76rem; color: var(--ink-soft); }
.chef-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chef-row input { width: 70px; text-align: center; }
.chef-row small { color: var(--ink-soft); }
.row-saved { color: var(--green); font-weight: 700; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; min-height: 32px; }
.finish-btn { flex: 1; }
#cmp-search { width: 100%; margin-bottom: 8px; }
.cmp-list { list-style: none; margin: 0; padding: 0; max-height: 58vh; overflow: auto; }
.cmp { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cmp__name { overflow-wrap: anywhere; }
.cmp__stores { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.cmp__row { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 4px 8px; border-radius: 8px; }
.cmp__row small { grid-column: 1 / -1; color: var(--ink-soft); font-size: 0.74rem; }
.cmp__row--best { background: var(--down-bg); color: var(--green); font-weight: 700; }
.cmp__row--old { opacity: 0.6; }
.split__summary { font-weight: 700; color: var(--green); }
.split__group { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.split__store { display: flex; justify-content: space-between; margin: 0 0 6px; font-size: 1rem; }
.split__items { list-style: none; margin: 0; padding: 0; }
.split__items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 0.9rem; }
.done { position: relative; overflow: hidden; text-align: center; }
.done__banner { display: grid; gap: 4px; margin: 12px 0; padding: 14px; border-radius: 14px; background: var(--green); color: var(--green-ink); }
.done__banner strong { font-size: 1.15rem; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; animation: tt-fall 1.6s ease-in forwards; }
@keyframes tt-fall { to { transform: translate(var(--dx, 0), 340px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ══ v2.7.0 TrolleyTally Pro ══ */
.primary-btn { background: var(--green); color: var(--green-ink); border: 0; border-radius: 10px; font: inherit; font-weight: 700;
  min-height: 46px; padding: 0 16px; cursor: pointer; text-align: center !important; margin-top: 8px; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: .6; }
.pro-badge { display: inline-block; margin-top: 2px; padding: 2px 9px; border-radius: 999px; background: var(--sticker); color: var(--sticker-ink);
  font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pro-lock { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 7px; vertical-align: middle; }
.is-pro .pro-lock { display: none; }
.store-compare .pro-lock { border: 0; background: none; padding: 0; margin-left: 2px; }
.pro-card { border: 1px dashed var(--green); border-radius: 12px; padding: 12px 14px; margin: 6px 0 4px; background: var(--down-bg); }
.pro-card--on { border: 1px solid var(--line); background: none; }
.pro-card__title { margin: 0 0 4px; font-weight: 700; }
.pro-card .ghost-btn { margin-top: 6px; text-align: center; }
.pro-card .sheet__actions a { text-decoration: none; color: inherit; }
.pro-kicker { margin: 0; color: var(--green); font-weight: 700; font-size: 14px; }
.pro-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 6px; }
.pro-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.pro-plan { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 2px solid var(--line);
  border-radius: 12px; cursor: pointer; text-align: center; }
.pro-plan input { position: absolute; opacity: 0; pointer-events: none; }
.pro-plan:has(input:checked) { border-color: var(--green); background: var(--down-bg); }
.pro-plan__price { font-size: 20px; font-weight: 700; }
.pro-plan__per { font-size: 13px; color: var(--ink-soft); }
.pro-plan__note { font-size: 12px; font-weight: 700; background: var(--sticker); color: var(--sticker-ink); border-radius: 999px; padding: 1px 8px; margin-top: 2px; }
.pro-plan__note:empty { display: none; }
.pro-soon { margin: 12px 0 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 216, 77, 0.22); font-size: 14px; }
#pro-interest input[type=email] { width: 100%; }
.pro-code { margin: 14px 0 4px; }
.pro-code summary { cursor: pointer; color: var(--ink-soft); font-size: 14px; }
.pro-code form { display: flex; gap: 8px; margin-top: 8px; }
.pro-code input { flex: 1; text-transform: uppercase; }
/* v2.7.1-preview: "Have a code?" */
.pro-codeform { margin: 14px 0 4px; }
.pro-codeform__label { display: block; font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.pro-codeform__row { display: flex; gap: 8px; }
.pro-codeform__row input { flex: 1; min-width: 0; text-transform: uppercase; }
.pro-codeform__row .ghost-btn { margin: 0; }
.pro-codemsg { margin: 8px 0 0; font-size: 14px; color: var(--ink-soft); }
.pro-codemsg--ok { padding: 10px 12px; border-radius: 10px; background: var(--down-bg); color: var(--green); font-weight: 700; }
.pro-codemsg--warn { color: var(--danger); }

/* ══ v2.8.0 Barcode scanner ══ */
.bc-btn { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 52px; padding: 2px 8px;
  background: var(--card); color: var(--green); border: 1px solid var(--green); border-radius: 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.bc-btn__icon { font-size: 20px; line-height: 1; transform: scaleX(1.3); }
.bc-btn:active { transform: scale(0.96); }
.bc-info { position: relative; margin-top: 8px; padding: 8px 34px 8px 12px; border-radius: 10px; background: var(--down-bg); font-size: 14px; }
.bc-info p { margin: 2px 0; }
.bc-info__code { font-size: 12px; color: var(--ink-soft); }
.bc-info__src { color: var(--ink-soft); }
.bc-info__src--warn { color: var(--warn); }
.bc-info__last { font-weight: 700; }
.bc-info__best { font-weight: 700; color: var(--green); }
.bc-info__lock { display: block; margin-top: 0; background: none; border: 0; padding: 4px 0; font: inherit; color: var(--ink-soft); cursor: pointer; }
.bc-info__x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; background: none; border: 0; color: var(--ink-soft); font-size: 15px; cursor: pointer; }
.bc { width: 100%; max-width: 560px; margin: auto auto 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
.bc__cam { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 56vh; background: #000; border-radius: 12px; overflow: hidden; }
.bc__cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.bc__guide { position: absolute; left: 10%; right: 10%; top: 32%; bottom: 32%; border: 3px solid var(--sticker); border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.bc__guide::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #e4572e; animation: bc-line 1.6s ease-in-out infinite alternate; }
@keyframes bc-line { from { transform: translateY(-30px); } to { transform: translateY(30px); } }
@media (prefers-reduced-motion: reduce) { .bc__guide::after { animation: none; } }
.bc__torch { position: absolute; right: 10px; top: 10px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); font-size: 20px; cursor: pointer; }
.bc__torch[aria-pressed="true"] { background: var(--sticker); }
.bc__msg { margin: 10px 2px 4px; font-weight: 600; }
.bc__msg--warn { color: var(--danger); font-weight: 600; }
.bc__manual { margin-top: 8px; }
.bc__manual label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.bc-btn { position: relative; }
.bc-btn__lock { position: absolute; top: -7px; right: -7px; font-size: 11px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 0 3px; line-height: 16px; }
.is-pro .bc-btn__lock { display: none; }

/* ══ v2.9.0 Your shops + Spending trends ══ */
.shops { margin: 10px 0 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.shops__title { margin: 0 0 8px; font-size: 1rem; }
.shops__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shops__stat { background: var(--paper); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.shops__stat b { font-size: 1.05rem; }
.shops__stat span { font-size: 0.8rem; color: var(--ink-soft); }
.shops__stat small { font-size: 0.75rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shops__note { margin: 8px 0 0; font-size: 0.8rem; }
.tr { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.tr__locked { display: block; width: 100%; text-align: left; background: var(--down-bg); border: 1px dashed var(--green); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 0.9rem; color: var(--ink); cursor: pointer; }
.tr__tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.tr__tab { flex: 1; min-height: 36px; border: 1px solid var(--line); background: none; border-radius: 8px; font: inherit; font-size: 0.85rem; color: var(--ink); cursor: pointer; }
.tr__tab--on { background: var(--green); color: var(--green-ink); border-color: var(--green); font-weight: 700; }
.tr__row { display: grid; grid-template-columns: 88px 1fr 64px; align-items: center; gap: 8px; margin: 5px 0; font-size: 0.85rem; }
.tr__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.tr__bar { height: 14px; background: var(--paper); border-radius: 7px; overflow: hidden; }
.tr__bar i { display: block; height: 100%; background: var(--green); border-radius: 7px; }
.tr__val { text-align: right; font-weight: 700; }
.saved li { flex-wrap: wrap; }
.saved__peek { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; font: inherit; color: inherit; cursor: pointer; }
.saved__peek .saved__name::after { content: " ▸"; color: var(--ink-soft); font-weight: 400; }
.saved--open .saved__peek .saved__name::after { content: " ▾"; }
.saved__items { flex-basis: 100%; background: var(--paper); border-radius: 10px; padding: 8px 12px; }
.saved__items ul { list-style: none; margin: 0; padding: 0; }
.saved__items li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0 !important; border: 0 !important; font-size: 0.88rem; }
.saved__items small { color: var(--ink-soft); }
.saved__date { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.saved__date input { flex: 0 1 170px; }
/* v2.11.0: paid Pro ended note + manage link */
.pro-manage-row { margin: 10px 0 0; }
.pro-ended { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--card, #fff); border-radius: 14px; padding: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: 520px; margin: 0 auto; }
.pro-ended__title { margin: 0 0 6px; font-weight: 700; }
.pro-ended__text { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.pro-ended__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── v2.12: aisle-sorted list ───────────────────────────────────── */
.aisle-bar { padding: 6px 16px 2px; display: flex; flex-direction: column; gap: 8px; }
.aisle-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; min-height: 40px; }
.aisle-toggle input { width: 20px; height: 20px; accent-color: var(--green); }
.aisle-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.aisle-tools[hidden] { display: none; }
.aisle-tools select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 0 10px; font: inherit; }
.aisle-shop-btn { min-height: 40px; padding: 0 14px; }
.aisle-untick { display: none; }
.shop-mode .aisle-untick { display: inline; }
.aisle-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 4px 4px;
  font-weight: 700; font-size: 0.95rem; color: var(--green); border-bottom: 2px solid var(--line); }
.aisle-head__count { color: var(--ink-soft); font-size: 0.8rem; font-weight: 400; }
.item--aisle { grid-template-columns: 1fr auto auto auto; }
.item--aisle.item--shop { grid-template-columns: auto 1fr auto auto auto; }
.aisle-chip { border: 1px solid var(--line); background: none; color: var(--ink-soft); border-radius: 999px;
  font-size: 0.72rem; padding: 2px 8px; min-height: 32px; white-space: nowrap; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; }
.shop-tick { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--green); background: none;
  color: #fff; font-size: 1.3rem; font-weight: 700; display: grid; place-items: center; padding: 0; }
.item--got .shop-tick { background: var(--green); }
.item--got .item__name, .item--got .item__line { text-decoration: line-through; opacity: 0.55; }
.shop-mode .item { padding: 12px 4px; }
.shop-mode .item__name { font-size: 1.08rem; }
.shop-mode .item--aisle .aisle-chip { display: none; }
.shop-mode .item--aisle.item--shop { grid-template-columns: auto 1fr auto auto; }
.aisle-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.aisle-pick { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); text-align: left; padding: 0 10px; font: inherit; }
.aisle-pick--on { border-color: var(--green); outline: 2px solid var(--green); font-weight: 700; }
.aisle-order { list-style: none; padding: 0; margin: 10px 0; max-height: 55vh; overflow-y: auto; }
.aisle-row { display: grid; grid-template-columns: 1fr 44px 44px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.aisle-row__btn { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 1rem; touch-action: manipulation; }
.aisle-row__btn:disabled { opacity: 0.3; }
/* v2.13: "Shopping at" is the first thing you see */
.store-bar { flex-wrap: wrap; }
.store-bar .store-btn { flex: 1 1 100%; white-space: normal; text-align: left; font-size: 1rem; }
.store-bar .store-compare { flex: 1 1 100%; }

/* v2.13.2: Pro free for everyone until January */
.pro-free-note { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--sticker); color: var(--sticker-ink); font-weight: 700; font-size: .92rem; }
.pro-free-note[hidden] { display: none; }
.pro-free .pro-welcome-link { display: none; }

/* v2.13.3: festive Pro badges ("🎁 free till Jan"), only while the free offer runs (html.pro-free) */
.pro-gift { display: none; align-items: center; gap: 3px; vertical-align: middle; margin-left: 6px; padding: 1px 7px 1px 5px;
  border-radius: 999px; font-size: 11px; line-height: 17px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  color: #fff; font-family: inherit; text-transform: none; flex: 0 0 auto; }
.pro-free .pro-gift { display: inline-flex; }
.pro-gift--box { padding: 1px 4px; }
.pro-gift__txt { font-size: 10.5px; }
.pro-gift--red { background: #c62f3a; }
.pro-gift--green { background: #1f7a4d; }
.pro-gift--gold { background: #f2c230; color: #3b2a00; }
.pro-gift--teal { background: #11807d; }
.bc-btn__gift { position: absolute; top: -8px; right: -8px; margin: 0; font-size: 10px; line-height: 15px; padding: 0 3px;
  box-shadow: 0 0 0 2px var(--card); }
.item__deal .pro-gift { margin-left: 5px; font-size: 9.5px; line-height: 14px; padding: 0 3px; }
.saved__btns .pro-gift { margin-left: 4px; font-size: 9.5px; line-height: 14px; padding: 0 3px; }
.sheet__sub .pro-gift { font-size: 11px; }
.weigh__label .pro-gift, .chef-row label .pro-gift { margin-left: 2px; }

/* ══ v2.14.1: Best Buy (packs.js) — which pack is better value; free for everyone, always ══ */
.pk-open { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 10px; font-weight: 700; text-align: left; }
.pk-open small { font-weight: 400; color: var(--ink-soft); }
.pk .hint { margin-top: 0; }
.pk-pack { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 8px; margin: 10px 0; background: var(--paper); transition: border-color .15s, box-shadow .15s; }
.pk-pack.is-best { border-color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; }
.pk-pack.is-tie { border-color: var(--green); }
.pk-pack__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 28px; }
.pk-pack__name { font-weight: 700; }
.pk-pack__per { margin-left: auto; font-size: .92rem; font-weight: 700; color: var(--ink-soft); }
.pk-pack.is-best .pk-pack__per { color: var(--green); }
.pk-pack.is-best .pk-star { display: inline-block; margin-right: .08em; filter: drop-shadow(0 0 2px #f2c230) drop-shadow(0 1px 0 #c99214); }
.pk-pack__del { border: 0; background: none; color: var(--ink-soft); font-size: 1rem; min-width: 36px; min-height: 36px; padding: 0; }
.pk-pack__row { display: flex; gap: 8px; }
.pk-field { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pk-field__lab { font-size: .78rem; color: var(--ink-soft); }
.pk-field input { width: 100%; min-height: 52px; font-size: 1.3rem; font-weight: 700; text-align: right; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); padding: 0 12px; }
.pk-units { margin-top: 8px; }
.pk-units .seg__opt span { min-height: 42px; padding: 0 4px; }
.pk-pack__err { margin: 4px 0 0; min-height: 0; font-size: .82rem; color: var(--danger); }
.pk-pack__err:empty { display: none; }
.pk-addbtn { text-align: center; min-height: 46px; border-style: dashed; }
.pk-addbtn[hidden] { display: none; }
.pk-result { margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line); }
.pk-result p { margin: 0; }
.pk-result__title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.pk-result__sub { margin-top: 4px !important; font-size: .92rem; color: var(--ink-soft); line-height: 1.4; }
.pk-result.is-win { border: 2px solid var(--green); background: color-mix(in srgb, #f2c230 14%, color-mix(in srgb, var(--green) 8%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #f2c230 50%, transparent); }
.pk-result.is-win .pk-result__sub { color: var(--ink); }
.pk-result.is-win .pk-star { display: inline-block; margin-right: .12em; filter: drop-shadow(0 0 2px #f2c230) drop-shadow(0 1px 0 #c99214); }
.pk-result.is-tie { border-style: solid; }
.pk-result.is-warn { border: 1px solid var(--sticker); background: color-mix(in srgb, var(--sticker) 18%, transparent); }
.pk-result.is-warn .pk-result__sub { color: var(--ink); }
.pk-actions { display: flex; gap: 8px; margin-top: 12px; }
.pk-actions .ghost-btn { flex: 1; min-height: 46px; }
.pk-foot { font-size: .8rem; margin-bottom: 0; }
.pk .seg__opt { flex: 1; }
.done__banner .pro-gift { align-self: center; width: fit-content; margin: 4px auto 0; }
