/* =========================================================================
   TOKENS — unchanged from qr.css
   ========================================================================= */

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #fdfeff 0%, #f7fafd 45%, #eef3fa 100%);
  color: var(--navy);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================================
   SHARED SHELL — identical on both pages
   ========================================================================= */

.card {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.deco {
  position: absolute;
  top: 0;
  right: 0;
  width: min(300px, 62%);
  height: auto;
  opacity: .5;
  pointer-events: none;
}

.body {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px 34px;
}

/* ---- header: same treatment, different content per page ---- */

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.backlink svg { width: 17px; height: 17px; }

/* wallet only — the container gets the solid band; card pages stay light.
   Negative margins bleed it to the edges of the content column. */
.hdr-fill {
  margin: -14px -16px 0;
  padding: 20px 16px 22px;
  background: linear-gradient(135deg, #3f7af5 0%, var(--blue-deep) 100%);
  color: #fff;
}
.hdr-fill .page-code { color: #fff; }
.hdr-fill .page-sub { color: rgba(255,255,255,.82); }

/* header with a utility button parked at the right */
.page-top { position: relative; display: flex; align-items: flex-start; gap: 14px; }
.page-top > .page-titles { flex: 1; min-width: 0; }

/* The toast must hang off the BUTTON, not the header. `top: 100%` against
   .page-top means "below the whole header block" — which drifts further away
   every time the header gains a line. This wrapper is the anchor. */
.hdr-act { position: relative; flex: none; }

/* blue caps = section label. Used sparingly so it keeps its meaning. */
.kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--blue);
}

.page-code {
  margin: 3px 0 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.1;
}

/* supporting detail: grey label AND grey value, so it stays quiet */
.meta-line {
  margin: 5px 0 0;
  font-size: 16px;
  color: #4b5563;
  line-height: 1.35;
}
/* The issuer is DATA, so it must not wear label clothing. Blue caps mean
   "label" everywhere on the page; grey caps mean "a value". */
.page-sub {
  margin: 7px 0 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--muted);
}

/* On a card page there is only one group and no group heading, so the voucher
   list needs no rule above it — just a small gap under the barcode. */
.v-wrap { margin-top: 6px; }

/* =========================================================================
   HEXAGON BADGES — kept from qr.css, plus a small size for voucher rows
   ========================================================================= */

.hex { flex: none; display: grid; place-items: center; clip-path: var(--hexclip); }
.hex-fill { display: grid; place-items: center; clip-path: var(--hexclip); }

/* shadow must sit on an unclipped wrapper — filter runs before clip-path */
.hex-shadow {
  flex: none;
  display: inline-grid;
  filter: drop-shadow(0 0 1px rgba(23,70,196,.22))
          drop-shadow(0 3px 8px rgba(23,70,196,.16));
}

/* outline: section rows */
.hex-outline { width: 44px; height: 49px; background: var(--blue-soft); }
.hex-outline > .hex-fill { width: 41px; height: 46px; background: var(--blue-wash); }
.hex-outline svg { width: 20px; height: 20px; color: var(--blue); }

/* solid small — used for the lock on the PIN screen */
.hex-vch { width: 42px; height: 47px; background: #fff; }
.hex-vch > .hex-fill {
  width: 36px;
  height: 40px;
  background: linear-gradient(145deg, #5a92fb 0%, #3b73f0 45%, #1b45bd 100%);
}
.hex-vch svg { width: 19px; height: 19px; color: #fff; }

/* =========================================================================
   SCAN BLOCK — the register's target. Same on both pages, near the top.
   ========================================================================= */

.scan {
  margin-top: 20px;
  padding: 14px 10px 8px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(8,24,58,.06), 0 6px 18px rgba(8,24,58,.08);
  text-align: center;
}
.scan .label { text-align: center; }

.barcode {
  font-family: "Libre Barcode 128", "Courier New", Courier, monospace;
  font-weight: normal;
  font-size: 62px;
  white-space: nowrap;
  margin-top: 4px;
}
.with-text { font-family: "Libre Barcode 128 Text"; }

.scan-hint { margin: 4px 0 5px 0; font-size: 14px; color: var(--muted); line-height: 1.45; }

/* =========================================================================
   GROUP — one per issuer. Appears once on a card page, N times in a wallet.
   ========================================================================= */

.group { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }

/* wallet only: a heavy rule marks the start of each store's section */
.group-sep {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 3px solid var(--blue-soft);
}

/* The first group needs no rule — the scan block above it is already a
   boundary, and a separator with nothing before it separates nothing.
   NB: `:first-of-type` would NOT work here. It matches the first element of
   its TAG type among siblings, and .scan is also a div, so `.group-sep:first-
   of-type` never matches anything. Adjacency is what actually selects it. */
.scan + .group-sep {
  border-top: 0;
  padding-top: 2px;
}

/* "Shop at" is the customer-facing constraint, and it can be a phrase or a
   list of stores — so it's a value, not a fixed-width chip. */
.group-name {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}


/* =========================================================================
   VOUCHER ROW — the shared atom. Amounts right-aligned so they stack.
   ========================================================================= */

.vch {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.v-list { margin-top: 14px; }
.v-list .vch:first-child { border-top: 0; }

.vch-main { flex: 1; min-width: 0; }
.vch-dept {
  font-size: 18.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue);
}
.vch-meta { margin-top: 3px; font-size: 16px; color: #4b5563; }

/* the issuer belongs per-voucher: one group can hold vouchers from several */
.vch-from { margin-top: 2px; font-size: 14px; color: var(--muted); }

.vch-amt {
  flex: none;
  text-align: right;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}
/* grey = context (the original limit) */
.vch-amt small {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}
/* ink = a second live balance, which can run out first */
.vch-amt .amt-ink {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0;
}

.vch-chev { flex: none; width: 17px; height: 17px; color: #9aa5b4; }

/* =========================================================================
   SECTION ROWS — assigned to / history / permalink
   ========================================================================= */

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 17px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.row-main { min-width: 0; }

.label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--blue);
}
.value { margin-top: 4px; font-size: 20px; font-weight: 500; }

.link-row { position: relative; }
.link-row .row-main { flex: 1; }
.link-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.link-text { font-size: 17px; }

.actions { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid #cbd7ea;
  border-radius: 11px;
  background: #fff;
  color: #3d4a5c;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.primary {
  border-color: transparent;
  background: linear-gradient(150deg, #4a86f8, var(--blue-deep));
  color: #fff;
  box-shadow: 0 2px 6px rgba(23,70,196,.26);
}

/* utility weight: present but not competing with the balances */
.icon-btn.ghost {
  border-color: #d3dae6;
  color: #7b8798;
  background: #fff;
  box-shadow: none;
}
.icon-btn.ghost:hover { border-color: #9aa8bd; color: #4b5563; }

.icon-btn .i-check { display: none; }
.toast {
  position: absolute;
  right: 0; bottom: calc(100% - 4px);
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  font-size: 14px; font-weight: 600;
  white-space: nowrap;
  opacity: 0; transform: translateY(4px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.toast::after {
  content: ""; position: absolute; top: 100%; right: 22px;
  border: 5px solid transparent; border-top-color: var(--navy);
}

/* At the top of the page the bubble has to hang BELOW the button, so this
   must come after .toast — it has to unset .toast's `bottom` and flip the
   arrow. Leaving both top and bottom set stretches the bubble. */
.toast-below {
  top: calc(100% + 9px);
  bottom: auto;
  right: 0;
}
.toast-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--navy);
}

/* copied state. The .icon-btn part is needed to outrank `.icon-btn .i-check`
   above — same class count otherwise, and that rule would win on order. */
.is-copied .icon-btn .i-copy  { display: none; }
.is-copied .icon-btn .i-check { display: block; }
.is-copied .icon-btn.ghost { border-color: #1a7f37; color: #1a7f37; }
.is-copied .toast { opacity: 1; transform: translateY(0); }
/* =========================================================================
   BUTTONS, PILLS, NOTICES
   ========================================================================= */

.cta { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(150deg, #4a86f8, var(--blue-deep));
  color: #fff;
  font: inherit;
  font-size: 17px; font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 7px rgba(23,70,196,.26);
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.btn-link {
  display: block;
  margin-top: 18px;
  text-align: center;
  font-size: 16.5px; font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}

.inwallet {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-bottom: 11px;
  font-size: 16px; font-weight: 600;
  color: #1a7f37;
}
.inwallet svg { width: 18px; height: 18px; }

.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--warn-bg); color: var(--warn-ink);
}

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue-wash);
  border: 1px solid var(--blue-soft);
  font-size: 14.5px; color: #33415c; line-height: 1.45;
}

/* page-level notes, not part of the last group */
.wallet-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.wallet-foot .install { margin-top: 0; }

.asof { margin-top: 15px; font-size: 14px; color: var(--muted); text-align: center; }

.install {
  margin-top: 17px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--blue-soft);
  background: #fff;
  font-size: 14.5px; color: #33415c; line-height: 1.45;
}
.install b { color: var(--navy); }

/* =========================================================================
   CARDS IN THIS WALLET — the wallet lists vouchers by group, which hides card
   boundaries. This is the only place card identity is visible, so it's also
   where removal lives.
   ========================================================================= */

.cards { margin-top: 20px; padding-top: 16px; border-top: 3px solid var(--blue-soft); }

.cardrow {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.cardlist { margin-top: 10px; }
.cardlist .cardrow:first-child { border-top: 0; }

/* the whole card line navigates to that card's page */
.cardlink {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.cardinfo { flex: 1; min-width: 0; }

/* the affordance is spelled out — a bare chevron next to a Remove link is
   ambiguous about what a tap will do */
.cardgo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
}
.cardgo .vch-chev { color: inherit; width: 15px; height: 15px; }
.cardnum { font-size: 18px; font-weight: 700; }
.cardsub { margin-top: 2px; font-size: 14px; color: var(--muted); }

/* Remove sits on its own line, well away from the chevron — a mis-tap on
   navigation is free, a mis-tap on removal is not. */
.rm {
  margin-top: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #b3261e;
  cursor: pointer;
}

/* inline rather than a modal — fewer surprises for a non-technical user */
.confirm {
  margin: 4px 0 6px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #fdf3f2;
  border: 1px solid #f3c9c5;
  font-size: 14.5px;
  color: #5f2320;
  line-height: 1.45;
}
.confirm-actions { display: flex; gap: 9px; margin-top: 11px; }
.btn-danger, .btn-cancel {
  padding: 9px 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger { border: 0; background: #b3261e; color: #fff; }
.btn-cancel { border: 1px solid #cbd7ea; background: #fff; color: #3d4a5c; font-weight: 600; }

.util { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.util a, .util button {
  display: block; width: 100%;
  padding: 12px 0;
  border: 0; background: none;
  font: inherit; font-size: 16px; font-weight: 600;
  color: var(--blue); text-align: left; text-decoration: none; cursor: pointer;
}
.util .danger { color: #b3261e; }
.util-note { font-size: 14px; color: var(--muted); }

/* ---- assign form (unchanged behaviour, retuned sizes) ---- */
.assign { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.assign-note { margin: 6px 0 0; font-size: 16px; color: var(--muted); }
.fields { display: grid; gap: 13px; margin-top: 15px; }
.field { display: flex; flex-direction: column; }
.field label { margin-bottom: 6px; font-size: 15px; font-weight: 600; color: #4b5563; }
.field input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #cbd7ea;
  border-radius: 11px;
  background: #fff; color: var(--navy);
  font: inherit; font-size: 17px;
}
.field input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47,107,243,.16);
}

/* ---- PIN ---- */
.pin-wrap { max-width: 340px; margin: 6px auto 0; text-align: center; }
.pin-lead { margin: 12px 0 0; font-size: 17px; color: #4b5563; line-height: 1.5; }
.pin-input {
  width: 100%; margin-top: 20px;
  padding: 15px 12px;
  border: 1px solid #cbd7ea; border-radius: 12px;
  background: #fff; color: var(--navy);
  font: inherit; font-size: 32px; font-weight: 700;
  letter-spacing: .5em; text-align: center; text-indent: .5em;
}
.pin-input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47,107,243,.16);
}
.pin-forgot { display: block; margin-top: 17px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.pin-forgot a { color: var(--blue); font-weight: 600; }

@media (max-width: 380px) {
  .page-code { font-size: 31px; }
  .barcode { font-size: 52px; }
  .vch-amt { font-size: 23px; }
  .row, .group { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .icon-btn, .btn, .field input { transition: none; }
}

/* ---- MOCKUP ONLY ---- */
#devbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; background: #0c1424;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#devbar span { color: #7f8ea8; padding: 6px 4px; }
#devbar button { padding: 6px 10px; border: 0; border-radius: 6px; background: #24314a; color: #cfe0ff; cursor: pointer; font: inherit; }
#devbar button.on { background: var(--blue); color: #fff; }