/* Headings only; body text stays in the system font. Self-hosted, so the
   app makes no request to a font service. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/vendor/bricolage-grotesque-5.2.8-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* Light and dark follow the browser. --soft fills small controls,
   --inv/--on-inv are the inverted surfaces (toast, "all done" card),
   --cat-N-* the colours handed to categories in their list order. */
:root {
  --bg: #f3f5ef;
  --surface: #ffffff;
  --soft: #f0f3ee;
  --text: #142019;
  --muted: #56635a;
  --faint: #647068;
  --line: #e3e8e1;
  --chipline: #dce3da;
  --accent: #1e7a4c;
  --accent-text: #ffffff;
  --accent-soft: #ddefe3;
  --accent-strong: #17603c;
  --inv: #142019;
  --on-inv: #ffffff;
  --on-inv-muted: #c3d1c7;
  --on-inv-accent: #7ee0a6;
  --toast-action: #ffc53d;
  --pop: #ffc53d;
  --track: #e2e8e0;
  --check-line: #86938a;
  --done-bg: #fafbf8;
  --fresh: #fff1c2;
  --warn: #8a5200;
  --warn-soft: #fff3dc;
  --danger: #c8372d;
  --swipe-ok: #1e7a4c;
  --swipe-del: #c8372d;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(20, 32, 25, .14);
  --shadow-soft: 0 1px 2px rgba(20, 32, 25, .06), 0 8px 22px -16px rgba(20, 32, 25, .25);
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.3, 1.6, .5, 1);
  --cat-0-bg: #e2f2d6; --cat-0-fg: #2f6b1f;
  --cat-1-bg: #fbe7cf; --cat-1-fg: #8f4e13;
  --cat-2-bg: #dceafb; --cat-2-fg: #205ea6;
  --cat-3-bg: #efe3fa; --cat-3-fg: #7139a3;
  --cat-4-bg: #fadce5; --cat-4-fg: #a82d57;
  --cat-5-bg: #d6f1ee; --cat-5-fg: #17675f;
  --cat-none-bg: #eceee9; --cat-none-fg: #56635a;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411;
    --surface: #182019;
    --soft: #222b25;
    --text: #e8eee9;
    --muted: #9caaa1;
    --faint: #85928a;
    --line: #232c26;
    --chipline: #2c3630;
    --accent: #4cc282;
    --accent-text: #07140c;
    --accent-soft: #1c3326;
    --accent-strong: #7ee0a6;
    --inv: #e8eee9;
    --on-inv: #0f1411;
    --on-inv-muted: #46524a;
    --on-inv-accent: #17603c;
    --toast-action: #17603c;
    --track: #26302a;
    --check-line: #627168;
    --done-bg: #141b16;
    --fresh: #3a3417;
    --warn: #f0b860;
    --warn-soft: #3a2e17;
    --danger: #ef6a62;
    --swipe-ok: #1e7a4c;
    --swipe-del: #c8372d;
    --shadow: 0 6px 24px rgba(0, 0, 0, .55);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px -16px rgba(0, 0, 0, .7);
    --cat-0-bg: #22361a; --cat-0-fg: #9bdb7a;
    --cat-1-bg: #3a2a16; --cat-1-fg: #f2b97a;
    --cat-2-bg: #17293f; --cat-2-fg: #8cbcff;
    --cat-3-bg: #2d2140; --cat-3-fg: #cba8ff;
    --cat-4-bg: #3a1a26; --cat-4-fg: #ff9cbb;
    --cat-5-bg: #143330; --cat-5-fg: #7fd9cf;
    --cat-none-bg: #222b25; --cat-none-fg: #9caaa1;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.row button > .i:not(:only-child) { width: 18px; height: 18px; }

button, input, select { font: inherit; color: inherit; }

button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 44px;
  transition: transform .2s var(--ease-spring), background-color .2s, border-color .2s;
}

button:active:not(:disabled) { transform: scale(.96); }

button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); }
button.danger-fill { background: var(--danger); color: var(--surface); border-color: var(--danger); }
button:disabled { opacity: .5; }

input[type="text"], input[type="search"], input[type="password"], input[type="number"], select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--chipline);
  border-radius: 12px;
  background: var(--surface);
}

textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1.5px solid var(--chipline);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  resize: vertical;
}

textarea:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  background: var(--bg);
}

.topbar .title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; font-size: 1.4rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar #btn-back { margin-left: -10px; }

.cat-pick:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.list-switch { display: inline-flex; align-items: center; gap: 4px; min-width: 0; min-height: 44px; padding: 0 4px 0 0; border: 0; background: transparent;
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -.025em; }
.list-switch > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-switch .i { width: 20px; height: 20px; color: var(--muted); transition: transform .3s var(--ease-spring); }
.list-switch[aria-expanded="true"] .i { transform: rotate(180deg); }
.list-switch:active:not(:disabled) { transform: scale(.97); }
.actions { display: flex; gap: 6px; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; padding: 0; background: transparent; border-color: transparent; }
a.icon-btn { height: 44px; border-radius: 10px; color: inherit; }

.banner { margin: 10px 16px 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }

/* Head of the list: connection, what is left and its estimate, and a
   ring that fills as items go into the cart. */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 14px; }
.list-head-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); padding: 4px 10px 4px 8px; border-radius: 999px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: live-pulse 1.8s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.summary { margin: 0; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.summary b { color: var(--text); font-weight: 700; }

@property --ring { syntax: "<number>"; inherits: false; initial-value: 0; }
.ring { position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--ring) * 1%), var(--track) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  transition: --ring .8s var(--ease-out); }
.ring-wrap { position: relative; flex: none; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }

.add-form { display: grid; grid-template-columns: 1fr 46px 46px; gap: 6px; margin-bottom: 8px; }
.add-form input { min-height: 46px; border-radius: 15px; border-color: transparent; box-shadow: var(--shadow-soft); transition: border-color .2s, box-shadow .2s; }
.add-form input:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }

/* Category for new articles: a tag button with the native select over it,
   green while a category other than "none" is chosen. */
.cat-pick { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 46px; border: 1.5px solid var(--chipline); border-radius: 15px; background: var(--surface); color: var(--muted); }
.cat-pick.on { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.cat-pick select { position: absolute; inset: 0; width: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.add-form > button { padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 15px; }
.add-form > button.primary { background: var(--inv); border-color: var(--inv); color: var(--on-inv); }
.add-form > button.primary:active { transform: scale(.88) rotate(90deg); }

.suggest { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; max-height: 50vh; box-shadow: var(--shadow-soft); }
.suggest li + li { border-top: 1px solid var(--line); }
.suggest-item { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: transparent; padding: 8px 12px; }
.unnamed .item-name { font-style: italic; color: var(--muted); }

.switch { display: flex; align-items: center; gap: 8px; width: fit-content; font-size: .85rem; color: var(--muted); min-height: 36px; margin: -2px 0 10px 2px; }

.swipe-hint { display: flex; align-items: center; gap: 7px; margin: 4px 2px 0; font-size: .8rem; color: var(--muted); }
.swipe-hint .i { width: 16px; height: 16px; color: var(--accent); }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.choices label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: .95rem; }
.choices input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

/* A category: its heading carries a small tile in the colour the
   category gets by its position in the list order. */
.group { margin-top: 16px; }
.group h2 { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; color: var(--text); margin: 0 0 6px 2px; }
.group h2 .count { color: var(--muted); font-weight: 600; }
.cat-tile { flex: none; width: 24px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; background: var(--cat-none-bg); color: var(--cat-none-fg); }
.cat-0 { background: var(--cat-0-bg); color: var(--cat-0-fg); }
.cat-1 { background: var(--cat-1-bg); color: var(--cat-1-fg); }
.cat-2 { background: var(--cat-2-bg); color: var(--cat-2-fg); }
.cat-3 { background: var(--cat-3-bg); color: var(--cat-3-fg); }
.cat-4 { background: var(--cat-4-bg); color: var(--cat-4-fg); }
.cat-5 { background: var(--cat-5-bg); color: var(--cat-5-fg); }

.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }

/* A list row. The grid around it lets the row close its gap smoothly
   (1fr to 0fr) when it leaves for the cart or is deleted. */
.item { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .42s cubic-bezier(.4, 0, .2, 1), opacity .38s ease; }
.item-inner { position: relative; overflow: hidden; min-height: 0; }
.item + .item .item-row { box-shadow: inset 0 1px 0 var(--line); }
.item.leave { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.item.gone { grid-template-rows: 0fr; pointer-events: none; transition: grid-template-rows .34s .16s cubic-bezier(.4, 0, .2, 1); }
.item-row { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; min-height: 56px; background: var(--surface); touch-action: pan-y; -webkit-user-select: none; user-select: none;
  transition: transform .42s var(--ease-out), background-color .3s; }
.item-row.dragging { transition: none; }
.item.gone .item-row { transition: transform .34s cubic-bezier(.4, 0, .7, 1); transform: translateX(-105%); }
.item.leave .item-row { transition: transform .45s cubic-bezier(.4, 0, .2, 1); transform: translateX(56px); }
.item.checking, .item.restoring { pointer-events: none; }

/* Behind a swiped row: green with a check to the right, red with a bin to
   the left; its opacity grows with the distance and fades on release. */
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; opacity: 0; transition: opacity .4s ease; }
.swipe-bg.live { transition: none; }
.item[data-swipe="right"] .swipe-bg { background: var(--swipe-ok); color: #fff; }
.item[data-swipe="left"] .swipe-bg { background: var(--swipe-del); color: #fff; }
.item[data-swipe="right"] .swipe-bg .i:last-child, .item[data-swipe="left"] .swipe-bg .i:first-child { visibility: hidden; }
.swipe-bg .i { width: 24px; height: 24px; stroke-width: 2.5; opacity: .55; transform: scale(.85); transition: transform .3s var(--ease-spring), opacity .2s; }
.item.armed .swipe-bg .i { opacity: 1; transform: scale(1.25); }

/* Round check: pops when tapped while its tick draws itself. */
.check { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; padding: 0; color: var(--accent-text); }
.check span { width: 25px; height: 25px; border: 2px solid var(--check-line); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background-color .2s, border-color .2s; }
.check .i { width: 14px; height: 14px; stroke-width: 3.4; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .12s ease-out; }
.item.checking .check span { background: var(--accent); border-color: var(--accent); animation: pop .5s var(--ease-spring); }
.item.checking .check .i { stroke-dashoffset: 0; }
@keyframes pop { 0% { transform: scale(.55); } 55% { transform: scale(1.22); } 100% { transform: scale(1); } }

.item-main { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 4px 0; min-height: 44px; }
.item-main:active:not(:disabled) { transform: none; }
.item-name { display: block; overflow-wrap: anywhere; }
.item .item-name { font-weight: 600; font-size: .97rem; }
/* The strike is a background line on the inline text, so it is drawn
   across every line of a long name at once. */
.strike { background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-size .35s ease-out, color .3s; }
.item.checking .strike { background-size: 100% 2px; color: var(--faint); }
.item-meta { display: block; font-size: .8rem; color: var(--muted); }
.item-meta.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stores .i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

/* Marks an item whose product no source knew: name and category still need
   a look. A small icon instead of a text badge keeps the row compact. */
.review { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--warn); }
.review .i { width: 17px; height: 17px; }
.merge-mark { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--accent); }
.merge-mark .i { width: 17px; height: 17px; }
.merge-hint { margin: 4px 0 12px; padding: 12px; border-radius: 16px; background: var(--cat-0-bg); }
.merge-hint p { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.merge-hint p .i { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.merge-hint .row.end { flex-wrap: nowrap; }
.merge-hint .row.end > button { flex: 1 1 auto; min-height: 42px; border-radius: 12px; white-space: nowrap; }

.badge { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); margin-left: 4px; vertical-align: 1px; }

.qty { display: inline-flex; align-items: center; flex: none; background: var(--soft); border-radius: 999px; padding: 2px; }
.qty button { width: 38px; min-height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.qty button:active:not(:disabled) { background: var(--surface); transform: scale(.82); }
.qty button:disabled { opacity: .35; }
.qty button .i { width: 16px; height: 16px; stroke-width: 2.6; }
.qty output { min-width: 18px; text-align: center; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.qty output.bump, .cart b.bump { animation: bump .45s var(--ease-spring); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* New on the list (scanned, added, back from the cart, or from another
   device): slides in with a short warm highlight. */
.item.fresh .item-row { animation: fresh 1.8s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes fresh { 0% { background-color: var(--fresh); transform: translateY(-12px) scale(.97); opacity: 0; } 25% { opacity: 1; transform: none; } 100% { background-color: var(--surface); } }

/* Shown once until the first swipe: the first row nudges left and right. */
.item.peek .item-row { animation: peek 1.4s 1.2s ease-in-out 2; }
@keyframes peek { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(34px); } 60% { transform: translateX(-22px); } }

.empty { text-align: center; color: var(--muted); padding: 32px 8px; }

/* The cart: a pill with the number of checked items; opened, the items
   as calm cards with the stroke already drawn and a button to put one
   back, which runs the check-off in reverse. */
.cart-wrap { display: flex; justify-content: center; margin-top: 18px; }
.cart { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--chipline); background: var(--surface); font-weight: 600; font-size: .9rem; }
.cart b { min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-variant-numeric: tabular-nums; }
.cart .i { width: 18px; height: 18px; }
.cart .i.chevron { width: 16px; height: 16px; color: var(--muted); transition: transform .35s var(--ease-spring); }
.cart[aria-expanded="true"] .i.chevron { transform: rotate(180deg); }
.done-list { margin-top: 10px; animation: rise .4s cubic-bezier(.2, 1.3, .4, 1); }
.done-list .rows { background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.done-list .item + .item .item-row { box-shadow: none; }
.done-list .item-inner { border-radius: 16px; }
.done-list .item-row { margin-bottom: 6px; padding-left: 10px; gap: 10px; min-height: 54px; background: var(--done-bg); border: 1px solid var(--line); border-radius: 16px; }
.done-list .cat-tile { width: 32px; height: 32px; border-radius: 10px; font-size: .8rem; opacity: .8; transition: opacity .3s, transform .35s var(--ease-spring); }
.done-list .item-name { color: var(--faint); }
.done-list .strike { background-size: 100% 2px; background-image: linear-gradient(var(--accent), var(--accent)); }
.done-list .item.restoring .item-row { background: var(--surface); }
.done-list .item.restoring .item-name { color: var(--text); }
.done-list .item.restoring .strike { background-size: 0 2px; transition: background-size .38s ease-in, color .3s; }
.done-list .item.restoring .cat-tile { opacity: 1; transform: scale(1.12); }
.done-list .item.leave .item-row { transform: translateX(-56px); }
.put-back { flex: none; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 14px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.put-back .i { transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
.item.restoring .put-back .i { transform: rotate(-360deg); }

/* Once, after a while: a quiet card about the scan station. */
.promo { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 14px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-soft); animation: rise .6s cubic-bezier(.2, 1.3, .4, 1); transition: opacity .3s, transform .3s; }
.promo.gone { opacity: 0; transform: translateY(8px); }
.promo-text { flex: 1; min-width: 0; }
.promo-text strong { display: block; }
.promo-text p { margin: 2px 0 10px; font-size: .85rem; line-height: 1.4; color: var(--muted); }
a.promo-go { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 12px; background: var(--cat-3-bg); color: var(--cat-3-fg); font-weight: 700; font-size: .85rem; text-decoration: none; }
.promo .hint-close { color: var(--muted); }

/* The last item went into the cart: a short celebration. */
.all-done { position: relative; margin-top: 18px; padding: 22px 20px; border-radius: 24px; background: var(--inv); color: var(--on-inv); overflow: hidden; animation: rise .7s cubic-bezier(.2, 1.4, .4, 1); }
.all-done h2 { position: relative; margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; letter-spacing: -.02em; }
.all-done p { position: relative; margin: 0; color: var(--on-inv-muted); }
.confetti { position: absolute; top: -16px; width: 8px; height: 14px; border-radius: 2px; animation: fall 2.4s ease-in infinite; }
@keyframes fall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(200px) rotate(560deg); opacity: 0; } }
@keyframes rise { from { transform: translateY(28px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Navigation at the bottom: four tabs and the scan button in the middle,
   raised and breathing. */
.dock { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6;
  width: min(560px, calc(100% - 28px)); height: 64px; padding: 0 6px; border-radius: 24px;
  display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px -10px rgba(20, 32, 25, .35), 0 0 0 1px var(--line); }
.dock-link { width: 58px; height: 52px; border-radius: 16px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: .66rem; font-weight: 600; transition: color .2s, transform .2s var(--ease-spring); }
.dock-link:active { transform: scale(.9); }
.dock-link .i { width: 21px; height: 21px; transition: transform .3s var(--ease-spring); }
.dock-link[aria-current="page"] { color: var(--text); }
.dock-link[aria-current="page"] .i { color: var(--accent); transform: translateY(-1px); }
.dock-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dock-scan { position: relative; width: 66px; min-height: 66px; margin-top: -34px; padding: 0; border: 0; border-radius: 22px;
  background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.dock-scan .i { width: 28px; height: 28px; }
.dock-scan::before { content: ""; position: absolute; inset: -6px; border-radius: 27px; border: 2px solid var(--accent); opacity: .4; animation: breathe 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes breathe { 0%, 100% { transform: scale(.96); opacity: .5; } 50% { transform: scale(1.06); opacity: 0; } }

/* Store filter: one tap per store; the chosen one is inverted. */
.chips { display: flex; gap: 6px; margin: 0 -16px 10px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--chipline); background: var(--surface); font-weight: 600; font-size: .88rem;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease-spring); }
.chip.on { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.chip .n { margin-left: 7px; font-variant-numeric: tabular-nums; opacity: .6; }
.chip .n:empty { display: none; }
.chip.empty:not(.on) { color: var(--muted); }

/* On/off switch for a checkbox: the knob springs across. */
input.toggle { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px;
  background: var(--chipline); cursor: pointer; transition: background-color .3s; }
input.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .45s var(--ease-spring), width .2s; }
input.toggle:active::after { width: 27px; }
input.toggle:checked { background: var(--accent); }
input.toggle:checked::after { transform: translateX(18px); }
input.toggle:checked:active::after { transform: translateX(13px); }
input.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}

dialog.sheet {
  border: 0;
  padding: 16px;
  width: min(560px, 100%);
  max-width: 100%;
  max-height: 92vh;
  margin: auto auto 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 26px; padding-bottom: 16px; }
}

dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog.sheet[open] { animation: sheet-up .45s cubic-bezier(.2, 1.1, .4, 1); }
dialog.sheet[open]::backdrop { animation: backdrop-in .3s ease; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 1.1rem; margin: 0; }

dialog label { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); }
dialog label input, dialog label select, dialog label .stepper { margin-top: 4px; color: var(--text); }

.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.stepper input { text-align: center; }
.stepper button { display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* Dialog footer: the "…" menu with the rarer actions, then Save. */
.sheet-actions { position: relative; display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.sheet-actions > .primary { flex: 1; min-height: 52px; border-radius: 16px; font-weight: 700; }
.sheet-actions .more-btn { min-height: 52px; border-radius: 16px; }
.menu-wrap { flex: none; }
.more-btn { width: 48px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.more-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* Opens upwards from the footer (the bottom of the sheet) and stays
   within its width, so the dialog never needs to scroll sideways. */
.pop-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.pop-menu button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 8px; background: transparent; padding: 10px 12px; }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--bg); }
.pop-menu .i { width: 20px; height: 20px; color: var(--muted); }
.pop-menu .danger .i { color: inherit; }
.pop-menu .menu-text { min-width: 0; }
.pop-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row input { flex: 1; }
.row.end { justify-content: flex-end; flex-wrap: wrap; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.web-search { color: var(--accent); white-space: nowrap; }
.web-search .i { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
#edit-info a:not(.web-search), #product-info a:not(.web-search) { color: inherit; }

.video-wrap { position: relative; background: #0d120f; border-radius: 22px; overflow: hidden; aspect-ratio: 4 / 3; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Viewfinder: four corners that snap inwards on a hit, a sweeping laser
   and a short flash. Yellow while looking, green on a hit. */
.scan-frame { position: absolute; inset: 22% 12%; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .3); }
.video-wrap.qr .scan-frame { inset: 12% 24%; }
.scan-frame i { position: absolute; width: 30px; height: 30px; border: 0 solid #ffc53d; transition: border-color .2s, transform .3s var(--ease-spring); }
.scan-frame i:nth-child(1) { left: 0; top: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 14px; }
.scan-frame i:nth-child(2) { right: 0; top: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 14px; }
.scan-frame i:nth-child(3) { left: 0; bottom: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 14px; }
.scan-frame i:nth-child(4) { right: 0; bottom: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 14px; }
.video-wrap.hit .scan-frame i { border-color: #7ee0a6; }
.video-wrap.hit .scan-frame i:nth-child(1) { transform: translate(10px, 10px); }
.video-wrap.hit .scan-frame i:nth-child(2) { transform: translate(-10px, 10px); }
.video-wrap.hit .scan-frame i:nth-child(3) { transform: translate(10px, -10px); }
.video-wrap.hit .scan-frame i:nth-child(4) { transform: translate(-10px, -10px); }
.laser { position: absolute; left: 8px; right: 8px; top: 10%; height: 2px; border-radius: 2px; background: #ffc53d; box-shadow: 0 0 12px 2px rgba(255, 197, 61, .55); animation: sweep 1.8s ease-in-out infinite; }
.video-wrap.hit .laser { background: #7ee0a6; box-shadow: 0 0 12px 2px rgba(126, 224, 166, .6); }
@keyframes sweep { 0%, 100% { top: 8%; } 50% { top: 90%; } }
.scan-flash { position: absolute; inset: 0; background: #7ee0a6; opacity: 0; pointer-events: none; }
.video-wrap.hit .scan-flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .35; } 100% { opacity: 0; } }
.torch { position: absolute; right: 10px; top: 10px; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 14px; background: rgba(232, 238, 233, .16); color: #e8eee9; display: inline-flex; align-items: center; justify-content: center; }
.torch[aria-pressed="true"] { background: #ffc53d; color: #2a1e00; }

.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.scan-head h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.1; }
.scan-head p { margin: 2px 0 0; }
button.scan-done { flex: none; border-radius: 999px; padding: 0 18px; border: 0; background: var(--inv); color: var(--on-inv); font-weight: 700; }
.scan-status { margin: 10px 2px 0; color: var(--muted); font-size: .85rem; }

/* What this scan session put on the list, newest first. */
.scan-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 34vh; overflow-y: auto; }
.scan-results:empty { display: none; }
.scan-results li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 0 4px 2px; animation: slide-in .5s cubic-bezier(.2, 1.4, .4, 1); }
.scan-results li + li { border-top: 1px solid var(--line); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.scan-results .cat-tile { width: 32px; height: 32px; border-radius: 10px; font-size: .8rem; }
.scan-results .scan-text { flex: 1; min-width: 0; }
.scan-results .item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-qty { flex: none; min-width: 40px; height: 30px; padding: 0 9px; border-radius: 999px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.scan-qty.bump { animation: bump-pop .45s var(--ease-spring); }
@keyframes bump-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); background: var(--pop); color: #142019; } 100% { transform: scale(1); } }
.scan-undo { flex: none; width: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }

/* Always dark on white: QR readers need the contrast, also in dark mode. */
.pair-qr { margin: 12px auto 4px; padding: 12px; background: #fff; border-radius: 12px; width: min(280px, 100%); }
.pair-qr svg { display: block; width: 100%; height: auto; }
.pair-qr rect { fill: #000; }

/* Lists on the subpages (stores, categories, devices, passkeys,
   products): soft cards with a small coloured tile in front. */
.cat-list { list-style: none; margin: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.cat-list li { display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 6px 6px 6px 12px; }
.cat-list li + li { box-shadow: inset 0 1px 0 var(--line); }
.cat-list li > .cat-tile, .cat-list li > .menu-tile { margin-right: 8px; }
.cat-list .cat-tile { width: 32px; height: 32px; border-radius: 10px; font-size: .8rem; }
.cat-list .menu-tile { width: 32px; height: 32px; border-radius: 10px; }
.cat-list .menu-tile .i { width: 16px; height: 16px; }
.cat-list input { flex: 1; min-width: 0; border-color: var(--accent); }
.cat-list button { width: 36px; padding: 0; border-color: transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.cat-list button .i { width: 19px; height: 19px; }
.cat-list button.danger { color: var(--danger); }
.cat-list button:disabled { opacity: .3; }
.cat-list:empty { display: none; }
.cat-list .row-name { flex: 1; min-width: 0; padding: 8px 4px; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; font-weight: 600; }
.cat-list .row-name .item-meta { font-weight: 400; }
.cat-list button.accent { color: var(--accent); }
.cat-list button.row-name { width: auto; min-height: 44px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--text); display: block; }
.cat-list li.current .row-name { color: var(--accent-strong); }
.parts a.promo-go { flex: none; margin-right: 6px; }
#station-parts > p { margin: 10px 2px 0; }
#dlg-lists .cat-list { margin-top: 4px; }
#list-form { margin-top: 12px; }

/* A section of a subpage as a card: tile and title, text, then its
   buttons at full width. */
.panel { margin-top: 12px; padding: 16px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-soft); }
.panel > p, .panel form > p { line-height: 1.45; }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel .cat-list { box-shadow: none; border: 1px solid var(--line); margin-top: 10px; }
.panel.danger-zone { background: color-mix(in srgb, var(--danger) 7%, var(--surface)); box-shadow: none; border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.panel-head { display: flex; align-items: center; gap: 12px; margin: 22px 2px 10px; }
.panel .panel-head { margin: 0 0 8px; }
.panel-head h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.015em; }
.tile-red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
main.view .row.end { flex-wrap: nowrap; }
main.view .row.end > button { flex: 1 1 0; min-height: 50px; border-radius: 16px; font-weight: 600; }
main.view .row.end > button[hidden] { display: none; }
main.view form.row > button[type="submit"], #list-form > button[type="submit"] { flex: none; min-height: 46px; border-radius: 15px; border-color: var(--inv); background: var(--inv); color: var(--on-inv); font-weight: 700; }
main.view form.row > input, #list-form > input { min-height: 46px; border-radius: 15px; border-color: transparent; box-shadow: var(--shadow-soft); }
.panel form.row > input { box-shadow: none; border-color: var(--chipline); }
#product-search { min-height: 46px; border-radius: 15px; border-color: transparent; box-shadow: var(--shadow-soft); margin-top: 6px; }
#view-products > .muted.small:first-child, #view-devices > .muted.small:first-child, #view-station > .muted.small:first-child { line-height: 1.45; margin-top: 2px; }
.station-legend { margin-top: 4px; }
button.danger:not(.danger-fill) { color: var(--danger); }
.panel.danger-zone button.danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--surface); }

h3 { font-size: 1rem; margin: 20px 0 8px; }
.sheet-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }

.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 16px; min-height: 64px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.menu-item:first-child { border-top: 0; }
.menu-item > .i { color: var(--accent); }
.menu-item .chevron { color: var(--muted); }
.menu-text { flex: 1; min-width: 0; }
.menu-group { margin: 20px 6px 8px; font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
#view-settings .items { border: 0; box-shadow: var(--shadow-soft); border-radius: 22px; }
#view-settings .menu-item { gap: 12px; min-height: 60px; padding: 8px 12px; border-top: 0; transition: background-color .15s; }
#view-settings .menu-item + .menu-item { box-shadow: inset 0 1px 0 var(--line); }
#view-settings .menu-item:active { background: var(--soft); }
.menu-tile { flex: none; width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; transition: transform .25s var(--ease-spring); }
.menu-tile .i { width: 18px; height: 18px; }
.menu-item:active .menu-tile { transform: scale(.86) rotate(-6deg); }
.menu-item > .i.chevron { color: var(--faint); width: 18px; height: 18px; }
.menu-badge { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tile-purple { background: var(--cat-3-bg); color: var(--cat-3-fg); }
.tile-yellow { background: var(--warn-soft); color: var(--warn); }
.tile-grey { background: var(--soft); color: var(--muted); }
.app-version { margin: 18px 0 0; text-align: center; color: var(--faint); font-size: .75rem; }
/* Imprint and privacy policy live on the homepage (emptly.app). */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 8px 0 0; font-size: .75rem; }
.legal-links a { color: var(--faint); }
.terms-note { text-align: center; font-size: .75rem; line-height: 1.5; color: var(--muted); }
.terms-note a { color: inherit; text-decoration: underline; }
.offer-terms { margin: 10px 0 0; }
.home-sub-terms { margin: 6px 0 0; }
/* Required by the licence of Open Food Facts (ODbL): name the source and
   link it and the licence. */
.data-credit { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; margin: 14px auto 0; color: var(--faint); font-size: .75rem; }
.data-credit a { color: inherit; }

.home-card { padding: 18px; border-radius: 26px; background: var(--inv); color: var(--on-inv); }
.home-top { display: flex; align-items: center; gap: 14px; }
.home-top strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.home-devs { display: flex; flex: none; }
.home-devs span { width: 40px; height: 40px; margin-left: -12px; border-radius: 50%; border: 3px solid var(--inv); display: inline-flex; align-items: center; justify-content: center; animation: pop .5s var(--ease-spring) both; }
.home-devs span:first-child { margin-left: 0; }
.home-devs span:nth-child(2) { animation-delay: .08s; }
.home-devs span:nth-child(3) { animation-delay: .16s; }
.home-devs .i { width: 18px; height: 18px; }
.home-live { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: .8rem; font-weight: 600; color: var(--on-inv-muted); }
.home-live.on { color: var(--on-inv-accent); }
.home-live.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: live-pulse 1.8s infinite; }
.home-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--on-inv) 9%, transparent); }
.home-status b { display: block; font-size: .9rem; }
.home-status small { display: block; margin-top: 2px; font-size: .75rem; line-height: 1.45; color: var(--on-inv-muted); white-space: pre-line; }
.home-meter { flex: none; width: 110px; display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 3px; }
.home-meter i { height: 7px; border-radius: 999px; background: color-mix(in srgb, var(--on-inv) 18%, transparent); }
.home-meter i.on { background: var(--on-inv-accent); }
button.home-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; margin-top: 12px; border: 0; border-radius: 16px; background: var(--on-inv); color: var(--inv); font-weight: 700; }
.home-add .i { width: 18px; height: 18px; }
button.home-sub { background: transparent; color: var(--on-inv); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--on-inv) 35%, transparent); }
.backup-hint { display: grid; grid-template-rows: 1fr; margin-top: 12px; transition: grid-template-rows .45s cubic-bezier(.4, 0, .2, 1), opacity .35s, margin .45s; }
.backup-hint > div { overflow: hidden; min-height: 0; }
.backup-hint.gone { grid-template-rows: 0fr; opacity: 0; margin-top: 0; }
.hint-box { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); }
.hint-icon { flex: none; width: 36px; height: 36px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 16%, transparent); display: inline-flex; align-items: center; justify-content: center; }
.hint-icon .i { width: 18px; height: 18px; }
.hint-text { flex: 1; min-width: 0; }
.hint-text strong { display: block; }
.hint-text p { margin: 2px 0 10px; font-size: .85rem; line-height: 1.4; }
a.hint-go { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 12px; background: var(--warn); color: var(--surface); font-weight: 700; font-size: .85rem; text-decoration: none; }
button.hint-close { flex: none; width: 40px; min-height: 40px; margin: -6px -6px 0 0; padding: 0; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.hint-close .i { width: 16px; height: 16px; }

.field { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); }
.field input { margin-top: 4px; color: var(--text); }
.product-list li { gap: 4px; }
.product-list button.product-text { flex: 1; min-width: 0; width: auto; min-height: 44px; padding: 4px 0; text-align: left; display: block; color: var(--text); font-weight: 600; }
.product-list button.product-text .item-meta { font-weight: 400; }
.field .choices { margin-top: 4px; }

.ask-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ask-options button { text-align: left; }
.ask-options .choice { flex: 1 1 100%; }
.ask-options .primary .item-meta { color: inherit; opacity: .85; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(126px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  min-height: 50px;
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--inv);
  color: var(--on-inv);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in .4s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes toast-in { from { transform: translate(-50%, 24px) scale(.96); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

.toast button { flex: none; min-height: 40px; padding: 0 10px; margin: -4px 0; border: 0; border-radius: 12px; background: transparent; color: var(--toast-action); font-weight: 700; }

.setting-list li { padding: 0; }
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; cursor: pointer; }
.setting select.lang-select { width: auto; max-width: 46%; min-height: 40px; margin-left: auto; flex: none; padding: 6px 10px; }
.setting input:not(.toggle) { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }


.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 999px; padding: 4px; background: var(--soft); }
.seg button { border: 0; border-radius: 999px; background: transparent; min-height: 36px; padding: 0 14px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(20, 32, 25, .15); }

/* Statistics as a report of tiles: bought (with the previous period),
   spending, distinct products, a podium of the top three and a ring of
   the categories. */
.stats-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.period-pick { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 2px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-soft); }
.period-pick strong { min-width: 7.2em; text-align: center; font-size: .88rem; white-space: nowrap; }
.period-pick .icon-btn { width: 40px; min-height: 40px; border-radius: 50%; }
.period-pick .icon-btn:disabled { opacity: .3; }
#stats-since { margin: 10px 2px 0; }
#view-statistics .banner { margin: 10px 0 0; }
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.tile { position: relative; min-width: 0; padding: 14px 14px 13px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.bento.enter .tile { animation: rise .55s cubic-bezier(.2, 1.3, .4, 1) both; }
.bento.enter .tile:nth-child(2) { animation-delay: .06s; }
.bento.enter .tile:nth-child(3) { animation-delay: .12s; }
.bento.enter .tile:nth-child(4) { animation-delay: .18s; }
.bento.enter .tile:nth-child(5) { animation-delay: .24s; }
.tile.wide { grid-column: 1 / -1; }
.tile.hero { background: var(--accent); color: var(--accent-text); }
.tile-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tile.hero .tile-label, .tile.hero .tile-sub { color: inherit; opacity: .8; }
.tile-num { display: block; margin-top: 8px; font-family: var(--font-display); font-weight: 800; font-size: 2.9rem; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-num.small { font-size: 1.8rem; overflow-wrap: anywhere; }
.tile-sub { display: block; margin-top: 4px; font-size: .78rem; color: var(--muted); }
.cmp { position: absolute; top: 12px; right: 12px; min-height: 28px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center;
  font-size: .75rem; font-weight: 700; background: color-mix(in srgb, currentColor 16%, transparent); animation: pop .5s var(--ease-spring); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; height: 178px; margin-top: 10px; }
.podium-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.podium-col strong { max-width: 100%; font-size: .78rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-col .i { width: 24px; height: 24px; color: #c98a00; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.podium-block { width: 100%; height: 0; padding-top: 8px; border-radius: 14px 14px 6px 6px; display: flex; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
  transition: height .8s cubic-bezier(.3, 1.4, .5, 1); overflow: hidden; }
.podium-col.p1 .podium-block { background: #ffe7a3; color: #7a4a00; }
.podium-col.p2 .podium-block { background: #e6eaee; color: #3c4a55; }
.podium-col.p3 .podium-block { background: #fbe0c6; color: #8f4e13; }
.more-items { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 0 4px; min-height: 40px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .85rem; }
.more-items .i { width: 16px; height: 16px; transition: transform .35s var(--ease-spring); }
.more-items[aria-expanded="true"] .i { transform: rotate(180deg); }
.rank-list { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: rank; animation: rise .4s cubic-bezier(.2, 1.3, .4, 1); }
.rank-list li { counter-increment: rank; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 0; box-shadow: inset 0 1px 0 var(--line); }
.rank-list li::before { content: counter(rank); flex: none; width: 26px; height: 26px; border-radius: 9px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; color: var(--muted); }
.rank-text { flex: 1; min-width: 0; }
.rank-count { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.donut-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.donut-wrap { position: relative; flex: none; width: 136px; height: 136px; }
.donut { width: 100%; height: 100%; border-radius: 50%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px)); }
.donut.enter { animation: spin-in .9s cubic-bezier(.3, 1.2, .5, 1); }
@keyframes spin-in { from { transform: rotate(-120deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-family: var(--font-display); font-weight: 800; font-size: 1.75rem; letter-spacing: -.03em; line-height: 1; }
.donut-center span { max-width: 84px; margin-top: 3px; font-size: .68rem; line-height: 1.2; color: var(--muted); }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.legend-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-size: .82rem; font-weight: 600; transition: background-color .2s, opacity .25s; }
.legend-item i { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.legend-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-item b { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-item[aria-pressed="true"] { background: var(--soft); }
.donut-legend.picked .legend-item[aria-pressed="false"] { opacity: .45; }
@media (max-width: 360px) { .donut-row { flex-direction: column; align-items: stretch; } .donut-wrap { align-self: center; } }

.center { text-align: center; }
.cat-list .row-name .item-meta { margin-top: 2px; }

/* Start screen of a device without a household: replaces every other view.
   A short promise and a mini list that plays itself instead of long text. */
body.welcome .topbar, body.welcome main.view, body.welcome .dock, body.welcome .banner { display: none !important; }
body.welcome { padding-bottom: 0; }
.welcome-screen { display: flex; flex-direction: column; gap: 0; max-width: 440px; min-height: 100vh; min-height: 100dvh; margin: 0 auto;
  padding: max(26px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.brand img { border-radius: 13px; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.brand strong { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; letter-spacing: -.02em; }
.welcome-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.1rem, 10vw, 2.6rem); letter-spacing: -.03em; line-height: 1; margin: 18px 4px 8px; }
.welcome-title em { font-style: normal; color: var(--accent); }
.welcome-lead { margin: 0 4px; color: var(--muted); line-height: 1.45; }
.welcome-notice { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.welcome-tip { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: .9rem; }
.welcome-tip .i { width: 16px; height: 16px; vertical-align: -3px; }
.welcome-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.welcome-foot p { margin: 2px 0 0; }
button.big { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; font-weight: 600; border-radius: 18px; }
.welcome-foot .primary.big { min-height: 58px; border-radius: 20px; font-size: 1.05rem; font-weight: 700; box-shadow: 0 14px 26px -10px color-mix(in srgb, var(--accent) 75%, transparent); }
.welcome-foot .big:not(.primary) { border: 1.5px solid var(--chipline); }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; }
.pill .i { width: 14px; height: 14px; stroke-width: 2.6; color: var(--accent); }

/* The demo: a few rows run through scan, check-off and cart in a loop. */
.demo { position: relative; margin-top: 26px; padding: 14px 12px 12px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-soft); }
.demo-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.demo-head strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.demo-head small { display: block; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.demo-ring-wrap { position: relative; }
.ring.demo-ring { width: 40px; height: 40px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.demo-ring-wrap span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.demo-rows { list-style: none; margin: 0; padding: 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.demo-item { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .42s cubic-bezier(.4, 0, .2, 1), opacity .38s ease; }
.demo-inner { overflow: hidden; min-height: 0; }
.demo-item + .demo-item .demo-line { box-shadow: inset 0 1px 0 var(--line); }
.demo-item.leave { grid-template-rows: 0fr; opacity: 0; }
.demo-line { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 3px 10px 3px 4px; background: var(--surface); transition: transform .45s cubic-bezier(.4, 0, .2, 1); }
.demo-item.leave .demo-line { transform: translateX(56px); }
.demo-item.fresh .demo-line { animation: fresh 1.6s cubic-bezier(.2, 1.2, .4, 1); }
.demo-check { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--accent-text); }
.demo-check > span { width: 23px; height: 23px; border-radius: 50%; border: 2px solid var(--check-line); display: inline-flex; align-items: center; justify-content: center; transition: background-color .2s, border-color .2s; }
.demo-check .i { width: 13px; height: 13px; stroke-width: 3.4; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .1s; }
.demo-item.on .demo-check > span { background: var(--accent); border-color: var(--accent); animation: pop .5s var(--ease-spring); }
.demo-item.on .demo-check .i { stroke-dashoffset: 0; }
.demo-item.on .strike { background-size: 100% 2px; color: var(--faint); }
.demo-text { flex: 1; min-width: 0; }
.demo-text b { font-weight: 600; font-size: .92rem; }
.demo-text small { display: block; color: var(--muted); font-size: .72rem; }
.demo-qty { min-width: 30px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem; font-variant-numeric: tabular-nums; }
.demo-qty.bump, .demo-cart b.bump { animation: bump-pop .45s var(--ease-spring); }
.demo-cart { display: flex; justify-content: center; margin-top: 10px; }
.demo-cart span { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px; border-radius: 999px; border: 1.5px solid var(--chipline); font-weight: 600; font-size: .78rem; }
.demo-cart b { min-width: 22px; height: 22px; border-radius: 999px; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; }
.demo-chip { position: absolute; left: 50%; top: -18px; z-index: 1; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 6px; border-radius: 999px;
  background: var(--inv); color: var(--on-inv); font-size: .78rem; font-weight: 600; white-space: nowrap; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5); animation: chip-in .5s cubic-bezier(.2, 1.5, .4, 1); }
.demo-chip .i { width: 26px; height: 26px; padding: 5px; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
@keyframes chip-in { from { transform: translate(-50%, 10px) scale(.9); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

/* "Ich habe schon eine Liste": every way back in one sheet. */
.sheet-title { margin: 4px 0 2px; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
button.option { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 70px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; }
button.option:hover { border-color: var(--accent); }
.option-tile { flex: none; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; }
.tile-blue { background: var(--cat-2-bg); color: var(--cat-2-fg); }
.tile-green { background: var(--cat-0-bg); color: var(--cat-0-fg); }
.tile-orange { background: var(--cat-1-bg); color: var(--cat-1-fg); }
.option .item-meta { line-height: 1.35; margin-top: 2px; }
.sheet-cancel { display: block; width: 100%; margin-top: 8px; text-decoration: none; color: var(--muted); font-weight: 600; min-height: 44px; }

/* Sharing a list as a read-only link: duration, the new link, the
   links that still work. */
.share-label { margin: 16px 2px 8px; font-size: .85rem; font-weight: 700; }
.seg.share-days { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.seg.share-days button { padding: 0 4px; }
#btn-share-create, #btn-invite-create { width: 100%; border-radius: 16px; font-weight: 700; }
#btn-share-create .i, #btn-invite-create .i, .share-result .i { width: 18px; height: 18px; }
.seg.share-mode { margin-bottom: 12px; }
.share-result { margin-top: 12px; padding: 12px; border-radius: 18px; background: var(--accent-soft); animation: rise .4s cubic-bezier(.2, 1.3, .4, 1); }
.share-result input { font-size: .85rem; }
.share-result .row.end > button { flex: 1 1 0; min-height: 46px; border-radius: 14px; }
#dlg-share .cat-list li .row-name { font-weight: 600; }

/* The page behind a share link: the list read only, a small note about
   Emptly on top and an invitation at the end. */
body.share-page { padding-bottom: 32px; }
.share-brand { display: flex; justify-content: center; padding: calc(12px + env(safe-area-inset-top)) 16px 0; }
.share-logo { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-soft); color: var(--muted); font-size: .8rem; font-weight: 600; text-decoration: none; }
.share-logo img { border-radius: 9px; }
.share-title { margin: 14px 2px 4px; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 9vw, 2.4rem); letter-spacing: -.03em; line-height: 1.05; overflow-wrap: break-word; }
.share-main .summary { margin: 0 2px 6px; }
.share-error { margin: 14px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--warn-soft); color: var(--warn); line-height: 1.45; }
.share-page .item-row { cursor: default; touch-action: auto; }

/* Cancel button page (cancel.html) */
.cancel-form fieldset { margin: 14px 0 0; padding: 0; border: 0; }
.cancel-form legend { padding: 0; margin-bottom: 2px; }
.cancel-contract { font-weight: 600; }
.cancel-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-size: .95rem; }
.cancel-choice input[type="radio"] { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.cancel-choice > span { flex: 1 1 0; min-width: 10em; }
.cancel-choice input[type="date"] { min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--chipline); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.cancel-form input[type="email"] { width: 100%; min-height: 44px; margin-top: 4px; padding: 10px 12px; border: 1.5px solid var(--chipline); border-radius: 12px; background: var(--surface); color: var(--text); }
.cancel-form textarea { min-height: 90px; margin-top: 4px; color: var(--text); }
.cancel-submit, .cancel-print { width: 100%; margin-top: 14px; }
.cancel-done h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.015em; }
.cancel-summary { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.cancel-unknown { margin: 12px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--warn-soft); color: var(--warn); line-height: 1.45; }
.cancel-unknown p { margin: 0; }
.cancel-unknown button { width: 100%; margin-top: 10px; }
@media print { .share-brand, .cancel-print, .cancel-unknown button, .legal-links { display: none; } }
.share-page .item-main { padding: 6px 0; }
.share-promo { margin-top: 28px; padding: 16px; border-radius: 22px; background: var(--accent-soft); }
.share-promo strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.share-promo p { margin: 4px 0 12px; color: var(--muted); font-size: .85rem; line-height: 1.45; }
a.share-go { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 700; text-decoration: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A moment of its own: the list is ready, or unlocked again. */
.celebrate { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
  background: var(--accent); color: var(--accent-text); overflow: hidden; animation: bloom .6s cubic-bezier(.2, 1, .3, 1); }
@keyframes bloom { from { clip-path: circle(0 at 50% 85%); } to { clip-path: circle(150% at 50% 85%); } }
.celebrate-mark { width: 96px; height: 96px; border-radius: 50%; background: color-mix(in srgb, var(--accent-text) 16%, transparent); display: inline-flex; align-items: center; justify-content: center; animation: pop .6s .3s var(--ease-spring) both; }
.celebrate-mark .i { width: 46px; height: 46px; stroke-width: 3; stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick-in .45s .55s ease-out forwards; }
@keyframes tick-in { to { stroke-dashoffset: 0; } }
.celebrate h2 { margin: 6px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 2rem; letter-spacing: -.02em; }
.celebrate p { margin: 0; max-width: 300px; line-height: 1.45; opacity: .85; }
.celebrate button { margin-top: 14px; min-height: 50px; padding: 0 26px; border: 0; border-radius: 999px; background: var(--accent-text); color: var(--accent); font-weight: 700; }
.celebrate .confetti { animation-name: fall-far; }
@keyframes fall-far { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

button.text-btn { margin-top: 0; padding: 8px; background: none; border: 0; color: var(--accent); text-decoration: underline; font-size: .9rem; }
.recovery-status { margin: 12px 0 0; }
.recover-error { margin: 4px 0 0; color: var(--danger); font-size: .9rem; }
.recovery-code { margin: 16px 0 4px; font: 600 1.5rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .04em; text-align: center; overflow-wrap: anywhere; user-select: all; }

/* The list body has two parts: the list itself and a side with the
   summary ring, the scan station card and the cart. On a phone both
   parts dissolve into one column and the summary moves back to the top;
   from 1200px the side becomes a column of its own. */
#list-body { display: flex; flex-direction: column; }
.list-main, .list-side { display: contents; }
#shared-note, #trial-hint { order: -2; }
.list-side > .list-head { order: -1; }
/* Flex items keep their margins apart; these match the gaps the
   collapsed margins gave before. */
#empty { margin: 8px 0 0; }
.empty-import { margin: -20px 0 0; text-align: center; font-size: .9rem; }
.empty-import a { color: var(--accent); font-weight: 600; text-decoration: none; }
.import-list { margin-top: 4px; }
.seg.paste-mode { margin-top: 12px; }
.due-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.due-label { flex: none; font-size: .8rem; font-weight: 600; color: var(--muted); }
.due-chips { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.due-chips::-webkit-scrollbar { display: none; }
.due-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px 0 8px; border-radius: 999px;
  border: 1.5px dashed var(--chipline); background: transparent; font-weight: 600; font-size: .82rem; color: inherit; }
.due-chip .i { width: 15px; height: 15px; color: var(--accent); }
.due-row .hint-close { flex: none; }
.suggest-item.paste-many { display: flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 600; }
.suggest-item.paste-many .i { width: 18px; height: 18px; flex: none; }
.import-list li { gap: 12px; min-height: 48px; cursor: pointer; }
.import-list input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.import-list .row-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.import-list .row-name .item-meta { font-weight: 400; }
.import-list li.off .row-name { color: var(--muted); text-decoration: line-through; }
.import-list .qty-tag { color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 8px; }
#swipe-hint { margin-top: 0; }
#all-done { margin-top: 10px; }

.dock-brand, .dock-scan-label { display: none; }

/* Laptop and desktop: the dock becomes a sidebar on the left, the top bar
   lines up with the content, and pointer devices get hover states. */
@media (min-width: 1024px) {
  :root { --rail: 248px; --page: 760px; }
  body:has(#view-list:not([hidden])):not(.locked) { --page: 1080px; }
  body { padding: 0 0 56px var(--rail); }
  body.welcome { padding-left: 0; }

  .topbar { padding: 18px max(16px, calc((100% - var(--page)) / 2 + 16px)) 10px;
    background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .topbar h1 { font-size: 1.75rem; }
  .list-switch { font-size: 2rem; }
  .banner { max-width: calc(var(--page) - 32px); margin: 10px auto 0; }
  main { max-width: var(--page); padding: 12px 16px; }

  .dock { left: 0; top: 0; bottom: 0; transform: none; width: var(--rail); height: auto; padding: 22px 16px; border-radius: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 1px 0 0 var(--line); }
  .dock-brand { order: -2; display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
  .dock-brand img { border-radius: 11px; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
  .dock-brand strong { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
  .dock-scan { order: -1; width: auto; min-height: 54px; margin: 0 0 18px; padding: 0 18px; gap: 12px; justify-content: flex-start;
    border-radius: 18px; font-weight: 700; font-size: 1rem; }
  .dock-scan .i { width: 24px; height: 24px; }
  .dock-scan::before { inset: -5px; border-radius: 22px; }
  .dock-scan-label { display: inline; }
  .dock-link { width: auto; height: 46px; padding: 0 14px; flex-direction: row; justify-content: flex-start; gap: 14px;
    border-radius: 14px; font-size: .95rem; transition: color .2s, background-color .2s, transform .2s var(--ease-spring); }
  .dock-link .i { width: 20px; height: 20px; }
  .dock-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
  .dock-link[aria-current="page"] .i { transform: none; }

  .toast { left: calc(50% + var(--rail) / 2); bottom: 32px; }

  #view-list .chips { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; overflow: visible; }
  .group { margin-top: 22px; }
  .item-row { padding-right: 10px; }

  /* Start screen: the promise on the left, the playing demo on the right. */
  body.welcome { background: radial-gradient(55% 60% at 78% 50%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
  .welcome-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); column-gap: clamp(40px, 6vw, 96px);
    align-content: center; max-width: 1120px; padding: 48px 48px; }
  .welcome-screen > * { grid-column: 1; }
  .welcome-screen > .demo { grid-column: 2; grid-row: 1 / span 8; align-self: center; margin: 0; box-shadow: var(--shadow); }
  .welcome-title { font-size: clamp(3rem, 5.4vw, 4.6rem); margin: 40px 0 18px; }
  .welcome-lead { margin: 0; font-size: 1.2rem; max-width: 30em; }
  .pills { justify-content: flex-start; margin-top: 24px; }
  .welcome-foot { margin-top: 0; padding-top: 30px; flex-direction: row; flex-wrap: wrap; }
  .welcome-foot .big { flex: none; padding: 0 24px; white-space: nowrap; }
  .welcome-foot p { flex-basis: 100%; text-align: left; }
}

@media (min-width: 1200px) {
  body:not(.locked) #list-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 26vw, 340px); column-gap: 28px; align-items: start; }
  body:not(.locked) .list-main, body:not(.locked) .list-side { display: block; }
  .list-side { position: sticky; top: 88px; }
  .list-side > :first-child { margin-top: 0; }
  #all-done { margin-top: 18px; }

  /* The summary as a card with a large ring. */
  .list-side .list-head { flex-direction: column-reverse; gap: 14px; margin: 0; padding: 26px 20px 22px; border-radius: 26px;
    background: var(--surface); box-shadow: var(--shadow-soft); text-align: center; }
  .list-side .list-head-text { align-items: center; }
  .list-side .ring { width: 148px; height: 148px;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px)); }
  .list-side .ring-label { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
  .list-side .summary { font-size: 1rem; }

  .list-side .promo { margin-top: 14px; }
  .list-side .cart-wrap { margin-top: 14px; }
  .list-side .cart { width: 100%; min-height: 54px; padding: 0 16px; border: 0; border-radius: 20px; box-shadow: var(--shadow-soft); font-size: .95rem; }
  .list-side .cart .chevron { margin-left: auto; }
  .list-side .done-list { max-height: calc(100vh - 420px); overflow-y: auto; scrollbar-width: thin; }
  .list-side .done-list .item-row { padding-right: 4px; }
}

@media (hover: hover) and (pointer: fine) {
  #swipe-hint { display: none !important; }
  .item-row:hover { background: color-mix(in srgb, var(--soft) 60%, var(--surface)); }
  .done-list .item-row:hover { background: var(--surface); }
  .item-main, .chip, .cart, .dock-link, .menu-item, .product-list button.product-text { cursor: pointer; }
  .chip:not(.on):hover { border-color: var(--accent); }
  .cart:hover { border-color: var(--accent); }
  .dock-link:not([aria-current="page"]):hover { background: var(--soft); color: var(--text); }
  .dock-scan:hover { filter: brightness(1.06); }
  #view-settings .menu-item:hover { background: color-mix(in srgb, var(--soft) 60%, var(--surface)); }
  .qty button:not(:disabled):hover, .check:hover span { background: var(--surface); }
  .check:hover span { border-color: var(--accent); }
  .icon-btn:hover { background: var(--soft); }
}

/* Printed list (browser print dialog): only #print-sheet, black on white. */
#print-sheet { display: none; }
#print-sheet .print-credit { margin-top: 14pt; font-size: 8pt; }
@media print {
  body { background: #fff; }
  body > *:not(#print-sheet) { display: none !important; }
  #print-sheet { display: block; color: #000; font: 12pt/1.4 system-ui, sans-serif; }
  #print-sheet h1 { font-size: 16pt; margin: 0 0 2pt; }
  #print-sheet .print-date { margin: 0 0 8pt; font-size: 10pt; }
  #print-sheet h2 { font-size: 12pt; margin: 10pt 0 2pt; padding-bottom: 1pt; border-bottom: 1px solid #000; break-after: avoid; }
  #print-sheet ul { list-style: none; margin: 0; padding: 0; }
  #print-sheet li { display: flex; gap: 6pt; padding: 2pt 0; break-inside: avoid; }
  #print-sheet .box { flex: none; width: 9pt; height: 9pt; margin-top: 3pt; border: 1px solid #000; }
  #print-sheet .name { flex: 1; }
  #print-sheet .note { font-style: italic; }
  #print-sheet .price { white-space: nowrap; }
  #print-sheet .print-total { margin-top: 10pt; padding-top: 4pt; border-top: 1px solid #000; }
  #print-sheet .card { max-width: 12cm; padding: 12pt 14pt; border: 1.5pt dashed #000; border-radius: 6pt; break-inside: avoid; }
  #print-sheet .card-code { margin: 8pt 0; font: 700 18pt/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
  #print-sheet .card-qr { width: 4cm; height: 4cm; margin: 4pt 0; }
  #print-sheet .card-qr svg { width: 100%; height: 100%; }
  #print-sheet .card-qr rect { fill: #000; }
  #print-sheet .card ol { margin: 6pt 0 0; padding-left: 14pt; }
  #print-sheet .card p { margin: 4pt 0; }
}

/* Trial over or subscription ended: instead of "locked", what the
   household did so far, the waiting scans and the offer. Scanning stays:
   scans are kept and reach the list once unlocked. */
body.locked #list-body, body.locked #btn-print { display: none !important; }
.locked-panel { padding: 8px 0 16px; }
.locked-tag { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 700; }
.locked-panel h2 { margin: 14px 2px 6px; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 8.5vw, 2.1rem); letter-spacing: -.03em; line-height: 1.02; }
.locked-lead { margin: 0 2px; color: var(--muted); line-height: 1.45; }
.locked-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.stat { padding: 14px 14px 12px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-soft); animation: rise .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.stat:nth-child(2) { animation-delay: .08s; }
.stat:nth-child(3) { animation-delay: .16s; }
.stat:last-child:nth-child(2) { grid-column: 1 / -1; }
.stat.wide { grid-column: 1 / -1; background: var(--inv); color: var(--on-inv); }
.stat b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.stat.wide span { color: var(--on-inv-muted); }
.locked-pending { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-soft); }
.locked-pending strong { display: block; }
.locked-pending span { display: block; margin-top: 2px; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.fan { position: relative; flex: none; width: 92px; height: 64px; }
.fan span { position: absolute; left: 8px; top: 14px; width: 76px; height: 38px; margin: 0; padding: 0 8px; border-radius: 12px; border: 1.5px solid var(--line);
  display: flex; align-items: center; font-size: .7rem; font-weight: 700; white-space: nowrap; overflow: hidden; animation: wobble 3s ease-in-out infinite; }
.fan span:nth-child(1) { transform: rotate(-9deg) translate(-6px, 2px); }
.fan span:nth-child(2) { transform: rotate(4deg) translate(4px, -4px); animation-delay: .2s; }
.fan span:nth-child(3) { transform: rotate(-1deg) translate(0, 6px); animation-delay: .4s; }
@keyframes wobble { 0%, 100% { margin-top: 0; } 50% { margin-top: -4px; } }
.offer { position: relative; margin-top: 12px; padding: 20px 18px 18px; border-radius: 26px; border: 2px solid var(--accent); background: var(--surface); overflow: hidden; }
.offer-ribbon { position: absolute; top: 16px; right: -34px; padding: 4px 40px; transform: rotate(35deg); background: var(--accent); color: var(--accent-text); font-size: .7rem; font-weight: 700; }
.offer h3 { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.offer-for { margin: 6px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.benefits { list-style: none; margin: 14px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.benefits li { display: flex; align-items: flex-start; gap: 10px; font-size: .9rem; line-height: 1.35; }
.benefits .i { flex: none; width: 22px; height: 22px; padding: 5px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); stroke-width: 3.2; }
.offer .primary.big { width: 100%; min-height: 58px; border-radius: 20px; font-size: 1.05rem; font-weight: 700; box-shadow: 0 14px 26px -10px color-mix(in srgb, var(--accent) 75%, transparent); }
.locked-fine { margin: 14px 4px 0; text-align: center; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.locked-fine a { color: var(--accent-strong); font-weight: 600; }
button.locked-remind { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px auto 0; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--chipline); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: .85rem; }
button.locked-remind .i { width: 17px; height: 17px; color: var(--accent-strong); }
.locked-remind-done { margin: 14px 4px 0; text-align: center; color: var(--accent-strong); font-size: .8rem; font-weight: 600; }
.trial-hint { margin: -4px 0 8px 4px; }

/* A list of another household: who shared it, and whether it can only be
   looked at. The guest sees no store filter and edits only quantities. */
.shared-note { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 8px 12px; border-radius: 14px; background: var(--soft); color: var(--muted); line-height: 1.4; }
.shared-note .i { flex: none; width: 16px; height: 16px; }
.shared-note.read-only { background: var(--warn-soft); color: var(--warn); }
body.on-shared #store-chips, body.on-shared #unassigned-switch { display: none; }
#dlg-edit.guest .owner-only { display: none; }

/* Scan station setup */
#view-station section { margin: 12px 0; }
#view-station progress { width: 100%; height: 10px; }
.station-advanced { margin: 4px 0 8px; font-size: .9rem; color: var(--muted); }
.station-legend { list-style: none; margin: 0 0 8px; padding: 0; font-size: .9rem; }
.station-legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.station-legend .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.station-legend .dot.blink { animation: station-blink 1s steps(1) infinite; }
@keyframes station-blink { 50% { opacity: .2; } }

/* The texts come from the dictionary of the device's language (app.js,
   share.js); until they are in place the page stays invisible. */
html.i18n-pending body { visibility: hidden; }
