/* ds-allow-hardcode:start
   Standalone app stylesheet. Colors live as tokens in :root;
   spacing and type sizes are local to this single file on purpose. */
:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --ink: #16181d;
  --ink-2: #4b5160;
  --ink-3: #8a909c;
  --line: #e4e4df;
  --brand: #16181d;
  --brand-ink: #ffffff;
  --ok: #157a46;
  --ok-bg: #e5f5ec;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 14px;
  --radius-sm: 10px;
  --card-bg: #1f2937;
  --card-fg: #ffffff;
  --card-accent: #f59e0b;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  color-scheme: light;
}

/* Display face: headings, balances and brand names carry the personality. */
h1, h2, h3,
.pass-business, .pass-points, .reward-pts, .cust-points,
.stat b, .adm-logo, .adm-top h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
}
.pass-points { letter-spacing: -0.04em; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; }
.muted { color: var(--ink-2); }
.fine { color: var(--ink-3); font-size: .8rem; margin: .25rem 0 0; }
.opt { color: var(--ink-3); font-weight: 400; }
[hidden] { display: none !important; }

/* ---------- shells ---------- */
.shell { max-width: 440px; margin: 0 auto; padding: 20px 16px 48px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}

/* ---------- buttons + forms ---------- */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #2a2e37; }
.page-card .btn-primary, .page-scan .btn-primary { background: var(--card-bg); border-color: var(--card-bg); color: var(--card-fg); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: #f3c5c0; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .88rem; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 400;
}
textarea { min-height: 90px; resize: vertical; }
input[type="color"] { padding: 4px; height: 44px; cursor: pointer; }
.error { color: var(--err); background: var(--err-bg); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.ok { color: var(--ok); background: var(--ok-bg); padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.toast { background: var(--ok-bg); color: var(--ok); padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 600; margin-bottom: 14px; }

/* ---------- the pass (wallet-style card) ---------- */
.pass {
  position: relative;
  background: var(--card-bg);
  color: var(--card-fg);
  border-radius: 20px;
  padding: 18px 18px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 18px 40px rgba(0,0,0,.18);
  overflow: hidden;
}
.pass::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 60% at 100% 0%, rgba(255,255,255,.12), transparent 60%);
  pointer-events: none;
}
.pass-head { display: flex; align-items: center; gap: 12px; }
.pass-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: rgba(255,255,255,.12); flex: none; }
.pass-logo-fallback { display: grid; place-items: center; font-weight: 800; font-size: .95rem; letter-spacing: .02em; }
.pass-brand { display: grid; min-width: 0; }
.pass-business { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pass-title { font-size: .78rem; opacity: .75; }
.pass-main { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 22px; }
.pass-field { display: grid; }
.pass-field-right { text-align: right; }
.pass-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; opacity: .7; font-weight: 600; }
.pass-points { font-size: 3.1rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.pass-field-value { font-weight: 600; }
.pass-field-sub { font-size: .8rem; opacity: .75; }
.pass-next { margin-top: 18px; }
.pass-next-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 2px 0 8px; }
.pass-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.pass-bar span { display: block; height: 100%; background: var(--card-accent); border-radius: inherit; transition: width .6s ease; }
.pass-qr {
  margin: 20px auto 0; width: 190px;
  background: #fff; color: #111;
  border-radius: 14px; padding: 14px 14px 8px;
  display: grid; justify-items: center; gap: 6px;
  position: relative; z-index: 1;
}
.pass-qr svg { width: 100%; height: auto; display: block; }
.pass-code { font: 600 .78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; padding-bottom: 4px; }
.pass-qr-placeholder { height: 120px; align-content: center; text-align: center; color: #777; font-size: .85rem; background: rgba(255,255,255,.9); }

.hint { text-align: center; color: var(--ink-2); font-size: .88rem; margin: 14px 0 6px; }
.save-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ios-tip { margin: 8px 0 0; font-size: .88rem; color: var(--ink-2); text-align: center; }
.ios-tip summary { cursor: pointer; }
.ios-tip p { margin-top: 6px; }

/* ---------- rewards + history ---------- */
.reward-list, .history, .redeem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.reward {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.reward-pts { font-weight: 800; font-size: 1.15rem; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.reward-pts small { display: block; font-size: .65rem; font-weight: 600; color: var(--ink-3); margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }
.reward-body { display: grid; min-width: 0; }
.reward-body span { color: var(--ink-2); font-size: .83rem; }
.reward-state { font-size: .78rem; color: var(--ink-3); white-space: nowrap; }
.reward-ok { border-color: var(--card-accent); background: color-mix(in srgb, var(--card-accent) 9%, white); }
.reward-ok .reward-state { color: var(--ok); font-weight: 700; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history small { display: block; color: var(--ink-3); font-size: .78rem; }
.history b { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--err); }
.terms p { color: var(--ink-2); font-size: .85rem; }
.foot { text-align: center; color: var(--ink-3); font-size: .8rem; margin-top: 18px; }
.join-hero { margin-bottom: 4px; }

/* ---------- scanner ---------- */
.scan-head { display: flex; align-items: center; gap: 12px; }
.scan-head > div { display: grid; }
.scan-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--card-bg); color: var(--card-fg); }
.reader { border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px; }
.reader:empty { display: none; }
#scan-view .panel { display: grid; gap: 12px; }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-form input { text-transform: uppercase; letter-spacing: .1em; font-family: ui-monospace, Menlo, monospace; }
.cust-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.cust-top > div:first-child { display: grid; }
.cust-points { font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; text-align: right; }
.cust-points small { font-size: .8rem; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.redeem-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.redeem-list li div { display: grid; }
.redeem-list small { color: var(--ink-3); }
.cust-card > .btn-ghost { width: 100%; margin-top: 14px; }
.cust-card .ok { margin-top: 12px; }

/* ---------- admin ---------- */
.adm { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.adm-side { background: var(--ink); color: #e9eaee; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.adm-logo { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; padding: 4px 8px 16px; color: #fff; }
.adm-logo span { color: #f5b544; }
.adm-side .side-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #8d93a3; padding: 12px 8px 4px; }
.adm-side button.nav {
  all: unset; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: .92rem;
  color: #cfd2da; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adm-side button.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.adm-side button.nav.active { background: rgba(255,255,255,.12); color: #fff; }
.adm-side button.nav:focus-visible { outline: 2px solid #fff; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.adm-side .spacer { flex: 1; }
.adm-main { padding: 28px 32px 60px; min-width: 0; }
.adm-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.adm-top h1 { font-size: 1.6rem; margin: 0; }
.adm-top .sub { color: var(--ink-2); margin-top: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 22px; overflow-x: auto; }
.tabs button { all: unset; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-color: var(--ink); }
.tabs button:focus-visible { outline: 2px solid var(--ink); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.sticky { position: sticky; top: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: .85rem; }
.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card-box h2 { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { all: unset; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: #fff; }
.rw-row { display: grid; grid-template-columns: 1.2fr 1.6fr 100px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { max-width: 340px; }
.share { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: center; }
.share img { width: 140px; height: 140px; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.copy { display: flex; gap: 8px; margin-top: 8px; }
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.chart div { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.drawer-bg { position: fixed; inset: 0; background: rgba(15,17,22,.4); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); z-index: 21; padding: 24px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.15); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .panel { width: min(380px, 100%); }
.snack { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.snack.err { background: var(--err); }

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; }
  .adm-side .side-label, .adm-side .spacer { display: none; }
  .adm-logo { padding: 4px 8px; }
  .adm-main { padding: 20px 16px 48px; }
  .rw-row { grid-template-columns: 1fr 90px auto; }
  .rw-row .rw-desc { grid-column: 1 / -1; grid-row: 2; }
  .share { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
}

/* ds-allow-hardcode:end */
