/* Digitale Stempelkarte – Bartolucci Digital branding (tokens from bartolucci-digital.de base.css) */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 800; font-display: swap; src: url('fonts/inter-latin-800-normal.woff2') format('woff2'); }

:root {
  --bg: #faf8f3;
  --bg-2: #f1ede4;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #566274;
  --line: rgba(15, 23, 42, 0.14);
  --accent: #5a6592;
  --accent-deep: #444e78;
  --accent-soft: rgba(90, 101, 146, 0.12);
  --navy: #0f172a;
  --sky: #96caeb;
  --ok: #1d6b45;
  --ok-soft: #e3f1e8;
  --warn: #8a4b00;
  --warn-soft: #fdf0dc;
  --err: #a3231b;
  --err-soft: #fbe7e5;
  --reward: #b8580f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 28px rgba(15, 23, 42, 0.09);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
img, svg { max-width: 100%; }
a { color: var(--accent-deep); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 8px; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.hint { font-size: 15px; color: var(--ink-3); }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.break { overflow-wrap: anywhere; }

/* ---------- frame ---------- */
.test-banner {
  background: #0f172a; color: #fff; text-align: center; font-weight: 600; font-size: 14px;
  padding: 7px 16px; letter-spacing: 0.01em;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; max-width: 760px; width: 100%; margin: 0 auto;
}
.brand img { display: block; height: 30px; width: auto; }
.wrap { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 18px 32px; }
.admin .wrap, .admin .top { max-width: 1040px; }
.foot { text-align: center; font-size: 14px; color: var(--ink-3); padding: 18px 18px 28px; border-top: 1px solid var(--line); }
.foot p { margin: 2px 0; }
form.inline { display: inline; margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 14px; border: 2px solid var(--ink);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--bg-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #1e293b; }
.btn.reward { background: var(--reward); border-color: var(--reward); color: #fff; }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; border-width: 1.5px; }
.btn.big { width: 100%; min-height: 58px; font-size: 19px; border-radius: 16px; }
.btn[disabled] { opacity: 0.55; cursor: wait; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; margin-top: 18px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { font-size: 19px; font-weight: 700; padding: 0; margin-bottom: 4px; }
fieldset > .hint { margin: -6px 0 0; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 16px; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 14px; margin-left: 4px; }
input, select {
  font: inherit; font-size: 17px; color: var(--ink); width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1.5px solid rgba(15, 23, 42, 0.28); border-radius: 12px; background: var(--surface);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.consent { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; }
.consent legend { float: left; width: 100%; margin-bottom: 8px; }
.check { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; font-size: 16px; line-height: 1.45; cursor: pointer; clear: both; }
.check input { width: 26px; height: 26px; min-height: 0; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.legal { font-size: 15px; color: var(--ink-3); margin: 0; }

/* ---------- alerts ---------- */
.alert { border-radius: 14px; padding: 14px 16px; margin: 14px 0; font-size: 16px; border: 1.5px solid; }
.alert.ok { background: var(--ok-soft); border-color: rgba(29, 107, 69, 0.35); color: #123f2a; }
.alert.err { background: var(--err-soft); border-color: rgba(163, 35, 27, 0.35); color: #6e140f; }
.draft-flag { background: var(--warn-soft); border: 2px dashed var(--warn); color: #5a3100; border-radius: 14px; padding: 12px 16px; margin: 8px 0 18px; }

/* ---------- loyalty card ---------- */
.intro { margin-bottom: 14px; }
.lcard {
  background: linear-gradient(140deg, #0f172a 0%, #26304f 55%, #5a6592 130%);
  color: #fff; border-radius: 22px; padding: 18px 18px 16px; box-shadow: 0 2px 6px rgba(11, 18, 32, 0.25), 0 18px 40px rgba(11, 18, 32, 0.22);
  margin: 8px 0 6px;
}
.lcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.lcard-head img { width: 34px; height: 34px; }
.lcard-shop { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; line-height: 1.2; }
.lcard-sub { font-size: 13px; color: var(--sky); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.45);
  display: grid; place-items: center; color: var(--navy); transition: transform 0.25s ease, background 0.25s ease;
}
.stamp.on { background: #fbfcfd; border: 2px solid #fbfcfd; }
.stamp.pop { transform: scale(1.18); }
.lcard-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; font-size: 15px; color: #dbe3f1; }
.lcard-count { font-weight: 800; color: #fff; }
.reward-ready { background: #fff4e5; border: 2px solid var(--reward); color: #6b3205; border-radius: 14px; padding: 12px 16px; margin: 10px 0 0; font-size: 16px; }

/* ---------- card page ---------- */
.qr-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 18px 14px; margin: 16px 0; text-align: center; }
.qr { width: min(260px, 72vw); margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-code-text { font-size: 18px; margin: 10px 0 4px; letter-spacing: 0.04em; }
.qr-code-text strong { font-size: 22px; letter-spacing: 0.12em; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.box p:last-child { margin-bottom: 0; }
.msgs { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.msgs li { border-left: 3px solid var(--accent); padding-left: 12px; }
.msgs p { margin: 2px 0; }
.msgs time { font-size: 13px; color: var(--ink-3); }
.link-strong { font-weight: 700; }
.wallet-offers { display: grid; gap: 10px; margin: 12px 0; }

/* ---------- prose ---------- */
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 18px; margin-top: 22px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }

/* ---------- staff scanner ---------- */
.who { font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.viewfinder {
  position: relative; background: #0b1220; border-radius: 22px; overflow: hidden; aspect-ratio: 1 / 1; width: 100%;
  max-height: 58vh; margin: 0 auto 14px;
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vf-guide { position: absolute; inset: 16%; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(11, 18, 32, 0.35); border: 3px solid rgba(255, 255, 255, 0.9); }
.vf-msg { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-weight: 600; font-size: 16px; padding: 0 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.manual { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
#manual-code { font-size: 22px; letter-spacing: 0.15em; text-transform: uppercase; text-align: center; font-weight: 700; }
.result { text-align: center; padding: 18px 4px 8px; border-radius: 24px; margin-top: 4px; }
.result h1 { font-size: 34px; margin: 10px 0 6px; }
.r-text { font-size: 20px; color: var(--ink-2); margin-bottom: 16px; }
.result-icon { width: 96px; height: 96px; border-radius: 50%; margin: 6px auto 0; display: grid; place-items: center; color: #fff; }
.result-icon svg { width: 56px; height: 56px; }
.result.ok { background: var(--ok-soft); }
.result.ok .result-icon { background: var(--ok); }
.result.reward { background: #fff4e5; }
.result.reward .result-icon { background: var(--reward); }
.result.warn { background: var(--warn-soft); }
.result.warn .result-icon { background: var(--warn); }
.result.err { background: var(--err-soft); }
.result.err .result-icon { background: var(--err); }
.result .stamps { max-width: 320px; margin: 0 auto 18px; padding: 0 14px; }
.result .stamp { border-color: rgba(15, 23, 42, 0.3); }
.result .stamp.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.r-actions { display: grid; gap: 12px; padding: 0 12px 6px; }

/* ---------- admin ---------- */
.admin-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.admin-grid .box { margin: 0; }
.admin-grid .box:first-child { grid-row: span 2; }
.staff-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.staff-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qr-preview { display: block; width: 180px; height: 180px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
@media (min-width: 860px) {
  .admin-grid { grid-template-columns: 1.1fr 1fr; }
  h1 { font-size: 34px; }
}
@media (max-width: 380px) {
  body { font-size: 16px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 27px; }
  .stamps { gap: 8px; }
  .row2 { grid-template-columns: 1fr; }
  .row2[role="group"] { grid-template-columns: 1fr 1.4fr; }
}
@media (prefers-reduced-motion: reduce) { .stamp { transition: none; } }

/* ---------- admin part 2: navigation, KPIs, charts, tables ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -4px 18px; padding: 4px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { flex: none; padding: 10px 14px; border-radius: 12px 12px 0 0; text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--ink); background: var(--bg-2); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.kpi-n { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-l { font-weight: 600; font-size: 15px; color: var(--ink-2); }
.kpi-s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.box-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.box-head h2 { margin: 0; }
.small { font-size: 14px; }
.mt { margin-top: 18px; }
.chart { display: block; width: 100%; height: auto; margin: 4px 0 2px; }
.c-bar { fill: var(--accent); }
.c-red { fill: var(--reward); stroke: #fff; stroke-width: 2; }
.c-grid { stroke: rgba(15, 23, 42, 0.1); stroke-width: 1; }
.c-axis { fill: var(--ink-3); font-size: 12px; font-family: var(--font); }
.legend { font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.lg-bar, .lg-red { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.lg-red { border-radius: 50%; background: var(--reward); margin-left: 10px; }
details.data summary { cursor: pointer; font-size: 14px; color: var(--accent-deep); min-height: 32px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 8px 0 16px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
.tbl th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); background: var(--bg-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.small td, .tbl.small th { padding: 7px 10px; font-size: 14px; }
.box .tbl { border-radius: 10px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); vertical-align: 1px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.reward { background: #fff4e5; color: #8a3f06; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 14px; padding: 3px; gap: 3px; background: var(--surface); margin: 4px 0 10px; flex-wrap: wrap; }
.seg a { padding: 8px 14px; border-radius: 11px; text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; }
.seg a[aria-current] { background: var(--ink); color: #fff; }
.plain-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.plain-list li { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--ink-3); font-size: 15px; }
.dl dd { margin: 0; }
.alert.info { background: var(--accent-soft); border-color: rgba(90, 101, 146, 0.35); color: var(--ink); }
textarea { font: inherit; font-size: 17px; color: var(--ink); width: 100%; padding: 12px 14px; border: 1.5px solid rgba(15, 23, 42, 0.28); border-radius: 12px; background: var(--surface); resize: vertical; }
textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.radio { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); }
.radio:has(input:checked) { border-color: var(--ink); }
.radio input { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; accent-color: var(--ink); }
.preview { border: 2px solid var(--accent); }
.pv-row { display: grid; gap: 14px; margin: 8px 0 14px; }
.pv-notif { display: flex; gap: 12px; align-items: flex-start; background: rgba(241, 237, 228, 0.9); border-radius: 18px; padding: 12px 14px; font-size: 15px; box-shadow: var(--shadow); }
.pv-notif img { border-radius: 8px; flex: none; }
.pv-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.pv-card h3 { margin: 0 0 8px; font-size: 16px; }
.danger-zone { display: grid; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn.danger { border-color: var(--err); color: var(--err); background: var(--surface); justify-self: start; }
.btn.danger:hover { background: var(--err); color: #fff; }
.btn.danger.solid { background: var(--err); color: #fff; }
.btn.danger.solid:hover { background: #7f1b15; border-color: #7f1b15; }
.confirm-box { border: 2px solid var(--err); background: var(--err-soft); border-radius: 14px; padding: 14px 16px; }
.confirm-box p { margin: 0 0 8px; color: #6e140f; }
.confirm-box .btn-row { margin-top: 12px; }
.btn[disabled] { cursor: not-allowed; }
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .pv-row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 860px) {
  .admin-grid.two { grid-template-columns: 1fr 1fr; }
  .admin-grid.two .box:first-child { grid-row: auto; }
  .admin-grid.two { margin-bottom: 16px; }
}
/* card table becomes stacked rows on phones */
@media (max-width: 720px) {
  .cards-tbl thead, .tbl.small thead { display: none; }
  .cards-tbl, .cards-tbl tbody, .cards-tbl tr, .cards-tbl td { display: block; width: 100%; }
  .cards-tbl tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .cards-tbl td { border: 0; padding: 3px 14px; display: flex; justify-content: space-between; gap: 12px; }
  .cards-tbl td::before { content: attr(data-l); color: var(--ink-3); font-size: 14px; }
  .tbl.small, .tbl.small tbody, .tbl.small tr, .tbl.small td { display: block; width: 100%; }
  .tbl.small tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl.small td { border: 0; padding: 2px 10px; }
  .tbl.small td[data-l]::before { content: attr(data-l) ': '; color: var(--ink-3); font-size: 13px; }
}
/* review fixes (360 px): tabs as 2x2, compact card rows, readable chart labels */
.c-axis { font-size: 15px; }
.pv-row { align-items: start; }
@media (max-width: 480px) {
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-bottom: 0; overflow: visible; margin: 0 0 14px; padding: 0; }
  .tabs a { justify-content: center; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
  .tabs a[aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); }
}
@media (max-width: 720px) {
  .cards-tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; }
  .cards-tbl td { display: block; padding: 0; }
  .cards-tbl td::before { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .cards-tbl td[data-l="Karte"], .cards-tbl td[data-l="Angelegt"] { display: none; }
}

/* ---------- wallet buttons (shown only when the wallet is set up) ---------- */
.btn.wallet { background: #000; border-color: #000; color: #fff; min-height: 56px; font-size: 17px; padding: 10px 14px; border-radius: 14px; white-space: nowrap; }
.btn.wallet:hover { background: #1f2937; color: #fff; }
.btn.wallet::before { content: ''; width: 26px; height: 20px; border-radius: 4px; flex: none;
  background: linear-gradient(#ff5f57 0 25%, #febc2e 25% 50%, #28c840 50% 75%, #3b82f6 75%); }
.btn.wallet.google::before { background: linear-gradient(90deg, #4285f4 0 25%, #ea4335 25% 50%, #fbbc04 50% 75%, #34a853 75%); }
.wallet-offers + #live { margin-top: 4px; }
