:root {
  color-scheme: light;
  --bg: #f7f6f2; --card: #ffffff; --ink: #17181a; --muted: #686b65; --faint: #9a9c95; --line: #e6e4dd; --soft: #f0eee8;
  --accent: #1f6b4a; --accent-ink: #ffffff; --accent-soft: #e4efe8;
  --warn-bg: #fbf0d5; --warn-ink: #6e4d00; --bad-bg: #fbe6e2; --bad-ink: #8c2116;
  --ok-bg: #e4efe8; --ok-ink: #1a5238; --synth: #6a4bb5; --off: #9a520c;
  --shadow: 0 0 0 1px rgb(40 38 30 / 0.04), 0 1px 2px rgb(40 38 30 / 0.04), 0 6px 20px rgb(40 38 30 / 0.05);
  --radius: 18px; --radius-sm: 12px;
  --tabbar: 64px;
}
/* light is the default; dark only when chosen with the header button (stored per device) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121311; --card: #1b1c1a; --ink: #ecebe6; --muted: #9c9f98; --faint: #6c6f69; --line: #2b2d29; --soft: #232522;
  --accent: #5cc493; --accent-ink: #0c1912; --accent-soft: #1a2f24;
  --warn-bg: #352c13; --warn-ink: #edd08a; --bad-bg: #3a1d1a; --bad-ink: #f2a69c;
  --ok-bg: #1a2f24; --ok-ink: #9fdcbc; --synth: #b9a3f0; --off: #eaa765;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}
[data-theme="dark"] .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header and tab bar */
.top { max-width: 560px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 20px 6px; display: flex; align-items: center; justify-content: space-between; }
.theme-btn { display: grid; place-items: center; width: 36px; height: 36px; margin-right: -8px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.theme-btn:hover { background: var(--soft); color: var(--ink); }
.theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .theme-btn .moon, :root:not([data-theme="dark"]) .theme-btn .sun { display: none; }
.logo { font-size: 21px; font-weight: 700; letter-spacing: -0.045em; color: var(--ink); text-decoration: none; }
.logo span { color: var(--accent); }
.tabbar { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 6px 12px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); }
.tabbar a { flex: 0 1 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 500; border-radius: 12px; transition: color .2s; }
.tabbar a.active { color: var(--ink); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--faint); color: var(--bg); font-weight: 600; font-size: 11px; transition: background .2s; }
.tabbar a.active .avatar { background: var(--accent); color: var(--accent-ink); }
.avatar.big { width: 52px; height: 52px; font-size: 20px; flex: none; background: var(--accent); color: var(--accent-ink); }

main { padding-top: 8px; padding-bottom: calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
h1 { font-size: 30px; font-weight: 650; line-height: 1.1; letter-spacing: -0.035em; margin: 18px 0 4px; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 22px; text-wrap: pretty; }
.eyebrow { margin: 22px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.sub { margin: 0 0 14px; font-size: 14px; }
.section-title { margin: 28px 0 10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.flush { padding: 4px 18px; }

/* forms */
label { display: block; margin: 0 0 12px; font-weight: 500; font-size: 14px; }
.card label:not(:first-child):not(.check):not(.opt) { margin-top: 18px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; margin-top: 6px; font: inherit; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0 10px 0 0; accent-color: var(--accent); flex: none; box-shadow: none; }
label.check { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-weight: 400; margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .grow { flex: 1 1 160px; margin-bottom: 0; }
.row > button { margin-bottom: 0; }
.prefix, .suffix { display: flex; align-items: center; gap: 6px; }
.prefix span, .suffix span { color: var(--muted); margin-top: 6px; }
.note { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: var(--radius-sm); padding: 10px 13px; margin: 14px 0 0; }

button { font: inherit; cursor: pointer; border-radius: var(--radius-sm); color: var(--ink); transition: background .15s, transform .1s, opacity .15s; }
button:active:not(:disabled), .file-btn:active { transform: scale(0.98); }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 11px 18px; font-weight: 600; }
.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.primary:disabled { opacity: 0.55; cursor: wait; }
[inert] { opacity: 0.55; }
.big-btn { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }
.ghost { background: var(--card); border: 1px solid var(--line); padding: 10px 14px; font-weight: 500; }
.ghost:hover { background: var(--soft); }
.ghost.full { width: 100%; margin-top: 10px; }
.ghost.danger { color: var(--bad-ink); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-size: inherit; font-weight: 500; border-radius: 0; }
.small { padding: 6px 11px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: inherit; }
.link:hover { color: var(--ink); }
.icon-btn { background: none; border: 0; width: 36px; height: 36px; font-size: 20px; line-height: 1; color: var(--faint); border-radius: 50%; flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }

/* segmented control and toggles */
.seg { display: flex; background: var(--soft); border-radius: var(--radius-sm); padding: 3px; gap: 3px; margin-top: 6px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.toggle { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.toggle[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; border: 1px solid var(--line); background: var(--card); padding: 13px 15px; display: grid; gap: 1px; }
.choice span { color: var(--muted); font-size: 13px; }
.choice[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* setup */
.progress { display: flex; gap: 5px; margin-top: 10px; }
.progress span { flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: background .3s; }
.progress span.on { background: var(--accent); }
.steps-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.steps-nav .primary { min-width: 120px; }
.loc-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding: 11px 13px; background: var(--soft); border-radius: var(--radius-sm); font-size: 14px; }
.loc-status .banner { width: 100%; margin: 4px 0 0; }
.pin { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* shop picker (scan page) */
.store-pick { margin-bottom: 4px; }
.field-label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.store-chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px;
  background: var(--accent-soft); border-radius: var(--radius-sm); }
.store-chosen div { display: grid; gap: 1px; min-width: 0; }
.store-chosen span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-q { display: flex; gap: 8px; }
.store-q input { margin: 0; flex: 1; min-width: 0; }
.store-q .ghost { display: inline-flex; align-items: center; gap: 5px; flex: none; white-space: nowrap; padding: 10px 12px; font-size: 14px; }
.store-q svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#store-msg .banner { margin: 10px 0 0; }
.store-results { list-style: none; margin: 8px 0 0; padding: 0; }
.store-results:empty { display: none; }
.shop-head { font-size: 12px; color: var(--muted); padding: 4px 2px 6px; }
.shop-none { font-size: 14px; color: var(--muted); padding: 8px 2px; }
.shop-opt { width: 100%; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; text-align: left; border: 0;
  background: none; padding: 10px 6px; border-radius: 10px; }
.shop-opt:hover { background: var(--soft); }
.store-results li + li .shop-opt { border-top: 1px solid var(--line); border-radius: 0; }
.shop-name { font-weight: 600; font-size: 15px; }
.shop-where { grid-column: 1; font-size: 13px; color: var(--muted); }
.shop-km { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* list */
.add-item { display: flex; gap: 8px; margin-bottom: 14px; }
.add-item input { margin: 0; font-size: 16px; padding: 13px 15px; background: var(--card); border-color: transparent; box-shadow: var(--shadow); }
.add-item input:focus { border-color: var(--accent); }
.add-item .primary { padding: 0 20px; border-radius: var(--radius-sm); }
.items { list-style: none; margin: 0 0 18px; padding: 4px 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.items:empty { display: none; }
.items li { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 18px; font-size: 16px; }
.items li + li { border-top: 1px solid var(--line); }
.items li .acts { display: flex; gap: 6px; align-items: center; flex: none; }
.items li label.check { margin: 0; flex: 1; }
.items li.done span { color: var(--muted); text-decoration: line-through; }
p.acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 10px 0; }
.confirm { background: var(--bad-ink); color: var(--card); border: 0; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 36px 24px; font-size: 15px; text-wrap: balance; }
.context { display: flex; justify-content: space-between; gap: 12px; margin: 12px 2px 0; font-size: 13px; }
.context a { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context a:hover { color: var(--ink); }
.context .link { flex: none; }

/* plan */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin: 14px 0 14px; }
.back::before { content: "←"; }
.back:hover { color: var(--ink); }
.hero { padding: 24px 20px 20px; }
.big { font-size: 52px; font-weight: 650; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-sub { color: var(--muted); margin-top: 8px; font-size: 15px; }
.budget { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 999px; }
.budget.under { background: var(--ok-bg); color: var(--ok-ink); }
.budget.over { background: var(--warn-bg); color: var(--warn-ink); }
.slider { margin-top: 26px; position: relative; }
.slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 0; padding: 0; border: 0; box-shadow: none; position: relative; z-index: 1; }
.slider input[type=range]:focus { outline: none; box-shadow: none; }
.slider input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line); }
.slider input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 4px solid var(--card); box-shadow: 0 1px 6px rgb(0 0 0 / 0.25); }
.slider input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 4px solid var(--card); box-shadow: 0 1px 6px rgb(0 0 0 / 0.25); }
.slider input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
.ticks { display: flex; justify-content: space-between; padding: 0 10px; margin-top: 2px; }
.ticks span { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.compare-line { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.compare-line:empty { display: none; }
.card.route-card { padding: 8px; }
.map { height: 220px; border-radius: 12px; overflow: hidden; background: var(--soft); margin-bottom: 8px; }
.route { list-style: none; margin: 0; padding: 4px 10px 6px; }
.route li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 7px 0 7px 18px; border-left: 1px dashed var(--faint); margin-left: 11px; position: relative; font-size: 15px; }
.route li.home { color: var(--muted); font-size: 14px; }
.route li .num { position: absolute; left: -12px; top: 7px; }
.route li.home::before { content: ""; position: absolute; left: -4px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; flex: none; }
.route .muted { font-size: 13px; }
.mk { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 12px "Geist", system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.3); }
.home-mk { background: #18191a; color: #fff; }
.route-line { stroke: var(--accent); }
.map-note { margin: -2px 10px 6px; font-size: 12px; color: var(--muted); }
.map-note:empty { display: none; }
.map .leaflet-control-attribution { font-size: 10px; }
.gmaps { margin: 2px 10px 8px; font-size: 14px; }
.gmaps .muted { font-size: 12px; }
.shop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.shop-head h2 { margin: 0; flex: 1; }
.shop-head strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.lines { list-style: none; margin: 0; padding: 0; }
.price-in { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; }
.price-in input { width: 5.5em; padding: 6px 8px; margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pick-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: -8px 0 18px; flex-wrap: wrap; }
.pick-bar .link { margin-right: auto; }
.pill.claim-pill { color: var(--warn-ink); background: var(--warn-bg); }
.pill.house-pill { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.trip-card .sub { margin-bottom: 4px; }
.summary { margin: 0; padding-left: 18px; line-height: 1.6; }
.summary ul { padding-left: 18px; margin: 4px 0 0; }
.lines li { padding: 12px 0; border-top: 1px solid var(--line); }
.lines li:first-child { border-top: 0; }
.line-main { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; }
.price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.price s { font-weight: 400; }
.line-sub { font-size: 13px; margin-top: 1px; }
.new-price select { width: auto; max-width: 100%; margin: 4px 0 0; padding: 4px 6px; font-size: 13px; }
.line-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
details.fine { margin: 18px 2px 0; font-size: 13px; color: var(--muted); }
details.fine p { margin: 8px 0 0; line-height: 1.55; }

/* profile */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 18px 0 22px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 2px 0 0; font-size: 13px; }
.savebar { position: sticky; bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; background: var(--card);
  border-radius: 16px; padding: 10px 10px 10px 16px; box-shadow: 0 8px 30px rgb(0 0 0 / 0.16); }
.savebar span { flex: 1; font-weight: 500; font-size: 14px; }
.discount-row { display: grid; grid-template-columns: 1fr 1fr 88px 36px; gap: 6px; align-items: center; margin-bottom: 8px; }
.discount-row input, .discount-row select { margin: 0; }
@media (max-width: 480px) {
  .discount-row { grid-template-columns: 1fr 88px 36px; }
  .discount-row .d-label { grid-column: 1 / -1; }
}

/* shared */
.banner { border-radius: var(--radius-sm); padding: 11px 14px; margin: 0 0 12px; font-size: 14px; }
.status { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 8px 13px; font-size: 13px; margin: 6px 0 4px; }
.status summary { cursor: pointer; font-weight: 500; }
.status ul { margin: 6px 0 2px; padding-left: 18px; }
.warn { background: var(--warn-bg); color: var(--warn-ink); }
.bad { background: var(--bad-bg); color: var(--bad-ink); }
.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill { display: inline-block; font-size: 12px; line-height: 1.4; border-radius: 6px; padding: 2px 7px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.synth { color: var(--synth); background: color-mix(in srgb, var(--synth) 12%, transparent); }
.pill.stale { color: var(--warn-ink); background: var(--warn-bg); white-space: normal; }
.pill.off { color: var(--off); background: color-mix(in srgb, var(--off) 10%, transparent); }
.pill.ok-pill { color: var(--ok-ink); background: var(--ok-bg); white-space: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 13px; border-radius: 8px; padding: 4px 10px; }
.chip.ok { background: var(--soft); color: var(--ink); }
.chip .hint { font-size: 12px; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td input, td select { margin: 0; padding: 4px 6px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stats div { font-size: 13px; color: var(--muted); } .stats strong { display: block; font-size: 20px; color: var(--ink); }
.small-print { font-size: 13px; color: var(--muted); }
footer { font-size: 12px; color: var(--muted); padding-top: 28px; }
footer p { margin: 0 0 6px; }
footer a { color: inherit; }
.sources summary { cursor: pointer; }
.sources ul { margin: 8px 0 0; padding-left: 16px; line-height: 1.6; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; opacity: .6; }
details[open] > summary::after { transform: translateY(1px) rotate(-135deg); }

/* scan */
.primary.full { width: 100%; margin-top: 10px; }
.file-btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; border-radius: 14px; cursor: pointer; font-size: 16px; padding: 15px; transition: transform .1s, background .15s; }
.file-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.card label.file-btn { margin-top: 14px; margin-bottom: 0; }
.alts { margin-top: 14px; border-top: 1px solid var(--line); }
.alt { border-bottom: 1px solid var(--line); }
.alt:last-child { border-bottom: 0; }
.alt > summary { cursor: pointer; padding: 13px 2px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.alt[open] { padding-bottom: 14px; }
.alt form { margin-top: 2px; }
.alt textarea { margin-top: 0; }
.alt form > button { margin-top: 8px; }
.scanner { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; margin-bottom: 10px; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 10%; right: 10%; top: 32%; bottom: 32%; border: 2px solid #fff; border-radius: 10px; box-shadow: 0 0 0 999px rgb(0 0 0 / 0.4); }
.scanner #scan-stop { position: absolute; right: 10px; bottom: 10px; }
.alt .ghost.full { margin-top: 0; }
.scan-manual { margin-top: 10px; }
.scan-manual input { margin: 0; }
.product { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.product img, .product .noimg { width: 80px; height: 80px; object-fit: contain; border-radius: var(--radius-sm); background: var(--soft); flex: none; }
.product .noimg, .saved .noimg { display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.prices-row .grow { margin-bottom: 0; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.saved li:first-child { border-top: 0; }
.saved img, .saved .noimg { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: var(--soft); flex: none; }
.saved .grow { flex: 1; min-width: 0; }
.saved .grow strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#saved-products > .small-print { margin: 14px 0; }

/* shelf label */
.typed-label { font-size: 14px; }
.pick-list { display: flex; flex-direction: column; margin: 8px 0 4px; }
.pick-list .opt { display: flex; gap: 2px; align-items: flex-start; font-weight: 400; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pick-list .opt:first-child { border-top: 0; }
.pick-list .opt input { margin-top: 2px; }
.pick-list .opt span { display: block; font-size: 14px; }
.pick-list .opt .muted { font-size: 12px; }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.offer-grid label { margin-top: 12px !important; margin-bottom: 0; }
.multibuy { display: flex; align-items: center; gap: 6px; }
.multibuy input { width: 4.5em; }
.multibuy span { color: var(--muted); margin-top: 6px; white-space: nowrap; }
.label-photo { max-height: 160px; border-radius: var(--radius-sm); display: block; margin-bottom: 12px; }
details.offer { margin-top: 16px; font-size: 14px; }
details.offer > summary { cursor: pointer; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
#setup-step .note { margin: 0 0 12px; }
.offer-grid label.check { grid-column: 1 / -1; margin-top: 14px !important; }
button.chip { border: 0; cursor: pointer; }
.join-code { font-family: ui-monospace, monospace; letter-spacing: 0.12em; font-size: 1.1em; color: var(--ink); margin-right: 6px; }

/* Buy again: chips under the add field. A tapped chip keeps its place with a tick until the taps stop. */
.buy-again { margin: -2px 0 18px; }
.buy-again-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.buy-again-head > span:first-child { flex: 1; }
.buy-again-head .linkish { font-size: 13px; }
.buy-again-undo { display: none; font-weight: 400; color: var(--faint); }
.buy-again.busy .buy-again-undo { display: inline; }
.buy-again.busy .buy-again-head .linkish { display: none; }
.buy-again-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.buy-again-chips.open { max-height: 44vh; overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.again { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 38px; padding: 0 13px 0 7px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; color: var(--ink);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: hover) { .again:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); } }
.again-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.again-n { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.again-mark { position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--soft);
  transition: background .15s, transform .15s; }
.again-mark::before, .again-mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.5px;
  border-radius: 1px; background: var(--muted); transform: translate(-50%, -50%); transition: all .18s; }
.again-mark::after { transform: translate(-50%, -50%) rotate(90deg); }
.again.usual { background: var(--accent-soft); border-color: transparent; }
.again.usual .again-mark { background: var(--card); }
.again.usual .again-mark::before, .again.usual .again-mark::after { background: var(--accent); }
/* tapped: the plus turns into a tick */
.buy-again:not(.editing) .again[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.buy-again:not(.editing) .again[aria-pressed=true] .again-n { color: inherit; opacity: .7; }
.buy-again:not(.editing) .again[aria-pressed=true] .again-mark { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); transform: scale(1.08); }
.buy-again:not(.editing) .again[aria-pressed=true] .again-mark::before { width: 5px; background: var(--accent-ink); transform: translate(-80%, 1px) rotate(45deg); }
.buy-again:not(.editing) .again[aria-pressed=true] .again-mark::after { width: 9px; background: var(--accent-ink); transform: translate(-28%, -1px) rotate(-50deg); }
/* edit mode: the plus turns into a cross, tapped ones are struck out */
.editing .again-mark::before { transform: translate(-50%, -50%) rotate(45deg); background: var(--bad-ink); }
.editing .again-mark::after { transform: translate(-50%, -50%) rotate(-45deg); background: var(--bad-ink); }
.editing .again-mark { background: var(--bad-bg); }
.editing .again[aria-pressed=true] { background: var(--soft); border-color: var(--line); color: var(--faint); }
.editing .again[aria-pressed=true] .again-t { text-decoration: line-through; }
.editing .again[aria-pressed=true] .again-mark { opacity: .4; transform: none; }
.buy-again-foot { display: flex; justify-content: space-between; margin: 10px 2px 0; font-size: 13px; }
.items li.pending { opacity: .55; }
/* a ticked household item drains a bar along its row, then moves to Bought */
.items li.ticking { position: relative; overflow: hidden; }
.items li.ticking::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent);
  transform-origin: left; animation: tick-drain 4s linear var(--tick-delay, 0ms) forwards; }
@keyframes tick-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.items li.ticking s { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .items li.ticking::after { display: none; } }
