/* ============================================================
   FinFlow — css/style.css
   ============================================================ */

:root {
  --bg:       #060d1a;
  --surface:  #0f1929;
  --border:   #1e293b;
  --muted:    #64748b;
  --text:     #e2e8f0;
  --textsub:  #94a3b8;
  --green:    #22d3a5;
  --red:      #f87171;
  --yellow:   #facc15;
  --purple:   #a78bfa;
  --orange:   #f59e0b;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: #060d1aee;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}
.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 20px;
  color: var(--green); text-decoration: none;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 7px 12px; border-radius: 8px;
  transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--border);
  text-decoration: none;
}
.nav-logout { color: var(--red) !important; }
.nav-hamburger {
  display: none; background: none; border: none;
  color: var(--text); font-size: 22px; cursor: pointer;
}
.nav-mobile {
  display: none; flex-direction: column;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; gap: 4px;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  color: var(--textsub); padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-hamburger { display: block; }
}

/* ── Layout ───────────────────────────────────────────────── */
.main-wrap { max-width: 860px; margin: 0 auto; }
.content-pad { padding: 24px 20px 60px; }

/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%; max-width: 420px;
}
.auth-card.wide { max-width: 680px; }
.auth-logo { font-size: 52px; text-align: center; margin-bottom: 12px; }
.auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
  text-align: center; margin-bottom: 4px;
}
.auth-sub { color: var(--muted); text-align: center; margin-bottom: 28px; font-size: 14px; }
.auth-link { text-align: center; color: var(--muted); font-size: 14px; margin-top: 20px; }

/* ── Form Fields ──────────────────────────────────────────── */
.field-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; margin-top: 2px;
}
.field-input {
  width: 100%;
  background: var(--border);
  border: 1.5px solid #334155;
  border-radius: 12px;
  padding: 13px 16px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.field-input:focus { border-color: var(--green); outline: none; }
.field-input.small { width: auto; margin-bottom: 0; }
.field-input option { background: var(--surface); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%;
  background: var(--green); color: var(--bg);
  border: none; border-radius: 14px;
  padding: 15px; font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 15px;
  cursor: pointer; letter-spacing: .3px;
  transition: opacity .2s;
}
.btn-primary:hover { opacity: .88; text-decoration: none; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  display: block; width: 100%;
  background: var(--border); color: var(--textsub);
  border: none; border-radius: 14px;
  padding: 13px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 14px;
  cursor: pointer; transition: opacity .2s;
}
.btn-secondary:hover { opacity: .8; text-decoration: none; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: 12px; padding: 13px 16px;
  font-size: 14px; margin-bottom: 16px;
}
.alert-ok     { background: #22d3a520; color: var(--green); border: 1px solid #22d3a540; }
.alert-error  { background: #f8717120; color: var(--red);   border: 1px solid #f8717140; }
.alert-warn   { background: #facc1520; color: var(--yellow);border: 1px solid #facc1540; }
.mt16 { margin-top: 16px; }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block; border-radius: 8px;
  padding: 4px 11px; font-size: 12px; font-weight: 700;
}
.badge-starter, .badge-green { background: #22d3a522; color: var(--green); }
.badge-plus,    .badge-yellow { background: #f59e0b22; color: var(--orange); }
.badge-pro,     .badge-purple { background: #a78bfa22; color: var(--purple); }
.badge-red      { background: #f8717122; color: var(--red); }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
}
.card-row {
  display: flex; justify-content: space-between; align-items: center;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px; margin-bottom: 14px;
}
.mt8 { margin-top: 8px; }
.small-text { font-size: 12px; color: var(--muted); }

/* ── Dashboard Header ─────────────────────────────────────── */
.dash-header {
  background: linear-gradient(160deg, #0a1628 0%, #0d2137 100%);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px 24px;
}
.dash-header-inner { max-width: 860px; margin: 0 auto; }
.dash-top-row {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 20px;
}
.dash-greeting { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.dash-balance {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 34px; color: #fff;
}
.dash-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dash-today-row { display: flex; gap: 12px; }
.today-card {
  flex: 1; border-radius: 12px; padding: 11px 14px;
}
.today-card.green { background: #22d3a515; }
.today-card.red   { background: #f8717115; }
.today-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.today-card.green .today-lbl { color: var(--green); }
.today-card.red   .today-lbl { color: var(--red); }
.today-val { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px; color: #fff; }

/* ── Health Bar ───────────────────────────────────────────── */
.health-bar-bg {
  background: var(--border); border-radius: 99px;
  height: 10px; overflow: hidden; margin: 8px 0;
}
.health-bar-fill {
  height: 100%; border-radius: 99px;
  background: var(--green);
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.health-bar-fill.yellow { background: var(--yellow); }
.health-bar-fill.red    { background: var(--red); }

/* ── Invest card ──────────────────────────────────────────── */
.card-invest {
  background: linear-gradient(135deg, #064e3b, #065f46) !important;
  border-color: #22d3a533 !important;
}
.invest-label {
  font-size: 12px; color: #6ee7b7; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px;
}
.invest-value {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 30px; color: var(--green); margin-bottom: 4px;
}
.invest-sub { font-size: 13px; color: #6ee7b7; }

/* ── Rule card ────────────────────────────────────────────── */
.card-rule { background: #0a1628 !important; border-color: #22d3a522 !important; }
.rule-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 14px; color: var(--green); margin-bottom: 10px;
}
.rule-row {
  display: flex; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid #1e293b44;
  font-size: 14px; color: var(--textsub);
}
.rule-row strong { color: var(--text); }

/* ── Transactions ─────────────────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
  margin-bottom: 12px; margin-top: 4px;
}
.tx-item {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}
.tx-item.entrada { border-left-color: var(--green); }
.tx-item.saida   { border-left-color: var(--red); }
.tx-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tx-meta { font-size: 12px; color: var(--muted); }
.tx-valor {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.tx-valor.entrada { color: var(--green); }
.tx-valor.saida   { color: var(--red); }
.empty-state {
  text-align: center; color: var(--muted);
  padding: 32px; font-size: 14px;
}

/* ── Lançamentos ──────────────────────────────────────────── */
.screen-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 24px; margin-bottom: 20px;
}
.ob-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.type-toggle { display: flex; gap: 10px; margin-bottom: 16px; }
.type-btn {
  flex: 1; padding: 12px; border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px;
  cursor: pointer; transition: all .2s;
}
.type-btn.active[id="btn-saida"]    { border-color: var(--red);   background: #f8717120; color: var(--red); }
.type-btn.active[id="btn-entrada"]  { border-color: var(--green); background: #22d3a520; color: var(--green); }

.amount-input { font-size: 26px !important; font-weight: 700; color: var(--red); }

.cat-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.cat-item {
  cursor: pointer;
}
.cat-item input { display: none; }
.cat-item span {
  display: inline-block;
  padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  transition: all .2s; cursor: pointer;
}
.cat-item input:checked + span {
  border-color: var(--green);
  background: #22d3a520;
  color: var(--green);
}

/* ── Relatório ────────────────────────────────────────────── */
.relatorio-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.filtro-form { display: flex; gap: 8px; }
.report-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 14px;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 16px;
}
.report-card.green { border-left: 3px solid var(--green); }
.report-card.red   { border-left: 3px solid var(--red); }
.report-card.purple{ border-left: 3px solid var(--purple); }
.rc-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.rc-value { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px; color: var(--text); }

.cat-report-row { margin-bottom: 14px; }
.cat-report-top {
  display: flex; justify-content: space-between; margin-bottom: 6px;
  font-size: 14px;
}

/* ── Planos ───────────────────────────────────────────────── */
.planos-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.plano-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 22px;
  position: relative; transition: border-color .3s;
}
.plano-card.recomendado { border-color: var(--green); }
.plano-card.atual        { border-color: var(--purple); }
.plano-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: var(--bg);
  font-size: 12px; font-weight: 800;
  padding: 4px 14px; border-radius: 99px;
}
.plano-nome {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 20px; margin-bottom: 6px;
}
.plano-preco {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 32px; color: var(--green); margin-bottom: 20px;
}
.plano-preco span { font-size: 14px; color: var(--muted); font-weight: 400; }
.plano-features { list-style: none; margin-bottom: 24px; }
.plano-features li { font-size: 14px; color: var(--textsub); padding: 5px 0; }
.plano-info-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 20px;
  font-size: 13px; color: var(--muted); line-height: 1.7;
}

/* ── Cadastro plan preview ────────────────────────────────── */
.plan-preview { margin-bottom: 20px; }
.plan-preview-cards { display: flex; gap: 10px; margin-bottom: 12px; }
.plan-mini {
  flex: 1; border-radius: 12px; padding: 12px 10px; text-align: center;
  border: 2px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 14px; transition: all .3s;
}
.plan-mini.active {
  border-color: var(--pc, var(--green));
  background: color-mix(in srgb, var(--pc, var(--green)) 15%, transparent);
  color: var(--pc, var(--green));
}
.plan-preview-info { font-size: 13px; color: var(--textsub); }

/* ── IA ───────────────────────────────────────────────────── */
.ai-box {
  background: linear-gradient(135deg, #0f2027, #1a1a2e);
  border: 1px solid #22d3a544;
  border-radius: 16px; padding: 20px; margin-bottom: 14px;
}
.ai-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.ai-title {
  font-family: 'Syne', sans-serif; font-weight: 700;
  color: var(--green); font-size: 15px;
}
.ai-response {
  color: #cbd5e1; font-size: 14px; line-height: 1.7;
  margin-bottom: 14px; white-space: pre-wrap;
}
.btn-ai {
  width: 100%; padding: 11px;
  background: linear-gradient(90deg, var(--green), #0891b2);
  color: #fff; border: none; border-radius: 10px;
  font-family: 'Syne', sans-serif; font-weight: 700;
  font-size: 14px; cursor: pointer; transition: opacity .2s;
}
.btn-ai:hover { opacity: .88; }
.btn-ai:disabled { background: var(--border); cursor: not-allowed; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .dash-balance { font-size: 26px; }
  .auth-card { padding: 28px 20px; }
  .content-pad { padding: 20px 16px 60px; }
}
