/* THE PHONE TILL'S LOOK (go.rcsbuilder.com/redeem/ - docs/claude/LOYALTY.md 5.6). Converse's design system vocabulary - the
   --cv-* reference and semantic tokens of design/src/shared/tokens.css, by the same names - declared here for the till alone (it is
   a staff tool, not a designable customer face: no design is worn here and the contract's parts are not drawn). Phone first: one
   hand, 48 px and up to tap, 16 px and up to type in (no zoom on focus), high contrast for a bright store, dark mode by the phone's
   own setting. System fonts only - nothing to download before the first paint. */

:root {
  --cv-color-brand: #1a56c8;
  --cv-color-ink: #10131a;
  --cv-color-paper: #ffffff;
  --cv-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cv-radius-s: 8px;
  --cv-radius-m: 12px;
  --cv-radius-l: 18px;
  --cv-space-1: 4px;
  --cv-space-2: 8px;
  --cv-space-3: 12px;
  --cv-space-4: 16px;
  --cv-space-5: 24px;
  --cv-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.08);
  --cv-motion-fast: 120ms;

  --cv-surface: var(--cv-color-paper);
  --cv-on-surface: var(--cv-color-ink);
  --cv-accent: var(--cv-color-brand);
  --cv-on-accent: #ffffff;
  --cv-muted: #4b5262;
  --cv-danger: #b3261e;
  --cv-focus: var(--cv-color-brand);
  --cv-field-font-size: 16px;

  --till-page: #eef1f6;
  --till-line: #c9cfdb;
  --till-good: #0b6b2f;
  --till-good-bg: #e3f6e9;
  --till-warn: #7a4a00;
  --till-warn-bg: #fff2d6;
  --till-bad-bg: #fde8e7;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cv-color-brand: #8ab4ff;
    --cv-color-ink: #f2f4f8;
    --cv-color-paper: #171a21;
    --cv-on-accent: #0b1220;
    --cv-muted: #b7bfcd;
    --cv-danger: #ff8a80;
    --till-page: #0d0f14;
    --till-line: #3a4150;
    --till-good: #7ee2a0;
    --till-good-bg: #0f2c1b;
    --till-warn: #ffd27a;
    --till-warn-bg: #2f2410;
    --till-bad-bg: #3a1514;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--till-page);
  color: var(--cv-on-surface);
  font: 16px/1.45 var(--cv-font-body);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--cv-focus);
  outline-offset: 2px;
}

/* ── The bar ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cv-space-3);
  padding: calc(var(--cv-space-3) + env(safe-area-inset-top)) var(--cv-space-4) var(--cv-space-3);
  background: var(--cv-surface);
  border-bottom: 1px solid var(--till-line);
}

/* THE COMPACT BAR (Kirk, 2026-11-07: "The language can be a small globe drop down so we can see the header. Log sign out an icon
   too."): the store and the person's name take the room and end in an ellipsis; at the right edge two fixed-size controls, 48 px to
   tap like every control here - the globe (the phone's own drop-down over it) and the door (Sign out). The bar is as tall on the
   page's first paint (index.html - the mark alone) as once drawn, and a language change never moves it: nothing shifts. */
.bar-who {
  display: flex;
  align-items: center;
  gap: var(--cv-space-3);
  min-width: 0;
  min-height: 48px;
}

.bar-names {
  min-width: 0;
}

.bar-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-sub {
  margin: 0;
  color: var(--cv-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-tools {
  display: flex;
  align-items: center;
  gap: var(--cv-space-2);
  flex-shrink: 0;
}

.icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* The globe: the drawing shows, the select lies over it unseen and takes the tap, the keys and the screen reader. */
.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 48px;
  border: 1px solid var(--till-line);
  border-radius: var(--cv-radius-m);
  background: var(--cv-surface);
  color: var(--cv-accent);
}

.lang .icon {
  width: 33px;
  height: 22px;
}

.lang-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: var(--cv-field-font-size);
}

/* The select is unseen, so its ring is drawn on the globe - for the keyboard only where the browser can tell. */
.lang:focus-within {
  outline: 3px solid var(--cv-focus);
  outline-offset: 2px;
}

.lang:has(.lang-select:focus:not(:focus-visible)) {
  outline: none;
}

/* The door: an icon button, the same size and frame as the globe; its name (Sign out) is its label and hover title. */
.btn.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-height: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--till-line);
  background: var(--cv-surface);
  color: var(--cv-accent);
}

.btn-icon .icon {
  width: 22px;
  height: 22px;
}

.lang:hover,
.btn.btn-icon:hover:not(:disabled) {
  border-color: var(--cv-accent);
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--cv-accent) url("icon.svg") center / cover no-repeat;
  flex-shrink: 0;
}

/* ── The page ──────────────────────────────────────────────────────────────────────────────────────────────────── */

.main {
  display: grid;
  gap: var(--cv-space-4);
  max-width: 640px;
  margin: 0 auto;
  padding: var(--cv-space-4) var(--cv-space-4) calc(var(--cv-space-5) + env(safe-area-inset-bottom));
}

.card {
  display: grid;
  gap: var(--cv-space-3);
  padding: var(--cv-space-4);
  background: var(--cv-surface);
  border: 1px solid var(--till-line);
  border-radius: var(--cv-radius-l);
  box-shadow: var(--cv-shadow-1);
}

h1,
.card-title {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
}

h2.card-title {
  font-size: 1.15rem;
}

.lead,
.sub,
.hint {
  margin: 0;
  color: var(--cv-muted);
}

.hint {
  font-size: 0.9rem;
}

.eyebrow {
  margin: 0;
  color: var(--cv-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.store-line {
  display: flex;
  justify-content: flex-end;
}

/* ── Fields and buttons ────────────────────────────────────────────────────────────────────────────────────────── */

.field {
  display: grid;
  gap: var(--cv-space-1);
}

.field label,
.inline label {
  font-weight: 600;
}

.input,
.select {
  width: 100%;
  min-height: 48px;
  padding: var(--cv-space-2) var(--cv-space-3);
  border: 2px solid var(--till-line);
  border-radius: var(--cv-radius-m);
  background: var(--cv-surface);
  color: var(--cv-on-surface);
  font: inherit;
  font-size: var(--cv-field-font-size);
}

.input:focus {
  border-color: var(--cv-accent);
  outline: none;
}

.input[aria-invalid="true"] {
  border-color: var(--cv-danger);
}

.input-big {
  min-height: 60px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

textarea.input {
  resize: vertical;
}

.error {
  margin: 0;
  color: var(--cv-danger);
  font-weight: 600;
  font-size: 0.95rem;
}

.btn {
  min-height: 48px;
  padding: 0 var(--cv-space-4);
  border: 2px solid transparent;
  border-radius: var(--cv-radius-m);
  background: transparent;
  color: var(--cv-on-surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--cv-motion-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--cv-accent);
  color: var(--cv-on-accent);
}

.btn-quiet {
  border-color: var(--cv-accent);
  color: var(--cv-accent);
}

.btn-ghost {
  color: var(--cv-accent);
}

.btn-danger {
  background: var(--cv-danger);
  color: var(--cv-color-paper);
}

.btn-small {
  min-height: 40px;
  padding: 0 var(--cv-space-3);
  font-size: 0.95rem;
}

.btn-wide {
  width: 100%;
}

.btn-redeem {
  min-height: 60px;
  font-size: 1.2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cv-space-2);
  justify-content: flex-end;
}

.actions-redeem {
  display: grid;
  grid-template-columns: 1fr 2fr;
}

.more {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--cv-space-2);
}

/* ── The look-up ───────────────────────────────────────────────────────────────────────────────────────────────── */

.look {
  display: grid;
  gap: var(--cv-space-2);
}

.look-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--cv-space-2);
}

.btn-scan {
  min-height: 56px;
}

.inline {
  display: grid;
  gap: var(--cv-space-1);
}

.chip-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cv-space-2);
  margin: 0;
}

.chip {
  padding: var(--cv-space-1) var(--cv-space-3);
  border-radius: 999px;
  background: var(--till-good-bg);
  color: var(--till-good);
  font-weight: 600;
  font-size: 0.9rem;
}

.alts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cv-space-2);
}

.alts .hint {
  width: 100%;
}

.note {
  display: grid;
  gap: var(--cv-space-2);
  padding: var(--cv-space-3);
  border-radius: var(--cv-radius-m);
  background: var(--till-page);
}

.note p {
  margin: 0;
}

.note.is-bad {
  background: var(--till-bad-bg);
  color: var(--cv-on-surface);
  border-left: 5px solid var(--cv-danger);
}

.note.is-warn {
  background: var(--till-warn-bg);
  border-left: 5px solid var(--till-warn);
}

/* ── The shopper ───────────────────────────────────────────────────────────────────────────────────────────────── */

.member-head {
  display: flex;
  align-items: center;
  gap: var(--cv-space-3);
}

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cv-accent);
  color: var(--cv-on-accent);
  font-weight: 800;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--cv-space-2);
  margin: 0;
}

.facts div {
  padding: var(--cv-space-2);
  border-radius: var(--cv-radius-s);
  background: var(--till-page);
}

.facts dt {
  color: var(--cv-muted);
  font-size: 0.8rem;
}

.facts dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.facts-list {
  grid-template-columns: 1fr 1fr;
}

.items,
.list,
.lines,
.today,
.reasons {
  display: grid;
  gap: var(--cv-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--cv-space-2);
  align-items: center;
  padding: var(--cv-space-3);
  border: 1px solid var(--till-line);
  border-radius: var(--cv-radius-m);
}

.item-main {
  grid-column: 1 / -1;
}

.row-title {
  margin: 0;
  font-weight: 700;
}

.row-sub,
.why {
  margin: 0;
  color: var(--cv-muted);
  font-size: 0.9rem;
}

.pill {
  justify-self: start;
  padding: var(--cv-space-1) var(--cv-space-3);
  border-radius: 999px;
  background: var(--till-page);
  font-weight: 700;
  font-size: 0.85rem;
}

.pill.is-fits {
  background: var(--till-good-bg);
  color: var(--till-good);
}

.pill.is-check {
  background: var(--till-warn-bg);
  color: var(--till-warn);
}

.pill.is-no {
  background: var(--till-bad-bg);
  color: var(--cv-danger);
}

.row-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cv-space-2);
  width: 100%;
  min-height: 56px;
  padding: var(--cv-space-3);
  border: 2px solid var(--till-line);
  border-radius: var(--cv-radius-m);
  background: var(--cv-surface);
  color: var(--cv-on-surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row-button.is-current {
  border-color: var(--cv-accent);
}

.row-button:disabled {
  opacity: 0.55;
}

.choices {
  display: grid;
  gap: var(--cv-space-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.choice,
.confirm {
  display: flex;
  align-items: center;
  gap: var(--cv-space-3);
  min-height: 48px;
  padding: var(--cv-space-2) var(--cv-space-3);
  border: 2px solid var(--till-line);
  border-radius: var(--cv-radius-m);
  cursor: pointer;
}

.choice input,
.confirm input {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--cv-accent);
}

/* ── The verdict: READY, CHECK FIRST, or why not - big, for a bright store ─────────────────────────────────────── */

.verdict {
  display: flex;
  align-items: center;
  gap: var(--cv-space-3);
  padding: var(--cv-space-4);
  border-radius: var(--cv-radius-m);
  background: var(--till-page);
}

.verdict p {
  margin: 0;
}

.verdict-word {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
}

.verdict-sub {
  font-weight: 700;
}

.verdict-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--till-line);
}

.verdict.is-fits {
  background: var(--till-good-bg);
  color: var(--till-good);
}

.verdict.is-fits .verdict-mark {
  background: var(--till-good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}

.verdict.is-check {
  background: var(--till-warn-bg);
  color: var(--till-warn);
}

.verdict.is-check .verdict-mark {
  background: var(--till-warn) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 6v8M12 18v.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}

.verdict.is-no {
  background: var(--till-bad-bg);
  color: var(--cv-danger);
}

.verdict.is-no .verdict-mark {
  background: var(--cv-danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 64% no-repeat;
}

.reasons li {
  padding-left: var(--cv-space-3);
  border-left: 3px solid var(--till-line);
}

.checkout,
.mark-used,
.undo {
  display: grid;
  gap: var(--cv-space-3);
}

.mark-used,
.undo.is-open {
  padding: var(--cv-space-3);
  border-radius: var(--cv-radius-m);
  background: var(--till-page);
}

/* ── The receipt ───────────────────────────────────────────────────────────────────────────────────────────────── */

.receipt {
  border-color: var(--till-good);
  border-width: 2px;
}

.receipt.is-undone {
  border-color: var(--till-line);
}

.receipt-head {
  display: flex;
  align-items: center;
  gap: var(--cv-space-3);
}

.receipt-mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--till-good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}

.receipt.is-undone .receipt-mark {
  background: var(--till-line);
}

.lines li {
  padding: var(--cv-space-2) var(--cv-space-3);
  border-radius: var(--cv-radius-s);
  background: var(--till-page);
}

/* ── Today at this store ───────────────────────────────────────────────────────────────────────────────────────── */

.today li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "time name amount" "time who amount";
  column-gap: var(--cv-space-3);
  padding: var(--cv-space-2) 0;
  border-bottom: 1px solid var(--till-line);
}

.today-time {
  grid-area: time;
  color: var(--cv-muted);
  font-variant-numeric: tabular-nums;
}

.today-name {
  grid-area: name;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-who {
  grid-area: who;
  color: var(--cv-muted);
  font-size: 0.9rem;
}

.today-amount {
  grid-area: amount;
  align-self: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.today .is-undone .today-name,
.today .is-undone .today-amount {
  text-decoration: line-through;
  color: var(--cv-muted);
}

.empty {
  display: grid;
  gap: var(--cv-space-1);
  padding: var(--cv-space-4);
  border-radius: var(--cv-radius-m);
  background: var(--till-page);
}

.empty p {
  margin: 0;
}

.empty-title {
  font-weight: 700;
}

.skel {
  height: 72px;
  border-radius: var(--cv-radius-m);
  background: linear-gradient(90deg, var(--till-page), var(--till-line), var(--till-page)) 0 0 / 200% 100%;
  animation: skel 1.2s linear infinite;
}

@keyframes skel {
  to {
    background-position: -200% 0;
  }
}

/* ── The camera sheet (scan.js) ────────────────────────────────────────────────────────────────────────────────── */

.scan-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-content: start;
  gap: var(--cv-space-3);
  padding: calc(var(--cv-space-4) + env(safe-area-inset-top)) var(--cv-space-4) calc(var(--cv-space-4) + env(safe-area-inset-bottom));
  background: #000;
  color: #fff;
}

.scan-title,
.scan-lead {
  margin: 0;
}

.scan-lead {
  color: #d6dbe6;
}

.scan-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--cv-radius-l);
  aspect-ratio: 3 / 4;
  max-height: 65vh;
  background: #111;
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-aim {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--cv-radius-l);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}

.scan-sheet .btn-primary {
  background: #fff;
  color: #000;
}

/* ── At the register: the shoppers' rotating code, and who scanned it just now ─────────────────────────────────────── */

.shopper {
  text-align: center;
}

.shopper .actions {
  justify-content: center;
}

.shopper-qr {
  display: block;
  width: min(80vw, 22rem);
  height: auto;
  margin: var(--cv-space-4) auto;
  padding: var(--cv-space-3);
  border-radius: var(--cv-radius-s);
  background: #fff;
}

.scanned li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: var(--cv-space-3);
  padding: var(--cv-space-2) 0;
  border-bottom: 1px solid var(--till-line);
}

.scanned-time {
  color: var(--cv-muted);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .skel {
    animation: none;
  }

  .btn {
    transition: none;
  }
}

@media (min-width: 560px) {
  .item {
    grid-template-columns: 1fr auto auto;
  }

  .item-main {
    grid-column: auto;
  }
}
