:root {
  /* Cores da marca (logo): vinho #4a0f3d, magenta #e83e9c, dourado #d2a86c, creme #f0d2a8 */
  --brand-wine: #4a0f3d;
  --brand-magenta: #e83e9c;
  --brand-gold: #d2a86c;
  --brand-cream: #f0d2a8;
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #f4ece2;
  --text: #2a0f24;
  --muted: #74606b;
  --border: #eadfd3;
  --primary: #a3196e;
  --primary-2: #e83e9c;
  --primary-ink: #ffffff;
  --primary-soft: #f8e1ee;
  --accent: #d2a86c;
  --danger: #d64545;
  --danger-soft: #fde5e5;
  --warn-soft: #fff3d6;
  --info-soft: #e3eefc;
  --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 8px 24px rgba(16, 40, 30, .06);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #160a14;
    --surface: #21101d;
    --surface-2: #2c1727;
    --text: #f6ebe0;
    --muted: #b49fa9;
    --border: #3a2234;
    --primary: #ef5aab;
    --primary-2: #f0b878;
    --primary-ink: #2a0618;
    --primary-soft: #3d1631;
    --danger-soft: #3a1d1d;
    --warn-soft: #3a2f14;
    --info-soft: #172a40;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid transparent; border-radius: 10px; padding: .6rem 1rem;
  font: 600 .95rem var(--font); cursor: pointer; background: var(--primary); color: var(--primary-ink);
  transition: transform .08s, filter .15s, background .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: .35rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--text); cursor: pointer; padding: .4rem; border-radius: 10px; position: relative; font-size: 1.25rem; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); }

label { display: block; font-weight: 600; font-size: .85rem; margin: .8rem 0 .3rem; }
input, select, textarea {
  width: 100%; padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); border-color: var(--primary); }
.field-hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.form-error { color: var(--danger); font-size: .88rem; min-height: 1.2em; margin-top: .5rem; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.25rem; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; display: block; object-fit: cover; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.brand-mark { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.topbar .spacer { flex: 1; }
.container { max-width: 1120px; margin: 0 auto; padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: 2fr 1fr; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-2, .grid.cols-4 { grid-template-columns: 1fr; } }
@media (min-width: 600px) and (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tab { background: none; border: 0; padding: .7rem 1rem; font: 600 .92rem var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: capitalize; }
.badge.paid { background: var(--primary-soft); color: var(--primary); }
.badge.pending { background: var(--warn-soft); color: #b77900; }
.badge.cancelled, .badge.expired { background: var(--surface-2); color: var(--muted); }

/* Progress */
.progress { position: relative; height: 18px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress .bar {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 1.4s cubic-bezier(.22, 1, .36, 1); position: relative; overflow: hidden;
}
.progress .bar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-100%);
}
.progress.shine .bar::after { animation: shine 1.2s ease-out 2; }
@keyframes shine { to { transform: translateX(100%); } }
.progress.thin { height: 8px; }

/* Toasts */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; padding: .75rem 1rem; box-shadow: var(--shadow); animation: toastIn .3s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast strong { display: block; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 15, 10, .5); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; width: min(480px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(820px, 100%); }
@keyframes fade { from { opacity: 0; } }

/* Auth page */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(circle at 85% 15%, rgba(232,62,156,.35), transparent 45%), linear-gradient(155deg, #2e0826, var(--brand-wine) 45%, #7a1b5c); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; }
.auth-hero h1 { font-size: 2.4rem; }
.auth-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; font-size: 1.02rem; }
.auth-hero li::before { content: "✓"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.2); margin-right: .6rem; font-size: .8rem; }
.auth-side { display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(400px, 100%); }
@media (max-width: 800px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { padding: 2rem 1.25rem; } .auth-hero h1 { font-size: 1.8rem; } }

.form-row { display: flex; gap: .75rem; }
.form-row > div { flex: 1; min-width: 0; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; font-size: .86rem; margin-top: 1rem; cursor: pointer; }
label.check input { width: auto; margin-top: .2rem; accent-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* Simulador */
.sim-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 1.25rem; max-width: 34rem; backdrop-filter: blur(6px); }
.sim-card h2 { font-size: 1.1rem; }
.sim-card label { color: inherit; opacity: .9; }
.sim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.sim-card .chip { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.sim-card .chip.on { background: var(--brand-gold); border-color: var(--brand-gold); color: var(--brand-wine); }
.sim-result { margin-top: .9rem; padding: .8rem 1rem; border-radius: 12px; background: rgba(0,0,0,.18); }
.sim-result .big { font-size: 1.4rem; font-weight: 800; color: var(--brand-cream); }
.sim-box { margin-top: 1rem; padding: 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.sim-box .big { font-size: 1.15rem; font-weight: 800; color: var(--primary); }
@media (max-width: 520px) { .sim-grid, .form-row { grid-template-columns: 1fr; flex-direction: column; gap: 0; } }

/* Rodapé e páginas de texto */
.site-footer { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; padding: 1.25rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
.site-footer a { color: var(--muted); }
.doc { max-width: 780px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.doc h1 { font-size: 1.8rem; }
.doc h2 { font-size: 1.15rem; margin-top: 1.75rem; }
.doc p, .doc li { color: var(--text); }
.doc .meta { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.narrow { max-width: 420px; margin: 3rem auto; padding: 0 1rem; }

/* Notifications dropdown */
.badge-count { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.dropdown { position: absolute; right: 1rem; top: 58px; width: min(380px, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.18); z-index: 30; }
.dropdown .dd-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif { padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif .t { font-weight: 700; font-size: .92rem; }
.notif .m { font-size: .86rem; color: var(--muted); }
.notif .d { font-size: .74rem; color: var(--muted); margin-top: .2rem; }

/* Customer dashboard */
.hero-card { position: relative; overflow: hidden; background: linear-gradient(140deg, var(--surface), var(--primary-soft)); }
.balance-label { color: var(--muted); font-weight: 600; font-size: .9rem; }
.balance { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; transition: color .3s; }
.balance.bump { animation: bump .7s cubic-bezier(.22, 1, .36, 1); color: var(--primary); }
@keyframes bump { 30% { transform: scale(1.08); } }
.float-gain { position: absolute; font-weight: 800; color: var(--primary); font-size: 1.4rem; pointer-events: none; animation: floatUp 2s ease-out forwards; }
@keyframes floatUp { from { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-70px); } }

.evolution { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; text-align: center; }
.evo-stage { font-size: 4.5rem; line-height: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,.12)); transition: transform .3s; }
.evo-stage.grow { animation: grow 1.1s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes grow { 0% { transform: scale(.4) rotate(-15deg); opacity: .3; } 60% { transform: scale(1.25) rotate(6deg); opacity: 1; } 100% { transform: scale(1); } }
.evo-stage.wiggle { animation: wiggle .8s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.08); } 50% { transform: rotate(6deg) scale(1.1); } 75% { transform: rotate(-3deg); } }
.evo-steps { display: flex; gap: .35rem; }
.evo-steps span { width: 26px; height: 6px; border-radius: 3px; background: var(--surface-2); transition: background .4s; }
.evo-steps span.on { background: var(--primary); }

.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; margin: .25rem auto;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0); transition: --p 1s; }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .v { font-size: 1.5rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .82rem; font-weight: 600; }

.quick-amounts { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .35rem .7rem; border-radius: 999px; cursor: pointer; font: 600 .82rem var(--font); }
.chip:hover { border-color: var(--primary); color: var(--primary); }

.boleto { border: 1px dashed var(--border); border-radius: 12px; padding: 1rem; margin-top: .75rem; background: var(--surface-2); }
.boleto .line { font-size: .92rem; word-break: break-all; background: var(--surface); padding: .6rem .7rem; border-radius: 8px; border: 1px solid var(--border); }
.boleto img { width: 100%; height: 56px; display: block; border-radius: 4px; margin: .6rem 0; background: #fff; }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.product { border: 1px solid var(--border); border-radius: 14px; padding: 1rem; display: flex; flex-direction: column; gap: .4rem; background: var(--surface); }
.product .e { font-size: 2.2rem; }
.product .n { font-weight: 700; }
.product .p { font-weight: 800; font-size: 1.1rem; margin-top: auto; }
.product .need { font-size: .78rem; color: var(--muted); }

/* Level-up overlay & confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.levelup { position: fixed; inset: 0; display: grid; place-items: center; z-index: 80; pointer-events: none; }
.levelup > div { background: var(--surface); border-radius: 24px; padding: 2rem 2.5rem; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.3); animation: pop 2.6s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.levelup .big { font-size: 5rem; line-height: 1; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 15% { transform: scale(1); opacity: 1; } 85% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: 0; } }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.admin-layout > main { min-width: 0; }
.sidebar { border-right: 1px solid var(--border); padding: 1rem .75rem; background: var(--surface); }
.sidebar button { display: flex; width: 100%; align-items: center; gap: .6rem; border: 0; background: none; color: var(--text); padding: .65rem .8rem; border-radius: 10px; font: 600 .92rem var(--font); cursor: pointer; text-align: left; }
.sidebar button:hover { background: var(--surface-2); }
.sidebar button.active { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: .5rem; }
  .sidebar button { width: auto; white-space: nowrap; }
}
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--primary); }
.chart .bar:hover { fill: var(--primary-2); }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input, .toolbar select { width: auto; flex: 1; min-width: 180px; }
.mini-progress { display: flex; align-items: center; gap: .5rem; min-width: 140px; }
.mini-progress .progress { flex: 1; }
.grid.cols-2-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid.cols-2-even { grid-template-columns: 1fr; } }
.notice { background: var(--warn-soft); border: 1px solid color-mix(in srgb, #b77900 35%, transparent); color: var(--text); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; }
.sidebar button:disabled { opacity: .4; cursor: not-allowed; }
.pw-meter { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: .4rem; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 12px; display: block; margin: .75rem 0; }
.secret-code { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); padding: .5rem .7rem; border-radius: 8px; word-break: break-all; letter-spacing: .05em; }
.recovery-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .8rem; margin: .75rem 0; }
.steps { padding-left: 1.2rem; margin: .5rem 0; }
.steps li { margin-bottom: .35rem; }
.link { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }
