:root {
  --bg: #f6f3f1;
  --surface: #ffffff;
  --text: #1d1416;
  --muted: #6f6265;
  --line: #e7dfdc;
  --brand: #1f0409;
  --accent: #cc1e41;
  --ok: #1d7a46;
  --danger: #b3261e;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141011;
    --surface: #1e1819;
    --text: #f3eeee;
    --muted: #a8999b;
    --line: #342b2d;
    --accent: #ff5a7a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
main { max-width: 440px; margin: 0 auto; padding: 32px 16px 48px; }
main.wide { max-width: 960px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
input {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 16px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.link { background: none; border: none; color: var(--muted); padding: 4px; font-weight: 500; text-decoration: underline; }
.full { width: 100%; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 0 0 8px; }

/* Loyalty card */
.card {
  background: var(--brand);
  color: #fff;
  border-radius: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 10px 30px rgba(31, 4, 9, .25);
}
.card .top { display: flex; justify-content: space-between; align-items: center; }
.card .brand { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; }
.card .label { color: #ff7d97; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.card .points { font-size: 56px; font-weight: 700; line-height: 1; margin: 18px 0 4px; font-variant-numeric: tabular-nums; }
.card .member { margin-top: 18px; }
.card .qr { background: #fff; border-radius: 12px; padding: 10px; width: 168px; margin: 20px auto 0; }
.card .qr img, .card .qr svg { display: block; width: 100%; height: auto; }
.card .code { text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #d9c4c8; margin-top: 8px; }

.wallets { display: grid; gap: 10px; margin: 20px 0 8px; }
.wallet-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #000; color: #fff; border-radius: 12px; padding: 13px 16px;
  text-decoration: none; font-weight: 600; border: 1px solid #333;
}
.wallet-btn svg { width: 22px; height: 22px; flex: none; }

/* Admin */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 820px) { .grid { grid-template-columns: 1fr 1fr; } }
.searchrow { display: flex; gap: 8px; }
.searchrow input { margin: 0; }
.list { list-style: none; padding: 0; margin: 12px 0 0; }
.list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.list li:hover, .list li.active { background: var(--bg); border-color: var(--line); }
.list .name { font-weight: 600; }
.list .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.balance { font-size: 48px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.quick button.minus { background: transparent; color: var(--danger); border-color: var(--line); }
.custom { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.custom input { margin: 0; }
.history { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.history li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plus { color: var(--ok); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600;
}
video#scanner { width: 100%; border-radius: 12px; background: #000; margin-top: 12px; }
