/* ============================================================
   Sistema Financeiro — estilos
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --verde: #059669;
  --verde-soft: #ecfdf5;
  --vermelho: #dc2626;
  --vermelho-soft: #fef2f2;
  --amarelo: #d97706;
  --amarelo-soft: #fffbeb;
  --azul: #2563eb;
  --azul-soft: #eff6ff;
  --roxo: #7c3aed;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08);
  /* fonte nativa do sistema: Segoe UI (Windows), San Francisco (Mac/iPhone), Roboto (Android) */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  /* números usam a mesma fonte, com algarismos de largura fixa (tabular) para alinhar valores */
  --num: var(--font);
  /* monoespaçada só para códigos (boleto, PIX, campos técnicos) */
  --codigo: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sidebar: 236px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: var(--accent); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--codigo); }
.muted { color: var(--muted); }
.verde { color: var(--verde); }
.vermelho { color: var(--vermelho); }
.amarelo { color: var(--amarelo); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.ic.sm { width: 15px; height: 15px; }

/* ---------- layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: #0b1220; color: #e2e8f0; display: flex; flex-direction: column; z-index: 60;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.marca .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22c55e); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px; }
.marca .nome { font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.marca .sub { font-size: 11px; color: #94a3b8; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.nav-grupo { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #64748b; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #a5b4c8; text-decoration: none; font-size: 13.5px; font-weight: 500; margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.ativo { background: var(--accent); color: #fff; font-weight: 600; }
.nav a .badge { margin-left: auto; }
.sidebar-rodape { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 8px; }
.sidebar-rodape .avatar { width: 28px; height: 28px; border-radius: 50%; background: #1e293b; display: grid; place-items: center; font-weight: 700; color: #c7d2fe; }
.sidebar-rodape button { margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.12); color: #cbd5e1; border-radius: 6px; padding: 4px 8px; font-size: 11px; }
.sidebar-rodape button:hover { background: rgba(255,255,255,.08); }

.conteudo { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topo {
  position: sticky; top: 0; z-index: 40; background: rgba(244,246,251,.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border);
}
.topo h1 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.topo .sub { font-size: 12px; color: var(--muted); }
.topo .acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn-menu { display: none; background: none; border: none; padding: 6px; }
main { padding: 22px 28px 60px; max-width: 1440px; width: 100%; }

/* seletor de entidade */
.segmento { display: inline-flex; background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; padding: 3px; gap: 2px; }
.segmento button { border: none; background: none; padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.segmento button:hover { color: var(--ink); }
.segmento button.sel { background: var(--ink); color: #fff; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; padding: 8px 14px;
  border: 1px solid transparent; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primario { background: var(--accent); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 14px rgba(79,70,229,.25); }
.btn-sec { background: var(--surface); border-color: var(--border-2); color: var(--ink-2); }
.btn-sec:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-verde { background: var(--verde); color: #fff; }
.btn-verde:hover:not(:disabled) { background: #047857; }
.btn-vermelho { background: var(--vermelho); color: #fff; }
.btn-vermelho:hover:not(:disabled) { background: #b91c1c; }
.btn-link { background: none; border: none; color: var(--accent); padding: 4px 2px; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-link.perigo { color: var(--vermelho); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.btn-icone { background: none; border: 1px solid transparent; border-radius: 7px; padding: 5px; display: inline-flex; color: var(--muted); }
.btn-icone:hover { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.grupo-btn { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* menu suspenso */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md); min-width: 200px; padding: 6px; z-index: 80; display: none;
}
.menu.aberto { display: block; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--ink-2); text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); color: var(--ink); }
.menu .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu .perigo { color: var(--vermelho); }
.menu kbd { margin-left: auto; font-family: var(--codigo); font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }

/* ---------- cartões / painéis ---------- */
.grade { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mb { margin-bottom: 14px; }
.mb-lg { margin-bottom: 22px; }
.painel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; min-width: 0;
}
.painel-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.painel-cab h2, .painel h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.painel-cab .acoes { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.painel.sem-pad { padding: 0; }
.painel.sem-pad .painel-cab { padding: 14px 18px 0; }

.kpi { position: relative; }
.kpi .rotulo { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .valor { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 700; letter-spacing: -.015em; margin-top: 6px; line-height: 1.1; }
.kpi .detalhe { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.kpi .detalhe b { font-weight: 600; color: var(--ink-2); font-family: var(--num); }
.kpi.destaque { background: #0b1220; color: #fff; border-color: #0b1220; }
.kpi.destaque .rotulo, .kpi.destaque .detalhe { color: #94a3b8; }
.kpi.destaque .detalhe b { color: #e2e8f0; }
.kpi .barra-fina { height: 6px; border-radius: 4px; background: var(--surface-2); margin-top: 10px; overflow: hidden; border: 1px solid var(--border); }
.kpi .barra-fina > div { height: 100%; background: var(--verde); border-radius: 4px; }

.variacao { font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 10px; }
.variacao.sobe { background: var(--verde-soft); color: var(--verde); }
.variacao.desce { background: var(--vermelho-soft); color: var(--vermelho); }

/* ---------- etiquetas ---------- */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 700; font-family: var(--num); background: var(--vermelho); color: #fff; }
.badge.amarelo { background: var(--amarelo); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; font-size: 11px; font-weight: 600;
  padding: 2px 8px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap;
}
.tag.pago { background: var(--verde-soft); color: var(--verde); border-color: #a7f3d0; }
.tag.pendente { background: var(--surface-2); color: var(--ink-2); }
.tag.agendado { background: var(--azul-soft); color: var(--azul); border-color: #bfdbfe; }
.tag.vencido { background: var(--vermelho-soft); color: var(--vermelho); border-color: #fecaca; }
.tag.hoje { background: var(--amarelo-soft); color: var(--amarelo); border-color: #fde68a; }
.tag.cancelado { background: #f1f5f9; color: var(--muted-2); text-decoration: line-through; }
.tag.receita { background: var(--verde-soft); color: var(--verde); border-color: #a7f3d0; }
.tag.despesa { background: var(--vermelho-soft); color: var(--vermelho); border-color: #fecaca; }
.tag.ent { font-family: var(--num); font-size: 10.5px; }
.ponto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- barra de filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filtros .espaco { flex: 1; }
.campo-filtro, .filtros select, .filtros input[type="search"], .filtros input[type="date"] {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 10px; font-size: 13px; max-width: 220px;
}
.filtros input[type="search"] { min-width: 220px; }
.filtros select:focus, .filtros input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border-2); background: var(--surface); border-radius: 20px; padding: 5px 12px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { font-family: var(--num); font-size: 11px; opacity: .8; }
.nav-mes { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; }
.nav-mes button { background: none; border: none; padding: 6px 9px; color: var(--ink-2); display: inline-flex; }
.nav-mes button:hover { background: var(--surface-2); }
.nav-mes span { font-size: 13px; font-weight: 600; min-width: 128px; text-align: center; cursor: pointer; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.tabela td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover td { background: #fafbff; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.sel td { background: var(--accent-soft) !important; }
.tabela .dir { text-align: right; }
.tabela .centro { text-align: center; }
.tabela .valor { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.tabela .valor.receita { color: var(--verde); }
.tabela .valor.despesa { color: var(--vermelho); }
.tabela .desc { font-weight: 600; color: var(--ink); }
.tabela .sub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tabela .acoes-linha { white-space: nowrap; text-align: right; }
.tabela tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); }
.tabela input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.tabela .grupo-linha td { background: var(--surface-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 7px 12px; }
.tabela .grupo-linha.vencido td { color: var(--vermelho); background: var(--vermelho-soft); }
.tabela .grupo-linha.hoje td { color: var(--amarelo); background: var(--amarelo-soft); }
.data-cel { white-space: nowrap; font-family: var(--num); font-size: 12.5px; }
.data-cel .dia-semana { display: block; font-family: var(--font); font-size: 11px; color: var(--muted); }

/* barra de totais / seleção */
.totais-barra {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 11px 16px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px;
}
.totais-barra .item { display: flex; flex-direction: column; }
.totais-barra .item span:first-child { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.totais-barra .item b { font-family: var(--num); font-size: 15px; }
.barra-lote {
  position: sticky; bottom: 16px; z-index: 30; display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #0b1220; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow-md); margin-top: 14px;
}
.barra-lote.ativa { display: flex; }
.barra-lote b { font-family: var(--num); }
.barra-lote .btn-sec { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.barra-lote .btn-sec:hover { border-color: #fff; color: #fff; }

/* ---------- formulários ---------- */
.campo { margin-bottom: 12px; min-width: 0; }
.campo > label, .rotulo-campo {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px;
}
.campo .ajuda { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.campo input:not([type="checkbox"]):not([type="radio"]), .campo select, .campo textarea {
  width: 100%; border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 10px; background: #fff;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.campo input.invalido { border-color: var(--vermelho); }
.campo textarea { resize: vertical; min-height: 64px; }
.campo input.grande { font-family: var(--num); font-size: 22px; font-weight: 600; padding: 10px 12px; }
.linha { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.linha.l3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.linha.l4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.tipo-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.tipo-toggle button { border: none; background: #fff; padding: 10px; font-weight: 700; font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.tipo-toggle button.sel.despesa { background: var(--vermelho); color: #fff; }
.tipo-toggle button.sel.receita { background: var(--verde); color: #fff; }
.secao-form { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface-2); }
.secao-form > .titulo { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
details.mais { margin-bottom: 12px; }
details.mais summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); padding: 4px 0; list-style: none; }
details.mais summary::-webkit-details-marker { display: none; }
details.mais summary::before { content: "▸ "; }
details.mais[open] summary::before { content: "▾ "; }
.opcoes-rep { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.calc-linha { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.calc-linha.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 7px; font-weight: 700; }
.calc-linha span:last-child { font-family: var(--num); }

/* ---------- modal / drawer ---------- */
.fundo {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: 0 24px 64px rgba(15,23,42,.28); width: 100%; max-width: 560px;
  animation: surge .16s ease; margin-bottom: 40px;
}
.modal.largo { max-width: 760px; }
.modal.estreito { max-width: 420px; }
.modal-cab { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-cab h3 { font-size: 17px; font-weight: 750; }
.modal-cab .fechar { margin-left: auto; }
.modal-corpo { padding: 16px 22px; }
.modal-rodape { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 0 22px 20px; flex-wrap: wrap; }
.modal-rodape .esq { margin-right: auto; }
.modal .erro-form { background: var(--vermelho-soft); color: var(--vermelho); border: 1px solid #fecaca; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; display: none; }
.modal .erro-form.mostrar { display: block; }
@keyframes surge { from { transform: translateY(10px); opacity: 0; } }
.fundo.drawer { justify-content: flex-end; padding: 0; align-items: stretch; }
.drawer-painel {
  background: var(--surface); width: 100%; max-width: 520px; height: 100%; overflow-y: auto; box-shadow: -16px 0 48px rgba(15,23,42,.2);
  animation: entra .18s ease; padding: 22px 24px 40px;
}
@keyframes entra { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal, .drawer-painel { animation: none; } }
.drawer-painel h3 { font-size: 18px; font-weight: 750; }
.drawer-painel h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 8px; }
.info-linhas { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.info-linhas dt { color: var(--muted); }
.info-linhas dd { font-weight: 500; word-break: break-word; }
.copiavel { font-family: var(--codigo); font-size: 12px; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 6px; padding: 6px 8px; word-break: break-all; cursor: pointer; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline .ev { border-left: 2px solid var(--border-2); padding: 2px 0 2px 12px; font-size: 12.5px; }
.timeline .ev .quando { font-size: 11px; color: var(--muted); font-family: var(--num); }

/* ---------- alertas ---------- */
.alerta {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow);
}
.alerta + .alerta { margin-top: 8px; }
.alerta .ic-wrap { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.alerta .corpo { flex: 1; min-width: 0; }
.alerta .titulo { font-weight: 700; font-size: 13.5px; }
.alerta .texto { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.alerta .acoes { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.alerta.critico { border-left-color: var(--vermelho); }
.alerta.critico .ic-wrap { background: var(--vermelho-soft); color: var(--vermelho); }
.alerta.alto { border-left-color: #ea580c; }
.alerta.alto .ic-wrap { background: #fff7ed; color: #ea580c; }
.alerta.medio { border-left-color: var(--amarelo); }
.alerta.medio .ic-wrap { background: var(--amarelo-soft); color: var(--amarelo); }
.alerta.info { border-left-color: var(--azul); }
.alerta.info .ic-wrap { background: var(--azul-soft); color: var(--azul); }
.alerta.positivo { border-left-color: var(--verde); }
.alerta.positivo .ic-wrap { background: var(--verde-soft); color: var(--verde); }
.alerta.oculto { opacity: .55; }
.alerta.compacto { align-items: center; padding: 8px 12px; gap: 10px; }
.alerta.compacto + .alerta.compacto { margin-top: 6px; }
.alerta.compacto .ic-wrap { width: 26px; height: 26px; border-radius: 7px; }
.alerta.compacto .corpo { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.alerta.compacto .titulo { white-space: nowrap; font-size: 13px; }
.alerta.compacto .texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; color: var(--muted); }
.alerta.compacto .acoes { margin: 0; flex-shrink: 0; flex-wrap: nowrap; }
@media (max-width: 860px) { .alerta.compacto .texto { display: none; } .alerta.compacto .titulo { white-space: normal; } }
.alerta-itens { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; display: none; }
.alerta-itens.aberto { display: block; }
.alerta-itens .it { display: flex; gap: 10px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.alerta-itens .it .v { margin-left: auto; font-family: var(--num); font-weight: 600; }

/* lista de vencimentos */
.lista-venc { display: flex; flex-direction: column; }
.venc {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.venc:last-child { border-bottom: none; }
.venc .dt { width: 52px; flex-shrink: 0; text-align: center; font-family: var(--num); font-size: 12px; font-weight: 600; border-radius: 7px; padding: 4px 0; background: var(--surface-2); border: 1px solid var(--border); }
.venc .dt.vencido { background: var(--vermelho-soft); color: var(--vermelho); border-color: #fecaca; }
.venc .dt.hoje { background: var(--amarelo-soft); color: var(--amarelo); border-color: #fde68a; }
.venc .info { flex: 1; min-width: 0; }
.venc .info .d { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.venc .info .d:hover { color: var(--accent); }
.venc .info .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venc .v { font-family: var(--num); font-weight: 600; white-space: nowrap; }

/* barras horizontais */
.barras { display: flex; flex-direction: column; gap: 9px; }
.barra-h .topo-b { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; gap: 10px; }
.barra-h .topo-b span:last-child { font-family: var(--num); font-weight: 600; white-space: nowrap; }
.barra-h .trilho { height: 8px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); position: relative; }
.barra-h .trilho > div { height: 100%; border-radius: 5px; }
.barra-h .trilho .marca-orc { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }

/* indicadores */
.indicadores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ind { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.ind .r { font-size: 11px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.ind .v { font-family: var(--num); font-size: 17px; font-weight: 600; margin-top: 3px; }
.ind .d { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dica { cursor: help; color: var(--muted-2); display: inline-flex; }

/* gráfico */
.grafico { width: 100%; position: relative; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .tooltip {
  position: absolute; pointer-events: none; background: #0b1220; color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: var(--shadow-md); opacity: 0; transition: opacity .1s; z-index: 5; min-width: 170px; white-space: nowrap;
}
.grafico .tooltip .l { display: flex; justify-content: space-between; gap: 14px; }
.grafico .tooltip .l span:last-child { font-family: var(--num); }
.legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* calendário */
.calendario { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-cab { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-dia {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-height: 92px; padding: 6px 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, box-shadow .15s;
}
.cal-dia:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.cal-dia.fora { background: transparent; border-style: dashed; opacity: .45; }
.cal-dia.hoje { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-dia.sel { background: var(--accent-soft); border-color: var(--accent); }
.cal-dia .n { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; }
.cal-dia .mov { font-family: var(--num); font-size: 11px; font-weight: 600; border-radius: 5px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-dia .mov.pagar { background: var(--vermelho-soft); color: var(--vermelho); }
.cal-dia .mov.receber { background: var(--verde-soft); color: var(--verde); }
.cal-dia .mov.atrasado { outline: 1px solid var(--vermelho); }
.cal-dia .mov.pago { opacity: .55; text-decoration: line-through; }

/* contas bancárias */
.cartao-conta { position: relative; overflow: hidden; }
.cartao-conta .faixa { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.cartao-conta .nome { font-weight: 700; font-size: 14.5px; }
.cartao-conta .meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cartao-conta .saldo { font-family: var(--num); font-size: 22px; font-weight: 600; margin: 10px 0 2px; }
.cartao-conta .linha-mini { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 3px; }
.cartao-conta .linha-mini b { font-family: var(--num); color: var(--ink-2); }
.cartao-conta .acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.cartao-conta.inativa { opacity: .6; }

/* DRE / orçamento */
.tabela.dre td, .tabela.dre th { padding: 7px 10px; }
.tabela.dre td.num, .tabela.dre th.num { text-align: right; white-space: nowrap; font-family: var(--num); font-variant-numeric: tabular-nums; }
.tabela.dre tr.grupo td:first-child { font-weight: 600; cursor: pointer; }
.tabela.dre tr.grupo td:first-child::before { content: "▸ "; color: var(--muted); }
.tabela.dre tr.grupo.aberto td:first-child::before { content: "▾ "; }
.tabela.dre tr.categoria td { font-size: 12px; color: var(--muted); }
.tabela.dre tr.categoria td:first-child { padding-left: 30px; }
.tabela.dre tr.total td { font-weight: 700; background: var(--surface-2); }
.tabela.dre tr.destaque td { font-weight: 800; background: #0b1220; color: #fff; }
.tabela.dre tr.margem td { font-size: 11.5px; color: var(--muted); font-style: italic; }
.tabela.dre td.neg { color: var(--vermelho); }
.tabela.dre tr.destaque td.neg { color: #fca5a5; }
.tabela.dre .col-total { background: var(--surface-2); font-weight: 700; }
.tabela.dre .mes-futuro { color: var(--muted-2); }
.tabela.orc input { width: 86px; border: 1px solid transparent; background: transparent; text-align: right; font-family: var(--num); font-size: 12px; padding: 3px 5px; border-radius: 5px; }
.tabela.orc input:hover { border-color: var(--border-2); background: #fff; }
.tabela.orc input:focus { outline: none; border-color: var(--accent); background: #fff; }
.tabela.orc .real { font-family: var(--num); font-size: 11px; text-align: right; padding-right: 6px; }
.tabela.orc td { padding: 5px 6px; }
.tabela.orc td.cat { padding-left: 12px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* vazio / carregando */
.vazio { text-align: center; padding: 36px 16px; color: var(--muted); }
.vazio .ic-grande { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 10px; color: var(--muted-2); border: 1px solid var(--border); }
.vazio h3 { color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.vazio p { font-size: 13px; max-width: 420px; margin: 0 auto 12px; }
.carregando { padding: 40px; text-align: center; color: var(--muted); }
.carregando::before { content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 10px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.esqueleto { background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 50%, #eef2f7 100%); background-size: 200% 100%; animation: brilho 1.2s infinite; border-radius: 8px; }
@keyframes brilho { to { background-position: -200% 0; } }

/* aviso inline */
.aviso { border-radius: 10px; padding: 10px 14px; font-size: 13px; border: 1px solid; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.aviso.info { background: var(--azul-soft); border-color: #bfdbfe; color: #1e3a8a; }
.aviso.atencao { background: var(--amarelo-soft); border-color: #fde68a; color: #78350f; }
.aviso.erro { background: var(--vermelho-soft); border-color: #fecaca; color: #7f1d1d; }
.aviso.ok { background: var(--verde-soft); border-color: #a7f3d0; color: #064e3b; }

/* checklist */
.checklist { display: flex; flex-direction: column; gap: 6px; }
.checklist .it { display: flex; gap: 8px; font-size: 13px; align-items: flex-start; }
.checklist .it .st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; font-weight: 800; }
.checklist .it.ok .st { background: var(--verde-soft); color: var(--verde); }
.checklist .it.nok .st { background: var(--amarelo-soft); color: var(--amarelo); }

/* login */
.tela-login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 10%, #1e1b4b 0%, #0b1220 55%); z-index: 200; padding: 16px; }
.login-caixa { background: var(--surface); border-radius: 18px; padding: 30px; width: 100%; max-width: 380px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-caixa h1 { font-size: 22px; font-weight: 800; margin: 14px 0 4px; }
.login-caixa p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-erro { color: var(--vermelho); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #0b1220; color: #fff; border-radius: 10px; padding: 10px 16px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); animation: surge .16s ease; pointer-events: auto; display: flex; gap: 12px; align-items: center; max-width: 92vw; }
.toast.erro { background: var(--vermelho); }
.toast.ok { background: #065f46; }
.toast button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }

/* impressão */
.so-impressao { display: none; }
@media print {
  .sidebar, .topo, .filtros, .barra-lote, .nao-imprimir, .toasts { display: none !important; }
  .conteudo { margin: 0; }
  main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .painel, .tabela-wrap { box-shadow: none; break-inside: avoid; }
  .so-impressao { display: block; }
}

/* ---------- responsivo ---------- */
@media (max-width: 1200px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .g-21, .g-12, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  body.menu-aberto .sidebar { transform: none; }
  body.menu-aberto::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; }
  .conteudo { margin-left: 0; }
  .btn-menu { display: inline-flex; }
  .topo { padding: 10px 14px; flex-wrap: wrap; }
  .topo h1 { font-size: 16px; }
  .topo .sub { display: none; }
  main { padding: 14px 14px 60px; }
  .g-2, .g-4, .g-5 { grid-template-columns: minmax(0, 1fr); }
  .linha, .linha.l3, .linha.l4 { grid-template-columns: minmax(0, 1fr); }
  .filtros input[type="search"] { min-width: 0; flex: 1 1 100%; max-width: none; }
  .calendario { gap: 3px; }
  .cal-dia { min-height: 60px; padding: 4px; }
  .cal-dia .mov { font-size: 9.5px; padding: 0 3px; }
  .esconde-mobile { display: none !important; }
  .modal-cab, .modal-corpo, .modal-rodape { padding-left: 16px; padding-right: 16px; }
  .fundo { padding-top: 2vh; }
  .topo .acoes { margin-left: 0; width: 100%; justify-content: space-between; }
}
/* tabela de lançamentos vira lista de cartões no celular */
@media (max-width: 860px) {
  .tabela.responsiva thead { display: none; }
  .tabela.responsiva, .tabela.responsiva tbody { display: block; width: 100%; }
  .tabela.responsiva tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 3px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: center; }
  .tabela.responsiva td { display: block; padding: 0; border: none; min-width: 0 !important; }
  .tabela.responsiva tr.grupo-linha { display: block; padding: 0; }
  .tabela.responsiva tr.grupo-linha td { padding: 7px 12px; }
  .tabela.responsiva td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; align-self: start; padding-top: 2px; }
  .tabela.responsiva td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .tabela.responsiva td:nth-child(2) { grid-column: 2; grid-row: 2; }
  .tabela.responsiva td:nth-child(5) { grid-column: 2; grid-row: 3; }
  .tabela.responsiva td:nth-child(6) { grid-column: 3; grid-row: 1; }
  .tabela.responsiva td:nth-child(7) { grid-column: 3; grid-row: 2 / span 2; }
  .tabela.responsiva .data-cel .dia-semana { display: inline; margin-left: 6px; }
  .tabela.responsiva tbody tr:hover td { background: transparent; }
}
@media (max-width: 520px) {
  .segmento button { padding: 5px 8px; font-size: 12px; }
  .kpi .valor { font-size: 21px; }
  .indicadores { grid-template-columns: minmax(0, 1fr); }
}
