/* Customer pages. Mobile-first. Brand colors come from --brand / --accent. */
:root {
  --brand: #4f46e5;
  --accent: #f59e0b;
  --ink: #1b1f2a;
  --muted: #667085;
  --line: #e5e7eb;
  --bg: #f7f7fb;
  --card: #ffffff;
  --ok: #16a34a;
  --bad: #dc2626;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.c-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.c-brand { display: flex; align-items: center; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.1rem; }
.c-brand img { max-height: 40px; max-width: 160px; }
.c-who { font-size: .85rem; color: var(--muted); text-align: right; }
.c-login { font-weight: 600; text-decoration: none; }
button.link { background: none; border: 0; color: var(--brand); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }
.c-main { max-width: 760px; margin: 0 auto; padding: 0 0 2rem; }
.c-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem 3rem; }
.c-footer nav { margin: .4rem 0; }
.c-footer a { color: var(--muted); }
.c-powered { margin-top: .5rem; }
.c-flash { max-width: 760px; margin: 1rem auto 0; padding: .8rem 1rem; border-radius: 10px; background: #eef2ff; color: #312e81; }
.c-flash-error { background: #fee2e2; color: #7f1d1d; }
.c-flash-success { background: #dcfce7; color: #14532d; }
.is-embed .c-header, .is-embed .c-footer { display: none; }

.section { padding: 1.25rem 1rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04); padding: 1.25rem; margin: 0 1rem 1rem; }
.card h2 { font-size: 1.2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .8rem 1.3rem; border-radius: 999px; border: 0; background: var(--brand); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #1b1f2a; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid #d0d5dd; }
.btn-sm { padding: .45rem .9rem; font-size: .875rem; }
.btn-block { width: 100%; }

/* Forms */
.f-field { margin-bottom: .9rem; }
.f-field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.f-field input[type=text], .f-field input[type=email], .f-field input[type=tel], .f-field input[type=number], .f-field input[type=date], .f-field select, .f-field textarea {
  width: 100%; padding: .75rem .85rem; border: 1px solid #d0d5dd; border-radius: 10px; font: inherit; background: #fff; }
.f-field textarea { min-height: 6rem; }
.f-field input:focus, .f-field select:focus, .f-field textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.f-check { display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; margin-bottom: .6rem; }
.f-check input { margin-top: .25rem; width: 1.05rem; height: 1.05rem; flex-shrink: 0; accent-color: var(--brand); }
.f-row { display: flex; gap: .75rem; }
.f-row > * { flex: 1; }
.f-error { background: #fee2e2; color: #7f1d1d; border-radius: 10px; padding: .7rem .9rem; margin-bottom: .9rem; font-size: .9rem; }
.f-help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.choice-list label { display: flex; gap: .5rem; align-items: center; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .45rem; font-weight: 400; cursor: pointer; }
.scale { display: flex; flex-wrap: wrap; gap: .35rem; }
.scale label { flex: 1 0 2.4rem; text-align: center; border: 1px solid #d0d5dd; border-radius: 8px; padding: .5rem 0; cursor: pointer; font-weight: 600; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale input:checked + span { color: #fff; }
.scale label:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }
.progress { height: 8px; background: #eceef3; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }

/* Dashboard */
.dash-hero { background: var(--brand); color: #fff; padding: 1.5rem 1rem 3.5rem; text-align: center; }
.dash-hero h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.dash-stats { display: flex; gap: .75rem; margin: -2.5rem 1rem 1rem; }
.dash-stat { flex: 1; background: #fff; border-radius: var(--radius); padding: .9rem; text-align: center; box-shadow: 0 2px 8px rgba(16,24,40,.08); }
.dash-stat .v { font-size: 1.7rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.dash-stat .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.verify-banner { background: #fef3c7; color: #713f12; padding: .85rem 1rem; margin: 0 1rem 1rem; border-radius: 12px; font-size: .9rem; }
.tier-badge { display: inline-block; padding: .2rem .7rem; border-radius: 99px; background: var(--accent); color: #1b1f2a; font-weight: 700; font-size: .8rem; }
.task { display: flex; gap: .85rem; align-items: center; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .ico { font-size: 1.5rem; width: 2.4rem; text-align: center; flex-shrink: 0; }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 700; }
.task .desc { font-size: .85rem; color: var(--muted); }
.task .pts { font-size: .8rem; font-weight: 700; color: var(--brand); }
.task .act { text-align: right; flex-shrink: 0; max-width: 45%; }
.task-state { font-size: .8rem; color: var(--muted); font-weight: 600; }
.task.is-done .title { color: var(--muted); }
.task.is-done .ico { filter: grayscale(1); opacity: .6; }
.pin-form { display: flex; gap: .35rem; justify-content: flex-end; }
.pin-form input { width: 4.5rem; padding: .4rem; border: 1px solid #d0d5dd; border-radius: 8px; font: inherit; text-align: center; letter-spacing: .2em; }
.share-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.share-row a, .share-row button { flex: 1 0 auto; }
.copy-field { display: flex; gap: .5rem; }
.copy-field input { flex: 1; min-width: 0; padding: .7rem; border: 1px solid #d0d5dd; border-radius: 10px; font: inherit; background: #f9fafb; }
.ref-stats { display: flex; gap: 1rem; margin-top: .75rem; font-size: .9rem; }
.reward-card { display: flex; gap: .85rem; align-items: center; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.reward-card:last-child { border-bottom: 0; }
.reward-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #f3f4f6; }
.reward-card .body { flex: 1; }
.reward-card .cost { font-weight: 800; color: var(--brand); }
.wallet-item { border: 1px dashed #c7cbd4; border-radius: 12px; padding: 1rem; margin-bottom: .75rem; text-align: center; }
.wallet-item.is-used { opacity: .55; }
.wallet-code { font: 700 1.5rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; margin: .5rem 0; }
.qr-box { display: flex; justify-content: center; margin: .5rem 0; }
.qr-box img { background: #fff; padding: 6px; border-radius: 8px; }
.leaderboard { list-style: none; padding: 0; margin: 0; counter-reset: lb; }
.leaderboard li { display: flex; justify-content: space-between; padding: .55rem 0; border-bottom: 1px solid var(--line); counter-increment: lb; }
.leaderboard li::before { content: counter(lb); width: 2rem; font-weight: 800; color: var(--muted); }
.leaderboard li span:first-of-type { flex: 1; }
.leaderboard li.me { font-weight: 800; color: var(--brand); }
.countdown { display: flex; gap: .5rem; justify-content: center; }
.countdown div { background: rgba(0,0,0,.18); border-radius: 10px; padding: .45rem .6rem; min-width: 3.4rem; text-align: center; }
.countdown b { display: block; font-size: 1.35rem; line-height: 1.1; }
.countdown small { font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.biz-card { background: #fff; border-radius: 12px; padding: .9rem; text-align: center; border: 1px solid var(--line); }
.biz-card img { max-height: 56px; margin-bottom: .4rem; }
.campaign-list .camp { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.campaign-list .camp:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; background: #dcfce7; color: #166534; }

/* Modal + toasts (shared with app.js) */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 1000; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
.toast { background: #111827; color: #fff; padding: .8rem 1rem; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); text-align: center; }
.toast.error { background: var(--bad); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 900; padding: 1rem; }
.modal { background: #fff; border-radius: 16px; max-width: 460px; width: 100%; padding: 1.4rem; }
.modal .actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.modal .btn-secondary { border-radius: 999px; }
.modal button { padding: .7rem 1.2rem; border-radius: 999px; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.modal button.btn-secondary { background: #fff; color: var(--ink); border: 1px solid #d0d5dd; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }

/* Rules / static pages */
.prose { background: #fff; padding: 1.5rem 1.25rem; margin: 1rem; border-radius: var(--radius); }
.prose h2 { font-size: 1.4rem; } .prose h3 { font-size: 1.05rem; margin-top: 1.4rem; }

/* Countdown visit page */
.go-page { text-align: center; padding: 2rem 1rem; }
.go-timer { font-size: 3.5rem; font-weight: 800; color: var(--brand); }
.a2hs { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; border-left: 4px solid var(--brand); }
.a2hs[hidden] { display: none; }
.a2hs-actions { display: flex; gap: .5rem; align-items: center; }
