:root {
  --green: #00BA4A;
  --green-dark: #00963C;
  --green-soft: #E7F8EE;
  --bg: #F4F7F5;
  --card: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --blue: #2563EB;
  --blue-soft: #DBEAFE;
  --red: #DC2626;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 15px; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font: inherit; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(84px + var(--safe-bottom)); }

/* Cabeçalho */
.top { background: var(--green); color: #fff; padding: 18px 18px 64px; border-radius: 0 0 28px 28px; }
.top-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .3px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; background: #fff; }
.brand small { display: block; font-weight: 500; font-size: 11px; opacity: .85; letter-spacing: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; font-weight: 700; }
.hello { margin-top: 18px; font-size: 14px; opacity: .9; }
.page-title { margin-top: 14px; font-size: 22px; font-weight: 800; }

.wrap { padding: 0 16px; }
.lift { margin-top: -48px; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgba(17,24,39,.06); margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 2px 10px; }
.section-title h2 { font-size: 17px; margin: 0; }
.section-title a { color: var(--green-dark); font-size: 13px; font-weight: 600; text-decoration: none; }

.balance-label { color: var(--muted); font-size: 13px; }
.balance { font-size: 34px; font-weight: 800; margin: 2px 0 8px; }
.balance-row { display: flex; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill.green { background: var(--green-soft); color: var(--green-dark); }
.pill.amber { background: var(--amber-soft); color: #92400E; }
.pill.blue { background: var(--blue-soft); color: #1E40AF; }
.pill.gray { background: #F3F4F6; color: #374151; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; border-radius: 12px; font-weight: 700; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.outline { border: 1.5px solid var(--green); color: var(--green-dark); background: #fff; }
.btn.whats { background: #25D366; color: #fff; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* Atalhos */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick button { background: var(--card); border-radius: 14px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; box-shadow: 0 2px 10px rgba(17,24,39,.06); }
.quick .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }

/* Banner indicação */
.promo { background: linear-gradient(135deg, #0F172A, #1F2937); color: #fff; border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; margin-bottom: 14px; }
.promo h3 { margin: 0 0 6px; font-size: 18px; }
.promo p { margin: 0 0 14px; opacity: .85; font-size: 13.5px; line-height: 1.4; }
.promo .big { position: absolute; right: -14px; top: -14px; opacity: .12; }
.promo .btn { width: auto; display: inline-flex; padding: 11px 18px; }

/* Listas */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.list-item .amount { font-weight: 700; white-space: nowrap; }
.amount.plus { color: var(--green-dark); }
.amount.minus { color: var(--red); }
.store-logo { width: 42px; height: 42px; border-radius: 12px; color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.chev { color: #9CA3AF; font-size: 20px; }

/* Indicação: progresso */
.steps { display: flex; justify-content: space-between; margin: 14px 0 6px; position: relative; }
.steps::before { content: ''; position: absolute; left: 12px; right: 12px; top: 11px; height: 3px; background: var(--line); }
.steps .bar { position: absolute; left: 12px; top: 11px; height: 3px; background: var(--green); }
.step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 25%; font-size: 11px; color: var(--muted); text-align: center; }
.step .dot { width: 25px; height: 25px; border-radius: 50%; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.step.done .dot { background: var(--green); border-color: var(--green); }
.step.done { color: var(--text); font-weight: 600; }

.crowd { display: flex; align-items: center; gap: 10px; background: var(--green-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.crowd .faces { display: flex; }
.crowd .faces span { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; margin-left: -8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; }
.crowd .faces span:first-child { margin-left: 0; }

/* Formulário */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; outline: none; }
.field input:focus { border-color: var(--green); }
.msg-box { background: #F9FAFB; border: 1px dashed #D1D5DB; border-radius: 12px; padding: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.link-box { display: flex; align-items: center; gap: 8px; background: var(--green-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; color: var(--green-dark); font-size: 14px; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-box button { background: var(--green); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; }

/* Regras */
.rules li { margin: 6px 0; font-size: 13.5px; line-height: 1.4; }
.rules { padding-left: 18px; margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.split div { background: #F9FAFB; border-radius: 12px; padding: 10px; text-align: center; }
.split b { display: block; font-size: 20px; color: var(--green-dark); }
.split small { color: var(--muted); font-size: 11.5px; }

/* Usar no caixa */
.qr-card { text-align: center; }
.qr-wrap { background: #fff; border-radius: 16px; padding: 14px; display: inline-block; border: 1px solid var(--line); }
.qr-wrap svg, .qr-wrap img { display: block; width: 220px; height: 220px; }
.member-code { font-size: 22px; font-weight: 800; letter-spacing: 2px; margin: 12px 0 2px; }
.timer { color: var(--muted); font-size: 12.5px; }
.how li { margin: 8px 0; font-size: 13.5px; }

/* Cupom */
.coupon { display: flex; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(17,24,39,.06); margin-bottom: 10px; }
.coupon .side { width: 72px; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; position: relative; }
.coupon .side::after { content: ''; position: absolute; right: -6px; top: 0; bottom: 0; width: 12px; background: radial-gradient(circle at 6px 8px, #fff 5px, transparent 5.5px) 0 0 / 12px 16px repeat-y; }
.coupon .body { padding: 12px 14px; flex: 1; }
.coupon .body b { display: block; font-size: 14px; }
.coupon .body small { color: var(--muted); }

/* Navegação inferior */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + var(--safe-bottom)); z-index: 10; }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; }
.nav button .ic { display: grid; place-items: center; height: 26px; }
.nav button.active { color: var(--green-dark); font-weight: 700; }

.nav .center .ic { width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; background: var(--green); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,186,74,.35); color: #fff; border: 4px solid #fff; }

/* Entrada */
.login { min-height: 100vh; display: flex; flex-direction: column; padding: 0; }
.login .hero { background: var(--green); color: #fff; padding: 48px 24px 40px; border-radius: 0 0 32px 32px; text-align: center; }
.login .hero img { width: 64px; height: 64px; border-radius: 18px; background: #fff; }
.login .hero h1 { margin: 14px 0 6px; font-size: 26px; }
.login .hero p { margin: 0; opacity: .9; line-height: 1.4; }
.login .perks { display: grid; gap: 10px; margin: 22px 0; }
.login .perk { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.login .perk span { width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; flex-shrink: 0; }
.fine { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; line-height: 1.4; }
.proto { background: var(--amber-soft); color: #92400E; font-size: 12px; text-align: center; padding: 6px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.back { display: inline-flex; align-items: center; gap: 4px; color: #fff; font-weight: 600; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 20px; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { padding: 8px 14px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); }
.tabs button.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Convite de instalação (opcional) */
.install-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-bottom)); width: calc(100% - 24px); max-width: 456px; background: #111827; color: #fff; border-radius: 14px; padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 10px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.install-bar img { width: 34px; height: 34px; border-radius: 9px; background: #fff; }
.install-bar div { flex: 1; font-size: 13.5px; line-height: 1.25; }
.install-bar small { display: block; opacity: .75; font-size: 12px; }
.install-bar .ok { background: var(--green); color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 9px; font-size: 13px; }
.install-bar .x { color: #fff; opacity: .7; padding: 6px 8px; font-size: 15px; }

.i { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }
.pill .i { vertical-align: -2px; }
.h-ic { display: flex; align-items: center; gap: 8px; }
.h-ic .i { color: var(--green-dark); }
.step .dot { color: #fff; }
.link-box span { display: flex; align-items: center; gap: 6px; }
.coupon .side { font-size: 16px; }

/* Mapa das lojas */
.map-card { padding: 0; overflow: hidden; }
#map { height: 260px; width: 100%; z-index: 0; }
.pin span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); color: #fff; font-weight: 800; font-size: 11px; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.pin span { line-height: 1; }
.pin { background: none; border: 0; }
.pin span > * { transform: rotate(45deg); }
.leaflet-popup-content { margin: 10px 12px; font-family: inherit; font-size: 13px; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.where { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.where small { font-size: 10.5px; }

/* Logos das lojas ocupando o quadrado */
.has-logo { overflow: hidden; padding: 0; }
.has-logo img { width: 100%; height: 100%; display: block; }
.store-logo.has-logo { border: 1px solid rgba(0,0,0,.06); }
/* Pino do mapa com a logo */
.pin-logo { position: relative; width: 44px; height: 52px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.3)); }
.pin-logo::after { content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); border: 7px solid transparent; border-top: 10px solid #fff; border-bottom: 0; }
.pin-img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: #fff; }
.pin-img img { border-radius: 50%; }
.leaflet-container .pin-img img { width: 100% !important; height: 100% !important; max-width: none !important; }
.leaflet-container .pin-img img[style*="contain"] { padding: 3px; box-sizing: border-box; }
