:root {
  --bg0: #080c14; --bg1: #0d1423; --bg2: #111b2e; --bg3: #162138;
  --blue1: #0d6ecc; --blue2: #1a8fff; --blue3: #5ab2ff;
  --green: #00e5a0; --red: #ff4d6a; --amber: #ffb347; --purple: #9b7fff;
  --text0: #f0f6ff; --text1: #b8d0f0; --text2: #6b8ab0; --text3: #3d5470;
  --border: rgba(26,143,255,0.12); --border2: rgba(26,143,255,0.22);
  --radius: 12px; --radius-sm: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg0); color: var(--text0); font-family: 'Inter', sans-serif; min-height: 100vh; }
.view { min-height: 100vh; }
.logo-text { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 1.15rem; color: var(--blue3); }

.login-box { max-width: 320px; margin: 20vh auto; padding: 24px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.login-box .form-input { margin-top: 16px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background: var(--bg1); border-bottom: 1px solid var(--border); position: sticky; top: 0; gap: 8px; z-index: 10; }
.content { max-width: 480px; margin: 0 auto; padding: 1rem; padding-bottom: 6rem; }

.tabs { display: flex; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem; }
.tab-btn { flex: 1; padding: 0.6rem; text-align: center; color: var(--text2); border: none; background: none; font-size: 0.85rem; cursor: pointer; font-family: 'Inter', sans-serif; }
.tab-btn.active { background: var(--blue0, #0a4f8c); color: var(--blue3); }

.month-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 1rem; font-family: 'JetBrains Mono', monospace; color: var(--text1); }
.month-nav button { background: var(--bg2); border: 1px solid var(--border); color: var(--text1); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; }

.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.card-title { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.875rem; color: var(--text1); }
.saldo-card { text-align: center; }
.metric-label { font-size: 0.72rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; text-transform: uppercase; margin-bottom: 6px; }
.metric-value { font-family: 'Inter', sans-serif; font-size: 2rem; font-weight: 800; }
.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }
.metric-sub { font-size: 0.8rem; color: var(--text3); margin-top: 4px; }

.divida-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.divida-item:last-child { border-bottom: none; }
.divida-topo { display: flex; justify-content: space-between; font-size: 0.875rem; margin-bottom: 6px; }
.progress-wrap { background: var(--bg3); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--blue2); border-radius: 4px; }
.divida-sub { font-size: 0.72rem; color: var(--text3); margin-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn-pagar { font-size: 0.72rem; padding: 2px 8px; background: rgba(0,229,160,0.15); color: var(--green); border: 1px solid rgba(0,229,160,0.2); border-radius: 20px; cursor: pointer; }

.mov-item { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.mov-item:last-child { border-bottom: none; }
.mov-desc { color: var(--text0); }
.mov-cat { font-size: 0.72rem; color: var(--text3); }
.mov-val.entrada { color: var(--green); font-family: 'JetBrains Mono', monospace; }
.mov-val.saida { color: var(--red); font-family: 'JetBrains Mono', monospace; }

.conta-pagar-item { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.conta-pagar-item:last-child { border-bottom: none; }
.conta-pagar-item.vencida .mov-desc { color: var(--red); }

.fab { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--blue1); color: white; border: none; padding: 0.9rem 1.6rem; border-radius: 30px; font-size: 0.95rem; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,0.4); cursor: pointer; z-index: 20; }

.btn { padding: 0.5rem 1rem; border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 0.875rem; font-weight: 500; }
.btn-primary { background: var(--blue1); color: white; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); text-decoration: none; display: inline-block; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.form-input { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; color: var(--text0); font-family: 'Inter', sans-serif; font-size: 0.875rem; }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; color: var(--text2); margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text1); margin-bottom: 1rem; }

.type-toggle { display: flex; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem; }
.type-btn { flex: 1; padding: 0.5rem; text-align: center; color: var(--text2); border: none; background: none; font-size: 0.875rem; cursor: pointer; }
.type-btn.active-entrada { background: rgba(0,229,160,0.15); color: var(--green); }
.type-btn.active-saida { background: rgba(255,77,106,0.15); color: var(--red); }

.alocacao-preview { background: var(--bg3); border-radius: var(--radius-sm); padding: 0.75rem; margin-bottom: 1rem; font-size: 0.8rem; color: var(--text1); }
.alocacao-preview div { display: flex; justify-content: space-between; padding: 2px 0; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); align-items: center; justify-content: center; z-index: 200; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius); width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-family: 'Inter', sans-serif; font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.erro-msg { color: var(--red); font-size: 0.8rem; margin-top: 8px; min-height: 1em; }

.health-score { display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0; }
.score-ring { width: 100px; height: 100px; position: relative; margin-bottom: 0.5rem; }
.score-ring svg { transform: rotate(-90deg); }
.score-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.score-num { font-family: 'Inter', sans-serif; font-size: 1.5rem; font-weight: 800; }
.score-text { font-size: 0.65rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; }

.alert { display: flex; gap: 10px; padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; align-items: flex-start; }
.alert-danger { background: rgba(255,77,106,0.08); border: 1px solid rgba(255,77,106,0.15); }
.alert-warn { background: rgba(255,179,71,0.08); border: 1px solid rgba(255,179,71,0.15); }
.alert-text { font-size: 0.82rem; color: var(--text1); line-height: 1.5; }

.streak-badge { text-align: center; font-size: 0.85rem; color: var(--text1); padding: 0.5rem 0; }
.streak-num { font-family: 'Inter', sans-serif; font-weight: 800; color: var(--amber); font-size: 1.1rem; }

.rel-toggle { display: flex; background: var(--bg3); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem; font-size: 0.8rem; }
.rel-toggle span { flex: 1; text-align: center; padding: 0.5rem; color: var(--text2); cursor: pointer; }
.rel-toggle span.on { background: var(--blue0, #0a4f8c); color: var(--blue3); }
.rel-donut-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.donut-wrap { position: relative; width: 160px; height: 160px; }
.donut-wrap svg { transform: rotate(-90deg); }
.donut-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-label b { font-family: 'Inter', sans-serif; font-size: 1.1rem; font-weight: 800; }
.donut-label span { font-size: 0.65rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; }
.rel-legend { display: flex; flex-direction: column; gap: 8px; }
.rel-legend .row { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; }
.rel-legend .row .cat { display: flex; align-items: center; gap: 8px; color: var(--text1); }
.rel-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.rel-legend .row .val { font-family: 'JetBrains Mono', monospace; color: var(--text0); font-size: 0.8rem; }

.onboarding-chat { display: flex; flex-direction: column; margin-bottom: 12px; max-height: 45vh; overflow-y: auto; }
.onboarding-bolha { padding: 0.65rem 0.85rem; border-radius: 12px; font-size: 0.85rem; line-height: 1.5; margin-bottom: 10px; max-width: 90%; }
.onboarding-bolha.bot { background: var(--bg3); color: var(--text1); border-bottom-left-radius: 3px; align-self: flex-start; }
.onboarding-bolha.user { background: var(--blue1); color: white; border-bottom-right-radius: 3px; align-self: flex-end; }
.onboarding-input-row { display: flex; gap: 8px; }
.onboarding-input-row .form-input { flex: 1; }
.onboarding-preview { background: var(--bg3); border: 1px dashed var(--border2); border-radius: var(--radius-sm); padding: 0.85rem; margin-bottom: 12px; }
.onboarding-preview .campo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; align-items: center; }
.onboarding-preview .campo label { font-size: 0.72rem; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
.onboarding-preview .item-lista { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

.categoria-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg3); border: 1px solid var(--border2); border-radius: 20px; padding: 4px 6px 4px 10px; font-size: 0.78rem; color: var(--text1); margin: 0 6px 6px 0; }
.categoria-chip button { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 0.75rem; padding: 2px 4px; }
.categoria-chip button:hover { color: var(--red); }
.btn-icone { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 0.85rem; padding: 2px 4px; }
.btn-icone:hover { color: var(--text0); }

.btn-explicar { background: var(--bg3); border: 1px solid var(--border2); color: var(--blue3); cursor: pointer; font-size: 0.68rem; font-weight: 600; width: 18px; height: 18px; border-radius: 50%; padding: 0; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-explicar:hover { background: var(--blue0, #0a4f8c); }
.explicacao-texto { font-size: 0.78rem; color: var(--text1); line-height: 1.5; background: var(--bg3); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; margin-top: 6px; }
