*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0A0F1E;
  --surface: #161D2F;
  --surface2: #1E2840;
  --border: rgba(255,255,255,0.08);
  --text: #F0F4FF;
  --text2: #8892A4;
  --text3: #4B5568;
  --green: #00E5A0;
  --green2: #00C78A;
  --red: #FF4D6A;
  --yellow: #FFD166;
  --blue: #4DA6FF;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
}


/* ── TEMA CLARO ──────────────────────────────────────────────── */
body.light {
  --bg: #F0F4FF;
  --surface: #FFFFFF;
  --surface2: #E8EDF8;
  --border: rgba(0,0,0,0.08);
  --text: #0A0F1E;
  --text2: #4B5568;
  --text3: #9CA3AF;
  --green: #00B884;
  --green2: #009E70;
  --red: #E8354A;
  --yellow: #D4A017;
  --blue: #2D7FD4;
}
body.light .btn-primary { color: #FFFFFF; }
body.light .splash { background: var(--bg); }
body.light .login-screen { background: var(--bg); }
body.light .bottom-nav { background: rgba(240,244,255,0.95); border-top-color: rgba(0,0,0,0.08); }
body.light .modal-sheet { background: var(--surface); }
body.light .input { background: var(--surface2); }
body.light .card { background: var(--surface); }
body.light .resumo-card { background: var(--surface); }
body.light .conta-item { background: var(--surface); }

html, body { height: 100%; width: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }

#app { height: 100dvh; width: 100%; max-width: 430px; margin: 0 auto; position: relative; overflow: hidden; }

.page { height: 100dvh; width: 100%; }
.page.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1.15; }
h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }

.text-muted { color: var(--text2); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-muted.text-sm { color: var(--text2); font-size: 14px; }
.text-muted.text-xs { color: var(--text3); font-size: 12px; }
.label-sm { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-family: var(--font-display); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 24px; border-radius: var(--radius-sm); border: none; font-family: var(--font-display); font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s; width: 100%; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--green); color: #0A0F1E; }
.btn-primary:active { transform: scale(0.97); background: var(--green2); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.info-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tip-box { background: var(--surface2); border-radius: 12px; padding: 14px 16px; border-left: 3px solid var(--green); }

.input { width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-body); font-size: 1rem; outline: none; transition: border-color 0.2s; }
.input:focus { border-color: var(--green); }
.input::placeholder { color: var(--text3); }

::-webkit-scrollbar { width: 0; }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-ring { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0,229,160,0.4); } 70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(0,229,160,0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0,229,160,0); } }
.fade-up { animation: fadeUp 0.4s ease forwards; }
.pulse-ring { animation: pulse-ring 2s infinite; }

/* Splash */
.splash { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.splash-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); border: 2px solid var(--green); display: flex; align-items: center; justify-content: center; font-size: 32px; box-shadow: 0 0 32px rgba(0,229,160,0.2); }
.splash-label { color: var(--text2); font-family: var(--font-display); font-size: 14px; letter-spacing: 4px; }

/* Login */
.login-header { padding: 60px 32px 32px; text-align: center; position: relative; }
.login-glow { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(0,229,160,0.1) 0%, transparent 70%); pointer-events: none; }
.login-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); border: 2px solid var(--green); display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; font-size: 32px; box-shadow: 0 0 32px rgba(0,229,160,0.2); }
.login-header h1 { margin-bottom: 8px; }
.login-form { padding: 0 24px; display: flex; flex-direction: column; gap: 12px; }
.login-terms { text-align: center; color: var(--text3); font-size: 12px; padding: 16px 24px 32px; }

.divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { color: var(--text3); font-size: 13px; }

.tab-switch { display: flex; background: var(--surface); border-radius: 10px; padding: 4px; }
.tab { flex: 1; padding: 8px; border-radius: 8px; border: none; background: transparent; color: var(--text3); font-family: var(--font-body); font-size: 14px; cursor: pointer; transition: all 0.2s; }
.tab.active { background: var(--surface2); color: var(--text); }

/* Onboarding */
.onb-welcome { padding: 60px 24px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.onb-welcome h1 { margin-bottom: 12px; }
.onb-info-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.onb-info-item { padding: 14px 20px; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); color: var(--text2); font-size: 15px; text-align: left; }
.onb-progress { padding: 32px 24px 0; }
.onb-progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress-bar { height: 4px; background: var(--surface2); border-radius: 4px; }
.progress-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width 0.3s ease; }
.onb-question { padding: 24px 24px 0; }
.onb-options { padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }

.option-btn { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-family: var(--font-body); font-size: 15px; cursor: pointer; text-align: left; transition: all 0.15s; -webkit-tap-highlight-color: transparent; }
.option-btn:active, .option-btn.selected { background: var(--surface2); border-color: var(--green); }

.result-screen { padding: 60px 24px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; }

/* Check-in */
.ci-header { display: flex; align-items: center; gap: 12px; padding: 40px 24px 0; }
.btn-back { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 20px; padding: 0; }
.ci-bars { display: flex; gap: 8px; flex: 1; }
.ci-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--surface2); transition: all 0.3s; }
.ci-bar.active { background: var(--green); }
.ci-body { padding: 32px 24px; display: flex; flex-direction: column; gap: 24px; }
.ci-options { display: flex; flex-direction: column; gap: 10px; }

.scale-wrap { display: flex; flex-direction: column; gap: 12px; }
.scale-emojis { display: flex; gap: 12px; }
.scale-btn { flex: 1; aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); font-size: 28px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.scale-btn:active, .scale-btn.selected { border-color: var(--green); background: rgba(0,229,160,0.1); transform: scale(1.1); }
.scale-labels { display: flex; justify-content: space-between; }

.done-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 24px; min-height: 100dvh; }
.done-icon { width: 100px; height: 100px; border-radius: 50%; background: rgba(0,229,160,0.1); border: 2px solid var(--green); display: flex; align-items: center; justify-content: center; font-size: 48px; margin-bottom: 24px; color: var(--green); }

/* Dashboard */
.dash-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 56px 24px 24px; background: linear-gradient(180deg, rgba(0,229,160,0.06) 0%, transparent 100%); border-bottom: 1px solid var(--border); }
.avatar-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.stats-row { display: flex; gap: 10px; padding: 16px 24px 0; }
.stat-chip { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-chip span { font-size: 20px; }
.stat-chip strong { font-family: var(--font-display); font-size: 13px; color: var(--text); }

.dash-body { padding: 16px 24px 0; display: flex; flex-direction: column; gap: 16px; }

.checkin-cta { width: 100%; padding: 24px; background: var(--green); border-radius: var(--radius); border: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 8px 32px rgba(0,229,160,0.25); -webkit-tap-highlight-color: transparent; }
.checkin-cta:active { transform: scale(0.98); }
.checkin-cta-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #0A0F1E; margin-bottom: 4px; }

.checkin-done { display: flex; align-items: center; gap: 16px; }
.checkin-done-icon { width: 48px; height: 48px; border-radius: 50%; background: rgba(0,229,160,0.1); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--green); flex-shrink: 0; }

.chart-section { display: flex; flex-direction: column; gap: 12px; }
.chart-header { display: flex; justify-content: space-between; align-items: center; }
.period-switch { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 4px; }
.period-btn { padding: 6px 14px; border-radius: 8px; border: none; background: transparent; color: var(--text3); font-family: var(--font-body); font-size: 13px; cursor: pointer; transition: all 0.2s; }
.period-btn.active { background: var(--surface2); color: var(--text); }

/* Profile */
.profile-header { padding: 56px 24px 32px; background: linear-gradient(180deg, rgba(0,229,160,0.06) 0%, transparent 100%); border-bottom: 1px solid var(--border); text-align: center; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--border); margin: 0 auto 16px; overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge-row { display: flex; align-items: center; gap: 12px; margin-bottom: 0; }
.badge-icon { width: 56px; height: 56px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge-tag { margin-left: auto; border: 1px solid; border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 700; }

.journey-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface2); border-radius: 12px; border: 1px solid transparent; margin-bottom: 8px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: var(--surface2); border-radius: 12px; padding: 14px; }
.stat-card span { font-size: 22px; }
.stat-value { font-size: 18px; font-family: var(--font-display); font-weight: 700; margin: 8px 0 4px; }

/* Bottom Nav */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; background: #0D1423; border-top: 1px solid var(--border); padding: 12px 0 env(safe-area-inset-bottom, 12px); display: flex; justify-content: space-around; z-index: 50; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; background: transparent; border: none; border-radius: 14px; padding: 4px 16px; cursor: pointer; color: var(--text3); -webkit-tap-highlight-color: transparent; }
.nav-btn.highlight { background: var(--green); padding: 8px 20px; color: #0A0F1E; }
.nav-btn span:first-child { font-size: 22px; }
.nav-label { font-size: 11px; font-family: var(--font-display); font-weight: 600; }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px); background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 20px; font-size: 14px; color: var(--text); z-index: 1000; opacity: 0; transition: all 0.3s; white-space: nowrap; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-success { border-color: rgba(0,229,160,0.4); }
.toast.toast-error { border-color: rgba(255,77,106,0.4); }

/* ── NOVOS COMPONENTES v2 ──────────────────────────────────── */

/* Botão flutuante de impulso */
.fab-impulso { position: fixed; bottom: 90px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--red); border: none; box-shadow: 0 4px 20px rgba(255,77,106,0.5); cursor: pointer; font-size: 24px; display: flex; align-items: center; justify-content: center; z-index: 40; -webkit-tap-highlight-color: transparent; transition: transform 0.15s; }
.fab-impulso:active { transform: scale(0.9); }

/* Alerta de contas vencidas */
.alert-box { background: rgba(255,77,106,0.1); border: 1px solid rgba(255,77,106,0.3); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14px; color: var(--text); }
.dash-alert { margin: 0 24px 0; }

/* Contas e pagamentos */
.month-nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; margin-bottom: 8px; }
.month-nav button { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; width: 36px; height: 36px; color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.month-nav span { font-family: var(--font-display); font-weight: 600; font-size: 15px; }

.conta-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; gap: 12px; }
.conta-item.pago { opacity: 0.55; }
.conta-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.conta-nome { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conta-venc { font-size: 12px; }
.conta-valor { font-family: var(--font-display); font-weight: 700; font-size: 15px; white-space: nowrap; }
.btn-pagar { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.btn-pagar.pago { background: rgba(0,229,160,0.1); border-color: rgba(0,229,160,0.3); color: var(--green); }
.btn-del { background: transparent; border: none; color: var(--text3); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.parcela-tag { background: var(--surface2); border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--text3); font-weight: 400; }

/* Header de página interna */
.page-header { display: flex; align-items: center; gap: 16px; padding: 56px 24px 24px; }
.page-header h2 { font-size: 20px; }
.btn-back { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Botão ícone (＋) */
.btn-icon { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; width: 44px; height: 44px; color: var(--green); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Campo label */
.field-label { font-size: 13px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: -4px; }

/* Select estilo input */
select.input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

/* Estado vazio */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text3); font-size: 14px; line-height: 1.8; }

/* Nav active state */
.nav-btn.nav-active { color: var(--green); }
.nav-btn.nav-active span:first-child { transform: scale(1.1); display: inline-block; }

/* Botão impulso vermelho na nav */
.nav-btn.highlight-red { background: var(--red); padding: 8px 20px; color: #fff; }

/* ── PWA INSTALL BANNER ──────────────────────────────────────── */
#install-banner { position: fixed; bottom: -120px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 398px; background: var(--surface2); border: 1px solid rgba(0,229,160,0.3); border-radius: 20px; padding: 16px; z-index: 200; transition: bottom 0.4s cubic-bezier(0.34,1.56,0.64,1); box-shadow: 0 -4px 32px rgba(0,0,0,0.4); }
#install-banner.show { bottom: 100px; }
.install-banner-content { display: flex; align-items: center; gap: 12px; }
.install-icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.install-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.install-text strong { font-size: 14px; font-family: var(--font-display); }
.install-text span { font-size: 12px; color: var(--text3); }
.install-btn-yes { background: var(--green); color: #0A0F1E; border: none; border-radius: 10px; padding: 8px 16px; font-family: var(--font-display); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.install-btn-no { background: transparent; border: none; color: var(--text3); font-size: 18px; cursor: pointer; padding: 4px 8px; flex-shrink: 0; }

/* ── RESUMO DO MÊS ───────────────────────────────────────────── */
.resumo-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.resumo-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin-bottom: 12px; }
.resumo-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.resumo-toggle-icon { color: var(--text3); font-size: 14px; }
.resumo-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 5px 0; }
.resumo-total { font-family: var(--font-display); font-weight: 700; font-size: 15px; padding-top: 8px; }
.resumo-divider { border-top: 1px solid var(--border); margin: 8px 0; }
.resumo-bar-label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.resumo-bar-bg { background: var(--surface2); border-radius: 99px; height: 8px; overflow: hidden; }
.resumo-bar-fill { background: var(--green); height: 100%; border-radius: 99px; transition: width 0.6s ease; }

/* ── FONTE MAIOR NOS ITENS DE CONTAS/GASTOS ──────────────────── */
.conta-nome { font-size: 15px; }
.conta-valor { font-size: 16px; }
.conta-venc { font-size: 13px; }

/* ── MODAIS ──────────────────────────────────────────────────── */
.modal-backdrop { position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:300;backdrop-filter:blur(4px); }
.modal-sheet { position:fixed;bottom:0;left:50%;transform:translateX(-50%) translateY(100%);width:100%;max-width:430px;background:var(--surface);border-radius:24px 24px 0 0;padding:28px 24px 40px;z-index:301;transition:transform .35s cubic-bezier(.34,1.56,.64,1);max-height:80vh;overflow-y:auto; }
.modal-sheet.show { transform:translateX(-50%) translateY(0); }
.modal-close { position:absolute;top:16px;right:16px;background:var(--surface2);border:none;border-radius:50%;width:32px;height:32px;color:var(--text3);font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center; }

/* ── CALENDÁRIO DE CHECK-INS ─────────────────────────────────── */
.cal-semanas { display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-bottom:6px; }
.cal-sem-label { text-align:center;font-size:11px;color:var(--text3);font-family:var(--font-display); }
.cal-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:4px; }
.cal-dia { aspect-ratio:1;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;color:var(--text3); }
.cal-dia.tem-checkin { background:var(--green);color:#0A0F1E;font-weight:700; }
.cal-dia.hoje { border:2px solid var(--green);color:var(--green); }
.cal-dia.hoje.tem-checkin { color:#0A0F1E; }

/* ── STAT-CARD HOVER ─────────────────────────────────────────── */
.stat-card[onclick]:active { transform:scale(.96); }
.stat-chip[style*="cursor"] { transition:transform .15s; }
.stat-chip[style*="cursor"]:active { transform:scale(.96); }

/* ── METAS ───────────────────────────────────────────────────── */
.emoji-btn.selected { border-color: var(--green) !important; background: var(--green)15; }
