:root {
  --bg-brand: #3b2a20; --accent: #d9a441;
  --bg: #f6f3ef; --fg: #1f1a16; --muted: #6b625a; --card: #ffffff; --line: #e3ddd5;
  --ok: #1e7a3c; --bad: #b3261e; --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161311; --fg: #f2ede8; --muted: #a79e95; --card: #221d1a; --line: #3a332e; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.45; }
body.brand { background: var(--bg-brand); color: #fff; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 480px; }
.center { text-align: center; }
.muted { color: var(--muted); }
body.brand .muted, body.brand .sub { color: rgba(255,255,255,.75); }
.small, small { font-size: .85rem; }
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.inline { display: inline; }
h1 { font-size: 1.6rem; margin: .3em 0; line-height: 1.2; }
h2 { font-size: 1.2rem; margin-top: 2em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font: inherit; font-weight: 600; background: var(--bg-brand); color: #fff; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-big { width: 100%; font-size: 1.1rem; padding: 16px; }
.btn-huge { width: 100%; font-size: 1.5rem; padding: 22px; margin: 8px 0; }
.btn-accent { background: var(--accent); color: #1a1a1a; }
.btn-reward { background: var(--ok); margin: 8px 0; }
.btn-secondary { background: transparent; color: var(--fg); border: 2px solid var(--line); width: 100%; margin: 6px 0; }
.btn-link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 8px; }
.btn.round { width: 52px; height: 52px; border-radius: 50%; font-size: 1.6rem; padding: 0; }
body.brand .btn { background: var(--accent); color: #1a1a1a; }

/* Google-Wallet-Button im Stil der offiziellen Vorgabe (schwarz, abgerundet) */
.gw-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px;
  background: #000; color: #fff; border: 1px solid #747775; border-radius: 26px; font: 500 1.05rem/1 "Google Sans", Roboto, system-ui, sans-serif; padding: 12px 20px; cursor: pointer; }
.gw-button:disabled { opacity: .45; cursor: not-allowed; }

/* Landing */
.brand-head { text-align: center; padding-top: 16px; }
.brand-head.small { display: flex; gap: 12px; align-items: center; text-align: left; }
.logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #fff2; }
.logo-sm { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: #fff3; display: inline-block; }
.card-preview { background: rgba(255,255,255,.08); border-radius: var(--radius); padding: 16px; margin: 16px 0; text-align: center; }
.get-card { display: grid; gap: 12px; margin: 16px 0; }
.choice { padding: 6px; border-radius: 30px; }
.choice.highlight { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice small { display: block; text-align: center; margin-top: 6px; }
.howto ol { padding-left: 1.2em; }
.howto li { margin: .5em 0; }
.reward-line { text-align: center; }

/* Karte */
.loyalty-card { background: var(--bg-brand); color: #fff; border-radius: 22px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12); }
.lc-head { display: flex; gap: 12px; align-items: center; }
.lc-head h1 { font-size: 1.3rem; margin: 0; }
.lc-head .sub { margin: 0; color: rgba(255,255,255,.75); }
.count { text-align: center; font-size: 1.2rem; margin: 14px 0 6px; font-weight: 600; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-width: 320px; margin: 10px auto; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 3px dashed rgba(255,255,255,.55); }
.stamp.on { border: 3px solid var(--accent); background: var(--accent) radial-gradient(circle, rgba(255,255,255,.35) 0 30%, transparent 31%); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); } to { transform: scale(1); } }
.reward-ready { background: var(--accent); color: #1a1a1a; border-radius: 12px; padding: 12px; text-align: center; margin: 10px 0; font-size: 1.05rem; }
.hh-banner { background: #ffde59; color: #1a1a1a; border-radius: 10px; padding: 8px 12px; text-align: center; font-weight: 700; margin: 10px 0; }
.messages .message { background: rgba(255,255,255,.1); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.messages .message p { margin: 4px 0 0; white-space: pre-line; }
.qr { background: #fff; border-radius: 14px; padding: 12px; width: min(260px, 80%); margin: 16px auto 4px; }
.qr svg { display: block; width: 100%; height: auto; }
.hint { text-align: center; margin: 4px 0; color: rgba(255,255,255,.8); }
.offline { text-align: center; font-size: .85rem; color: #ffde59; }
.ios-help { background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.ios-help summary { cursor: pointer; font-weight: 600; }
.link-google { color: #fff; }
.footer { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 24px 16px 40px; font-size: .85rem; opacity: .85; }

/* Formulare */
.form { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); min-height: 44px; }
input[type=color] { padding: 2px; width: 72px; }
input[type=checkbox] { min-height: auto; width: 20px; height: 20px; }
input.num { width: 9em; }
input.pin { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
textarea { min-height: 6em; }
.alert { background: #fff3cd; color: #5c4400; border-radius: 10px; padding: 10px 14px; }
.alert.error { background: #fde2e1; color: var(--bad); }
.alert.ok { background: #dff3e4; color: var(--ok); }
.bad { color: var(--bad); }
.prose p { white-space: pre-line; }

/* Personal / Scanner */
body.staff { background: var(--bg); }
.staff-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.video-box { position: relative; aspect-ratio: 1; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-box video, #qr-fallback { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 4px solid rgba(255,255,255,.8); border-radius: 18px; pointer-events: none; }
.manual { display: flex; gap: 8px; margin-top: 12px; }
.manual input { flex: 1; min-width: 0; }
#card-view .stamps .stamp { border-color: var(--line); }
#card-view .stamps .stamp.on { border-color: var(--accent); }
.big-count { font-size: 3.2rem; font-weight: 800; text-align: center; margin: 4px 0; }
.qty { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 1.2rem; margin: 12px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 14px 20px; border-radius: 12px; font-weight: 600; max-width: 92vw; z-index: 10; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
dialog { border: 0; border-radius: 16px; padding: 20px; max-width: 360px; background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .row { justify-content: flex-end; }
dialog .btn-secondary { width: auto; }

/* Admin */
body.admin { background: var(--bg); }
.admin-head { background: var(--card); border-bottom: 1px solid var(--line); }
.admin-head .wrap { padding-top: 10px; padding-bottom: 10px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-top: 0 !important; }
.tabs a { padding: 8px 12px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.tabs a.active { background: var(--bg-brand); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 4px; }
.kpi b { font-size: 1.8rem; }
.kpi span { color: var(--muted); font-size: .9rem; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 14px 0; }
.chart figcaption { font-weight: 600; margin-bottom: 8px; }
.chart svg { width: 100%; height: 160px; display: block; }
.chart rect { fill: var(--bg-brand); }
@media (prefers-color-scheme: dark) { .chart rect { fill: var(--accent); } }
.chart-axis { display: flex; font-size: .65rem; color: var(--muted); }
.chart-axis span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.design-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.preview { position: sticky; top: 16px; }
@media (max-width: 760px) {
  .design-grid { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  .table th { display: none; }
}
