:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #15171c;
  --muted: #6b7280;
  --line: #e4e6eb;
  --accent: #d4a514;
  --accent-text: #8a6700;
  --on-accent: #141414;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --panel: #181b21; --text: #eef0f4; --muted: #9aa1ad; --line: #2a2e36; --accent: #e0b437; --accent-text: #e9c35a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-dot { width: 26px; height: 26px; flex: none; background: url(/logo/treuetap-icon.svg) center / contain no-repeat; }
.top-links { display: flex; gap: 8px; }
a.tag { color: inherit; text-decoration: none; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 28px; max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
h1 { font-size: 22px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 20px; }
.presets button, .ghost { background: transparent; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.presets button:hover, .ghost:hover { border-color: var(--accent); }

form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 14px; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 8px; }
input:not([type=checkbox]):not([type=file]):not([type=color]), select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-weight: 400;
}
input[type=color] { width: 100%; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.logo-row { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.logo-row input { min-width: 0; flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 14px; margin: 0; }
fieldset legend { padding: 0 6px; }
fieldset:has(input[name=interimOn]:not(:checked)) .row { opacity: .4; pointer-events: none; }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.primary { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.primary:hover { filter: brightness(1.08); }

/* Vorschau */
.preview { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.switch { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px; }
.switch button { border: 0; background: transparent; padding: 7px 14px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.switch button.active { background: var(--accent); color: var(--on-accent); }

.phone { width: 100%; max-width: 360px; background: #0b0b0d; border-radius: 44px; padding: 14px 14px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.phone-status { display: flex; justify-content: space-between; color: #fff; font-size: 13px; font-weight: 600; padding: 4px 18px 12px; }
.sim { display: flex; gap: 10px; }
.toast { background: #12b76a; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; }

/* ---------- Apple-Wallet-Stil ---------- */
.pass { --fg: #fff; --lbl: rgba(255,255,255,.7); color: var(--fg); background: var(--c); overflow: hidden; }
.pass.apple { border-radius: 14px; }
.a-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.logo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: rgba(255,255,255,.18); overflow: hidden; flex: none; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.a-name { font-weight: 600; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr { text-align: right; }
.lbl { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--lbl); font-weight: 600; }
.val { display: block; font-size: 17px; font-weight: 500; }

.strip { padding: 16px 14px; background: rgba(0,0,0,.18); display: grid; gap: 10px; justify-content: center; }
.stamp { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; border: 2px dashed rgba(255,255,255,.45); position: relative; }
.stamp.on { border: 2px solid transparent; background: rgba(255,255,255,.95); }
.stamp.gift::after { content: "🎁"; position: absolute; right: -6px; top: -6px; font-size: 13px; }
.stamp.pop { animation: pop .45s ease; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
.fields .full { grid-column: 1 / -1; }
.barcode { margin: 6px auto 18px; width: 150px; background: #fff; border-radius: 8px; padding: 10px; text-align: center; color: #111; }
.barcode img { width: 100%; display: block; }
.barcode small { display: block; font-size: 10px; margin-top: 6px; color: #444; }

/* ---------- Google-Wallet-Stil ---------- */
.pass.google { border-radius: 22px; }
.g-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 4px; }
.g-head .logo { border-radius: 50%; }
.g-issuer { font-size: 14px; font-weight: 500; }
.g-title { font-size: 22px; font-weight: 500; padding: 8px 16px 14px; }
.g-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 16px; }
.g-fields .lbl { text-transform: none; letter-spacing: 0; font-size: 12px; }
.pass.google .barcode { width: 160px; border-radius: 14px; }
.pass.google .strip { background: rgba(0,0,0,.22); }

/* ---------- Handy-Seiten (Kunde & Scanner) ---------- */
.mobile-page { min-height: 100vh; }
.m-wrap { max-width: 420px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 16px; }
.m-head { text-align: center; display: grid; justify-items: center; gap: 6px; }
.m-head h1 { margin: 6px 0 0; }
.m-logo { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; font-size: 36px; overflow: hidden; }
.m-logo img { width: 100%; height: 100%; object-fit: cover; }
.m-offer { margin: 4px 0; font-size: 17px; }
.m-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.center { text-align: center; }
.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 4px; }
.err { color: #e5484d; font-weight: 600; min-height: 1em; margin: 6px 0 0; }
.legal-foot { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-size: 13px; padding: 16px; }
.legal-foot a, .small-links a { color: var(--muted); }
.news { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.4; }
.wallet-btn { background: #000; color: #fff; border: 1px solid #333; border-radius: 12px; padding: 12px; font-weight: 600; opacity: .6; }
.toast.floating { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
button:disabled { opacity: .5; cursor: not-allowed; }

.banner { margin: 0 14px 12px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.95); color: #111; font-weight: 600; font-size: 13px; text-align: center; }
.redeem-btn { width: 100%; padding: 16px; border: 0; border-radius: 14px; background: #12b76a; color: #fff; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }

/* Hinweis auf (geplante) Wartung – Dashboard und Scanner */
.mt-notice { background: #fff4e5; color: #6b3a00; border-bottom: 1px solid #f3d6a8; padding: 10px 16px; font-size: 14px; font-weight: 600; text-align: center; line-height: 1.4; }

/* Google-Bewertung auf der Kundenkarte */
.review-btn { display: block; text-align: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600; text-decoration: none; }
.review-box { display: grid; gap: 8px; }
.review-box .review-btn { margin-top: 4px; background: #fbbc04; border-color: #fbbc04; color: #1f1f1f; }

/* Hintergrundfoto hinter den Stempeln und Bild-Stempel (Logo oder eigenes Bild) */
.strip.photo { background-size: cover; background-position: center; padding: 24px 14px; }
.strip.photo .stamp:not(.on) { border-color: rgba(255,255,255,.8); background: rgba(0,0,0,.2); }
.stamp img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.stamp.on.pic { background: #fff; border: 2px solid #fff; }
.r-stamps span img, .t-dots span img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* Karte wiederfinden, Feedback, Karte sichern */
.recover { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.recover summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.recover form { display: grid; gap: 10px; margin-top: 10px; }
.fb-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.fb-faces { display: flex; gap: 10px; justify-content: center; }
.fb-faces button { font-size: 30px; line-height: 1; background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; }
.fb-faces button[aria-pressed=true] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fb-box textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical; }
.save-btn { display: block; width: 100%; text-align: center; padding: 11px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
