:root {
  --bg: #0d1117; --panel: #161b22; --border: #21262d; --line: #21262d;
  --text: #e6edf3; --muted: #8294a8; --sans: 'Inter',system-ui,sans-serif;
  --green: #34d399; --red: #f87171; --gold: #fbbf24; --blue: #60a5fa;
  --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--panel);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.user { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); }

.container { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

/* Navigation */
.nav-mes {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.nav-mes h2 { font-size: 1.15rem; font-weight: 600; color: var(--gold); }

/* Cards */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.card.hl { border-color: var(--green); }
.card .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.card .v { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.card .meta { font-size: .78rem; color: var(--muted); }

/* Progress bar */
.progress-wrap { margin-bottom: 18px; }
.progress-bar { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; display: flex; }
.bar-saida  { background: var(--red);  height: 100%; transition: width .4s; }
.bar-invest { background: var(--gold); height: 100%; transition: width .4s; }
.progress-legend { display: flex; gap: 20px; font-size: .78rem; color: var(--muted); margin-top: 6px; }

/* Grid */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Panel */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.body { padding: 16px 18px; }
.scroll { overflow-x: auto; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl thead th { padding: 8px 10px; text-align: left; color: var(--muted); font-weight: 500; font-size: .75rem; border-bottom: 1px solid var(--border); }
.tbl tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.03); }
.tbl td { padding: 9px 10px; vertical-align: middle; }
.tbl .empty { text-align: center; color: var(--muted); padding: 20px; }
.tbl .ev { max-width: 220px; }
.tbl .muted { color: var(--muted); font-size: .82rem; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .acoes { text-align: right; white-space: nowrap; }
.pago-row { opacity: .6; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-size: .85rem; font-weight: 500; font-family: var(--sans);
  background: var(--green); color: #000; transition: opacity .15s; text-decoration: none;
}
.btn:hover { opacity: .85; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid transparent; color: var(--red); padding: 4px 8px; }
.btn.danger:hover { border-color: var(--red); }
.btn.full { width: 100%; }
.btn.mini { padding: 3px 7px; font-size: .78rem; }

/* Check button */
.check { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0 4px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); cursor: pointer; margin-top: 8px; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 8px;
  font-family: var(--sans); font-size: .92rem;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Tags */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.tag.green  { background: rgba(52,211,153,.15); color: var(--green); }
.tag.red    { background: rgba(248,113,113,.15); color: var(--red); }
.tag.yellow { background: rgba(251,191,36,.15);  color: var(--gold); }

/* Colors */
.pos  { color: var(--green); }
.neg  { color: var(--red); }
.gold { color: var(--gold); }

/* Flash */
.flash {
  padding: 10px 16px; border-radius: 8px; margin-bottom: 14px; font-size: .88rem;
  background: rgba(52,211,153,.1); border: 1px solid var(--green); color: var(--green);
}
.flash.error { background: rgba(248,113,113,.1); border-color: var(--red); color: var(--red); }

/* Insights */
.insight {
  padding: 12px 14px; border-radius: 8px; margin-bottom: 10px;
  border-left: 3px solid var(--border);
}
.insight.alerta  { border-color: var(--red);   background: rgba(248,113,113,.06); }
.insight.ok      { border-color: var(--green);  background: rgba(52,211,153,.06); }
.insight.sugestao{ border-color: var(--gold);   background: rgba(251,191,36,.06); }
.insight.info    { border-color: var(--blue);   background: rgba(96,165,250,.06); }
.insight-titulo  { font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.insight-texto   { font-size: .82rem; color: var(--muted); line-height: 1.5; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px;
}
.modal-box h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 16px; }

/* Auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; width: 100%; max-width: 380px;
}
.auth-card .brand { justify-content: center; margin-bottom: 20px; }
.auth-card .brand h1 { font-size: 1.15rem; }
.sub { text-align: center; color: var(--muted); font-size: .88rem; margin-bottom: 20px; }

/* Responsive */
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 760px)  { .stats { grid-template-columns: repeat(2,1fr); } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 480px)  { .stats { grid-template-columns: 1fr 1fr; } }

/* ── Página de lançamentos ─────────────────────────────── */

/* CTA no dashboard */
.cta-lancamentos { text-align: center; margin: 24px 0 20px; }
.cta-lancamentos .btn { font-size: .95rem; padding: 11px 28px; }

/* Cabeçalho da página */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.page-header-left { display: flex; align-items: center; gap: 14px; }
.back-link { font-size: .82rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.back-link:hover { color: var(--text); }
.page-title { font-size: 1rem; font-weight: 600; }

/* Resumo inline na nav de meses */
.mini-resumo { display: flex; align-items: center; gap: 10px; font-size: .85rem; flex-wrap: wrap; justify-content: center; }
.mini-resumo .sep { color: var(--border); }

/* Barra de filtros */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: .82rem;
  font-family: var(--sans); transition: all .15s;
}
.tab:hover { border-color: var(--muted); color: var(--text); }
.tab.active { background: var(--green); border-color: var(--green); color: #000; font-weight: 600; }

.filter-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#search {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-family: var(--sans);
  font-size: .85rem; width: 200px;
}
#search:focus { outline: none; border-color: var(--green); }
.toggle-zeros {
  font-size: .82rem; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}

/* Badges de tipo */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; white-space: nowrap;
}
.badge-green { background: rgba(52,211,153,.15); color: var(--green); }
.badge-red   { background: rgba(248,113,113,.15); color: var(--red); }
.badge-gold  { background: rgba(251,191,36,.15);  color: var(--gold); }

/* Ícone de observação */
.obs-tag { cursor: help; font-size: .82rem; margin-left: 4px; opacity: .65; vertical-align: middle; }

/* Rodapé: meta + links */
.footer-bar {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px; padding: 12px 0;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.meta-form { display: flex; align-items: center; gap: 8px; }
.meta-form label { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.meta-form input {
  width: 110px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 6px 10px; border-radius: 8px;
  font-size: .88rem; font-family: var(--sans);
}
.meta-form input:focus { outline: none; border-color: var(--green); }
.meta-form .btn { font-size: .82rem; padding: 6px 12px; }
.footer-links { display: flex; gap: 8px; }
.footer-links .btn { font-size: .82rem; }
