:root {
    --brown: #5c3a24;
    --cream: #f6efe7;
    --ink: #2a1d14;
    --muted: #7a6a5e;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--cream);
    color: var(--ink);
}
.wrap { max-width: 420px; margin: 0 auto; padding: 32px 16px; }
.wrap.wide { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1 { margin: 0 0 8px; }
.qr { width: 260px; height: 260px; background: #fff; padding: 12px; border-radius: 16px; margin: 16px auto; display: block; }
.small-qr { width: 150px; height: 150px; margin-top: 20px; }
code { word-break: break-all; }

.card { background: var(--brown); color: #fff; border-radius: 20px; padding: 24px; }
.card-head { font-weight: 600; font-size: 18px; margin-bottom: 20px; }
.label { color: #ecd6be; font-size: 12px; letter-spacing: .08em; margin-top: 14px; }
.big { font-size: 40px; font-weight: 700; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ecd6be; }
.dot.on { background: #fff; border-color: #fff; }

.button { display: block; text-align: center; background: #000; color: #fff; text-decoration: none;
    padding: 14px; border-radius: 12px; margin: 20px 0; font-weight: 600; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.actions { display: flex; gap: 6px; }
button { background: var(--brown); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button.secondary { background: #fff; color: var(--brown); border: 1px solid var(--brown); }
button:disabled { opacity: .4; cursor: default; }
h1.section { margin-top: 40px; }
.stack { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stack select { padding: 8px 10px; border: 1px solid #d8cbbf; border-radius: 8px; font: inherit; background: #fff; }
.stack input { padding: 8px 10px; border: 1px solid #d8cbbf; border-radius: 8px; font: inherit; flex: 1 1 160px; }
.flash { background: #fff; border-left: 4px solid var(--brown); padding: 10px 12px; border-radius: 6px; }

/* ---------- Verwaltung (v2) ---------- */
.wrap.admin { max-width: 980px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; background: #fff; border-bottom: 1px solid #e8ddd2; }
.topbar a { color: var(--brown); text-decoration: none; font-weight: 600; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar form { margin: 0; }
.flash.error { border-left-color: #b3261e; color: #b3261e; }
.panel { background: #fff; border-radius: 14px; padding: 18px 20px; margin: 18px 0; }
.panel h2 { margin: 0 0 12px; font-size: 19px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 28px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
label.field input, label.field select, textarea {
    padding: 8px 10px; border: 1px solid #d8cbbf; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
textarea.code { width: 100%; min-height: 360px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
textarea.code.short { min-height: 140px; }
.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.row-form input[type=text], .row-form input[type=number], .row-form input[type=password] {
    padding: 6px 8px; border: 1px solid #d8cbbf; border-radius: 6px; font: inherit; }
.row-form input[type=number] { width: 80px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eee3d8; color: var(--brown); }
.badge.off { background: #f3d6d4; color: #b3261e; }
.table-wrap { overflow-x: auto; }
.assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.asset { border: 1px solid #eee3d8; border-radius: 10px; padding: 12px; }
.asset img { max-width: 100%; max-height: 80px; display: block; margin: 8px 0; background: #f4f4f4; }
a.link { color: var(--brown); }
.reward-list { list-style: none; padding: 0; margin: 0; }
.reward-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; }
@media (max-width: 600px) { .topbar { flex-wrap: wrap; } }

/* ---------- Aushang ---------- */
.poster { max-width: 640px; margin: 0 auto; padding: 40px 24px; text-align: center; background: #fff; }
.poster h1 { font-size: 40px; }
.poster img { width: 70%; max-width: 420px; }
.poster .steps { font-size: 20px; line-height: 1.6; }
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}

.big-code { font-family: ui-monospace, Menlo, monospace; font-size: 28px; font-weight: 700;
    background: #fff; display: inline-block; padding: 10px 18px; border-radius: 10px; }

/* ---------- Pass-Ansicht (ähnlich Apple Wallet) ---------- */
.pass { --pass-bg: #5c3a24; --pass-fg: #fff; --pass-label: #ecd6be;
    background: var(--pass-bg); color: var(--pass-fg); border-radius: 14px; width: 100%; max-width: 340px;
    margin: 0 auto; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.18);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif; }
.pass-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; min-height: 52px; }
.pass-logo { max-height: 32px; max-width: 110px; }
.pass-logotext { font-weight: 600; font-size: 17px; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pass-header { display: flex; gap: 12px; text-align: right; }
.pass-label { color: var(--pass-label); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.pass-value { font-size: 17px; white-space: pre-line; }
.pass-value.big { font-size: 34px; font-weight: 300; line-height: 1.1; }
.pass-strip { position: relative; }
.pass-strip img { display: block; width: 100%; aspect-ratio: 375 / 123; object-fit: cover; }
.pass-strip .pass-primary { position: absolute; left: 14px; top: 10px; }
.pass-strip.no-image .pass-primary { position: static; padding: 4px 14px 8px; }
.pass-primary .pass-field + .pass-field { margin-top: 6px; }
.pass-row { display: flex; gap: 16px; padding: 12px 14px; }
.pass-row .pass-field { flex: 1; min-width: 0; }
.pass-row .pass-field:last-child { text-align: right; }
.pass-barcode { background: #fff; color: #000; width: 168px; margin: 10px auto 16px; padding: 10px 10px 6px;
    border-radius: 8px; text-align: center; }
.pass-barcode img { width: 148px; height: 148px; display: block; margin: 0 auto; }
.pass-alt { font-size: 11px; margin-top: 2px; font-family: ui-monospace, Menlo, monospace; }
.pass-back { max-width: 340px; margin: 12px auto 0; background: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.pass-back summary { cursor: pointer; color: var(--muted); }
.pass-back dt { color: var(--muted); font-size: 12px; margin-top: 10px; }
.pass-back dd { margin: 2px 0 0; white-space: pre-line; }

/* ---------- Reiter ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 4px; border-bottom: 1px solid #e8ddd2; }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; border-radius: 8px 8px 0 0; font-weight: 600; }
.tabs a.active { background: #fff; color: var(--brown); }
.js-tabs .tab { display: none; }
.js-tabs .tab.active { display: block; }
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.design-grid .preview-col { position: sticky; top: 12px; }
@media (max-width: 860px) { .design-grid { grid-template-columns: 1fr; } .design-grid .preview-col { position: static; } }
.preview-controls { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.preview-controls input[type=range] { flex: 1; }
.preview-status { font-size: 12px; color: var(--muted); min-height: 16px; text-align: center; margin-top: 6px; }

/* ---------- Kunden-Karte ---------- */
.card-page { padding-top: 20px; }
.save-actions { max-width: 340px; margin: 20px auto 8px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.save-actions .button { margin: 0; }
.wallet-badge { display: block; text-align: center; }
.wallet-badge img { height: 48px; }
.wallet-fallback { background: #000; }
.secondary-button { background: #fff; color: var(--ink); border: 1px solid #d8cbbf; }

/* ---------- Rechtliches, Vollbild-QR ---------- */
.legal-links { text-align: center; font-size: 13px; color: var(--muted); padding: 24px 16px 32px; }
.legal-links a { color: var(--muted); }
.legal-text { white-space: pre-line; line-height: 1.5; }
.fullscreen-qr { position: fixed; inset: 0; background: #fff; z-index: 100; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center; padding: 24px; cursor: pointer; }
.fullscreen-qr[hidden] { display: none; }
.fullscreen-qr img { width: min(80vw, 70vh); height: auto; }
.fullscreen-qr p { font-size: 22px; color: var(--muted); }
@media print {
    .js-tabs .tab { display: none !important; }
    .js-tabs .tab#poster.active { display: block !important; }
    .wrap.admin { padding: 0; }
}
.card-meta { text-align: center; font-size: 14px; color: var(--muted); margin: 12px 0 0; font-variant-numeric: tabular-nums; }
