:root {
  --bg: #0b0c10;
  --bg-2: #13151c;
  --card: #171a23;
  --line: #262a36;
  --text: #f4f1ec;
  --muted: #9aa0ae;
  --orange: #ff5500;
  --orange-2: #ff7a2f;
  --cream: #f1ece4;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f5b301;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: var(--orange-2); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- topo ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: rgba(11,12,16,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.02em; font-size: 20px; color: #fff; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--orange); display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 18px; }
.brand small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: rgba(255,85,0,.12); color: var(--orange-2); border: 1px solid rgba(255,85,0,.35); white-space: nowrap; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap-wide { max-width: 1180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stack > * + * { margin-top: 14px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-2); }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.05; }
h1 { font-size: clamp(32px, 9vw, 48px); font-weight: 900; }
h2 { font-size: 26px; font-weight: 900; }
h3 { font-size: 17px; font-weight: 800; }
p { margin: 0; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps span { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.steps span.on { background: var(--orange); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 26px 22px; background:
  radial-gradient(120% 90% at 100% 0%, rgba(255,85,0,.35), transparent 60%), linear-gradient(160deg, #1b1d26, #0f1016); border: 1px solid var(--line); }
.hero .meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero h1 span { color: var(--orange); }
.counter { margin-top: 18px; display: flex; align-items: baseline; gap: 8px; }
.counter b { font-size: 44px; font-weight: 900; color: #fff; }

.prizes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prize { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.prize .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; }
.prize .ico svg { width: 26px; height: 26px; }
.prize b { display: block; font-size: 14px; line-height: 1.2; }
.prize span { font-size: 12px; color: var(--muted); }
.prize.out { opacity: .45; }

.how { counter-reset: s; display: grid; gap: 10px; }
.how li { list-style: none; display: flex; gap: 12px; align-items: flex-start; }
.how li::before { counter-increment: s; content: counter(s); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 14px; }
.how { padding: 0; margin: 0; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 14px 18px; border-radius: 14px;
  border: 0; background: var(--orange); color: #fff; font-weight: 900; font-size: 17px; letter-spacing: .01em; transition: transform .08s, opacity .2s, background .2s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 700; }
.btn.light { background: var(--cream); color: #111; }
.btn.small { min-height: 40px; font-size: 14px; padding: 8px 14px; width: auto; border-radius: 10px; }
.btn.green { background: var(--green); }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px; font-size: 14px; }

/* ---------- formulário ---------- */
.field { display: block; }
.field label { display: block; font-size: 13px; font-weight: 700; color: #d8d6d0; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 16px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,85,0,.2); }
.field .err { color: #ff8b8b; font-size: 12px; margin-top: 5px; min-height: 0; }
.field.invalid input { border-color: var(--red); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1.2fr 2fr .8fr; gap: 10px; }
@media (max-width: 420px) { .row-3 { grid-template-columns: 1fr 1fr; } .row-3 .field:first-child { grid-column: 1 / -1; } }

.social { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); }
.social .s-ico { flex: 0 0 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.social .s-ico svg { width: 22px; height: 22px; }
.social .s-txt { flex: 1; min-width: 0; }
.social .s-txt b { display: block; font-size: 15px; }
.social .s-txt span { font-size: 12px; color: var(--muted); }
.social.ok { border-color: rgba(34,197,94,.6); background: rgba(34,197,94,.08); }
.seg { display: flex; gap: 6px; margin-top: 10px; }
.seg button { flex: 1; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 700; font-size: 13px; }
.seg button.on { background: var(--orange); border-color: var(--orange); color: #fff; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: #d8d6d0; }
.check input { flex: 0 0 22px; width: 22px; height: 22px; accent-color: var(--orange); margin-top: 1px; }

/* chips (perfil) */
.q { padding: 16px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; padding-top: 4px; }
.q h3 { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-weight: 700; font-size: 14px; }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }

/* opt-in */
.optin { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; }
.optin.on { border-color: var(--orange); background: rgba(255,85,0,.08); }
.optin .tg { flex: 0 0 52px; height: 30px; border-radius: 99px; background: #333847; position: relative; transition: background .2s; }
.optin .tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
.optin.on .tg { background: var(--orange); }
.optin.on .tg::after { left: 25px; }
.optin b { display: block; }
.optin span { font-size: 13px; color: var(--muted); }

/* roleta */
.wheel-box { position: relative; width: min(88vw, 420px); aspect-ratio: 1; margin: 6px auto 0; }
.wheel-box canvas { width: 100%; height: 100%; display: block; }
.pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid var(--cream); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); z-index: 2; }
.hub { position: absolute; inset: 0; margin: auto; width: 22%; height: 22%; border-radius: 50%; background: #0b0c10; border: 4px solid var(--cream); display: grid; place-items: center; font-weight: 900; color: var(--orange); font-size: clamp(16px, 5vw, 26px); }

/* cupom */
.coupon { background: var(--cream); color: #111; border-radius: 22px; padding: 22px; text-align: center; position: relative; }
.coupon .prize-name { font-size: 24px; font-weight: 900; line-height: 1.1; margin: 6px 0 14px; }
.coupon .qr { width: 210px; height: 210px; margin: 0 auto; background: #fff; padding: 10px; border-radius: 14px; }
.coupon .qr img, .coupon .qr canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.coupon .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 900; letter-spacing: .08em; margin-top: 12px; }
.coupon .status { display: inline-block; margin-top: 10px; padding: 6px 12px; border-radius: 99px; font-weight: 800; font-size: 13px; }
.status.pend { background: #111; color: var(--cream); }
.status.done { background: var(--green); color: #fff; }
.coupon-cut { height: 0; border-top: 2px dashed #c9c2b5; margin: 18px -22px; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #ffc0c0; }
.alert.ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); color: #b7f5cb; }
.alert.info { background: rgba(255,85,0,.08); border-color: rgba(255,85,0,.35); color: #ffd2b8; }

.foot { text-align: center; padding: 22px 16px 34px; color: var(--muted); font-size: 12px; }
.foot a { color: var(--muted); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tabs button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 700; white-space: nowrap; font-size: 14px; }
.tabs button.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 30px; font-weight: 900; margin-top: 4px; letter-spacing: -.02em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.charts { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
@media (max-width: 380px) { .charts { grid-template-columns: 1fr; } }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.chart-card h3 { margin-bottom: 4px; }
.chart-card .sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.chart-card .cv { position: relative; height: 240px; }
.chart-card.wide { grid-column: 1 / -1; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 12px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: var(--orange); }
.bar-row .n { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.funnel-row .fill { background: linear-gradient(90deg, var(--orange), var(--orange-2)); }
.insight { border-left: 3px solid var(--orange); padding: 10px 12px; background: var(--bg-2); border-radius: 0 10px 10px 0; font-size: 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { color: var(--muted); font-weight: 700; font-size: 12px; position: sticky; top: 0; background: var(--card); }
.table-wrap { overflow: auto; max-height: 65vh; border: 1px solid var(--line); border-radius: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; }
.tag.g { background: rgba(34,197,94,.15); color: #86efac; }
.tag.o { background: rgba(255,85,0,.15); color: #ffb48a; }
.tag.n { background: #262a36; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input { flex: 1; min-width: 180px; min-height: 42px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); }
