/* Hallmark · shape: app screen · genre: modern-minimal · theme: Coral (deal 1/3, seed utilitarian-supermarket-bill-estimator-3a02·b07c1f54·2026-10-30·r0)
 * nav: top bar with wordmark, cart/list groove switch (phone), new-cart action · signature: the till receipt, a cotton slip whose total is the biggest thing on screen · states: start, empty cart, full, over budget, empty list, scan (starting, scanning, form, lookup, fail), offline
 * axes: light/grotesk-sans/warm · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R3 V4 · weakest: R (range), the list panel is plain rows; kept plain on purpose so the receipt carries the identity */
/* Hallmark · waive 28b · the only video is the live camera viewfinder inside the scan sheet · a poster frame on a shopper's camera feed would show a stale picture before the barcode scan starts */
@import url("./tokens.css");
@import url("./base.css");

@font-face { font-family: "General Sans"; src: url("fonts/general-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("fonts/general-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("fonts/general-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --bar-h: 60px;
  --actions-h: 84px;
  --hit: 44px;
  --ctl: 40px;
  --ctl-big: 52px;
  --panel-max: 1120px;
  --color-over: oklch(49% 0.165 29);
  --color-warn-ground: oklch(95% 0.03 60);
  --color-over-ground: oklch(94% 0.035 30);
  --color-flash: oklch(95% 0.04 75);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.num { font-family: var(--font-outlier); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--color-muted); }
.small { font-size: var(--text-sm); }
.hint { font-size: var(--text-sm); color: var(--color-muted); }
.label { font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); }
.tag { display: inline-block; font-family: var(--font-body); font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); border: 1px solid var(--color-rule-2); border-radius: var(--radius-input); padding: 0 var(--space-2xs); line-height: 1.5; vertical-align: 0.1em; white-space: nowrap; }
.link { background: none; border: 0; padding: 0; color: var(--color-ink); font: inherit; text-decoration: underline; text-decoration-color: var(--color-accent); text-underline-offset: 0.18em; cursor: pointer; min-height: var(--hit); }
.link:hover { text-decoration-thickness: 2px; }
.link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 2px; }

body { background: var(--tex-desk) var(--color-desk); min-height: 100dvh; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: var(--z-sticky-nav); background: var(--color-paper); border-bottom: 1px solid var(--color-rule); padding-top: env(safe-area-inset-top); }
.bar-in { max-width: var(--panel-max); margin-inline: auto; height: var(--bar-h); display: flex; align-items: center; gap: var(--space-sm); padding-inline: var(--space-md); }
.wordmark { font-weight: 600; font-size: var(--text-lg); letter-spacing: -0.03em; text-decoration: none; color: var(--color-ink); margin-right: auto; min-height: var(--hit); display: inline-flex; align-items: center; }
.wordmark span { color: var(--color-paid); }
.wordmark:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

/* the groove switch: a channel pressed into cotton, a card riding to the chosen stop */
.switch { display: inline-flex; padding: var(--space-2xs); border-radius: 12px; background: var(--color-paper-2); box-shadow: var(--press-groove); }
.switch button { appearance: none; border: 0; background: transparent; color: var(--color-muted); font: inherit; font-weight: 500; font-size: var(--text-sm); min-height: 36px; min-width: 64px; padding: 0 var(--space-sm); border-radius: var(--radius-card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs); transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.switch button[aria-selected="true"] { background: var(--color-cotton); color: var(--color-ink); box-shadow: var(--edge-stock), var(--cast-stock); }
.switch button:hover { color: var(--color-ink); }
.switch button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; transition: none; }
.count { font-family: var(--font-outlier); font-size: var(--text-xs); color: var(--color-muted); }
.count:empty { display: none; }

/* ---------- buttons ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--ctl); padding: 0 var(--space-md); border-radius: var(--radius-card); border: 0; background: var(--color-cotton); color: var(--color-ink); font: inherit; font-weight: 500; font-size: var(--text-md); line-height: 1.2; cursor: pointer; box-shadow: var(--edge-stock), var(--cast-stock); text-shadow: 0 1px 0 oklch(var(--lit) / 0.8); transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); -webkit-tap-highlight-color: transparent; position: relative; }
.btn::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: max(100%, var(--hit)); height: max(100%, var(--hit)); transform: translate(-50%, -50%); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--edge-stock), var(--cast-stock-lift); }
.btn:active { transform: translateY(1px); box-shadow: var(--edge-stock); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--color-board); color: var(--color-board-type); text-shadow: 0 -1px 0 oklch(var(--deep) / 0.8); box-shadow: 0 0 0 0.5px oklch(var(--deep) / 0.6), var(--cast-stock); }
.btn-primary:hover { background: var(--color-ink-2); box-shadow: 0 0 0 0.5px oklch(var(--deep) / 0.6), var(--cast-stock-lift); }
.btn-primary:active { box-shadow: 0 0 0 0.5px oklch(var(--deep) / 0.6); }
.btn-big { min-height: var(--ctl-big); font-size: var(--text-md); padding: 0 var(--space-lg); }
.btn-quiet { background: transparent; box-shadow: none; text-shadow: none; color: var(--color-ink-2); padding: 0 var(--space-sm); }
.btn-quiet:hover { background: var(--color-paper-2); box-shadow: none; transform: none; }
.btn-quiet:active { background: var(--color-paper-3); transform: none; }
.btn-on-dark { color: var(--color-board-type); text-decoration: underline; text-decoration-color: var(--color-accent); text-underline-offset: 0.2em; }
.btn-on-dark:hover { background: var(--color-ink-2); }
.btn-icon { width: var(--ctl); padding: 0; background: transparent; box-shadow: none; text-shadow: none; color: var(--color-ink-2); }
.btn-icon:hover { background: var(--color-paper-2); box-shadow: none; transform: none; }
.btn-icon:active { background: var(--color-paper-3); transform: none; }
.btn-danger-quiet { background: transparent; box-shadow: none; text-shadow: none; color: var(--color-over); padding: 0 var(--space-sm); }
.btn-danger-quiet:hover { background: var(--color-over-ground); box-shadow: none; transform: none; }

/* ---------- inputs ---------- */
.input { width: 100%; min-height: 48px; padding: 0 var(--space-sm); border: 1px solid var(--color-muted); border-radius: var(--radius-input); background: var(--color-cotton); color: var(--color-ink); font: inherit; font-size: var(--text-md); transition: border-color var(--dur-short) var(--ease-out); }
.input::placeholder { color: var(--color-muted); opacity: 0.8; }
.input:hover { border-color: var(--color-ink-2); }
.input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -1px; transition: none; }
.input[aria-invalid="true"] { border-color: var(--color-error); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.textarea { padding: var(--space-sm); min-height: 180px; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: var(--space-2xs); min-width: 0; }
.field > label { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink-2); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm); }
.field-inline { display: flex; gap: var(--space-xs); }
.field-inline .btn { min-height: 48px; }
.err { min-height: 1lh; font-size: var(--text-sm); color: var(--color-error); }
.err:empty { min-height: 0; }

.stepper { display: flex; align-items: center; gap: var(--space-2xs); }
.stepper .input { text-align: center; min-width: 0; padding: 0 var(--space-2xs); }

/* ---------- layout ---------- */
.shell { max-width: var(--panel-max); margin-inline: auto; padding: var(--space-md) var(--space-md) calc(var(--actions-h) + var(--space-xl) + env(safe-area-inset-bottom)); }
.panel:focus { outline: none; }
body[data-view="cart"] .panel-list { display: none; }
body[data-view="list"] .panel-cart { display: none; }
body[data-view="list"] .shell { padding-bottom: var(--space-2xl); }

/* ---------- the start slip ---------- */
.start { display: grid; place-items: center; min-height: calc(100dvh - var(--bar-h) - var(--space-2xl)); }
.slip { position: relative; background: var(--color-cotton); color: var(--color-print); border-radius: var(--radius-stock) var(--radius-stock) 0 0; box-shadow: var(--edge-stock), var(--cast-stock-lift); }
/* the torn foot of a till roll */
.slip::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: linear-gradient(-45deg, transparent 6px, var(--color-cotton) 0) 0 0 / 12px 8px repeat-x, linear-gradient(45deg, transparent 6px, var(--color-cotton) 0) 6px 0 / 12px 8px repeat-x; filter: drop-shadow(0 2px 1px oklch(var(--shade) / 0.12)); }
.slip-start { width: min(100%, 26rem); padding: var(--space-xl) var(--space-lg) var(--space-xl); display: grid; gap: var(--space-md); text-align: left; }
.slip-start h1 { font-size: var(--text-3xl); max-width: 14ch; line-height: 1.04; }
.slip-start .btn { width: 100%; }
.slip-start .lead { color: var(--color-ink-2); }
.slip-store { font-family: var(--font-outlier); font-size: var(--text-sm); color: var(--color-muted); }
.slip-rule { height: 0; border-top: 1px dashed var(--color-rule-2); }

/* ---------- the receipt (signature) ---------- */
.receipt { background: var(--tex-cotton) var(--color-cotton); color: var(--color-print); border-radius: var(--radius-stock); box-shadow: var(--edge-stock), var(--cast-stock); padding-bottom: var(--space-lg); }
.receipt-head { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: var(--z-sticky); background: var(--color-cotton); padding: var(--space-md) var(--space-md) var(--space-sm); border-bottom: 1px dashed var(--color-rule-2); border-radius: var(--radius-stock) var(--radius-stock) 0 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-sm); align-items: end; }
.receipt-head .label { grid-column: 1 / -1; }
.total { grid-column: 1 / -1; font-size: clamp(2rem, 12vw, 3.5rem); font-weight: 500; line-height: 0.95; letter-spacing: -0.05em; color: var(--color-ink); white-space: nowrap; min-width: 0; }
.receipt-head .units { grid-column: 1 / -1; text-align: left; padding: var(--space-2xs) 0 0; }
.units { font-size: var(--text-sm); color: var(--color-muted); padding-bottom: 0.3em; text-align: right; white-space: nowrap; }
.budget-line { grid-column: 1 / -1; margin-top: var(--space-sm); appearance: none; border: 0; background: none; padding: var(--space-xs) 0; text-align: left; font: inherit; font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; display: grid; gap: var(--space-xs); min-height: var(--hit); border-radius: var(--radius-input); }
.budget-line:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.budget-line:hover .budget-state { text-decoration: underline; text-decoration-color: var(--color-accent); text-underline-offset: 0.18em; }
.budget-state { display: inline-flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap; }
.budget-state strong { font-weight: 600; }
.budget-state .ic { width: 18px; height: 18px; }
.meter { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--color-paper-2); box-shadow: var(--press-groove); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--color-ink-2); transform-origin: left; transform: scaleX(0); transition: transform var(--dur-long) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.receipt-head[data-status="near"] .meter-fill { background: var(--color-accent); }
.receipt-head[data-status="over"] { background: var(--color-over-ground); }
.receipt-head[data-status="over"] .total { color: var(--color-over); }
.total-flag { display: block; font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; line-height: 1.6; }
.receipt-head[data-status="over"] .budget-state { color: var(--color-over); }
.receipt-head[data-status="over"] .meter-fill { background: var(--color-over); }
.advice { padding: var(--space-xs) var(--space-md) var(--space-sm); font-size: var(--text-sm); color: var(--color-ink-2); display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-sm); border-bottom: 1px dashed var(--color-rule-2); }
.advice[data-status="over"] { background: var(--color-over-ground); }
.advice p { max-width: 60ch; }

.chips-wrap { padding: var(--space-md) var(--space-md) var(--space-xs); border-bottom: 1px dashed var(--color-rule-2); }
.chips { list-style: none; margin: var(--space-xs) 0 0; padding: 0 0 var(--space-xs); display: flex; gap: var(--space-xs); overflow-x: auto; scrollbar-width: thin; }
.chip { appearance: none; border: 0; font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; display: grid; gap: var(--space-3xs); min-height: var(--hit); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink); box-shadow: var(--edge-stock), var(--cast-stock); white-space: nowrap; transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.chip:hover { transform: translateY(-1px); box-shadow: var(--edge-stock), var(--cast-stock-lift); }
.chip:active { transform: translateY(1px); box-shadow: var(--edge-stock); }
.chip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.chip-price { font-size: var(--text-xs); color: var(--color-muted); }
.chip > span:first-child { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }

/* the item grid: receipt lines */
.grid { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.grid th { font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); text-align: left; white-space: nowrap; padding: var(--space-sm) var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.grid td { padding: var(--space-xs); border-bottom: 1px solid var(--color-rule); vertical-align: middle; }
.grid th:first-child, .grid td:first-child { padding-left: var(--space-md); }
.grid th:last-child, .grid td:last-child { padding-right: var(--space-md); }
.grid .c-sr { width: 4.5rem; color: var(--color-muted); }
.grid .c-price, .grid .c-amt { text-align: right; white-space: nowrap; }
.grid .c-qty { width: 9.5rem; }
.grid tfoot th, .grid tfoot td { border-bottom: 0; border-top: 2px solid var(--color-print); padding-top: var(--space-sm); font-weight: 600; color: var(--color-ink); font-size: var(--text-md); }
.grid tfoot .c-amt { font-size: var(--text-lg); }
.cell-label { display: none; }
.name-btn { appearance: none; border: 0; background: none; padding: var(--space-2xs) 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: var(--hit); overflow-wrap: anywhere; border-radius: 4px; }
.name-btn:hover { text-decoration: underline; text-decoration-color: var(--color-accent); text-underline-offset: 0.18em; }
.name-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.stepper-row .input { width: 3.25rem; min-height: var(--ctl); text-align: center; }
.stepper-row .btn-icon { width: 36px; min-height: 36px; }
tr.flash td { animation: flash 1.2s var(--ease-out); }
@keyframes flash { from { background: var(--color-flash); } to { background: transparent; } }

.cart-empty, .list-empty { padding: var(--space-xl) var(--space-md); display: grid; gap: var(--space-2xs); }
.cart-empty p:first-child, .list-empty p:first-child { font-weight: 600; font-size: var(--text-lg); letter-spacing: -0.02em; }
.credit { margin-top: var(--space-xs) !important; }
.disclaimer { margin: var(--space-md) var(--space-md) 0; font-size: var(--text-sm); color: var(--color-muted); max-width: 60ch; }

/* ---------- bottom actions (thumb reach) ---------- */
.actions { position: fixed; z-index: var(--z-sticky); left: 0; right: 0; bottom: 0; padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom)); background: var(--color-paper); border-top: 1px solid var(--color-rule); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-xs); }
.actions .btn { width: 100%; padding: 0 var(--space-sm); }
body[data-view="list"] .actions { display: none; }

/* ---------- list ---------- */
.panel-list { display: grid; gap: var(--space-sm); align-content: start; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.panel-head h2 { font-size: var(--text-xl); }
.add-line { display: flex; gap: var(--space-xs); }
.add-line .btn { width: 48px; min-height: 48px; padding: 0; flex: none; }
.list { list-style: none; margin: 0; padding: 0; background: var(--color-cotton); border-radius: var(--radius-card); box-shadow: var(--edge-stock), var(--cast-stock); }
.list:empty { display: none; }
.entry { display: grid; grid-template-columns: var(--hit) minmax(0, 1fr) auto var(--ctl); align-items: center; gap: var(--space-2xs); padding: var(--space-2xs) var(--space-xs) var(--space-2xs) var(--space-2xs); border-bottom: 1px solid var(--color-rule); min-height: 52px; }
.entry:last-child { border-bottom: 0; }
.tick { display: grid; place-items: center; width: var(--hit); height: var(--hit); cursor: pointer; }
.tick input { width: 22px; height: 22px; accent-color: var(--color-ink); cursor: pointer; margin: 0; }
.tick input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.entry-name { overflow-wrap: anywhere; }
.entry-meta { font-size: var(--text-sm); color: var(--color-muted); display: inline-flex; align-items: center; gap: var(--space-2xs); white-space: nowrap; }
.entry-meta .ic { width: 16px; height: 16px; }
.entry.is-done .entry-name { text-decoration: line-through; text-decoration-color: var(--color-muted); color: var(--color-muted); }
.entry.is-got .entry-meta { color: var(--color-ink-2); }
.list-foot { display: flex; justify-content: flex-end; gap: var(--space-xs); flex-wrap: wrap; }

/* ---------- sheets ---------- */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 34rem; max-height: 92dvh; overflow: auto; border-radius: 14px 14px 0 0; background: var(--color-cotton); color: var(--color-print); box-shadow: var(--edge-stock), 0 -12px 32px -12px oklch(var(--shade) / 0.35); }
dialog:not([open]) { display: none; }
.sheet::backdrop { background: oklch(var(--deep) / 0.42); }
.sheet[open] { animation: rise var(--dur-short) var(--ease-out); }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet > form, .sheet-scan { display: grid; gap: var(--space-md); padding: var(--space-md) var(--space-md) calc(var(--space-lg) + env(safe-area-inset-bottom)); }
.sheet-scan > form { display: grid; gap: var(--space-sm); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.sheet-head h2 { font-size: var(--text-xl); }
.sheet-note { font-size: var(--text-sm); color: var(--color-ink-2); background: var(--color-paper-2); border-radius: var(--radius-input); padding: var(--space-xs) var(--space-sm); }
.sheet-actions { display: flex; gap: var(--space-xs); justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.sheet-actions .btn-primary { flex: 1 1 12rem; }
.line-preview { font-size: var(--text-sm); color: var(--color-ink-2); min-height: 1lh; }
.sheet-small { max-width: 26rem; }
.sheet-small form { gap: var(--space-sm); }
.sheet-small h2 { font-size: var(--text-xl); }

.viewfinder { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-card); overflow: hidden; background: var(--color-board); }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.aim { position: absolute; left: 10%; right: 10%; top: 50%; height: 0; border-top: 2px solid var(--color-accent); box-shadow: 0 0 0 1px oklch(var(--deep) / 0.25); }
.sheet-scan[data-mode="form"] .viewfinder { aspect-ratio: 16 / 7; }
.vf-paused { position: absolute; left: var(--space-xs); top: var(--space-xs); padding: var(--space-3xs) var(--space-xs); border-radius: var(--radius-input); background: var(--color-board); color: var(--color-board-type); font-size: var(--text-xs); font-weight: 500; }
.sheet-scan[data-mode="form"] .aim { opacity: 0.35; }
.scan-status { font-size: var(--text-sm); color: var(--color-ink-2); min-height: 1lh; }
.scan-fail { display: grid; gap: var(--space-md); }

.insights { margin: 0; display: grid; gap: 0; border-top: 1px dashed var(--color-rule-2); }
.insights > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: 1px dashed var(--color-rule-2); }
.insights dt { font-weight: 500; font-size: var(--text-sm); color: var(--color-ink-2); }
.insights dd { margin: 0; text-align: right; font-size: var(--text-sm); min-width: 0; }
.insights .biggest { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); }
.insights .biggest dd { text-align: left; display: grid; gap: var(--space-2xs); }
.big-line { display: flex; justify-content: space-between; gap: var(--space-sm); }
.big-line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.big-line .num { white-space: nowrap; }
#suggestions h3 { font-size: var(--text-md); margin-bottom: var(--space-xs); }
.fixes { list-style: none; margin: 0 0 var(--space-xs); padding: 0; display: grid; gap: var(--space-xs); }
.fixes li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); background: var(--color-paper); border-radius: var(--radius-input); font-size: var(--text-sm); }
.fixes li > span { min-width: 0; overflow-wrap: anywhere; }
.fixes .btn { flex: none; white-space: nowrap; }

/* ---------- toasts and alerts ---------- */
.notices { position: fixed; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); width: min(calc(100% - var(--space-xl)), 30rem); bottom: calc(var(--actions-h) + var(--space-sm) + env(safe-area-inset-bottom)); display: grid; gap: var(--space-xs); pointer-events: none; }
.toasts, .alerts { display: grid; gap: var(--space-xs); }
body[data-view="list"] .notices { bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); }
.toast, .alert { pointer-events: auto; display: flex; align-items: center; gap: var(--space-sm); border-radius: var(--radius-card); padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-md); min-height: 48px; font-size: var(--text-sm); animation: rise var(--dur-short) var(--ease-out); }
.toast { background: var(--color-board); color: var(--color-board-type); box-shadow: var(--cast-stock-lift); justify-content: space-between; }
.alert { background: var(--color-cotton); color: var(--color-ink); box-shadow: var(--edge-stock), var(--cast-stock-lift); border: 1px solid var(--color-accent); }
.alert > .ic { color: var(--color-accent-2); }
.alert p { flex: 1; }
.alert-over { border-color: var(--color-over); background: var(--color-over-ground); }
.alert-over > .ic { color: var(--color-over); }

.noscript { padding: var(--space-lg); }

/* ---------- tablet and up ---------- */
@media (min-width: 40rem) {
  .shell { padding-inline: var(--space-lg); }
  .receipt-head { padding-inline: var(--space-lg); }
  .grid th:first-child, .grid td:first-child { padding-left: var(--space-lg); }
  .grid th:last-child, .grid td:last-child { padding-right: var(--space-lg); }
  .chips-wrap, .advice { padding-inline: var(--space-lg); }
  .disclaimer { margin-inline: var(--space-lg); }
  .sheet { margin: auto; border-radius: 14px; }
  .actions { left: 50%; right: auto; transform: translateX(-50%); width: min(100%, 34rem); border: 0; background: transparent; padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); }
}

/* ---------- desktop: list and receipt side by side ---------- */
@media (min-width: 60rem) {
  .switch { display: none; }
  .shell { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: var(--space-xl); align-items: start; padding-top: var(--space-xl); padding-bottom: var(--space-2xl); }
  body[data-view] .panel-list, body[data-view] .panel-cart { display: block; }
  body[data-view] .panel-list { display: grid; position: sticky; top: calc(var(--bar-h) + var(--space-xl)); }
  .panel-cart { grid-column: 2; }
  .panel-list { grid-column: 1; grid-row: 1; }
  .actions { position: static; transform: none; width: auto; padding: 0; margin-bottom: var(--space-md); display: flex; gap: var(--space-xs); grid-template-columns: none; order: -1; }
  .actions .btn { width: auto; }
  .panel-cart { display: flex !important; flex-direction: column; }
  .notices { bottom: var(--space-lg); }
  .start { min-height: auto; padding-top: var(--space-xl); place-items: start; }
}

/* ---------- phones: restack the grid rows as receipt lines ---------- */
@media (max-width: 39.99rem) {
  .grid thead { display: none; }
  .grid tbody tr { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; grid-template-areas: "sr name amt" ". price qty"; column-gap: var(--space-xs); row-gap: 0; padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-rule); }
  .grid tbody td { border: 0; padding: 0; }
  .grid tbody td:first-child { padding-left: 0; }
  .grid tbody td:last-child { padding-right: 0; }
  .grid tbody .c-sr { grid-area: sr; width: auto; padding-top: 0.6em; font-size: var(--text-sm); }
  .grid tbody .c-name { grid-area: name; }
  .grid tbody .c-amt { grid-area: amt; padding-top: 0.55em; font-weight: 500; }
  .grid tbody .c-price { grid-area: price; text-align: left; font-size: var(--text-sm); color: var(--color-muted); align-self: center; }
  .grid tbody .c-qty { grid-area: qty; width: auto; justify-self: end; }
  .cell-label { display: inline; font-family: var(--font-body); }
  .grid tfoot tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--space-sm); padding: var(--space-sm) var(--space-md) 0; border-top: 2px solid var(--color-print); }
  .grid tfoot th, .grid tfoot td { border: 0; padding: 0; }
  .grid tfoot .c-qty, .grid tfoot .c-price { display: none; }
  .grid tfoot .c-sr { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill, .btn, .chip, .switch button { transition: none; }
  tr.flash td { animation: none; background: var(--color-flash); }
}
