:root {
  /* Paleta oficial FinanSAAS */
  --preto: #1F2937;       /* grafite */
  --preto-2: #2b3647;     /* grafite hover */
  --dourado: #165DFF;     /* azul primário (nome da variável mantido por compatibilidade interna) */
  --dourado-claro: #4c86ff;
  --verde: #22C55E;
  --vermelho: #d9534f;
  --azul: #165DFF;
  --cinza: #6b7280;
  --cinza-claro: #F3F4F6;
  --branco: #ffffff;
  --borda: #e5e7eb;
  --radius: 10px;
}

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

* { box-sizing: border-box; }

img { max-width: 100%; height: auto; }

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cinza-claro);
  color: #1f2937;
}

a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* --- Barra lateral --- */
.sidebar {
  width: 230px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  background: var(--preto);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px;
  border-bottom: 1px solid #2f3b4d;
}
.sidebar .brand .brand-icone {
  width: 100px; height: auto; object-fit: contain;
}
.sidebar nav { flex: 1; min-height: 0; padding: 14px 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 8px;
  color: #c7cad1; font-size: 14.5px; margin-bottom: 3px;
}
.sidebar nav a:hover { background: #333e52; color: #fff; }
.sidebar nav a.active { background: var(--dourado); color: #fff; font-weight: 600; }
.sidebar .rodape-side {
  padding: 16px 20px; border-top: 1px solid #2f3b4d; font-size: 12.5px; color: #8b8f98;
}
.sidebar .rodape-side a { color: #d1d5db; }

/* --- Conteúdo --- */
.conteudo { flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.btn-menu-mobile {
  display: none; background: none; border: none; font-size: 22px; cursor: pointer;
  color: #1f2937; padding: 4px 6px; margin-right: 6px; line-height: 1;
}
.sidebar-backdrop { display: none; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--borda);
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar .topbar-esquerda { display: flex; align-items: center; min-width: 0; }
.topbar h1 { font-size: 19px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .usuario { font-size: 13.5px; color: var(--cinza); white-space: nowrap; }
.pagina { flex: 1 0 auto; width: 100%; padding: 26px 28px; max-width: 1200px; }
.conteudo > .rodape-padrao { margin-top: auto; flex-shrink: 0; }

/* --- Cartões --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--radius);
  padding: 18px 20px;
}
.card .rotulo { font-size: 12.5px; color: var(--cinza); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.card .valor { font-size: 24px; font-weight: 700; }
.card.receita .valor { color: var(--verde); }
.card.despesa .valor { color: var(--vermelho); }
.card.saldo .valor { color: #1f2937; }
.card.investimento .valor { color: var(--azul); }

.painel { background: #fff; border: 1px solid var(--borda); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; }
.painel h2 { font-size: 16px; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- Filtros --- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-end; }
.filtros .campo { display: flex; flex-direction: column; gap: 4px; }
.filtros label { font-size: 12px; color: var(--cinza); }

/* --- Formulários --- */
label { font-size: 13.5px; font-weight: 600; color: #374151; display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--borda); border-radius: 7px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--dourado); box-shadow: 0 0 0 3px rgba(214,161,58,.18); }
.campo-grupo { margin-bottom: 14px; }
.linha-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .linha-form { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-primario { background: var(--preto); color: #fff; }
.btn-primario:hover { background: var(--preto-2); }
.btn-dourado { background: var(--dourado); color: #fff; }
.btn-dourado:hover { background: var(--dourado-claro); }
.btn-secundario { background: #fff; border: 1px solid var(--borda); color: #374151; }
.btn-secundario:hover { background: #f3f4f6; }
.btn-perigo { background: #fdecea; color: var(--vermelho); }
.btn-perigo:hover { background: #f8d7d5; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* --- Tabelas --- */
table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
thead th {
  text-align: left; padding: 10px 12px; background: #fafafa; color: var(--cinza);
  font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--borda);
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
tbody tr:hover { background: #fbfbfc; }
.tabela-wrap { overflow-x: auto; }
.acoes { display: flex; gap: 6px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pago, .badge-quitado { background: #e6f7ee; color: var(--verde); }
.badge-pendente, .badge-aberto { background: #fdf3e2; color: #b8791c; }
.badge-receita { background: #e6f7ee; color: var(--verde); }
.badge-despesa { background: #fdecea; color: var(--vermelho); }
.badge-investimento { background: #e8f0fd; color: var(--azul); }

.barra-progresso { background: #edeef1; border-radius: 20px; height: 8px; overflow: hidden; }
.barra-progresso > div { height: 100%; background: var(--dourado); }

.vazio { text-align: center; padding: 50px 20px; color: var(--cinza); }
.vazio .btn { margin-top: 14px; }

.topo-pagina { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.topo-pagina h2 { margin: 0; font-size: 20px; }

/* --- Modal --- */
.modal-fundo {
  display: none; position: fixed; inset: 0; background: rgba(20,22,26,.55);
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-fundo.aberto { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; padding: 26px 28px;
}
.modal-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-topo h3 { margin: 0; font-size: 18px; }
.fechar-modal { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--cinza); line-height: 1; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- Auth (login/cadastro) --- */
.tela-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1F2937, #2b3647);
  padding: 20px;
}
.caixa-auth {
  background: #fff; border-radius: 14px; padding: 36px 34px; width: 100%; max-width: 400px;
}
.caixa-auth .brand-auth { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.caixa-auth .brand-auth .brand-icone { width: 34px; height: 34px; object-fit: contain; }
.caixa-auth h1 { font-size: 20px; margin: 0 0 4px; }
.caixa-auth p.sub { color: var(--cinza); font-size: 13.5px; margin: 0 0 22px; }
.caixa-auth .rodape-auth { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--cinza); }
.caixa-auth .rodape-auth a { color: var(--dourado); font-weight: 600; }

.alerta { padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alerta-erro { background: #fdecea; color: #b83f3b; }
.alerta-sucesso { background: #e6f7ee; color: #1f7a4d; }

.chip-natureza-receita { color: var(--verde); }
.chip-natureza-despesa { color: var(--vermelho); }
.chip-natureza-investimento { color: var(--azul); }

.rodape-padrao { width:100%; padding:28px; font-size:12.5px; }
.rodape-padrao--claro { color:var(--cinza); background:transparent; }
.rodape-padrao--escuro { color:#cfd2d8; background:var(--preto); }
.rodape-padrao-colunas { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:36px; width:100%; max-width:1200px; margin:0 auto; }
.rodape-padrao-bloco { line-height:1.65; }
.rodape-padrao-esquerda { text-align:left; }
.rodape-padrao-centro { text-align:center; min-width:190px; }
.rodape-padrao-centro img { display:inline-block; width:auto; height:52px; max-width:230px; object-fit:contain; }
.rodape-padrao-direita { text-align:right; }
.rodape-padrao-politicas { display:flex; align-items:center; justify-content:center; gap:18px; flex-wrap:wrap; max-width:1200px; margin:18px auto 0; padding-top:14px; border-top:1px solid var(--borda); text-align:center; }
.rodape-padrao--escuro .rodape-padrao-politicas { border-color:rgba(255,255,255,.14); }
.rodape-padrao-politicas a { color:inherit; }
.rodape-padrao-politicas a:hover { color:var(--dourado); }

/* =====================================================================
   RESPONSIVO (celular / tablet)
   ===================================================================== */
@media (max-width: 860px) {
  .rodape-padrao-colunas { grid-template-columns:1fr; gap:14px; }
  .rodape-padrao-esquerda, .rodape-padrao-centro, .rodape-padrao-direita { text-align:center; }
  .rodape-padrao-centro { order:-1; min-width:0; }
  .btn-menu-mobile { display: inline-flex; align-items: center; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 210;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.aberta { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(15,17,21,.55); z-index: 200;
  }
  .sidebar-backdrop.aberta { display: block; }

  .conteudo { width: 100%; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 17px; }
  .topbar .usuario { display: none; } /* some no topo pra dar espaço no celular; segue visível no rodapé da sidebar */
  .pagina { padding: 16px; }

  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .card { padding: 14px 14px; }
  .card .valor { font-size: 19px; }

  .painel { padding: 16px; }

  table { font-size: 12.8px; }
  thead th { padding: 8px 8px; }
  tbody td { padding: 9px 8px; }

  .modal { padding: 20px 18px; border-radius: 10px; }
  .modal-fundo { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; }

  .topo-pagina { flex-direction: column; align-items: stretch; }
  .topo-pagina .btn { width: 100%; }

  .filtros { gap: 8px; }
  .filtros .campo { flex: 1 1 140px; }

  .acoes { flex-wrap: wrap; }

  .caixa-auth { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .lp-precos, .grid-2 { grid-template-columns: 1fr !important; }
}
