:root {
  color-scheme: light dark;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --bg: #f3f6f5;
  --surface: #ffffff;
  --ink: #14181b;
  --ink-soft: #6b757c;
  --line: #e3e9e7;
  --accent: #0b6e99;
  --accent-soft: rgba(11, 110, 153, 0.09);
  --warn: #a8531b;
  --warn-soft: rgba(168, 83, 26, 0.12);

  --walk-line: #ccdae0;

  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;

  --gutter: 1rem;

  --t-xs: 0.7rem;
  --t-sm: 0.8rem;
  --t-md: 0.85rem;
  --t-lg: 0.95rem;
  --t-xl: 1.05rem;
  --t-2xl: 1.2rem;

  --term: 7rem;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --walk: 24px;
  --stop: 13px;
  --sign-line: 18px;

  --tick: 1.15rem;

  --lip: 5px;
  --card-peek: 16px;
  --headroom: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101416;
    --surface: #191f21;
    --ink: #edf1f0;
    --ink-soft: #98a2a6;
    --line: #283134;
    --accent: #52c4ec;
    --accent-soft: rgba(82, 196, 236, 0.13);
    --warn: #e2a06a;
    --warn-soft: rgba(226, 160, 106, 0.14);
    --walk-line: #33454c;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { height: var(--frame, 100%); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;

  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  height: var(--frame, 100svh);
  max-width: 34rem;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

header {
  flex: none;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: calc(var(--s3) + var(--safe-top)) calc(var(--gutter) + var(--safe-right)) var(--s3) calc(var(--gutter) + var(--safe-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.mark {
  flex: none;
  width: 20px;
  height: 20px;
  display: block;
}

h1 {
  margin: 0;
  font-size: var(--t-xl);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tally {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.more {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
}

.more svg { display: block; fill: currentColor; }
.more:hover { color: var(--accent); border-color: var(--accent); }
.more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Two snap stops: at rest a strip of the card shows under the header; past the list's top the whole card is in view. */
.scroll:has(> .pocket:not([hidden])) { scroll-snap-type: y mandatory; }

.pocket {
  padding-top: var(--headroom);
  scroll-snap-align: start;
}

.pocket .card {
  width: 100%;
  border-bottom: var(--lip) solid var(--card-band);
  border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius-sm);
}

/* The list is at least a screen tall, so there is always room to scroll the card out of view. */
.pocket:not([hidden]) + .route {
  min-height: calc(100% - var(--card-peek));
  scroll-snap-align: start;
  scroll-margin-top: var(--card-peek);
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  padding: 0 calc(var(--gutter) + var(--safe-right)) var(--s4) calc(var(--gutter) + var(--safe-left));
}

/* The top gap sits on .route, not .scroll: a scroll container's padding moves where sticky headers stick. */
.route { position: relative; padding-top: var(--s3); }
.route:has(.group) { padding-left: var(--walk); }

.route:has(.group)::before {
  content: "";
  position: absolute;
  left: calc(var(--stop) / 2 - 0.5px);
  top: calc(var(--s3) + var(--s1) + var(--sign-line) / 2);
  bottom: 0;
  width: 1px;

  background: linear-gradient(var(--walk-line) calc(100% - 1.5rem), transparent);
}

.group { margin: 0; }
.group + .group { margin-top: var(--s3); }

.group h2 {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: 0;
  padding: var(--s1) 0 var(--s2);
  line-height: var(--sign-line);
  white-space: nowrap;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 700;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.group h2::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--walk));
  top: calc(var(--s1) + var(--sign-line) / 2);
  transform: translateY(-50%);
  width: calc(var(--stop) - 4px);
  height: calc(var(--stop) - 4px);
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.group h2 .aisle {
  flex: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group h2 .count {
  margin-left: auto;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.group[data-done="true"] h2::before { background: var(--accent); }
.group[data-done="true"] h2 { color: var(--ink-soft); }

.fold {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.fold:hover { color: var(--accent); }
.fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }

.chev {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--s4);
  height: var(--s4);
  color: var(--ink-soft);
  font-size: var(--t-xs);
  line-height: 1;
  transition: transform 0.18s ease;
}

.group[data-collapsed="true"] .chev { transform: rotate(-90deg); }

.group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.item {
  display: grid;
  grid-template-columns: var(--tick) var(--tick) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.item:last-child { border-bottom: 0; }

.tick {
  grid-column: 1;
  width: var(--tick);
  height: var(--tick);
  flex: none;
  padding: 0;
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.tick::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--s2));
}

.tick::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.12rem;
  width: 0.26rem;
  height: 0.54rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg) scale(0.4);
  opacity: 0;
  transition: 0.14s ease;
}

.item[data-checked="true"] .tick { background: var(--accent); border-color: var(--accent); }
.item[data-checked="true"] .tick::after { opacity: 1; transform: rotate(42deg) scale(1); }
.tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.glyph {
  grid-column: 2;
  width: var(--tick);
  font-size: var(--t-lg);
  line-height: 1;
  text-align: center;
}

.item[data-checked="true"] .glyph { filter: grayscale(1); opacity: 0.7; }

.glyph img {
  display: block;
  width: var(--tick);
  height: var(--tick);
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.link-icon {
  flex: none;
  width: 0.95em;
  height: 0.95em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.linked {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 14ch;
  min-width: 0;
  color: var(--accent);
  font-size: var(--t-xs);
  line-height: 1.35;
  text-decoration: none;
  position: relative;
}

.linked::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--s3)) calc(-1 * var(--s1));
}

.linked:hover span { text-decoration: underline; }
.linked:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.linked span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary {
  grid-column: 3;
  font-size: var(--t-lg);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tail {
  grid-column: 4;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.qualifier {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: var(--t-xs);
  line-height: 1.35;
  font-style: italic;
}

.quantity {
  padding: 2px var(--s1);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--t-xs);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.info {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  position: relative;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
}

.info::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--s2));
}

.info[data-told="true"] { opacity: 1; border-color: var(--line); color: var(--accent); }
.info:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }

.item[data-checked="true"] .primary { text-decoration: line-through; }
.item[data-checked="true"] { opacity: 0.45; }

.item[data-status="failed"] .primary { color: var(--warn); }

.item[data-declined="true"] { opacity: 0.4; }
.item[data-declined="true"] .primary { text-decoration: line-through; font-weight: 400; }

.item .note {
  grid-column: 3 / 5;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: var(--t-xs);
  line-height: 1.35;
}

.item .note.reason { font-style: italic; }

.item.joined { border-bottom-color: transparent; }

.joint {
  display: flex;
  align-items: center;
  height: 0;
  padding-left: calc(var(--s3) + 2 * (var(--tick) + var(--s2)));
  pointer-events: none;
}

.joint span {
  position: relative;
  z-index: 1;
  padding: 0 var(--s1);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.jump {
  position: relative;
  max-width: 9rem;
  padding: 2px var(--s2);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--t-xs);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.jump:hover { border-color: var(--accent); }
.jump:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.item.found { animation: found 1.2s ease; }

@keyframes found {
  0%, 60% { background: var(--accent-soft); }
  to { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .item.found { animation: none; background: var(--accent-soft); }
}

.retry {
  padding: var(--s1) var(--s2);
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font: inherit;
  font-size: var(--t-xs);
  cursor: pointer;
}

.landed { animation: land 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

@keyframes land {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.empty { padding: var(--s4) 0; color: var(--ink-soft); font-size: var(--t-md); }

.composer {
  flex: none;
  z-index: 5;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0 calc(var(--gutter) + var(--safe-right)) calc(var(--s3) + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
  box-shadow: 0 -14px 26px -22px rgba(0, 0, 0, 0.4);
}

.tray { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) 0 0; }
.tray:empty { display: none; }

.pending-batch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  animation: land 0.3s ease both;
}

.pending-batch .text {
  font-size: var(--t-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-batch .count {
  font-size: var(--t-xs);
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.shimmer {
  width: 2rem;
  height: 3px;
  flex: none;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line), var(--accent), var(--line));
  background-size: 200% 100%;
  animation: slide 1.15s linear infinite;
}

@keyframes slide {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

.suggestions {
  margin: var(--s3) 0 0;
  padding: 0;
  list-style: none;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.suggestions[hidden], .usuals[hidden] { display: none; }

.suggestion { display: flex; align-items: center; }
.suggestion + .suggestion { border-top: 1px solid var(--line); }

.suggestion-add {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s1) var(--s3);
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.suggestion-add .glyph, .usual-row .glyph { flex: none; }
.suggestion-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-quantity { color: var(--ink-soft); }
.suggestion-note { color: var(--ink-soft); font-style: italic; }

.suggestion-fill {
  flex: none;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.suggestion-fill svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.suggestion-add:hover, .suggestion-fill:hover { background: var(--accent-soft); }
.suggestion-add:focus-visible, .suggestion-fill:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.plus { flex: none; color: var(--accent); font-weight: 600; }

.usuals { display: flex; align-items: center; gap: var(--s2); padding-top: var(--s3); }

.chips {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 1.5rem), transparent);
}

.chips::-webkit-scrollbar { display: none; }

/* Lets the last chip scroll clear of the fade. */
.chips::after { content: ""; flex: none; width: calc(1.5rem - var(--s2)); }

.chip {
  flex: none;
  height: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.9rem 0 0.7rem;
  border: 1px solid var(--walk-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-lg);
  white-space: nowrap;
  cursor: pointer;
}

.chip .glyph { width: auto; }

.all-usuals {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--walk-line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.all-usuals svg { fill: currentColor; }

.chip:hover, .all-usuals:hover { border-color: var(--accent); }
.chip:focus-visible, .all-usuals:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.usual-rows { margin: var(--s2) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }

.usual-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 3.75rem;
  border-bottom: 1px solid var(--line);
}

.usual-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.usual-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usual-every { color: var(--ink-soft); font-size: var(--t-sm); }

.usual-remove, .usual-add {
  flex: none;
  min-height: 2.25rem;
  padding: 0 var(--s3);
  border-radius: 999px;
  font: inherit;
  font-size: var(--t-md);
  cursor: pointer;
}

.usual-remove { border: 0; background: transparent; color: var(--ink-soft); }
.usual-add { border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 600; }
.usual-remove:focus-visible, .usual-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#status {
  margin: var(--s2) 0 0;
  color: var(--ink-soft);
  font-size: var(--t-md);
}

#status:empty { display: none; }
#status[data-kind="warn"] { color: var(--warn); }
#status a { color: var(--accent); word-break: break-all; }

#status .linky {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

#status .linky:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#capture { display: flex; align-items: flex-end; gap: var(--s2); padding-top: var(--s3); }

#omnibar {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 5.4rem;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  line-height: 1.35;

  scrollbar-width: none;
}

#omnibar::-webkit-scrollbar { display: none; }

#omnibar:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

#send {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: var(--t-xl);
  cursor: pointer;
  transition: opacity 0.12s ease;
}

#send:disabled { opacity: 0.32; cursor: default; }
#send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.attach {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.attach svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.attach:hover { color: var(--accent); background: var(--accent-soft); }

.attach:has(+ #photo:focus-visible),
.attach:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  color: var(--accent);
}

.reading .text { color: var(--ink-soft); }

.peek { display: none; }

.composer[data-state="peek"] .peek {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s3) 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.composer[data-state="peek"] #capture,
.composer[data-state="peek"] .suggestions,
.composer[data-state="peek"] .usuals,
.composer[data-state="peek"] .tray { display: none; }

.peek:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.peek .pcount { font-size: var(--t-md); color: var(--accent); font-variant-numeric: tabular-nums; }
.peek .pnext { font-size: var(--t-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek .pnext b { color: var(--ink); font-weight: 600; }

.peek .plus {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: var(--t-xl);
  line-height: 1;
}

.peek:hover .plus { color: var(--accent); border-color: var(--accent); }

.scrim {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(8, 18, 22, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.app[data-sheet="1"] .scrim { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  max-height: 84%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: var(--s2) calc(var(--gutter) + var(--safe-right)) calc(var(--s4) + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
  visibility: hidden;
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s linear 0.26s;
  box-shadow: 0 -18px 40px -20px rgba(0, 15, 22, 0.5);
}

.app[data-sheet="1"] .sheet {
  visibility: visible;
  transform: none;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s;
}

.app[data-sheet="1"] .sheet[data-dragging="1"] { transition: none; }

.sheet[hidden] { display: block; }

.grip {
  display: block;
  width: 3rem;
  height: 1.5rem;
  margin: 0 auto var(--s2);
  padding: 0;
  border: 0;
  background: none;
  touch-action: none;
  cursor: pointer;
}

.grip::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 4px;
  margin: 0.5rem auto 0;
  border-radius: 4px;
  background: var(--line);
}

.sheet h3 { margin: 0; font-size: var(--t-2xl); font-weight: 600; }

.shop-words {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s1) var(--s3);
  margin: var(--s3) 0 0;
}

.shop-words dt {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.shop-words dd {
  margin: 0;
  min-width: 0;
  font-size: var(--t-lg);
  color: var(--ink);
}

.shop-words dd .printed { color: var(--ink-soft); }
.shop-words dd .printed::before { content: " · "; }

.exact {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s3);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--accent);
  text-decoration: none;
}

.exact:hover { border-color: var(--accent); background: var(--accent-soft); }
.exact:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.exact img {
  flex: none;
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
}

.exact .words { display: flex; flex-direction: column; min-width: 0; }

.exact .title {
  color: var(--ink);
  font-size: var(--t-md);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.exact .site { font-size: var(--t-xs); }

.outlinks { display: flex; gap: var(--s2); margin-top: var(--s4); }

.outlinks a {
  flex: 1;
  padding: var(--s2) var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: var(--t-md);
  text-align: center;
  text-decoration: none;
}

.outlinks a:hover { border-color: var(--accent); background: var(--accent-soft); }
.outlinks a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.facts { margin: var(--s4) 0 0; }

.fact {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-md);
}

.fact:last-child { border-bottom: 0; }

.fact dt {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 2px;
}

.fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.fact dd a { color: var(--accent); }

.fact dd .who { color: var(--ink); }
.fact dd .device { color: var(--ink-soft); }
.fact dd .device::before { content: " · "; }

.quote { font-size: var(--t-md); }

.hint { margin: var(--s4) 0 0; font-size: var(--t-md); color: var(--ink-soft); }

.picker { display: flex; flex-direction: column; margin-top: var(--s3); }

.options {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s2) var(--s3);
  margin: var(--s3) 0 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}

.options dt {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.options dd { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); margin: 0; min-width: 0; font-size: var(--t-md); }
.options dd:has(.edit) { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.options dd:has(.field) { align-items: stretch; }
.options .reason { font-style: italic; }
.options .none { color: var(--ink-soft); }
.options .fine { margin: 0; }

.options .to,
.options .edit {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.options .to { font-size: var(--t-lg); }
.options .to .where { color: var(--ink-soft); font-size: var(--t-md); }
.options .edit { font-size: var(--t-xs); }
.options .to:focus-visible,
.options .edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.picker-label {
  margin: var(--s4) 0 0;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.picker-label + .picker { margin-top: var(--s1); }

.field { display: flex; gap: var(--s2); margin-top: var(--s2); }

.field input {
  flex: 1;
  min-width: 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-lg);
}

.field input:focus { outline: none; border-color: var(--accent); }

.field button {
  flex: none;
  padding: 0 var(--s3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--t-md);
  cursor: pointer;
}

.field button:disabled { opacity: 0.5; cursor: default; }
.field button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fine { margin: var(--s1) 0 0; font-size: var(--t-xs); color: var(--ink-soft); }

.suggest { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }

.suggest button {
  padding: 2px var(--s2);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  cursor: pointer;
}

.suggest button:hover { border-color: var(--accent); color: var(--accent); }
.suggest button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pick {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: var(--s2);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pick:last-child { border-bottom: 0; }
.pick:disabled { opacity: 0.5; cursor: default; }
.pick:disabled:hover { background: transparent; }
.pick:hover { background: var(--accent-soft); }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pick .pt { font-size: var(--t-lg); font-weight: 600; color: var(--ink); }
.pick .pu { font-size: var(--t-sm); color: var(--ink-soft); }
.pick[data-current="true"] .pt { color: var(--accent); }

.acts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s4); }

.signature {
  display: block;
  width: fit-content;
  margin: var(--s4) auto 0;
  color: var(--ink-soft);
  font-size: var(--t-xs);
  text-decoration: none;
}

.signature:hover { color: var(--accent); }
.signature:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.acts button {
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-md);
  cursor: pointer;
}

.acts button:hover { border-color: var(--accent); color: var(--accent); }
.acts button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acts button:disabled { opacity: 0.5; cursor: default; }

.acts .wide { grid-column: 1 / -1; }

.acts .primary { border-color: var(--accent); color: var(--accent); }

.acts .danger { border-color: var(--warn-soft); color: var(--warn); }
.acts .danger:hover { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.acts .danger:focus-visible { outline-color: var(--warn); }

.acts .danger.commit { border-color: var(--warn); background: var(--warn-soft); }

.notice { padding: 3rem var(--s4); text-align: center; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.whoami,
.shop-row,
.log-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.whoami .term,
.shop-row .term,
.log-row .term {
  flex: none;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.whoami .who,
.shop-row .who,
.log-row .who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--t-lg);
  font-weight: 600;
}

.whoami .change,
.shop-row .change,
.log-row .change {
  flex: none;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--t-md);
  cursor: pointer;
}

.whoami .change:focus-visible,
.log-row .change:focus-visible,
.shop-row .change:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.log-row { margin-top: var(--s4); }
.log-row .who { font-size: var(--t-md); font-weight: 400; color: var(--ink-soft); }

.log { margin: var(--s3) 0 0; padding: 0; list-style: none; }

.log li {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-md);
}

.log li:last-child { border-bottom: 0; }
.log-what { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink-soft); }
.log-what b { font-weight: 600; color: var(--ink); }
.log-when { flex: none; font-size: var(--t-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.log .log-empty { color: var(--ink-soft); }

.name-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 6.5rem;
  margin-top: var(--s2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
}

.name-entry input {
  width: 100%;
  padding: 0 var(--s3);
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-2xl);
  font-weight: 600;
  text-align: center;
}

.name-entry input:focus { outline: none; }
.name-entry .cue { margin: 0; color: var(--ink-soft); font-size: var(--t-xs); }

.wallet {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s2);
  padding-bottom: var(--s2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.wallet::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-band);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[data-scheme] { --card-band: var(--accent); --card-face: linear-gradient(#20404f, #12262f); }
[data-scheme="albert-heijn"] { --card-band: #f4791f; --card-face: linear-gradient(#1b9cd8, #0d6ba4); }

.plate {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin: var(--s1);
  padding: var(--s2) var(--s3) var(--s1);
  border-radius: var(--radius-sm);
  background: #fff;
}

.plate svg { display: block; width: 100%; height: 3.1rem; margin-inline: auto; }

.plate .digits {
  margin: 0;
  color: #101314;
  font-size: var(--t-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.card .face {
  flex: 1;
  position: relative;
  padding: var(--s3) var(--s3) var(--s4);
  background: var(--card-face);
  color: #fff;
  text-align: center;
  overflow: hidden;
}

.card .face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 3px, transparent 3px 17px);
  -webkit-mask-image: linear-gradient(transparent 25%, #000 90%);
  mask-image: linear-gradient(transparent 25%, #000 90%);
  pointer-events: none;
}

.card .face .name {
  position: relative;
  z-index: 1;
  font-size: var(--t-xl);
  font-weight: 700;
}

.tap-hint { margin: var(--s1) 0 0; color: var(--ink-soft); font-size: var(--t-xs); text-align: center; }

.sheet-foot { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }

.foot-label {
  margin: 0 0 var(--s2);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.card-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--t-md);
  cursor: pointer;
}

.card-slot:hover { border-color: var(--accent); color: var(--accent); }
.card-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-slot svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.4; }

.card-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 8.5rem;
  margin-top: var(--s2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
}

.card-entry input {
  width: 100%;
  padding: 0 var(--s3);
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--t-2xl);
  letter-spacing: 0.1em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.card-entry input:focus { outline: none; }
.card-entry .cue { color: var(--ink-soft); font-size: var(--t-xs); }
.card-entry[data-kind="warn"] { border-color: var(--warn); }
.card-entry[data-kind="warn"] .cue { color: var(--warn); }

.card-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s2);
}

.card-tools button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--t-xs);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.card-tools button:hover { color: var(--accent); }
.card-tools button:disabled { color: var(--ink-soft); text-decoration: none; cursor: default; }
.card-tools button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.presenter {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  padding: var(--s4) 0 calc(var(--s4) + var(--safe-bottom));
  background: #fff;
  color: #101314;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.app[data-card="1"] .presenter {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0s;
}

.presenter-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--gutter);
  color: #6b757c;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.presenter-top button {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid #dfe5e3;
  border-radius: 50%;
  background: transparent;
  color: #6b757c;
  font: inherit;
  font-size: var(--t-xl);
  line-height: 1;
  cursor: pointer;
}

.presenter-top button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.presenter .wallet {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  margin: 0;
  padding: var(--s3) var(--gutter);
}

.presenter .card { cursor: default; }
.presenter .plate { margin: var(--s2); padding: var(--s3) var(--s4) var(--s2); }
.presenter .plate svg { height: 5.5rem; }
.presenter .plate .digits { font-size: 1.35rem; }

.presenter .card .face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  padding: var(--s4) var(--s3);
}

.presenter .card .face .name { font-size: 1.45rem; }

.presenter .card .face .by {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--s1);
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.presenter .card .face .by svg { display: block; fill: currentColor; }

.presenter-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--gutter);
  color: #6b757c;
  font-size: var(--t-sm);
}

.dots { display: flex; gap: var(--s1); }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #cfd8dc; }
.dots i[data-on="true"] { background: #00559b; }

.awake { display: flex; align-items: center; gap: var(--s1); margin: 0; }
.awake::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #1f9d55; }
