/* quikpass design system: dark ground, lime accent. Mobile first, one column, max 480px. */
:root {
  --ground: #0E0E12; --surface: #1A1A21; --input: #15151B; --border: #2C2C36;
  --text: #F4F4F0; --muted: #A8A8B3; --dim: #8A8A96; --chip: #26262F; --chip-text: #C8C8D0;
  --accent: #D4FF3A; --on-accent: #0E0E12;
  --warn: #FFB020; --on-warn: #1A1200;
  --bad: #C8322A; --on-bad: #FFFFFF; --bad-soft: #FF8A80; --bad-bg: #2A1414; --bad-line: #5A2A2A;
  --online-bg: #10301E; --online: #6EE7A0; --offline-bg: #3A2A06;
  --font: Archivo, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font-family: var(--font); line-height: 1.4; -webkit-font-smoothing: antialiased; }
main { max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: 28px 20px; display: flex; flex-direction: column; gap: 20px; }
main.staff { padding: 24px 16px; gap: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; font-weight: 800; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 800; }
a { color: var(--accent); }
button, input, select { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex-shrink: 0; }

/* Brand + header */
.logo { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.logo small { color: var(--muted); font-weight: 600; font-size: 16px; letter-spacing: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.who { font-size: 22px; font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.who-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.who-wrap .btn.ghost { min-height: 44px; text-decoration: none; color: var(--accent); font-size: 14px; border-color: var(--border); }
select.input.venue-sel { width: auto; max-width: 168px; height: 44px; padding: 0 34px 0 12px; font-size: 15px; font-weight: 600; background-position: right 10px center; text-overflow: ellipsis; }
.pill { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-text); white-space: nowrap; }
.pill.ok { background: var(--online-bg); color: var(--online); }
.pill.warn { background: var(--offline-bg); color: var(--warn); }
.pill.lime { background: #1F2A0A; color: var(--accent); }
.pill.bad { background: var(--bad); color: var(--on-bad); }

/* Text helpers */
.muted { color: var(--muted); } .dim { color: var(--dim); font-size: 13px; }
.lede { color: var(--muted); font-size: 15px; margin-top: 4px; }
.foot { color: var(--dim); font-size: 13px; text-align: center; }
.error { color: var(--bad-soft); font-size: 14px; min-height: 0; } .error:empty { display: none; }
.mono { font-family: var(--mono); }
.spacer { flex-grow: 1; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; color: var(--muted); }
.input { width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--input); color: var(--text); font-size: 16px; }
.input::placeholder { color: #6A6A76; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8A8B3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input.mono { font-family: var(--mono); font-size: 15px; }
.input.pin { height: 56px; font-family: var(--mono); font-size: 24px; letter-spacing: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; width: 100%; }
.btn.primary { height: 56px; border: 0; border-radius: 14px; background: var(--accent); color: var(--on-accent); font-size: 17px; font-weight: 800; }
.btn.light { height: 56px; border: 0; border-radius: 14px; background: var(--text); color: var(--on-accent); font-size: 17px; font-weight: 800; }
.btn.confirm { flex-grow: 1; width: auto; height: 48px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn.reject { width: 52px; height: 48px; padding: 0; border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad-soft); }
.btn.ghost { width: auto; min-height: 44px; padding: 0 12px; border-radius: 10px; background: transparent; }
.btn.danger { color: var(--bad-soft); border-color: var(--bad-line); }
.btn.tall { height: 52px; }
.btn:disabled { cursor: default; opacity: .6; }
.btn.light:disabled, .btn.primary:disabled { opacity: .55; }
.btn[disabled].tall { color: var(--dim); opacity: 1; }

/* Selectable cards (venue, station) */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { text-align: left; padding: 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: block; width: 100%; }
.choice[aria-pressed="true"] { border-color: var(--accent); }
.choice .t { display: block; font-weight: 800; overflow-wrap: anywhere; }
.choice .s { display: block; color: var(--muted); font-size: 13px; }
.station { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; }
.station .t { font-size: 17px; }
.station svg { stroke: var(--muted); }
.station[aria-pressed="true"] svg { stroke: var(--accent); }

/* Cards, rows */
.card { background: var(--surface); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.pad-sm { padding: 14px; }
.kv { display: flex; justify-content: space-between; gap: 16px; }
.kv > :first-child { color: var(--muted); } .kv > :last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv > .mono { font-weight: 500; }

/* Waiting */
.center { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; text-align: center; }
.center p { color: var(--muted); font-size: 15px; max-width: 290px; }
.center h1 { font-size: 28px; }
.spinner { width: 112px; height: 112px; border-radius: 50%; border: 6px solid var(--border); border-top-color: var(--accent); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: center; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3A3A46; display: inline-flex; align-items: center; justify-content: center; }
.steps .done .dot { background: var(--accent); border-color: var(--accent); }
.steps .now .dot { border-color: var(--accent); }
.steps .todo { color: var(--dim); }

/* Pass */
.qr-card { background: #fff; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.qr { width: 100%; max-width: 270px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: #0E0E12; text-align: center; font-weight: 600; }
.qr svg { display: block; width: 100%; height: auto; }
.timer { width: 100%; height: 6px; border-radius: 3px; background: #E4E4E8; overflow: hidden; }
.timer > div { height: 6px; background: var(--ground); transition: width 1s linear; }
.qr-note { color: #4A4A55; font-size: 13px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-weight: 800; font-size: 20px; }
.stat .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat .of { color: var(--muted); }
.dots { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent); display: block; }
.dots i.used { background: transparent; border-color: #3A3A46; }

/* Staff: tabs, scanner */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: var(--surface); border-radius: 14px; padding: 4px; }
.seg button { height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--chip-text); font-weight: 600; cursor: pointer; }
.seg button.active { background: var(--accent); color: var(--on-accent); font-weight: 800; }
/* Scanner stage: square, centred camera; scan results overlay it in the same grid cell instead of
   pushing the camera down the page. */
.scan-stage { display: grid; width: 100%; max-width: 420px; margin-inline: auto; }
.scan-stage > * { grid-area: 1 / 1; }
.viewfinder { position: relative; width: 100%; aspect-ratio: 1 / 1; align-self: start; border-radius: 18px; background: #1C1C24; overflow: hidden; }
#reader { position: absolute; inset: 0; border: 0 !important; }
#reader > div, #reader video { width: 100% !important; height: 100% !important; }
#reader video { object-fit: cover; display: block; }
#reader #qr-shaded-region, #reader canvas { display: none !important; }
.vf-frame { position: absolute; inset: 15%; pointer-events: none; opacity: .9; background:
  linear-gradient(var(--accent), var(--accent)) top left / 32px 4px, linear-gradient(var(--accent), var(--accent)) top left / 4px 32px,
  linear-gradient(var(--accent), var(--accent)) top right / 32px 4px, linear-gradient(var(--accent), var(--accent)) top right / 4px 32px,
  linear-gradient(var(--accent), var(--accent)) bottom left / 32px 4px, linear-gradient(var(--accent), var(--accent)) bottom left / 4px 32px,
  linear-gradient(var(--accent), var(--accent)) bottom right / 32px 4px, linear-gradient(var(--accent), var(--accent)) bottom right / 4px 32px;
  background-repeat: no-repeat; }
#result { position: relative; z-index: 2; }
.qty { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qty button { height: 52px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 18px; font-weight: 600; cursor: pointer; }
.qty button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.paste { display: flex; gap: 8px; }
.paste .btn { width: auto; padding: 0 18px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #2A2006; border: 1px solid #5A4410; color: #FFD27A; font-size: 14px; }

/* Result card */
#result { display: block; }
#result:empty { display: none; }
.result-wrap { display: flex; flex-direction: column; gap: 16px; }
.result { border-radius: 22px; padding: 24px; aspect-ratio: 1 / 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; text-align: center; background: var(--accent); color: var(--on-accent); overflow-wrap: anywhere; }
.result.ok { background: var(--accent); color: var(--on-accent); }
.result.warn { background: var(--warn); color: var(--on-warn); }
.result.bad { background: var(--bad); color: var(--on-bad); }
.result .big { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.result .name { font-size: 18px; font-weight: 600; }
.result .sub { font-size: 15px; }
.result .sub.sm { font-size: 14px; opacity: .85; }
.result .dots { color: inherit; font-size: 15px; gap: 8px; }
.result .dots i { width: 16px; height: 16px; background: currentColor; border-color: currentColor; }
.result .dots i.used { background: transparent; }
.advice .t { font-weight: 600; } .advice .d { color: var(--muted); font-size: 14px; }
.todo-list { display: flex; flex-direction: column; gap: 12px; }
.todo-list div { display: flex; gap: 10px; color: var(--chip-text); }
.todo-list b { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--chip); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }

/* Payments */
.txn { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.txn .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.txn .head strong { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; } .txn .head span { font-weight: 800; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.chip { padding: 4px 8px; border-radius: 8px; background: var(--chip); color: var(--chip-text); overflow-wrap: anywhere; }
.chip.plain { background: none; color: var(--muted); }
.actions { display: flex; gap: 8px; }
.approved-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
.approved-row:first-child { border-top: 0; }
.approved-row .head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.approved-row .btns { display: flex; gap: 8px; }
.approved-row .btn { width: auto; flex: 1; }
.section-title { font-size: 14px; color: var(--muted); font-weight: 600; }

/* Sync + conflicts */
.conflict { background: var(--surface); border: 1px solid var(--bad-line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.conflict .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.conflict .head strong { font-weight: 800; overflow-wrap: anywhere; } .conflict .head span { color: var(--muted); font-size: 13px; }
.conflict .problem { color: var(--bad-soft); font-weight: 600; font-size: 15px; }
.conflict .detail { color: var(--muted); font-size: 14px; }
.summary { flex-direction: row; align-items: center; gap: 14px; }
.summary .icon { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--accent); border-right-color: var(--accent); }
  .timer > div { transition: none; }
}

/* Optional marketing consent on the guest purchase form (unchecked by default). */
.optin { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.optin input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
