@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");  /* fonte da padronização Jarda Lab's */
/* Layout: menu lateral flutuante à esquerda. Cada módulo abre as suas rotinas (sub-abas).
   Visual alinhado ao site do Balancete: superfícies brancas, azul institucional como cor principal,
   faixa azul/verde/laranja da marca e títulos em Poppins. Tema claro e escuro conforme o sistema. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fontes/poppins-700-latin.woff2") format("woff2"); }
:root {
  --bg: #f2f2f5; --surface: #ffffff; --sunk: #f5f5f7; --head: #ededf0; --lado: #ffffff; --thumb: #ffffff; --rotulo-barra: #ffffff; --s-pl: #2e8b7a; --s-passivo: #c8734f;
  --cartao-sombra: 0 1px 2px rgb(0 0 0 / .05), 0 0 0 .5px rgb(0 0 0 / .05); --r-bloco: 20px;
  --fill: rgb(60 60 67 / .1); --fill-forte: rgb(60 60 67 / .18); --foco: rgb(26 115 232 / .5);
  --ink: #111113; --ink2: #2c2c2e; --muted: #55555a; --line: #d2d2d7; --line-forte: #b0b0b6; --icone: #8e8e93;
  --accent: #111113; --accent-forte: #3a3a3c; --accent-soft: #f0f0f2; --accent-ink: #ffffff;
  --marca: #111113; --marca-soft: #ebebef; --marca-2: #8e8e93;
  --marca-verde: #34c759; --marca-laranja: #ff9500;
  --ok: #047857; --ok-soft: #d1fae5; --warn: #7a4100; --warn-soft: #ffeecc; --neg: #c00012;
  --s1: #1a73e8; --s2: #e8710a; --s3: #f9ab00; --s4: #12b5cb; --s5: #5f6368;
  --r-card: 14px; --r-ctrl: 9px; --shadow: none; --shadow-alta: 0 12px 34px rgb(0 0 0 / .14), 0 0 0 .5px rgb(0 0 0 / .06);
  --lat-shadow: none;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI Variable Text", "Segoe UI", Roboto, Arial, sans-serif;
  --titulo: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI Variable Display", "Segoe UI", Roboto, Arial, sans-serif;
  --lat-w: 236px; --gap: 12px;
  color-scheme: light;
}
:root[data-tema="escuro"] {
  --bg: #000000; --surface: #1c1c1e; --sunk: #2c2c2e; --head: #2c2c2e; --lado: #1c1c1e; --thumb: #636366; --rotulo-barra: #ffffff; --s-pl: #3aa592; --s-passivo: #d0876a;
  --cartao-sombra: 0 0 0 .5px rgb(255 255 255 / .08);
  --fill: rgb(118 118 128 / .24); --fill-forte: rgb(118 118 128 / .36); --foco: rgb(138 180 248 / .55);
  --ink: #ffffff; --ink2: #e5e5ea; --muted: #b0b0b6; --line: #3a3a3c; --line-forte: #545458; --icone: #8e8e93;
  --accent: #f5f5f7; --accent-forte: #d1d1d6; --accent-soft: #2c2c2e; --accent-ink: #111113;
  --marca: #ffffff; --marca-soft: #3a3a3c; --marca-2: #8e8e93;
  --ok: #30d158; --ok-soft: #12301b; --warn: #ff9f0a; --warn-soft: #3a2a0c; --neg: #ff453a;
  --s1: #8ab4f8; --s2: #fcad70; --s3: #fdd663; --s4: #78d9ec; --s5: #9aa0a6;
  --shadow-alta: 0 12px 34px rgb(0 0 0 / .7), 0 0 0 .5px rgb(255 255 255 / .12);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
button, select, input { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* ---------- menu lateral ---------- */
.lateral { position: fixed; top: var(--gap); bottom: var(--gap); left: var(--gap); width: var(--lat-w); z-index: 20;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--lat-shadow);
  display: flex; flex-direction: column; overflow: hidden; }
.faixa-marca { height: 4px; flex: none; background: linear-gradient(to right, var(--accent), var(--marca-verde), var(--marca-laranja)); }
.lateral-topo { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.marca { display: grid; gap: 4px; min-width: 0; }
.marca-nome { font-family: var(--titulo); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.marca-emp { color: var(--muted); font-size: .78rem; font-weight: 600; }
.b-menu { display: none; }
.menu { flex: 1; overflow-y: auto; padding: 10px; display: grid; align-content: start; gap: 4px; }
.menu-modulo { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 10px; border: 0; border-radius: var(--r-ctrl);
  background: none; color: var(--ink); font-weight: 700; font-size: .95rem; text-align: left; cursor: pointer; }
.menu-modulo:hover { background: var(--sunk); border: 0; }
.menu-modulo > span:first-child { flex: 1; }
.menu-qt { font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--head); border-radius: var(--r-ctrl); padding: 0 6px; font-variant-numeric: tabular-nums; }
.menu-seta { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; margin-right: 2px; }
.menu-grupo.aberto > .menu-modulo .menu-seta { transform: rotate(45deg); }
.menu-grupo.atual > .menu-modulo { color: var(--accent); }
.menu-sub { list-style: none; margin: 2px 0 8px; padding: 0 0 0 10px; display: none; gap: 1px; border-left: 2px solid var(--line); margin-left: 14px; }
.menu-grupo.aberto .menu-sub { display: grid; }
/* pastas dentro do módulo (chave "submenu" em catalogo.py) */
.menu-pasta-titulo { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 3px 10px 3px 8px; border: 0; border-radius: var(--r-ctrl);
  background: none; color: var(--ink); font-weight: 600; font-size: .88rem; text-align: left; cursor: pointer; }
.menu-pasta-titulo:hover { background: var(--sunk); border: 0; }
.menu-pasta-titulo > span:nth-child(2) { flex: 1; }
.menu-pasta-titulo .menu-seta { width: 6px; height: 6px; border-width: 0 1.5px 1.5px 0; margin: 0 2px; }
.menu-pasta.aberta > .menu-pasta-titulo .menu-seta { transform: rotate(45deg); }
.menu-pasta:has(.menu-item.atual) > .menu-pasta-titulo { color: var(--accent); }
.menu-pasta-itens { list-style: none; margin: 1px 0 4px 13px; padding: 0 0 0 8px; display: none; gap: 1px; border-left: 1px solid var(--line); }
.menu-pasta.aberta > .menu-pasta-itens { display: grid; }
@media (prefers-reduced-motion: reduce) { .menu-seta { transition: none; } }
.menu-item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  min-height: 28px; padding: 3px 10px; border: 0; border-radius: var(--r-ctrl); background: none; color: var(--muted); font-size: .88rem; cursor: pointer; }
.menu-item:hover { background: var(--sunk); color: var(--ink); border: 0; }
.menu-item.atual { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-rotina { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu-item.atual .menu-rotina { color: var(--accent); }
/* link fixo para Configurações, logo acima do rodapé */
.menu-config { display: flex; align-items: center; gap: 10px; margin: 0 10px 8px; min-height: 32px; padding: 5px 10px; border-radius: var(--r-ctrl);
  color: var(--ink); font-weight: 600; font-size: .92rem; text-decoration: none; }
.menu-config svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.menu-config:hover { background: var(--sunk); }
.menu-config.atual { background: var(--accent-soft); color: var(--accent); }
.menu-config.atual svg { color: var(--accent); }
.lateral-rodape { padding: 12px 18px 16px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: .74rem; color: var(--muted); }
.selo-fonte:empty { display: none; }
.selo-seguro { color: var(--ok); font-weight: 700; }

/* ---------- página ---------- */
.pagina { margin-left: calc(var(--lat-w) + var(--gap) * 2); max-width: 1400px; padding: 24px 28px 48px 8px; display: grid; gap: var(--gap); }
.cabecalho { display: grid; gap: 2px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cab-modulo { margin: 0; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.cab-modulo:empty { display: none; }
.cab-aba { margin: 0; font-family: var(--titulo); font-size: 1.6rem; font-weight: 700; line-height: 1.2; text-wrap: balance; }

/* ---------- página ---------- */

.filtros { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.campo { display: grid; gap: 4px; font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.campo select, .campo input { min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-ctrl); background: var(--sunk);
  color: var(--ink); font-size: .95rem; font-weight: 400; text-transform: none; letter-spacing: 0; }
.campo-filial { flex: 1 1 340px; min-width: 0; }
.campo-filial select { width: 100%; }
.campo-mini select { min-height: 32px; font-size: .88rem; }

/* seletor de filiais */
.campo-filial { position: relative; }
.seletor { width: 100%; min-height: 36px; text-align: left; background: var(--sunk); font-weight: 400; text-transform: none; letter-spacing: 0;
  padding-right: 32px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.seletor::after { content: "▾"; position: absolute; right: 12px; color: var(--muted); }
.painel-filiais { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(640px, 92vw); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); padding: 12px; display: grid; gap: 10px;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); font-size: .9rem; }
.atalhos { display: flex; flex-wrap: wrap; gap: 6px; }
.atalhos button { min-height: 30px; padding: 2px 12px; border-radius: var(--r-ctrl); font-size: .85rem; background: var(--sunk); }
.atalhos button.ativo { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.atalhos button.limpar { color: var(--muted); }
#busca-filial { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-ctrl); background: var(--sunk); color: var(--ink); }
.lista-filiais { max-height: 340px; overflow: auto; display: grid; gap: 10px; padding-right: 4px; }
.grupo-filiais h3 { margin: 0 0 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; }
.grupo-filiais h3 button { min-height: 22px; padding: 0 8px; font-size: .72rem; border-radius: var(--r-ctrl); text-transform: none; letter-spacing: 0; }
.grupo-filiais .itens { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 10px; }
.item-filial { display: flex; gap: 8px; align-items: center; padding: 1px 6px; border-radius: 6px; cursor: pointer; }
.item-filial:hover { background: var(--sunk); }
.item-filial input { accent-color: var(--accent); margin: 0; }
.item-filial .cod { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 22px; text-align: right; }
.item-filial .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.painel-rodape { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
#contagem-filiais { color: var(--muted); font-size: .85rem; }
.acoes { display: flex; gap: 8px; }
button { min-height: 36px; padding: 4px 16px; border: 1px solid var(--line); border-radius: var(--r-ctrl); background: var(--surface); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: progress; }
button.primario { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.leve { min-height: 30px; padding: 2px 12px; font-size: .86rem; background: var(--sunk); }
.estado { flex-basis: 100%; margin: 0; font-size: .86rem; color: var(--muted); }
.estado.erro { color: var(--warn); font-weight: 600; }

main { display: grid; gap: 16px; min-width: 0; scroll-margin-top: 72px; }
@media (max-width: 760px) { main { scroll-margin-top: 112px; } }
.faixa-status { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .86rem; color: var(--muted); }
.faixa-status .rotina { font-weight: 600; color: var(--ink); }
.selo { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-radius: var(--r-ctrl); padding: 2px 10px; }
.selo.validado { background: var(--ok-soft); color: var(--ok); }
.selo.em_validacao { background: var(--warn-soft); color: var(--warn); }

/* abertura */
.trilha { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .92rem; }
.trilha button { min-height: 28px; padding: 1px 12px; border-radius: var(--r-ctrl); background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.trilha .sep { color: var(--muted); }
.trilha .atual { font-weight: 700; }
.trilha .nivel { color: var(--muted); font-size: .82rem; margin-left: 4px; }
.dica-abrir { font-size: .85rem; color: var(--accent); font-weight: 600; }
.conferencia { font-size: .86rem; padding: 8px 14px; border-radius: 8px; }
.conferencia.ok { background: var(--ok-soft); color: var(--ok); }
.conferencia.dif { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* totais */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpis:empty { display: none; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 2px; }
.kpi .l { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .v.neg { color: var(--neg); }

/* cartões */
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
.cartao[hidden] { display: none; }
.cartao-topo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 10px; }
.cartao h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.controles { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.metricas { display: flex; flex-wrap: wrap; gap: 6px; }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--r-ctrl); background: var(--sunk); cursor: pointer; }
.chk input { margin: 0; accent-color: var(--accent); }
.grafico { width: 100%; height: 380px; }
.dica { margin: 0; font-size: .8rem; color: var(--muted); }
.aviso { margin: 0; color: var(--warn); font-weight: 600; }
.menu-colunas { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; background: var(--sunk); border-radius: 8px; }

/* ---------- tabelas (Tabulator) ---------- */
.tabulator { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: .88rem; color: var(--ink); overflow: hidden; }
.tabulator .tabulator-header { background: var(--head); border-bottom: 1px solid var(--line); color: var(--ink); }
.tabulator .tabulator-header .tabulator-col { background: var(--head); border-right: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 5px 10px 4px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--line); }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
  width: 100%; margin-top: 4px; padding: 3px 7px; font-size: .8rem; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 5px; }
.tabulator .tabulator-tableholder .tabulator-table { background: var(--surface); color: var(--ink); }
.tabulator-row { background: var(--surface); border-bottom: 1px solid var(--line); min-height: 26px; }
.tabulator-row.tabulator-row-even { background: var(--surface); }
.tabulator-row .tabulator-cell { border-right: 0; padding: 4px 10px; }
.tabulator-row.tabulator-selectable:hover { background: var(--accent-soft); }
.abrivel .tabulator-row { cursor: pointer; }
.abrivel .tabulator-row:hover .tabulator-cell:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tabulator .col-num, .tabulator .col-cod { font-variant-numeric: tabular-nums; }
.tabulator .col-cod { color: var(--muted); }
.tabulator .num-neg { color: var(--neg); }
.tabulator .tabulator-footer, .tabulator .tabulator-footer .tabulator-calcs-holder { background: var(--head) !important; border-top: 2px solid var(--line); color: var(--ink); }
#tabela .tabulator-calcs-holder,
#tabela .tabulator-calcs-holder .tabulator-row,
#tabela .tabulator-row.tabulator-calcs,
#tabela .tabulator-row.tabulator-calcs .tabulator-cell , #tabela-ano .tabulator-row.tabulator-calcs .tabulator-cell { background: var(--head) !important; color: var(--ink) !important; font-weight: 700; }
.tabulator .tabulator-row.tabulator-calcs-bottom { border-top: 2px solid var(--line); }
.tabulator .tabulator-placeholder span { color: var(--muted) !important; font-size: .95rem; font-weight: 400; }
.tabulator .tabulator-col-resize-handle:hover { background: var(--accent-soft); }

@media (max-width: 900px) {
  .lateral { position: sticky; top: 0; left: 0; bottom: auto; width: auto; border-radius: 0; max-height: 100vh; }
  .lateral-topo { padding: 12px 16px; }
  .b-menu { display: inline-flex; align-items: center; min-height: 36px; }
  .menu, .lateral-rodape, .menu-config { display: none; }
  .menu-aberto .menu-config { display: flex; }
  .menu-aberto .menu { display: grid; max-height: 70vh; }
  .menu-aberto .lateral-rodape { display: grid; }
  .pagina { margin-left: 0; padding: 16px; }
  .acoes { flex-basis: 100%; }
  .kpi .v { font-size: 1.3rem; }
  .grafico { height: 300px; }
}

/* ---------- página Configurações ---------- */
.config { display: grid; gap: var(--gap); min-width: 0; }
/* menu horizontal (abas) das Configurações */
.config-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.config-abas [role=tab] { min-height: 40px; padding: 8px 16px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px;
  background: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.config-abas [role=tab]:hover { color: var(--ink); border-bottom-color: var(--line); }
.config-abas [role=tab][aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.config-painel { display: grid; gap: var(--gap); min-width: 0; }
.config-busca { min-height: 32px; flex: 1 1 260px; min-width: 0; max-width: 460px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-ctrl);
  background: var(--sunk); color: var(--ink); font-size: .88rem; }
.config-obs.erro { color: var(--warn); font-weight: 600; }
/* plano de contas agrupado por GRUPOCONTA */
#plano-tabela .tabulator-row.tabulator-group { display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 3px 12px;
  background: var(--head); border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-weight: 600; cursor: pointer; }
#plano-tabela .tabulator-row.tabulator-group:hover { background: var(--sunk); }
#plano-tabela .tabulator-group .tabulator-arrow { border-left-color: var(--muted); margin-right: 2px; }
#plano-tabela .tabulator-group.tabulator-group-visible .tabulator-arrow { border-top-color: var(--muted); border-left-color: transparent; }
#plano-tabela .plano-grupo-cod { font-variant-numeric: tabular-nums; color: var(--accent); min-width: 34px; }
#plano-tabela .plano-grupo-nome { flex: 1; }
#plano-tabela .tabulator-group span { margin-left: 0; color: inherit; }
#plano-tabela .tabulator-group .menu-qt { color: var(--muted); }
.config code { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: .84em; background: var(--head);
  border-radius: var(--r-ctrl); padding: 1px 6px; overflow-wrap: anywhere; }
.config-cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--gap); align-items: start; }
.config-largo { grid-column: 1 / -1; }
.config-lista { margin: 0; display: grid; gap: 0; }
.config-linha { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.config-linha:first-child { border-top: 0; padding-top: 0; }
.config-linha dt { color: var(--muted); }
.config-linha dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.config-vazio { color: var(--muted); font-style: italic; }
.config-obs { margin: 0; font-size: .86rem; color: var(--muted); }
.config-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-variant-numeric: tabular-nums; padding: 2px 9px; border-radius: var(--r-ctrl); background: var(--head); color: var(--ink); }
.chip.fechado { background: var(--ok-soft); color: var(--ok); }
.config-grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 20px; }
.config-grupo h3 { margin: 0 0 6px; font-size: .86rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.config-tabela { overflow-x: auto; }
.config-tabela table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.config-tabela th { text-align: left; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 4px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.config-tabela td { padding: 3px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.config-tabela tr:last-child td { border-bottom: 0; }
.config-tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .config-linha { grid-template-columns: 1fr; gap: 2px; } }

/* barra de controles das abas de Configurações: tudo numa linha (quebra só em tela estreita) */
.config-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.config-barra .config-obs { margin-left: auto; }
#plano-tabela .col-dre { cursor: pointer; }
#plano-tabela .col-dre:hover { background: var(--accent-soft); }

/* DRE: linhas em até 3 níveis, contas como 4º nível */
.dre-arvore { display: grid; gap: 2px; }
.dre-linha { --recuo: 0px; display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 1px 8px 1px calc(8px + var(--recuo));
  border-radius: var(--r-ctrl); border-left: 3px solid transparent; }
.dre-linha:hover, .dre-linha:focus-within { background: var(--sunk); }
.dre-linha.nivel-1 { background: var(--head); border-left-color: var(--accent); font-weight: 700; margin-top: 4px; }
.dre-linha.nivel-1:first-child { margin-top: 0; }
.dre-linha.nivel-2 { --recuo: 26px; font-weight: 600; }
.dre-linha.nivel-3 { --recuo: 52px; }
.dre-cod { min-width: 44px; font-variant-numeric: tabular-nums; color: var(--accent); font-size: .86rem; }
.dre-desc { flex: 1; min-width: 0; min-height: 26px; padding: 2px 8px; border: 1px solid transparent; border-radius: var(--r-ctrl);
  background: transparent; color: var(--ink); font: inherit; font-size: .92rem; }
.dre-desc:hover { border-color: var(--line); }
.dre-desc:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.dre-qt { min-height: 22px; padding: 0 10px; border-radius: var(--r-ctrl); font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); border: 0; font-variant-numeric: tabular-nums; }
.dre-qt.zero { background: none; color: var(--muted); font-weight: 400; cursor: default; }
.dre-qt.total { display: inline-flex; align-items: center; background: none; color: var(--muted); font-weight: 400; }
.dre-acoes { display: flex; gap: 4px; }
.dre-acoes button { min-height: 24px; padding: 0 10px; font-size: .8rem; }
.dre-acoes button.icone, .dre-conta button.icone { min-width: 24px; padding: 0; }
.dre-acoes button:disabled { opacity: .35; cursor: not-allowed; }
.dre-acoes button.perigo:hover { border-color: var(--neg); color: var(--neg); }
.dre-contas { --recuo: 0px; display: grid; gap: 0; margin: 0 0 6px calc(62px + var(--recuo)); padding-left: 10px; border-left: 1px solid var(--line); }
.dre-contas.nivel-2 { --recuo: 26px; }
.dre-contas.nivel-3 { --recuo: 52px; }
.dre-conta { display: flex; align-items: center; gap: 10px; min-height: 24px; font-size: .86rem; color: var(--muted); }
.dre-conta .dre-cod { color: var(--muted); }
.dre-conta-nome { flex: 1; color: var(--ink); }
.dre-conta button { min-height: 24px; font-size: .72rem; opacity: 0; }
.dre-conta:hover button, .dre-conta button:focus-visible { opacity: 1; }
@media (max-width: 700px) {
  .dre-linha { flex-wrap: wrap; }
  .dre-acoes { width: 100%; justify-content: flex-end; }
  .dre-linha.nivel-2 { --recuo: 14px; } .dre-linha.nivel-3 { --recuo: 28px; }
  .dre-contas { margin-left: 20px; }
}

/* lista suspensa da coluna DRE (editor do Tabulator) no tema do site */
.tabulator-edit-list { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-ctrl);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: .88rem; }
.tabulator-edit-list .tabulator-edit-list-item { color: var(--ink); padding: 6px 10px; }
.tabulator-edit-list .tabulator-edit-list-item:hover,
.tabulator-edit-list .tabulator-edit-list-item.focused { background: var(--accent-soft); color: var(--accent); outline: none; }
.tabulator-edit-list .tabulator-edit-list-item.active { background: var(--accent); color: var(--accent-ink); }
.tabulator-edit-list .tabulator-edit-list-notice { color: var(--muted); padding: 8px 10px; }
#plano-tabela .tabulator-cell.tabulator-editing { border: 1px solid var(--accent); background: var(--surface); }
#plano-tabela .tabulator-cell.tabulator-editing input { color: var(--ink); background: transparent; }

/* DRE: alça de arrastar, lixeira, confirmação no botão e linha de resultado */
.dre-alca { flex: none; width: 22px; min-height: 24px; padding: 0; border: 0; background: none; color: var(--muted); cursor: grab;
  font-size: .9rem; letter-spacing: -3px; line-height: 1; touch-action: none; border-radius: var(--r-ctrl); opacity: .55; }
.dre-linha:hover .dre-alca, .dre-alca:focus-visible { opacity: 1; }
.dre-alca:hover { background: var(--head); color: var(--ink); }
.em-arraste, .em-arraste * { cursor: grabbing !important; user-select: none; }
.dre-arvore .arrastando { opacity: .4; }
.dre-arvore .drop-antes { box-shadow: inset 0 3px 0 var(--accent); }
.dre-arvore .drop-depois { box-shadow: inset 0 -3px 0 var(--accent); }
.dre-acoes button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; margin: auto; }
.dre-acoes button.perigo { color: var(--muted); }
.dre-acoes button.perigo:hover { color: var(--neg); border-color: var(--neg); }
button.confirmando, .dre-acoes button.perigo.confirmando { width: auto; padding: 0 10px; background: var(--neg); border-color: var(--neg); color: #fff; font-size: .78rem; font-weight: 700; }
.dre-linha.resultado { flex-wrap: wrap; background: var(--accent-soft); border-left-color: var(--accent-forte); }
.dre-linha.resultado .dre-desc { font-weight: 700; }
.dre-igual { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: .9rem; }
.dre-formula { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 4px 88px; font-weight: 400; }
.dre-termo { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 4px 0 2px; border: 1px solid var(--line); border-radius: var(--r-ctrl);
  background: var(--surface); font-size: .84rem; }
.dre-sinal { min-height: 22px; width: 22px; padding: 0; border: 0; border-radius: var(--r-ctrl); font-weight: 800; font-size: .95rem; line-height: 1; }
.dre-sinal.soma { background: var(--ok-soft); color: var(--ok); }
.dre-sinal.subtrai { background: var(--warn-soft); color: var(--neg); }
.dre-termo-x { min-height: 20px; width: 20px; padding: 0; border: 0; background: none; color: var(--muted); font-size: .7rem; }
.dre-termo-x:hover { color: var(--neg); }
.dre-termo-novo { min-height: 24px; padding: 2px 8px; border: 1px dashed var(--line); border-radius: var(--r-ctrl); background: transparent; color: var(--muted); font-size: .84rem; }
@media (max-width: 700px) { .dre-formula { padding-left: 0; } }
.dre-fx { font-style: italic; font-weight: 700; font-family: Georgia, "Times New Roman", serif; font-size: .9rem; color: var(--accent); }
.dre-fx.ativo { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* as colunas do plano já cabem na largura (fitColumns); o Tabulator soma a largura da barra vertical
   e criava uma barra horizontal à toa */
#plano-tabela .tabulator-tableholder { overflow-x: hidden; }

/* ===================== modo compacto (todo o sistema) =====================
   Fica no fim do arquivo de propósito: redefine alturas, espaçamentos e tamanhos acima.
   Para voltar ao visual espaçado, basta apagar este bloco (e o rowHeight 22 em app.js). */
:root { --gap: 12px; --lat-w: 236px; }
body { font-size: 14px; line-height: 1.4; }

/* menu lateral */
.lateral-topo { padding: 10px 12px 8px; }
.marca { gap: 2px; }
.marca-nome { font-size: .98rem; }
.menu { padding: 6px; gap: 2px; }
.menu-modulo { min-height: 28px; padding: 3px 8px; font-size: .9rem; }
.menu-sub { margin: 1px 0 4px 12px; padding-left: 8px; }
.menu-pasta-titulo { min-height: 24px; padding: 2px 8px 2px 6px; font-size: .85rem; }
.menu-pasta-itens { margin: 0 0 2px 11px; padding-left: 6px; }
.menu-item { min-height: 24px; padding: 2px 8px; font-size: .84rem; gap: 8px; }
.menu-config { min-height: 28px; padding: 3px 8px; margin: 0 6px 6px; font-size: .88rem; }
.menu-config svg { width: 16px; height: 16px; }
.lateral-rodape { padding: 8px 12px 10px; gap: 2px; }

/* página, cabeçalho e filtros */
.pagina { padding: 12px 16px 24px 4px; }
.cabecalho { padding-bottom: 8px; }
.cab-aba { font-size: 1.25rem; }
.filtros { padding: 8px 12px; gap: 6px 12px; }
.campo { gap: 2px; font-size: .68rem; }
.campo select, .campo input, .seletor { min-height: 28px; padding: 2px 8px; font-size: .88rem; }
.seletor { padding-right: 28px; }
.campo-mini select { min-height: 26px; font-size: .84rem; }
.painel-filiais { padding: 8px; gap: 6px; }
.atalhos button { min-height: 24px; padding: 1px 10px; font-size: .8rem; }
#busca-filial { min-height: 28px; padding: 2px 8px; }
.lista-filiais { gap: 6px; }
.painel-rodape { padding-top: 6px; }
button { min-height: 28px; padding: 2px 12px; font-size: .88rem; }
button.leve { min-height: 24px; padding: 1px 10px; font-size: .82rem; }
.estado { font-size: .8rem; }

/* conteúdo: faixa, abertura, indicadores, cartões e gráfico */
main { gap: 10px; }
.faixa-status { font-size: .8rem; gap: 4px 10px; }
.selo { padding: 1px 8px; font-size: .66rem; }
.trilha { font-size: .86rem; gap: 4px; }
.trilha button { min-height: 22px; padding: 0 10px; }
.conferencia { padding: 4px 10px; font-size: .8rem; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.kpi { padding: 8px 12px; gap: 0; }
.kpi .l { font-size: .66rem; }
.kpi .v { font-size: 1.25rem; }
.cartao { padding: 10px 12px; gap: 8px; }
.cartao h2 { font-size: .95rem; }
.controles { gap: 6px 8px; }
.chk { padding: 1px 8px; font-size: .8rem; }
.grafico { height: 300px; }
.dica { font-size: .74rem; }
.menu-colunas { padding: 6px; gap: 4px; }

/* tabelas */
.tabulator { font-size: .84rem; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 3px 8px 2px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: .68rem; }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input { margin-top: 2px; padding: 1px 6px; font-size: .76rem; }
.tabulator-row { min-height: 22px; }
.tabulator-row .tabulator-cell { padding: 2px 8px; }
#plano-tabela .tabulator-row.tabulator-group { min-height: 24px; padding: 2px 10px; }
.tabulator-edit-list .tabulator-edit-list-item { padding: 3px 8px; }

/* Configurações */
.config-abas [role=tab] { min-height: 30px; padding: 4px 12px; }
.config-busca { min-height: 26px; padding: 2px 8px; font-size: .84rem; }
.config-linha { padding: 2px 0; font-size: .86rem; }
.config-tabela table { font-size: .84rem; }
.config-tabela th { padding: 2px 8px; font-size: .66rem; }
.config-tabela td { padding: 2px 8px; }
.chip { padding: 0 7px; font-size: .74rem; }
.config-grupos { gap: 8px 16px; }

/* DRE */
.dre-arvore { gap: 1px; }
.dre-linha { min-height: 24px; padding: 0 6px 0 calc(6px + var(--recuo)); gap: 8px; }
.dre-linha.nivel-1 { margin-top: 2px; }
.dre-linha.nivel-2 { --recuo: 22px; }
.dre-linha.nivel-3 { --recuo: 44px; }
.dre-desc { min-height: 22px; padding: 1px 6px; font-size: .86rem; }
.dre-cod { font-size: .8rem; min-width: 40px; }
.dre-qt { min-height: 18px; padding: 0 8px; font-size: .7rem; }
.dre-acoes { gap: 3px; }
.dre-acoes button { min-height: 20px; padding: 0 8px; font-size: .74rem; }
.dre-acoes button.icone, .dre-conta button.icone { min-width: 20px; }
.dre-acoes button svg { width: 13px; height: 13px; }
.dre-alca { min-height: 20px; width: 18px; }
.dre-igual { width: 18px; height: 18px; font-size: .78rem; }
.dre-contas { margin: 0 0 4px calc(54px + var(--recuo)); }
.dre-contas.nivel-2 { --recuo: 22px; }
.dre-contas.nivel-3 { --recuo: 44px; }
.dre-conta { min-height: 20px; font-size: .8rem; }
.dre-conta button { min-height: 18px; }
.dre-formula { padding: 1px 0 3px 76px; gap: 4px; }
.dre-termo { min-height: 20px; font-size: .78rem; gap: 4px; }
.dre-sinal { min-height: 18px; width: 18px; font-size: .85rem; }
.dre-termo-x { min-height: 16px; width: 16px; }
.dre-termo-novo { min-height: 20px; padding: 0 6px; font-size: .78rem; }

@media (max-width: 900px) {
  .pagina { padding: 8px; }
  .lateral-topo { padding: 8px 12px; }
  .b-menu { min-height: 28px; }
  .grafico { height: 240px; }
}
@media (max-width: 700px) { .dre-formula { padding-left: 0; } }
/* DRE sem o cartão por trás: o conteúdo fica direto na página */
.config-secao { display: grid; gap: 8px; min-width: 0; }

/* classificação DRE no grupo do plano de contas (as contas herdam) */
#plano-tabela .plano-grupo-dre { flex: 0 1 260px; min-width: 120px; min-height: 20px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-ctrl);
  background: var(--surface); color: var(--ink); font-size: .78rem; font-weight: 400; cursor: pointer; }
#plano-tabela .plano-grupo-dre:hover, #plano-tabela .plano-grupo-dre:focus { border-color: var(--accent); outline: none; }
#plano-tabela .plano-grupo-excecoes { font-size: .72rem; font-weight: 400; color: var(--warn); white-space: nowrap; }
#plano-tabela .plano-grupo-excecoes:empty { display: none; }
.dre-herdada { color: var(--muted); font-style: italic; }
.dre-conta .dre-herdada { font-size: .72rem; white-space: nowrap; }
#plano-tabela .plano-grupo-dre { flex: 0 0 260px; width: 260px; }
#plano-tabela .tabulator-group .menu-qt { min-width: 30px; text-align: right; }
/* campo DRE do grupo alinhado à coluna DRE: posição e largura vêm da coluna medida (--dre-x / --dre-w, em app.js) */
#plano-tabela .tabulator-row.tabulator-group { position: relative; }
#plano-tabela .plano-grupo-dre { position: absolute; top: 50%; transform: translateY(-50%);
  left: calc(var(--dre-x, 60%) + 2px); width: calc(var(--dre-w, 30%) - 48px); flex: none; }
#plano-tabela .plano-grupo-nome { flex: 0 1 auto; min-width: 0; max-width: calc(var(--dre-x, 60%) - 70px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#plano-tabela .tabulator-group .menu-qt { margin-left: auto; }  /* contagem sempre na ponta direita */

/* páginas de indicador (Controladoria) */
.modo-indicador #g-metricas, .modo-indicador .cartao-topo .controles .campo-mini, .modo-indicador #b-colunas,
.modo-indicador #menu-colunas, .modo-indicador .dica { display: none !important; }
.kpi-falta .v { color: var(--muted); }
.kpi .falta { font-size: .7rem; color: var(--warn); line-height: 1.3; }
.situacao-falta { color: var(--warn); }
#tabela .tabulator-row.linha-destaque, #tabela .tabulator-row.linha-destaque .tabulator-cell { background: var(--head); font-weight: 700; }
.conferencia div + div { margin-top: 2px; }
.modo-indicador #faixa, .modo-indicador #conferencia { display: none !important; }  /* sem selo e notas nos indicadores */
/* grupo empresarial que não foi salvo: a célula volta ao valor anterior e fica marcada */
#filiais-tabela .tabulator-cell.nao-salvo { box-shadow: inset 0 0 0 1px var(--neg); color: var(--neg); }
/* abas horizontais dos Indicadores DRE / BP (mesmo visual das abas de Configurações) */
.painel-abas { margin-bottom: 2px; }

/* filtros: Tipo, Grupo empresarial, Ano e Competência */
.campo-sel select { min-width: 110px; }
#f-ano { min-width: 80px; }
#f-comp { min-width: 120px; }
#f-tipo, #f-grupoemp { max-width: 180px; }
.campo-filial { flex: 1 1 260px; }

/* lista de filiais: uma coluna, só as do Tipo/Grupo escolhidos, com "Marcar todas" no topo */
.lista-filiais { display: flex; flex-direction: column; gap: 0; }
.lista-filiais .item-filial { padding: 2px 6px; }
.lista-filiais .item-todas { border-bottom: 1px solid var(--line); margin-bottom: 2px; padding-bottom: 4px; font-weight: 600; }
.painel-filiais { width: min(420px, 92vw); }

/* legenda dos gráficos de indicador, na faixa do título (à direita) */
#cartao-grafico .cartao-topo { align-items: center; }
.g-legenda { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
.g-legenda-item { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 4px; border: 0; background: none;
  color: var(--muted); font-size: .8rem; cursor: pointer; }
.g-legenda-item:hover { color: var(--ink); }
.g-legenda-item[aria-pressed=false] { opacity: .4; }
.g-legenda-cor { width: 12px; height: 8px; border-radius: 2px; }
.modo-indicador #cartao-grafico .cartao-topo .controles { display: none; }

/* Visão Geral: % da Receita Líquida embaixo do valor do card */
.kpi .sub { font-size: .72rem; color: var(--muted); }
/* aba DRE: grupos do nível 1 em negrito, resultados destacados, contas mais discretas */
#tabela .tabulator-row.lin-nivel1 .tabulator-cell , #tabela-ano .tabulator-row.lin-nivel1 .tabulator-cell { font-weight: 700; }
#tabela .tabulator-row.lin-resultado, #tabela .tabulator-row.lin-resultado .tabulator-cell { background: var(--accent-soft); font-weight: 700; }
#tabela .tabulator-row.lin-conta .tabulator-cell , #tabela-ano .tabulator-row.lin-conta .tabulator-cell { color: var(--muted); font-size: .8rem; }
#tabela .tabulator-row.lin-fora .tabulator-cell , #tabela-ano .tabulator-row.lin-fora .tabulator-cell { color: var(--warn); font-style: italic; }
#tabela .tabulator-data-tree-control , #tabela-ano .tabulator-data-tree-control { border-color: var(--muted); }
#tabela .tabulator-data-tree-control .tabulator-data-tree-control-expand,
#tabela .tabulator-data-tree-control .tabulator-data-tree-control-collapse,
#tabela .tabulator-data-tree-control .tabulator-data-tree-control-expand:after , #tabela-ano .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { background: var(--muted); }

/* DRE Gerencial: "+"/"−" para abrir sublinhas e contas (mesmo jeito da aba DRE dos indicadores) */
.dre-dobra { flex: none; width: 16px; height: 16px; min-height: 16px; padding: 0; border: 1px solid var(--muted); border-radius: 2px;
  background: none; color: var(--muted); font-size: .75rem; font-weight: 700; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.dre-dobra:hover { border-color: var(--accent); color: var(--accent); }
.dre-dobra.vazio { border: 0; cursor: default; }

/* aba DRE: o espaço do "+" fica reservado nas linhas que não abrem (textos do mesmo nível alinhados) */
#tabela .tabulator-data-tree-control , #tabela-ano .tabulator-data-tree-control { margin-right: 6px; }
#tabela .dre-sem-filhos { display: inline-block; width: 11px; margin-right: 6px; }

/* aba DRE: valores com dígitos de largura fixa e o mesmo tamanho em todas as linhas (colunas alinhadas) */
#tabela .tabulator-cell.col-num , #tabela-ano .tabulator-cell.col-num { font-variant-numeric: tabular-nums; }
#tabela .tabulator-row.lin-conta .tabulator-cell.col-num , #tabela-ano .tabulator-row.lin-conta .tabulator-cell.col-num { font-size: .84rem; }

/* aba DRE: botões AV (%) / AH (%) ligados ficam azuis; as colunas de análise são mais discretas */
button.alterna[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
#tabela .tabulator-cell.col-analise , #tabela-ano .tabulator-cell.col-analise { color: var(--muted); font-size: .76rem; }
#tabela .tabulator-col.col-analise .tabulator-col-title , #tabela-ano .tabulator-col.col-analise .tabulator-col-title { color: var(--accent); }

/* aba Receitas: rankings por filial na horizontal */
.rankings { display: grid; gap: 10px; }
.ranking-rolagem { overflow-x: auto; }
table.ranking { border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.ranking th, table.ranking td { padding: 4px 10px; text-align: right; border-bottom: 1px solid var(--line, #2d323b); }
table.ranking thead th { color: var(--muted); font-weight: 600; font-size: .76rem; vertical-align: bottom; }
table.ranking tbody th { text-align: left; color: var(--muted); font-weight: 600; }
table.ranking td:last-child, table.ranking th:last-child { font-weight: 700; border-left: 1px solid var(--line, #2d323b); }
table.ranking .ranking-part td { color: var(--muted); font-size: .76rem; font-weight: 400; }
.ranking-pos { display: block; color: var(--accent); font-size: .7rem; }
.rankings .falta { color: var(--muted); margin: 4px 0; }
.ranking-grafico { width: 100%; }
.rankings-lado { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.ranking-grafico canvas { cursor: pointer; }
/* gráficos de filial (Receitas): título à esquerda, legenda ao centro, ordenação à direita */
.ranking-topo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.ranking-topo .ranking-legenda { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ranking-topo .g-legenda-item { cursor: default; }
.ranking-legenda-pct { font-weight: 700; color: var(--ink); margin-right: 5px; font-size: .78rem; }
.modo-indicador .cartao-topo .ranking-ordem-campo { display: flex !important; flex-direction: row; align-items: center;
  gap: 6px; justify-self: end; white-space: nowrap; }
/* nos quadros estreitos (lado a lado): título e ordenação na 1ª linha, legenda centrada na 2ª */
.rankings-lado > .cartao:not(:only-child) .ranking-topo { grid-template-columns: 1fr auto;
  grid-template-areas: "titulo ordem" "legenda legenda"; }
.rankings-lado > .cartao:not(:only-child) .ranking-topo h2 { grid-area: titulo; }
.rankings-lado > .cartao:not(:only-child) .ranking-topo .ranking-legenda { grid-area: legenda; }
.rankings-lado > .cartao:not(:only-child) .ranking-topo .ranking-ordem-campo { grid-area: ordem; }
#cartao-comparativo .config-obs { margin: 0 0 4px; }
#tabela-ano .tabulator-row.lin-resultado, #tabela-ano .tabulator-row.lin-resultado .tabulator-cell { background: var(--accent-soft); font-weight: 700; }
#tabela-ano .tabulator-data-tree-control .tabulator-data-tree-control-expand,
#tabela-ano .tabulator-data-tree-control .tabulator-data-tree-control-collapse { background: var(--muted); }
#tabela-ano .dre-sem-filhos { display: inline-block; width: 11px; margin-right: 6px; }
#tabela-ano .tabulator-col.col-analise .tabulator-col-title { color: var(--accent); }
.var-pos { color: var(--ok); }
.var-neg { color: var(--neg); }
/* colunas de análise (AV, AHm, AHa) sem negrito, inclusive nas linhas de grupo e resultado */
.tabulator-row .tabulator-cell.col-analise, .tabulator-row .tabulator-cell.col-analise * { font-weight: 400 !important; }
/* coluna fixa da DRE: fundo opaco para os valores passarem por baixo */
.tabulator-row .tabulator-cell.tabulator-frozen { background: inherit; }
.tabulator-row .tabulator-cell.tabulator-frozen-left { border-right: 1px solid var(--line); }
/* Visão Geral: cascata e Receita Bruta trimestral lado a lado */
.graficos-lado { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.graficos-lado:has(#cartao-trim:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .graficos-lado:has(#cartao-trim:not([hidden])) { grid-template-columns: minmax(0, 1fr); } }
.graficos-lado > .cartao[hidden] { display: none; }
.modo-indicador #cartao-trim .cartao-topo .trim-campo:not([hidden]) { display: flex !important; flex-direction: row; align-items: center; gap: 6px; }
#cartao-trim .cartao-topo { align-items: center; }
.modo-indicador #cartao-grafico .cartao-topo .trim-campo:not([hidden]) { display: flex !important; flex-direction: row; align-items: center; gap: 6px; }
/* sem negrito no projeto: só títulos (h1–h6, título da aba, marca) e cabeçalhos de tabela */
body *:not(h1, h2, h3, h4, h5, h6, th, .cab-aba, .cab-modulo, .marca-nome, .tabulator-col-title, .tabulator-col-title *) {
  font-weight: 400 !important; }
h1, h2, h3, h4, h5, h6, .cab-aba, .marca-nome { font-weight: 700 !important; }
th, .tabulator-col-title { font-weight: 600 !important; }

/* ===================== MoniThor: tema da Controladoria FNI =====================
   Fica no fim de propósito (mesma ideia do "modo compacto"): só aparência, nenhuma tela ou função muda.
   Segue o padrão de layout do Portal da Controladoria FNI: fundo cinza-claro, menu lateral em cartão flutuante,
   cartões brancos de canto 18px com sombra bem leve, cores neutras (azul só para ação/seleção), números grandes
   e tabulares. Fonte do sistema no padrão Apple (San Francisco nos aparelhos Apple; a mais próxima nos demais).
   Tema claro por padrão; o escuro é escolhido nos botões do menu (atributo data-tema em <html>). */
body { font-size: 14px; line-height: 1.45; letter-spacing: -.006em; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- menu lateral ----------
   Painel cinza colado à esquerda, com cantos arredondados, no padrão das barras laterais da Apple
   (fonte do sistema, linhas altas, seleção em plaquinha branca). Sem vidro/desfoque.
   Em telas largas com mouse:
   - começa FIXO e aberto: a página se ajusta à largura que sobra;
   - clicar, rolar ou digitar na página recolhe o menu (só ícones) e a página ganha o espaço;
   - recolhido, passar o mouse abre por cima do conteúdo; clicar dentro dele fixa de novo.
   A classe menu-fixo em <body> é ligada/desligada em app.js (montarMenuFixo). */
.lateral { top: 8px; bottom: 8px; left: 8px; padding: 16px 14px 12px; border: 0; border-radius: 16px; background: var(--lado); box-shadow: none; font-size: 15px; }
.faixa-marca { display: none; }
.lateral-topo { padding: 2px 3px 14px; border-bottom: 0; }
.marca { display: flex; align-items: center; gap: 12px; }
.marca-logo { width: 34px; height: 34px; flex: none; }
.marca-logo path { fill: none; stroke-width: 5; stroke-linecap: round; }
.marca-logo path:nth-child(1) { stroke: var(--icone); }
.marca-logo path:nth-child(2) { stroke: var(--muted); }
.marca-logo path:nth-child(3) { stroke: var(--ink); }
.marca-texto { display: grid; gap: 0; line-height: 1.2; min-width: 0; }
.marca-nome { font-family: var(--titulo); font-size: 19px; font-weight: 700; letter-spacing: -.022em; white-space: nowrap; }
.marca-nome b { font-weight: 700; color: var(--ink); }
.marca-lema { font-size: 12px; color: var(--muted); white-space: nowrap; }
.marca-emp { display: none; }  /* o produto serve a qualquer empresa: o nome da instalação não aparece no menu */
.menu-rotulo { padding: 10px 10px 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.menu { padding: 0; gap: 2px; }
.menu-modulo, .menu-config { min-height: 42px; margin: 0; padding: 0 10px; gap: 12px; border-radius: 10px; font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.menu-modulo > span:not(.menu-seta) { flex: 1; }
.menu-modulo .ic, .menu-config .ic, .menu-config svg, .tema > span .ic { width: 22px; height: 22px; flex: none; stroke-width: 2.2; color: var(--ink2); }
.menu-modulo:hover, .menu-config:hover, .menu-item:hover { background: var(--fill); color: var(--ink); }
.menu-grupo.atual > .menu-modulo { background: none; font-weight: 700; }
.menu-grupo.atual > .menu-modulo .ic, .menu-config.atual svg { color: var(--ink); }
.menu-item.atual, .menu-config.atual { background: var(--thumb); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.menu-seta { width: 8px; height: 8px; margin-right: 4px; border-width: 0 2px 2px 0; border-color: var(--muted); }
.menu-sub { margin: 2px 0 8px; padding: 0; border-left: 0; gap: 2px; }
.menu-grupo.aberto .menu-sub { animation: menu-abre .18s ease-out; }
@keyframes menu-abre { from { opacity: 0; transform: translateY(-4px); } }
.menu-pasta-titulo { min-height: 30px; padding: 0 10px 0 44px; gap: 6px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.menu-pasta-titulo:hover { background: none; color: var(--ink); }
.menu-pasta-titulo .menu-seta { order: 2; width: 6px; height: 6px; margin: 0 5px 0 auto; }
.menu-pasta:has(.menu-item.atual) > .menu-pasta-titulo { color: var(--muted); }
.menu-pasta-itens { margin: 0 0 4px; padding: 0; border-left: 0; gap: 2px; }
.menu-item { min-height: 38px; padding: 0 10px 0 44px; border-radius: 10px; font-size: 14px; color: var(--ink); white-space: nowrap; }
.menu-item > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.menu-rotina, .menu-item.atual .menu-rotina { font-size: 12px; font-weight: 500; color: var(--muted); }
.tema { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 2px 0 10px; font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.tema > span { display: inline-flex; align-items: center; gap: 12px; }
.tema-sw { display: inline-flex; gap: 0; padding: 2px; border-radius: 9px; background: var(--fill); }
.tema-sw button { width: 36px; min-height: 30px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink2); }
.tema-sw button .ic { width: 17px; height: 17px; }
.tema-sw button[aria-pressed="true"] { background: var(--thumb); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / .14), 0 0 0 .5px rgb(0 0 0 / .05); }
.lateral-rodape { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 12px 3px 2px; border-top: 1px solid var(--line-forte); white-space: nowrap; }
.usuario-foto { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 99px; background: var(--fill); color: var(--ink2); }
.usuario-foto .ic { width: 20px; height: 20px; }
.usuario-nome { font-size: 15px; font-weight: 500; color: var(--ink); }

@media (min-width: 901px) and (hover: hover) {
  :root { --lat-fechado: 70px; --lat-aberto: 288px; }
  .lateral { width: var(--lat-fechado); padding-left: 0; padding-right: 0; transition: width .22s cubic-bezier(.3, .7, .2, 1) .06s, box-shadow .22s; }
  /* o conteúdo tem largura fixa (a do menu aberto) e só é recortado: nada "pula" ao abrir */
  .lateral > * { width: var(--lat-aberto); padding-left: 14px; padding-right: 14px; flex-shrink: 0; }
  .lateral > .lateral-topo { padding-left: 18px; }
  .lateral > .menu-rotulo { padding-left: 24px; }
  .lateral > .menu-config, .lateral > .tema, .lateral > .lateral-rodape { width: calc(var(--lat-aberto) - 28px); margin-left: 14px; margin-right: 14px; }
  .lateral > .menu-config { padding-left: 10px; padding-right: 10px; }
  .lateral > .tema { padding-left: 10px; padding-right: 2px; }
  .lateral > .lateral-rodape { padding-left: 3px; padding-right: 0; }
  .lateral:hover, .lateral:focus-within { width: var(--lat-aberto); box-shadow: var(--shadow-alta); }
  .menu-fixo .lateral { width: var(--lat-aberto); box-shadow: none; }
  /* recolhido: só logo e ícones */
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) .menu-sub { display: none; }
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) :is(.marca-texto, .menu-rotulo, .menu-modulo > span, .menu-config > span, .tema-sw, .usuario-nome) { opacity: 0; }
  .lateral :is(.marca-texto, .menu-rotulo, .menu-modulo > span, .menu-config > span, .tema-sw, .usuario-nome) { transition: opacity .16s .08s; }
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) .tema > span { font-size: 0; }
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) :is(.menu-grupo.atual > .menu-modulo, .menu-config.atual) { width: 42px; background: var(--thumb); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
  .pagina { margin-left: calc(var(--lat-fechado) + 8px); transition: margin-left .22s cubic-bezier(.3, .7, .2, 1) .06s; }
  .menu-fixo .pagina { margin-left: calc(var(--lat-aberto) + 8px); }
}
@media (prefers-reduced-motion: reduce) { .lateral, .lateral *, .pagina { transition: none !important; animation: none !important; } }

/* ---------- página, cabeçalho e filtros ----------
   Uma página só, branca, sem cartão para cada coisa: as partes são separadas por espaço e por linhas finas.
   Cartão (fundo + sombra) fica só para o que flutua por cima: lista de filiais, menus e dicas. */
.pagina { max-width: none; padding: 28px 40px 56px 32px; gap: 0; }
.pagina > * { min-width: 0; }
.cabecalho { padding: 0 0 18px; border: 0; background: none; box-shadow: none; }
.cab-modulo { font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.cab-aba { font-family: var(--titulo); font-size: 30px; font-weight: 700; letter-spacing: -.028em; line-height: 1.15; }
.filtros { padding: 0 0 18px; gap: 10px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.campo { gap: 5px; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.campo select, .campo input, .seletor, .config-busca, #busca-filial { min-height: 36px; padding: 0 10px; border: 1px solid var(--line-forte); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 14px; }
.campo select:hover, .campo input:hover, .seletor:hover, .config-busca:hover { border-color: var(--ink2); background: var(--surface); }
.campo select:focus-visible, .campo input:focus-visible, .seletor:focus-visible, .config-busca:focus-visible { outline: 3px solid var(--foco); outline-offset: 0; }
.seletor { padding-right: 30px; }
.campo-mini select { min-height: 30px; font-size: 13px; }
button { min-height: 36px; padding: 0 18px; border: 0; border-radius: 980px; background: var(--fill-forte); color: var(--ink); font-size: 14px; font-weight: 500;
  transition: background .12s, opacity .12s; }
button:hover { background: rgb(60 60 67 / .28); border: 0; }
button:active { opacity: .7; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--foco); outline-offset: 1px; }
button.primario { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primario:hover { background: var(--accent-forte); }
button.leve { min-height: 30px; padding: 0 14px; font-size: 13px; background: var(--fill-forte); }
button.leve:hover { background: rgb(60 60 67 / .28); }
button.alterna[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.painel-filiais { border: 0; border-radius: 14px; padding: 12px; background: var(--surface); box-shadow: var(--shadow-alta); }
.atalhos button { border-radius: 980px; }
.estado { font-size: 13px; }

/* ---------- conteúdo ---------- */
main, .config { gap: 0; }
main > *, .config > * { margin-top: 20px; }
.faixa-status { font-size: 13px; color: var(--ink2); }
.selo { padding: 2px 8px; border-radius: 6px; text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 600; }
.trilha { font-size: 13px; }
.trilha button { min-height: 26px; background: var(--fill); color: var(--ink); }
.dica-abrir { color: var(--muted); font-weight: 400; }
.conferencia { padding: 8px 12px; border-radius: 10px; font-size: 12px; }

/* números: uma faixa de totais, separados por linhas finas, sem caixa */
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px 0; }
.kpi { padding: 2px 20px 2px 16px; gap: 4px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.kpi .l { font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.kpi .v { font-family: var(--titulo); font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.kpi .sub { font-size: 12px; }
.kpi .falta { font-size: 11px; }

/* seções (gráfico, tabela): título e conteúdo direto na página */
.cartao { padding: 22px 0 0; gap: 14px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
main > .cartao, .config .cartao { margin-top: 24px; }
.cartao h2 { font-family: var(--titulo); font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.cartao-topo { align-items: center; }
.chk { padding: 5px 14px; border: 0; border-radius: 980px; background: var(--fill-forte); font-size: 13px; color: var(--ink2); cursor: pointer; }
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk:hover { background: var(--fill-forte); }
.chk:has(input:checked) { background: var(--ink); color: var(--surface); font-weight: 500; }
.chk:has(input:focus-visible) { outline: 3px solid var(--foco); outline-offset: 1px; }
.grafico { height: 340px; }
.menu-colunas { padding: 0; border-radius: 0; background: none; }
.g-legenda-item { background: none; padding: 0 4px; font-size: 12px; }
.g-legenda-item:hover { background: none; }
.g-legenda-cor { width: 8px; height: 8px; border-radius: 99px; }
.dica { font-size: 12px; }

/* abas (indicadores e Configurações): controle segmentado */
.config-abas { width: fit-content; max-width: 100%; gap: 0; padding: 2px; border: 0; border-radius: 10px; background: var(--fill); box-shadow: none; outline: 0; overflow-x: auto; }
.config-abas [role=tab] { min-height: 30px; margin: 0; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 13px; font-weight: 500; }
.config-abas [role=tab]:hover { background: none; color: var(--ink); border: 0; }
.config-abas [role=tab][aria-selected=true] { background: var(--thumb); color: var(--ink); font-weight: 600; box-shadow: 0 2px 6px rgb(0 0 0 / .12), 0 0 0 .5px rgb(0 0 0 / .04); }
.painel-abas { margin-bottom: 0; }
.chip { border-radius: 6px; padding: 1px 8px; }
.config-cartoes { gap: 0 40px; }
.config-cartoes .cartao h2 { font-size: 17px; }
.config-barra button.leve { min-height: 34px; }
.dre-linha.nivel-1 { border-left-color: var(--ink); }
.dre-cod, #plano-tabela .plano-grupo-cod { color: var(--muted); }

/* ---------- tabelas: direto na página, só linhas finas ---------- */
.tabulator { border: 0; border-radius: 0; background: none; font-size: 13.5px; }
.tabulator .tabulator-header { border-bottom: 1px solid var(--line); }
.tabulator .tabulator-header, .tabulator .tabulator-header .tabulator-col { background: var(--surface); }
.tabulator .tabulator-header .tabulator-col { border-right: 0; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 8px 12px 6px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--sunk); }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input { padding: 3px 8px; border: 0; border-radius: 7px; background: var(--fill); }
.tabulator-row, .tabulator-row.tabulator-row-even { background: var(--surface); }
.tabulator-row.tabulator-selectable:hover { background: var(--sunk); }
.tabulator-row .tabulator-cell { padding: 3px 12px; }
.abrivel .tabulator-row:hover .tabulator-cell:first-child { box-shadow: inset 3px 0 0 var(--ink); }
#tabela .tabulator-row.lin-resultado, #tabela .tabulator-row.lin-resultado .tabulator-cell { background: var(--sunk); }
.tabulator .tabulator-footer, .tabulator .tabulator-footer .tabulator-calcs-holder { border-top-width: 1px; }
.tabulator-edit-list { border: 0; border-radius: 10px; box-shadow: var(--shadow-alta); }

/* ---------- tipografia e alinhamento (padrão único do site) ----------
   Escala de texto (uma família só, a do sistema): título de página 30/800 · título de seção 19/800 ·
   número de total 30/800 · texto e campos 14/500 · rótulos 13/600–700 · apoio 12–13/600.
   Nada abaixo de peso 500: texto fino cansa e some em telas claras. Números sempre tabulares. */
body { font-size: 14px; font-weight: 500; line-height: 1.45; }
.cab-modulo { font-weight: 600; }
.cab-aba { font-weight: 800; }
.cartao h2 { font-weight: 800; }
.campo { font-weight: 700; color: var(--ink2); }
.campo select, .campo input, .seletor, .config-busca, #busca-filial { font-weight: 500; }
.seletor { display: flex; align-items: center; }
.seletor::after { top: 50%; transform: translateY(-50%); }
button { font-weight: 600; }
button.primario { font-weight: 700; }
.estado { font-weight: 500; color: var(--ink2); }
.estado.erro { font-weight: 700; }
.faixa-status { font-weight: 500; align-items: center; }
.faixa-status .rotina { font-weight: 700; }
.selo { font-weight: 700; }
.trilha { font-weight: 600; align-items: center; }
.kpi .l { font-weight: 700; color: var(--ink2); }
.kpi .v { font-weight: 800; }
.kpi .sub { font-weight: 600; color: var(--muted); }
.chk { font-weight: 600; display: inline-flex; align-items: center; }
.chk:has(input:checked) { font-weight: 700; }
.dica { font-weight: 500; color: var(--muted); }
.g-legenda-item { font-weight: 600; color: var(--ink2); }
.config-abas [role=tab] { font-weight: 600; }
.config-abas [role=tab][aria-selected=true] { font-weight: 700; }
.config-linha dt { font-weight: 600; color: var(--muted); }
.config-linha dd { font-weight: 500; }
.config-linha { align-items: baseline; }
.config-tabela th { font-size: 12.5px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink2); }
.config-tabela td { font-weight: 500; }
.config-obs { font-size: 13px; font-weight: 500; }
.config-grupo h3 { font-size: 14px; font-weight: 700; }
.chip { font-weight: 600; }
.menu-qt { font-weight: 700; }
.dre-desc { font-weight: 500; }
.dre-linha.nivel-1 .dre-desc { font-weight: 700; }
.dre-linha.nivel-2 .dre-desc { font-weight: 600; }
.dre-cod { font-weight: 600; }

/* menu lateral: pesos */
.marca-nome { font-weight: 800; }
.marca-lema { font-weight: 600; }
.menu-rotulo, .menu-pasta-titulo { font-weight: 700; }
.menu-modulo, .menu-config, .tema, .usuario-nome { font-weight: 600; }
.menu-item { font-weight: 500; }
.menu-grupo.atual > .menu-modulo, .menu-item.atual, .menu-config.atual { font-weight: 700; }
.menu-rotina, .menu-item.atual .menu-rotina { font-weight: 600; }

/* tabelas: pesos */
.tabulator { font-weight: 500; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-weight: 700; color: var(--ink2); }
.tabulator .col-cod { font-weight: 600; }
#tabela .tabulator-row.lin-conta .tabulator-cell { font-weight: 500; }
#tabela .tabulator-row.lin-nivel1 .tabulator-cell, #tabela .tabulator-row.lin-resultado .tabulator-cell { font-weight: 700; }

/* totais alinhados com a margem da página: a linha divisória só aparece entre um total e outro */
.kpis { margin-left: -17px; clip-path: inset(0 0 0 17px); }
/* título da seção e controles na mesma linha de base; controles sempre à direita */
.cartao-topo { align-items: flex-end; }
.cartao-topo h2 { align-self: center; }
.controles { align-items: flex-end; margin-left: auto; }
.config-barra { align-items: center; }

/* ---------- painel em blocos (padrão de dashboard) ----------
   Página em cinza-claro (--bg); cada parte da análise é um bloco branco de canto 20px com sombra quase nula:
   filtros, cada total, gráfico e tabela. Substitui as linhas finas da versão "página inteira". */
.pagina { padding: 22px 28px 48px 24px; }
.lateral { background: var(--lado); box-shadow: var(--cartao-sombra); }
.menu-fixo .lateral { box-shadow: var(--cartao-sombra); }
.menu-item.atual, .menu-config.atual { background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) :is(.menu-grupo.atual > .menu-modulo, .menu-config.atual) { background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
.tema-sw { background: var(--sunk); }
.lateral-rodape { border-top-color: var(--line); }

/* marca: só logo e nome, alinhados à esquerda com os ícones do menu (o lema saiu) */
.lateral-topo { padding-bottom: 14px; }
.marca { gap: 10px; }
.marca-logo { width: 32px; height: 32px; }
.marca-nome { font-size: 17px; }
.marca-lema { display: none; }

/* menu compacto: mais estreito, linhas e textos menores (mínimos da seção 3 mantidos) */
.lateral { padding: 14px 10px 10px; }
.menu-rotulo { padding: 8px 10px 4px; font-size: 11.5px; }
.menu-modulo, .menu-config, .tema { min-height: 36px; font-size: 14px; gap: 10px; }
.menu-modulo .ic, .menu-config .ic, .menu-config svg, .tema > span .ic { width: 19px; height: 19px; }
.tema > span { gap: 10px; }
.menu-item { min-height: 32px; padding-left: 39px; font-size: 13.5px; border-radius: 8px; }
.menu-pasta-titulo { min-height: 26px; padding-left: 39px; }
.menu-modulo, .menu-config { border-radius: 9px; }
.tema-sw button { width: 32px; min-height: 26px; }
.lateral-rodape { gap: 10px; padding-top: 10px; }
.usuario-foto { width: 30px; height: 30px; }
.usuario-foto .ic { width: 17px; height: 17px; }
.usuario-nome { font-size: 14px; }
@media (min-width: 901px) and (hover: hover) {
  :root { --lat-fechado: 60px; --lat-aberto: 232px; }
  .lateral { padding-left: 0; padding-right: 0; }
  .lateral > .menu { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
  .lateral > * { padding-left: 10px; padding-right: 10px; }
  .lateral > .lateral-topo { padding-left: 16px; }
  .lateral > .menu-rotulo { padding-left: 20px; }
  .lateral > .menu-config, .lateral > .tema, .lateral > .lateral-rodape { width: calc(var(--lat-aberto) - 20px); margin-left: 10px; margin-right: 10px; }
  .lateral > .lateral-rodape { padding-left: 5px; }
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) :is(.menu-grupo.atual > .menu-modulo, .menu-config.atual) { width: 39px; }
}

.cabecalho { padding: 4px 4px 16px; }
.filtros { padding: 16px 18px; border: 0; border-radius: var(--r-bloco); background: var(--surface); box-shadow: var(--cartao-sombra); }
.campo select, .campo input, .seletor, .config-busca, #busca-filial { background: var(--surface); }

main > *, .config > * { margin-top: 16px; }
.faixa-status { padding: 0 4px; }

/* totais: um bloco por número, número grande e rótulo acima */
.kpis { margin-left: 0; clip-path: none; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; gap: 6px; border: 0; border-radius: var(--r-bloco); background: var(--surface); box-shadow: var(--cartao-sombra); }

/* seções (gráfico, tabela, Configurações) */
.cartao { padding: 20px 22px; gap: 14px; border: 0; border-radius: var(--r-bloco); background: var(--surface); box-shadow: var(--cartao-sombra); }
main > .cartao, .config .cartao { margin-top: 16px; }
.config-cartoes { gap: 16px; }
.config-abas { background: var(--fill); }

/* tabela dentro do bloco: cabeçalho e linhas no fundo do bloco */
.tabulator .tabulator-header, .tabulator .tabulator-header .tabulator-col,
.tabulator-row, .tabulator-row.tabulator-row-even { background: var(--surface); }

/* ---------- cor e vida (paleta SaaS: índigo + neutros slate) ----------
   Índigo (--marca) marca ação e seleção; séries dos gráficos em --s1…--s5; verde/vermelho só para bom/ruim. */
.marca-logo { width: 30px; height: 30px; overflow: visible; }
.marca-logo * { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
/* logo monocromática: lupa com barras dentro da lente e seta de alta cruzando a lente */
.marca-logo .lupa { stroke-width: 2.8; }
.marca-logo .lupa-cabo { stroke-width: 4.2; }
.marca-logo .seta { stroke-width: 2.6; }
.marca-logo .seta-ponta { fill: var(--ink); stroke-width: 1; }
.marca-logo .barras polygon { stroke: none; fill: var(--ink); }
.marca-logo .barras .b1 { opacity: .4; }
.marca-logo .barras .b2 { opacity: .7; }
.marca { align-items: center; gap: 9px; }
.marca-logo { width: 32px; height: 32px; }
.marca-texto { display: flex; align-items: center; }
.marca-nome { font-family: var(--titulo); font-size: 21px; font-weight: 800; line-height: 1; letter-spacing: -.035em; }
.marca-nome b { color: var(--ink); }
.menu-item.atual, .menu-config.atual { background: var(--marca-soft); color: var(--marca); box-shadow: none; }
body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) :is(.menu-grupo.atual > .menu-modulo, .menu-config.atual) { background: var(--marca-soft); box-shadow: none; }
.menu-grupo.atual > .menu-modulo .ic, .menu-config.atual svg { color: var(--marca); }
.menu-item.atual .menu-rotina { color: var(--marca); }
.chk:has(input:checked) { background: var(--marca); color: var(--accent-ink); }
button.alterna[aria-pressed=true] { background: var(--marca); color: var(--accent-ink); }
.config-abas [role=tab][aria-selected=true] { color: var(--marca); }
.cab-modulo { color: var(--muted); font-weight: 700; }
/* totais: o primeiro é o destaque (faixa índigo no topo); cada rótulo leva um ponto na cor da série */
.kpi { position: relative; overflow: hidden; }
.kpi:first-child::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--marca); }
.kpi .l { display: flex; align-items: center; gap: 7px; }
.kpi .v.perc-sobe, .tabulator-cell.perc-sobe { color: var(--ok); }
.kpi .v.perc-cai, .tabulator-cell.perc-cai { color: var(--neg); }
.kpi .l::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 99px; background: var(--s1); }
.kpi:nth-child(5n+2) .l::before { background: var(--s2); }
.kpi:nth-child(5n+3) .l::before { background: var(--s3); }
.kpi:nth-child(5n+4) .l::before { background: var(--s4); }
.kpi:nth-child(5n+5) .l::before { background: var(--s5); }
.abrivel .tabulator-row:hover .tabulator-cell:first-child { box-shadow: inset 3px 0 0 var(--marca); }

/* ---------- melhorias de UI/UX ---------- */
/* filtros numa linha só; o botão Consultar fica alinhado à base dos campos */
.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.filtros .estado { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 12.5px; }
/* faixa de situação: bloco discreto, texto de apoio com largura de leitura confortável */
.faixa-status { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 12px 16px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--cartao-sombra); }
.faixa-status .conferir { flex-basis: 100%; max-width: 110ch; font-size: 13px; color: var(--muted); line-height: 1.5; }
/* totais: cabem numa linha só em tela larga, sem total "sobrando" sozinho */
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi:first-child::before { display: none; }
.kpi { transition: box-shadow .15s, transform .15s; }
.kpi .v { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: clamp(20px, 1.9vw, 30px); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
/* tabela: cabeçalho fixo ao rolar, números com dígitos de mesma largura */
.tabulator .tabulator-header { position: sticky; top: 0; z-index: 2; }
.tabulator .tabulator-cell { font-variant-numeric: tabular-nums; }
/* clique: área de toque confortável e retorno visual */
button { transition: background .12s, opacity .12s, transform .08s; }
button:active { transform: scale(.98); }

/* totais: a grade segue a largura da ÁREA (não da tela), então abrir/fechar o menu não deixa total sobrando.
   Colunas fixas e equilibradas: 8 totais = 4+4 ou 2×4; 5 = 5 ou 3+2; número sempre colado no topo do bloco. */
main { container: area / inline-size; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 620px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 740px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (min-width: 820px) { .kpis:has(> .kpi:nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@container (min-width: 620px) and (max-width: 739px) { .kpis:has(> .kpi:nth-child(8):last-child), .kpis:has(> .kpi:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 480px) and (max-width: 819px) { .kpis:has(> .kpi:nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* duas colunas com número ímpar de totais: o último ocupa a linha toda */
@container (max-width: 479px) { .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.kpi { display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; }
.kpi .v { font-size: clamp(19px, 2.5cqi, 28px); }
/* rótulo, número e subtítulo alinhados entre os totais da mesma linha (mesmo que um rótulo quebre) */
@supports (grid-template-rows: subgrid) {
  .kpi { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; align-content: start; }
  .kpi .l { align-self: end; }
}
@container area (max-width: 479px) { .kpi .v { font-size: clamp(15px, 4.6cqi, 24px); letter-spacing: -.04em; } }
.pagina, main { transition: none; }

/* abas de indicador: em tela larga quebram em mais de uma linha em vez de esconder as últimas */
@media (min-width: 901px) { .painel-abas { flex-wrap: wrap; overflow: visible; row-gap: 2px; } }

/* ---------- marca só com o nome (sem logo) ----------
   Aberto: "MoniThor" escrito. Recolhido (60px): só a inicial "M", no mesmo peso. */
.marca-inicial { display: none; font-family: var(--titulo); font-size: 22px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--ink); }
.marca-nome { font-size: 22px; }
@media (min-width: 901px) and (hover: hover) {
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) .marca-inicial { display: block; width: 28px; text-align: center; }
  body:not(.menu-fixo) .lateral:not(:hover):not(:focus-within) .marca-texto { display: none; }
}

/* ---------- topo: título (30%) e filtros (70%) na mesma faixa, filtros sem bloco ---------- */
.faixa-topo { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); gap: 16px; align-items: end; }
.faixa-topo .cabecalho { padding-bottom: 4px; }
.faixa-topo .filtros { padding: 0 0 4px; gap: 8px 10px; justify-content: flex-end; background: none; box-shadow: none; border-radius: 0; }
.faixa-topo .campo { gap: 3px; font-size: 12px; }
.faixa-topo .campo select, .faixa-topo .campo input, .faixa-topo .seletor { min-height: 30px; padding: 0 8px; font-size: 13px; border-radius: 8px; }
.faixa-topo .seletor { max-width: 220px; }
.faixa-topo .filtros button.primario { min-height: 30px; padding: 0 14px; font-size: 13px; }
.faixa-topo .filtros { flex-wrap: nowrap; position: relative; }
.faixa-topo .filtros > * { flex: 0 1 auto; min-width: 0; }
.faixa-topo .filtros .campo select, .faixa-topo .filtros .seletor { width: 100%; }
.faixa-topo .filtros .campo-filial { flex: 1 1 200px; max-width: 240px; }
.faixa-topo .filtros > button { flex: 0 0 auto; }
.faixa-topo .filtros .estado { position: absolute; right: 0; top: 100%; flex: none; white-space: nowrap; }
@media (max-width: 1100px) { .faixa-topo { grid-template-columns: minmax(0, 1fr); } .faixa-topo .filtros { justify-content: flex-start; flex-wrap: wrap; } .faixa-topo .filtros .estado { position: static; white-space: normal; } }

/* ---------- totais compactos ---------- */
.kpis { gap: 12px; }
.kpi { padding: 10px 14px; row-gap: 2px; }
.kpi .l { font-size: 12px; }
.kpi .v { font-size: 22px; }
.kpi .sub { font-size: 11.5px; }

/* ---------- DRE Gerencial: botões de ícone das linhas (quadrados, cantos arredondados) ---------- */
.dre-acoes button.icone { width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; }
.dre-acoes button.icone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* gráficos lado a lado: o gráfico fica no pé do bloco, para as bases das colunas se alinharem */
.graficos-lado > .cartao { align-content: space-between; }
/* Indicadores DRE › CMV: gráfico do mês em 2/3 da faixa e a pizza por grupo empresarial em 1/3 */
@media (min-width: 1001px) { .graficos-lado.com-pizza:has(#cartao-trim:not([hidden])) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

.trim-campo[hidden] { display: none !important; }

.g-legenda.legenda-baixo { justify-content: center; margin: 4px 0 0; }

/* títulos de gráficos e rankings: um tamanho só, um pouco menor que o título de seção */
#conteudo .cartao h2 { font-size: 16px; }

/* filtro "Até" dos gráficos: campo fino */
#conteudo .trim-campo, #conteudo .trim-campo:not([hidden]) { flex-direction: column !important; align-items: flex-start !important; font-size: 11px; gap: 2px !important; color: var(--muted); }
#conteudo .trim-campo select { min-height: 24px; height: 24px; padding: 0 6px; font-size: 12px; border-radius: 6px; }

/* Visão Geral › Evolução mensal: campo "Linhas" (linhas de resultado da DRE, com caixas de marcar) */
#cartao-trim .cartao-topo { align-items: flex-end; justify-content: flex-start; gap: 8px; }
#cartao-trim .cartao-topo > h2 { margin-right: auto; }
#cartao-trim .cartao-topo > .trim-campo { margin: 0 !important; flex: 0 0 auto; }
.trim-linhas-menu { position: relative; }
.trim-linhas-menu summary { list-style: none; cursor: pointer; height: 24px; line-height: 22px; padding: 0 22px 0 6px; font-size: 12px;
  color: var(--ink); border: 1px solid var(--line-forte); border-radius: 6px; background: var(--surface); white-space: nowrap; position: relative; }
.trim-linhas-menu summary::-webkit-details-marker { display: none; }
.trim-linhas-menu summary::after { content: ""; position: absolute; right: 8px; top: 8px; width: 5px; height: 5px;
  border-right: 2px solid var(--ink2); border-bottom: 2px solid var(--ink2); transform: rotate(45deg); }
.trim-linhas-menu > div { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; max-height: 240px; overflow: auto;
  padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-alta); }
.chk-linha { display: flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 6px; font-size: 12px; white-space: nowrap; color: var(--ink); border-radius: 6px; cursor: pointer; }
.chk-linha:hover { background: var(--sunk); }
#conteudo .trim-linhas .chk-linha input { width: 13px; height: 13px; min-height: 0; margin: 0; padding: 0; }

.cartao h2 .titulo-sub { display: block; margin-top: 1px; font-size: 11px; font-weight: 400; color: var(--muted); }

/* Indicadores DRE › DRE Gerencial: tabela mais leve — mais respiro, linhas quase invisíveis, sem divisória
   vertical, linhas de resultado só com fundo suave, botão de abrir discreto */
#tabela .tabulator-header { border-bottom: 1px solid var(--line); }
#tabela .tabulator-header .tabulator-col { border-right: 0 !important; }
#tabela .tabulator-header .tabulator-col .tabulator-col-title { color: var(--muted); font-size: 12px; }
#tabela .tabulator-row { border-bottom: 1px solid var(--sunk); }
#tabela .tabulator-row .tabulator-cell { padding: 7px 14px; border-right: 0; height: auto !important; }
#tabela .tabulator-row .tabulator-cell.tabulator-frozen-left { border-right: 0; }
#tabela .tabulator-row.lin-resultado { border-bottom-color: transparent; }
#tabela .tabulator-row.lin-resultado .tabulator-cell { background: var(--sunk); }
#tabela .tabulator-row.lin-resultado .tabulator-cell:first-child { border-radius: 8px 0 0 8px; }
#tabela .tabulator-row.lin-resultado .tabulator-cell:last-child { border-radius: 0 8px 8px 0; }
#tabela .tabulator-data-tree-control { width: 12px; height: 12px; border-width: 1.5px; border-color: var(--line-forte); border-radius: 4px; opacity: .8; }
#tabela .tabulator-tableholder { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* Configurações › Plano de contas: tabela mais leve — grupos sem fundo cinza, mais respiro, divisórias suaves,
   seletor da DRE como cápsula discreta e contagem em cinza */
#plano-tabela { background: var(--surface); border-radius: 12px; }
#plano-tabela .tabulator-header { border-bottom: 1px solid var(--line); }
#plano-tabela .tabulator-header .tabulator-col .tabulator-col-title { color: var(--muted); font-size: 12px; }
#plano-tabela .tabulator-row.tabulator-group { min-height: 32px; padding: 2px 14px; background: var(--surface);
  border-top: 0; border-bottom: 1px solid var(--sunk); font-weight: 600; }
#plano-tabela .tabulator-row.tabulator-group:hover { background: var(--sunk); }
#plano-tabela .tabulator-group .tabulator-arrow { border-left-color: var(--icone); }
#plano-tabela .tabulator-group.tabulator-group-visible .tabulator-arrow { border-top-color: var(--icone); }
#plano-tabela .plano-grupo-cod { color: var(--muted); font-weight: 600; }
#plano-tabela .plano-grupo-dre { min-height: 22px; height: 22px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px;
  background-color: var(--fill); color: var(--ink); font-size: 13px; font-weight: 500; }
#plano-tabela .plano-grupo-dre:hover, #plano-tabela .plano-grupo-dre:focus { border-color: var(--line-forte); background-color: var(--surface); }
#plano-tabela .tabulator-group .menu-qt { font-size: 12px; font-weight: 600; color: var(--icone); background: none; border: 0; }
#plano-tabela .tabulator-row:not(.tabulator-group) { border-bottom: 1px solid var(--sunk); }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell { border-right: 0; }
#plano-tabela .tabulator-tableholder { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* Plano de contas: a célula da DRE de cada conta com a mesma cápsula do seletor do grupo */
/* mesma posição e largura do seletor do grupo (2px à direita da coluna, 48px antes do fim), com a setinha */
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre { position: relative; padding: 5px 46px 5px 2px;
  height: auto !important; overflow: visible; }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre::after { content: ""; position: absolute; right: 58px;
  top: 50%; width: 6px; height: 6px; border: solid var(--ink); border-width: 0 1.8px 1.8px 0; transform: translateY(-70%) rotate(45deg);
  pointer-events: none; }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre {
  background: var(--fill); background-clip: content-box; border-radius: 8px; }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre .config-vazio,
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre { font-size: 13px; font-weight: 500; line-height: 22px; text-indent: 10px; }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre .config-vazio { font-style: normal; color: var(--muted); }
#plano-tabela .tabulator-row:not(.tabulator-group) .tabulator-cell.col-dre:hover { background: var(--fill-forte); background-clip: content-box; }

/* Lista de escolha das células (Plano de contas › DRE de cada conta): igual à lista do seletor do grupo —
   caixa com contorno fino, itens de 14px e item atual/sob o mouse em azul com texto branco */
.tabulator-edit-list { border: 1px solid var(--line-forte); border-radius: 2px; box-shadow: var(--shadow-alta); padding: 0; }
.tabulator-edit-list .tabulator-edit-list-item { padding: 6px 12px; font-size: 14px; font-weight: 500; color: var(--ink); }
.tabulator-edit-list .tabulator-edit-list-item:hover,
.tabulator-edit-list .tabulator-edit-list-item.focused,
.tabulator-edit-list .tabulator-edit-list-item.active { background: var(--s1); color: var(--rotulo-barra); outline: none; }

/* Plano de contas: o campo aberto na conta é o mesmo seletor do grupo, no lugar da cápsula */
#plano-tabela .tabulator-row .tabulator-cell.col-dre.tabulator-editing { border: 0; background: none !important; padding: 5px 54px 5px 2px !important; }
#plano-tabela .tabulator-cell.col-dre.tabulator-editing::after { display: none; }
#plano-tabela .plano-conta-dre { position: static; transform: none; left: auto; width: 100%; margin: 0; }

/* Configurações › DRE Gerencial: linha de resultado padrão (fixa) — nome travado, sem excluir, só se move */
.dre-linha.fixa .dre-desc[readonly] { cursor: default; border-color: transparent; background: transparent; box-shadow: none; }
.dre-linha.fixa .dre-acoes::after { content: ""; width: 30px; flex: none; }  /* lugar do botão excluir: ƒx fica alinhado */

/* Plano de contas: conta que segue o grupo — mesmo texto das demais, só a seta ↳ e a cor de apoio indicam a herança */
#plano-tabela .col-dre .dre-herdada { font-style: normal; color: var(--ink2); }

/* Indicadores BP › Balanço: item da legenda para a "ponte" de crescimento do PL (traço cinza) */
.g-legenda-ponte { cursor: default; }
.g-legenda-traco { display: inline-block; width: 16px; height: 8px; margin-right: 6px; border: 1.6px solid var(--icone);
  border-bottom: 0; border-radius: 2px 2px 0 0; vertical-align: middle; }

/* Todas as telas: espaçamento mais enxuto entre blocos e dentro deles */
:root { --gap: 10px; }
.pagina { gap: 10px; padding-top: 16px; }
main, #conteudo { gap: 10px; }
#conteudo > .cartao, #conteudo > section, #conteudo > div, .graficos-lado > .cartao { margin-top: 0; }
.cartao { padding: 14px 16px; }
.kpis { gap: 10px; }
.graficos-lado, .rankings-lado, .config-cartoes { gap: 10px; }
.cartao-topo { margin-bottom: 4px; }

/* Tabelas sem árvore (ex.: Indicadores BP): linhas mais baixas e menos espaço entre o título do bloco e a tabela */
#tabela:not(.dre-arvore-tab) .tabulator-row .tabulator-cell { padding-top: 5px; padding-bottom: 5px; }
.cartao:has(> #tabela) { row-gap: 6px; }

/* Todas as telas: ícone de expandir ao lado do título dos gráficos e o bloco aberto em 80% da tela */
.bt-expandir { display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0 0 0 6px;
  vertical-align: middle; position: relative; top: -2px; border: 0; border-radius: 6px; background: none; color: var(--icone); cursor: pointer; }
.bt-expandir .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bt-expandir:hover { background: var(--fill); color: var(--ink2); }
#fundo-expandido { position: fixed; inset: 0; z-index: 900; background: var(--fill-forte); }
#fundo-expandido[hidden] { display: none; }
.cartao.expandido { position: fixed; top: 5vh; left: 5vw; width: 90vw; height: 90vh; z-index: 901; margin: 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-alta); overflow: auto; }
.cartao.expandido .grafico, .cartao.expandido .ranking-grafico { flex: 1 1 auto; height: auto !important; min-height: 0; }
.cartao.expandido .grafico > div:first-child, .cartao.expandido .ranking-grafico > div:first-child { width: 100% !important; height: 100% !important; }
.cp-cartao.expandido { position: fixed; top: 5vh; left: 5vw; width: 90vw; height: 90vh; z-index: 901; margin: 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-alta); overflow: auto; }
.cp-cartao.expandido .cp-grafico { flex: 1 1 auto; height: auto !important; min-height: 0; }
.cp-cartao.expandido .cp-grafico > div:first-child { width: 100% !important; height: 100% !important; }
.cp-topo h3 .bt-expandir { margin-left: 6px; vertical-align: middle; }

/* Configurações › Balanço Patrimonial: Ativo e Passivo lado a lado, uma linha da 117 por linha com o seletor da classe */
.bp-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 10px; align-items: start; }
.bp-bloco { background: var(--surface); border-radius: 12px; padding: 10px 14px; }
.bp-bloco h3 { margin: 2px 0 6px; font-size: 14px; font-weight: 800; }
.bp-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px;
  border-bottom: 1px solid var(--sunk); font-size: 13.5px; font-weight: 500; }
.bp-linha:last-child { border-bottom: 0; }
.bp-linha .bp-classe { width: 210px; flex: none; height: 26px; min-height: 0; padding: 0 10px; border: 1px solid transparent; border-radius: 8px;
  background-color: var(--fill); color: var(--ink); font-size: 13px; font-weight: 500; }
.bp-linha .bp-classe:hover, .bp-linha .bp-classe:focus { border-color: var(--line-forte); background-color: var(--surface); }

/* Todas as telas: ícone "i" (memória de cálculo) entre o título do gráfico e o ícone de expandir */
.bt-info { display: inline-grid; place-items: center; width: 17px; height: 17px; min-height: 0; padding: 0; margin: 0 0 0 8px;
  vertical-align: middle; position: relative; top: -2px; border: 1.6px solid var(--icone); border-radius: 50%; background: none;
  color: var(--icone); font: italic 700 11px/1 Georgia, serif; cursor: pointer; }
.bt-info:hover, .bt-info[aria-expanded="true"] { border-color: var(--ink2); color: var(--ink2); }
.cartao h2 { position: relative; }
.info-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: max-content; max-width: min(560px, 80vw);
  padding: 10px 14px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-alta);
  font-size: 13px; font-weight: 500; color: var(--ink2); white-space: normal; }
.info-pop strong { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.info-pop p { margin: 3px 0; }
.info-pop b { font-weight: 700; color: var(--ink); }

/* ===================== Legibilidade: pesos, números e campos conforme o DESIGN.md =====================
   A regra "sem negrito no projeto" (peso 400 em tudo, com !important) deixava números e rótulos finos e
   contrariava o DESIGN.md (peso mínimo 500, totais 30px/800). Aqui a escala da seção 5 volta a valer em todas as
   telas. Fonte: a do sistema (system-ui), com números tabulares. Gráficos não mudam. */
:root {
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --titulo: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body, body *:not(h1, h2, h3, h4, h5, h6, th, .cab-aba, .cab-modulo, .marca-nome, .tabulator-col-title, .tabulator-col-title *) { font-weight: 500 !important; }
body { font-size: 14px; }

/* números: totais, mini-totais dos painéis, tabelas */
.kpi .v, .cp-kpi .v { font-family: var(--titulo); font-weight: 800 !important; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--ink); }
.kpi .v { font-size: clamp(19px, 5.4cqi, 30px); line-height: 1.15; }
.kpi .v.neg, .cp-kpi .v.neg { color: var(--neg); }
.kpi .v.perc-sobe { color: var(--ok); }
.kpi .v.perc-cai { color: var(--neg); }
.cp-kpi .v { font-size: 24px; }
.kpi .l, .cp-kpi .l { font-size: 13px; font-weight: 700 !important; color: var(--ink2); }
.kpi .sub { font-size: 12.5px; font-weight: 600 !important; color: var(--muted); }
.tabulator { font-size: 14px; }
.tabulator .tabulator-cell { font-variant-numeric: tabular-nums; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: 12.5px; font-weight: 700 !important; color: var(--ink2); }
#tabela .tabulator-row.lin-nivel1 .tabulator-cell, #tabela .tabulator-row.lin-resultado .tabulator-cell,
#tabela-ano .tabulator-row.lin-nivel1 .tabulator-cell, #tabela-ano .tabulator-row.lin-resultado .tabulator-cell,
#tabela .tabulator-row.tabulator-calcs .tabulator-cell, #tabela-ano .tabulator-row.tabulator-calcs .tabulator-cell,
table.tp td.tp-total, table.tp tr.tp-grupo td, table.tp tfoot td { font-weight: 700 !important; }
table.tp { font-size: 14px; }

/* títulos */
.cab-modulo { font-size: 13px; font-weight: 600 !important; }
.cab-aba { font-size: 30px; font-weight: 800 !important; letter-spacing: -.025em; }
.cartao h2, .cp-topo h3 { font-weight: 800 !important; letter-spacing: -.01em; }

/* campos e seletores: rótulo forte, contorno visível, alvo de 36px */
.campo { font-size: 13px; font-weight: 700 !important; color: var(--ink2); }
.campo select, .campo input, .seletor, .config-busca, #busca-filial {
  min-height: 36px; padding: 0 12px; font-size: 14px; font-weight: 600 !important; color: var(--ink);
  border: 1px solid var(--line-forte); border-radius: var(--r-ctrl); background-color: var(--surface); }
.campo select:hover, .campo input:hover, .seletor:hover, .config-busca:hover { border-color: var(--ink2); }
button { font-weight: 600 !important; }
button.primario { font-weight: 700 !important; }
.seg button[aria-pressed="true"], [role=tab][aria-selected="true"] { font-weight: 700 !important; }

/* menu */
.menu-modulo { font-weight: 600 !important; }
.menu-item.atual, .menu-grupo.atual > .menu-modulo { font-weight: 700 !important; }
.menu-rotina { font-weight: 600 !important; }

/* faixa do topo: com os pesos novos os filtros precisam de um pouco mais de largura */
@media (min-width: 1440px) { .faixa-topo { grid-template-columns: minmax(0, 2.4fr) minmax(0, 7.6fr); } }
@media (max-width: 1439px) { .faixa-topo { grid-template-columns: minmax(0, 1fr); } .faixa-topo .filtros { justify-content: flex-start; flex-wrap: wrap; } }
.faixa-topo .campo { font-size: 12px; font-weight: 600 !important; white-space: nowrap; }
.faixa-topo .campo select, .faixa-topo .campo input, .faixa-topo .seletor { font-size: 13px; padding: 0 6px; }
.faixa-topo .filtros { gap: 8px; }

/* ===================== Padronização Jarda Lab's =====================
   Tema da Jarda Lab's: fundo creme com brilhos azuis, Plus Jakarta Sans no texto, vidro no menu e nos blocos,
   logo da Jarda e azul cobalto como destaque. Os números ficam na fonte do sistema (bloco "Legibilidade"). */
:root {
  --bg: #f7f5f0; --surface: #ffffff; --sunk: rgb(42 86 214 / .06); --head: #edf1fb; --lado: #ffffff;
  --ink: #141414; --ink2: #2b2b2e; --muted: #6e6a62; --line: #dcd7cc; --line-forte: #c4bfb4; --icone: #8d8a83;
  --accent: #2a56d6; --accent-forte: #1f45c4; --accent-soft: #e6edfc; --accent-ink: #ffffff;
  --marca: #2a56d6; --marca-soft: #e6edfc; --marca-2: #6e6a62; --marca-verde: #1f9d55; --marca-laranja: #38bdf8;
  --foco: rgb(42 86 214 / .45);
  --s1: #2a56d6; --s2: #f2600c; --s3: #38bdf8; --s4: #1f9d55; --s5: #8d8a83;
  --r-bloco: 22px; --r-card: 18px; --r-ctrl: 10px;
  --cartao-sombra: 0 1px 2px rgb(0 0 0 / .05);
  --shadow-alta: 0 18px 40px -12px rgb(20 30 60 / .25), 0 0 0 .5px rgb(20 30 60 / .08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --titulo: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --numero: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-tema="escuro"] {
  --bg: #0b1020; --surface: #161c30; --sunk: rgb(125 155 255 / .08); --head: #1a2140; --lado: #161c30;
  --accent: #7d9bff; --accent-forte: #9db3ff; --accent-soft: rgb(125 155 255 / .14); --accent-ink: #0b1020;
  --marca: #7d9bff; --s1: #7d9bff; --s2: #ff9a5c; --s3: #7dd3fc; --s4: #4ade80;
}

/* fundo creme com brilhos azuis */
body { background: var(--bg); }

/* vidro: menu lateral, filtros, totais e blocos */
.filtros, .kpi, .cartao, .cp-cartao, .bp-bloco, .painel-filiais { border: 1px solid rgb(20 20 20 / .08) !important; box-shadow: var(--cartao-sombra); }
.lateral { background: #ffffff; border: 1px solid rgb(20 20 20 / .08) !important; box-shadow: var(--cartao-sombra); }
:root[data-tema="escuro"] .lateral { background: #161c30; }
:root[data-tema="escuro"] :is(.lateral, .filtros, .kpi, .cartao, .cp-cartao, .bp-bloco, .painel-filiais) { border-color: rgb(255 255 255 / .08) !important; }
/* sem pontinho decorativo antes do rótulo do total (U10) */
.kpi .l::before { display: none; }
.faixa-topo .filtros { backdrop-filter: none; -webkit-backdrop-filter: none; border: 0 !important; box-shadow: none; }
.lateral { background: var(--lado); border-radius: 22px; }
.faixa-marca { background: var(--accent); }
.tabulator, .tabulator-row, .tabulator-row.tabulator-row-even,
.tabulator .tabulator-header, .tabulator .tabulator-header .tabulator-col,
.tabulator .tabulator-tableholder .tabulator-table { background: transparent; }
.tabulator-row:hover { background: var(--sunk) !important; }

/* marca: logo da Jarda Lab's ao lado do nome do produto */
.marca { display: flex !important; align-items: center; gap: 10px; }
.marca-inicial { display: block !important; width: 26px; height: 26px; flex: none; font-size: 0; color: transparent;
  background: no-repeat center / contain url("/static/marca/monithor.svg"); }
:root[data-tema="escuro"] .marca-inicial { background-image: url("/static/marca/monithor-escuro.svg"); }
.marca-texto { display: grid !important; gap: 1px; }
.marca-nome { letter-spacing: -0.02em; }
.marca-nome b { color: var(--accent); }
.marca-emp { display: block !important; font-size: 0 !important; line-height: 1; }
.marca-emp::after { content: "por Jarda Lab's"; font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* destaques em cobalto */
.cab-aba { letter-spacing: -0.03em; }
button.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: none; border-radius: var(--r-ctrl); padding-inline: 16px; transition: background-color .15s ease-out; }
button.primario:hover { background: var(--accent-forte); border-color: var(--accent-forte); }
.menu-item.atual { background: var(--accent-soft); color: var(--accent); }
.menu-item.atual .menu-rotina, .menu-grupo.atual > .menu-modulo { color: var(--accent); }

/* números: fonte do sistema (como na Crítica de Despesas), por cima do tema */
.kpi .v, .cp-kpi .v, .tabulator .tabulator-cell, table.tp, .kpi .sub { font-family: var(--numero); }

/* faixa do topo: rótulos da Plus Jakarta são mais largos; mais espaço entre os filtros */
.faixa-topo .filtros { column-gap: 12px; }
.faixa-topo .campo { letter-spacing: -0.01em; min-width: max-content; }

/* ritmo dos blocos na escala de 4/8 (revisão unslop-ui): blocos irmãos com o mesmo respiro */
.kpi, .cartao, .cp-cartao { padding: 20px; }
.filtros { padding: 16px 20px; }
.pagina { padding: 24px 32px 48px 24px; }
@media (max-width: 900px) { .kpi { padding: 12px; } .cartao, .cp-cartao, .filtros { padding: 16px; } .pagina { padding: 16px 12px 32px; } }

/* efeitos leves: as telas já carregam muitos dados, então nada de desfoque nem animação de layout.
   Só cor, opacidade e transform, curtos (150ms). Gráficos ficam como estão. */
.lateral, .filtros, .kpi, .cartao, .cp-cartao, .bp-bloco, .painel-filiais { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.kpi { transition: none; }
.kpi:hover { transform: none; }
button { transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; }
.menu-seta { transition: transform .15s ease-out; }
.menu-grupo.aberto .menu-sub { animation: menu-abre .12s ease-out; }
@media (min-width: 901px) and (hover: hover) {
  .lateral { transition: width .15s ease-out, box-shadow .15s ease-out; }
  .lateral :is(.marca-texto, .menu-rotulo, .menu-modulo > span, .menu-config > span, .tema-sw, .usuario-nome) { transition: opacity .1s ease-out; }
}

/* todas as telas: sem a faixa de situação (selo + rotina + texto de conferência) e sem a linha de estado abaixo dos
   filtros; a linha de estado só aparece quando é um erro */
#faixa, #conferencia { display: none !important; }
#estado:not(.erro) { display: none; }
#estado.erro { overflow-wrap: anywhere; }
/* Contas a Pagar/Receber: "Ver por" (filial, grupo empresarial, tipo) acima do gráfico de filiais */
.cp-ver-por { display: flex !important; flex-direction: row; align-items: center; gap: 6px; justify-content: flex-end; margin-bottom: 4px; }
/* totais: número um pouco menor (era até 30px) */
.kpi .v { font-size: clamp(17px, 4.6cqi, 25px); }
.kpi .l { font-size: 12.5px; }
/* tabelas: um tamanho só de fonte em todas as células (valores, análises, contas), um pouco menor */
.tabulator .tabulator-row .tabulator-cell, .tabulator .tabulator-row .tabulator-cell.col-num,
.tabulator .tabulator-row .tabulator-cell.col-analise, #tabela .tabulator-row.lin-conta .tabulator-cell,
#tabela .tabulator-row.lin-conta .tabulator-cell.col-num { font-size: 13px !important; text-overflow: clip; }
/* campos pequenos dos cartões ("Até", "Ordenar por", "Ver por"): rótulo à esquerda do filtro, na mesma linha */
#conteudo .cartao-topo .campo-mini.trim-campo:not([hidden]), #conteudo .cartao-topo .campo-mini.ranking-ordem-campo, #conteudo .cp-ver-por {
  display: flex !important; flex-direction: row !important; align-items: center !important; gap: 6px; }
/* colunas de análise (AV/AH): margem interna menor, para ficarem estreitas sem cortar o número */
.tabulator .tabulator-row .tabulator-cell.col-analise { padding-left: 6px !important; padding-right: 8px !important; overflow: visible; text-overflow: clip; }
.tabulator .tabulator-col.col-analise .tabulator-col-content { padding-left: 6px !important; padding-right: 8px !important; }
/* totais pequenos dos cartões (Contas a Pagar/Receber, Contabilidade): rótulo e número menores */
#conteudo .cp-kpi .l { font-size: 11px !important; }
#conteudo .cp-kpi .v { font-size: 18px !important; line-height: 1.2; }
/* tabelas dos indicadores: título de coluna longo quebra em mais de uma linha, para a coluna ficar do tamanho do número */
#tabela .tabulator-col .tabulator-col-title, #tabela-ano .tabulator-col .tabulator-col-title { white-space: normal; overflow-wrap: normal; line-height: 1.2; }
/* Configurações › DRE: soltar no meio de um grupo (vira sublinha) e escolha do nível na fórmula */
.dre-arvore .drop-dentro { box-shadow: inset 0 0 0 2px var(--accent); background: var(--sunk); }
.dre-formula .dre-termo-nivel { order: -1; height: 20px; min-height: 20px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-ctrl); background: transparent; color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1; cursor: pointer; }
.dre-formula .dre-termo-nivel:hover { border-color: var(--ink2); }
/* fórmula da linha de resultado: termos um embaixo do outro, à medida que entram */
#dre-arvore .dre-formula { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 4px; }
/* fórmula: uma linha por termo — nível | escolha (a última linha é a do próximo termo) */
#dre-arvore .dre-termo-linha { display: grid; grid-template-columns: 78px auto; align-items: center; gap: 6px; }
#dre-arvore .dre-termo-tipo { height: 20px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-ctrl);
  color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 18px; box-sizing: border-box; white-space: nowrap; }
#dre-arvore .dre-termo-linha .dre-termo-nivel { width: 78px; order: 0; }
/* Configurações › Filtros Padrão */
.filtros-tabela { width: 100%; max-width: 720px; border-collapse: collapse; font-size: 13.5px; }
.filtros-tabela th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.filtros-tabela td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.filtros-tabela select { min-height: 30px; min-width: 180px; }
/* cabeçalho: Fornecedor e Produto são campos com busca (lista da base do cliente) */
.filtros .campo-item input { min-height: 36px; width: 200px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-forte); border-radius: var(--r-ctrl); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
#f-dep { max-width: 200px; }
/* totais numa linha só: uma coluna por card (tela larga); número menor quando há muitos cards */
@container (min-width: 700px) {
  #conteudo .kpis[data-n] { grid-template-columns: repeat(var(--n), minmax(0, 1fr)) !important; }
  #conteudo .kpis[data-n] .kpi .v { font-size: clamp(15px, calc(100cqi / var(--n) / 8.5), 25px) !important; }
  #conteudo .kpis[data-n] .kpi .sub { font-size: 11.5px; }
  #conteudo .kpis[data-n] .kpi { padding-left: 14px; padding-right: 10px; min-width: 0; }
  #conteudo .kpis[data-n] .kpi .l { white-space: normal; line-height: 1.2; }
}
/* tabelas: a coluna parada (frozen) tem fundo próprio, para o que rola por baixo não aparecer através dela */
.tabulator .tabulator-row { background-color: var(--surface); }
.tabulator .tabulator-row .tabulator-cell.tabulator-frozen { background-color: var(--surface); z-index: 11; }
.tabulator .tabulator-header .tabulator-col.tabulator-frozen { background-color: var(--surface); z-index: 12; }
#tabela .tabulator-row.lin-resultado .tabulator-cell.tabulator-frozen, #tabela-ano .tabulator-row.lin-resultado .tabulator-cell.tabulator-frozen { background-color: var(--accent-soft); }
.tabulator .tabulator-row.linha-destaque .tabulator-cell.tabulator-frozen { background-color: var(--head); }
.tabulator .tabulator-row:hover .tabulator-cell.tabulator-frozen { background-color: var(--sunk); }
/* colunas de % (AV, AHm, AHa): sem negrito, inclusive nas linhas de resultado e de total */
.tabulator .tabulator-row .tabulator-cell.col-analise, .tabulator .tabulator-row .tabulator-cell.col-analise *,
#tabela .tabulator-row .tabulator-cell.col-analise, #tabela .tabulator-row .tabulator-cell.col-analise *,
#tabela-ano .tabulator-row .tabulator-cell.col-analise, #tabela-ano .tabulator-row .tabulator-cell.col-analise * { font-weight: 400 !important; }
/* listas dentro dos cartões (Ordenar por, Ver por, Por, Até, Tipo, Mostrar): o mesmo formato pequeno do "Até" */
#conteudo .cartao-topo .campo-mini, #conteudo .cp-ver-por, #conteudo .cp-topo .campo-mini { font-size: 11px !important; font-weight: 500; color: var(--muted); gap: 6px; }
#conteudo .cartao-topo .campo-mini select, #conteudo .cartao-topo select.ranking-ordem, #conteudo .cp-ver-por select, #conteudo .cp-topo select {
  min-height: 24px !important; height: 24px !important; padding: 0 6px !important; font-size: 12px !important; font-weight: 600;
  border-radius: 6px !important; min-width: 0; width: auto; }
/* cabeçalho: Competência com vários meses (botão + lista de meses, como o de Filiais) */
.campo-meses { position: relative; }
.campo-meses .seletor { min-width: 130px; }
.painel-meses { width: 230px !important; }
.lista-meses { max-height: none; gap: 0 !important; }
.lista-meses .item-filial { min-height: 24px !important; height: 24px; padding: 0 8px !important; font-size: 12.5px; }
.lista-meses .item-filial input { width: 14px; height: 14px; margin: 0 6px 0 0; }
.lista-meses .item-todas { border-bottom: 1px solid var(--line); margin-bottom: 2px; font-weight: 600; }
.painel-meses { padding: 6px !important; width: 170px !important; }
/* sem botão Consultar: cada filtro já consulta ao mudar */
#b-consultar { display: none !important; }
/* cabeçalho: lista de Filiais no mesmo padrão compacto da Competência (aplica ao marcar) */
.painel-slim { padding: 6px !important; width: 280px !important; }
.painel-slim #busca-filial { min-height: 28px; height: 28px; font-size: 12.5px; padding: 0 8px; margin-bottom: 4px; }
.painel-slim .lista-filiais { gap: 0 !important; max-height: 360px; overflow-y: auto; }
.painel-slim .item-filial { min-height: 24px !important; height: 24px; padding: 0 8px !important; font-size: 12.5px; gap: 6px; }
.painel-slim .item-filial input { width: 14px; height: 14px; margin: 0; }
.painel-slim .item-filial .cod { display: none; }  /* sem o código: o nome reduzido já identifica a filial */
.painel-slim .item-todas { border-bottom: 1px solid var(--line); margin-bottom: 2px; font-weight: 600; }
/* Contas a Pagar › gráfico de filiais: "Ver por" na faixa do título; Qtd/Valor por cima do gráfico (canto superior direito) */
.cp-cartao.kpis-sobre { position: relative; }
.cp-cartao.kpis-sobre .cp-topo { flex-wrap: nowrap; align-items: center; }
.cp-cartao.kpis-sobre .cp-topo .cp-ver-por { margin: 0 0 0 auto !important; justify-content: flex-end; width: auto; }
.cp-cartao.kpis-sobre .cp-topo > .cp-kpis { position: absolute; top: 64px; right: 18px; z-index: 2; }
/* controle segmentado pequeno (Ordenar por Valor/Índice nos rankings): mesmo visual do Quantidade/Valor, na altura das listas dos cartões */
#conteudo .seg.seg-mini { padding: 2px; height: 24px; align-items: center; margin-left: auto; }
#conteudo .seg.seg-mini button { min-height: 20px; height: 20px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
/* ---------- telas estreitas ---------- */
@media (max-width: 900px) {
  .pagina { padding: 14px 12px 32px; }
  /* filtros em duas colunas iguais; filial, estado e botão ocupam a linha inteira */
  .filtros { display: grid; grid-template-columns: 1fr 1fr; }
  .filtros > * { min-width: 0; }
  .filtros .campo select, .filtros .campo input { width: 100%; }
  .filtros .campo-filial, .filtros .estado, .filtros .acoes, .filtros > button { grid-column: 1 / -1; }
  .filtros button.primario { width: 100%; }
  /* abas que não cabem: rolam de lado, com a borda direita esmaecida indicando que há mais */
  .config-abas { max-width: 100%; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); scrollbar-width: none; }
  .config-abas::-webkit-scrollbar { display: none; }
  .kpis { gap: 10px; }
  .kpi { padding: 10px 12px; }
  .filtros, .cartao { padding: 14px; border-radius: 16px; }
  .faixa-topo .filtros { padding: 0; }
  .lateral { top: 0; left: 0; border-radius: 0 0 16px 16px; padding: 8px 12px; }
  .lateral-topo { padding: 2px 0; }
  .b-menu { min-height: 34px; }
  .tema, .menu-rotulo, .lateral-rodape { display: none; }
  .menu-aberto .tema { display: flex; }
  .menu-aberto .menu-rotulo { display: block; }
  .menu-aberto .lateral-rodape { display: flex; }
  .pagina { padding: 18px 16px 40px; }
  .cab-aba { font-size: 24px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 2px 8px 2px 12px; }
  .grafico { height: 260px; }
  .acoes { flex-basis: 100%; }
}

/* ---------- Financeiro › Contas a Pagar (painel com sub-abas) ---------- */
.painel-cp { display: grid; gap: 16px; min-width: 0; }
/* sub-abas: o mesmo controle segmentado das abas de indicador (.config-abas.painel-abas), que quebra linha em tela larga */
.subabas [role=tab] { white-space: nowrap; }
.cp-conteudo { display: grid; gap: 16px; min-width: 0; }
.cp-grade { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.cp-cartao { background: var(--surface); border: 0; border-radius: var(--r-bloco); box-shadow: var(--cartao-sombra);
  padding: 18px 20px 14px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.cp-topo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
.cp-topo h3 { margin: 0; font-family: var(--titulo); font-size: 19px; font-weight: 800; color: var(--ink); }
.cp-sub { margin: 2px 0 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.cp-kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-kpi { display: grid; gap: 0; min-width: 120px; padding: 6px 14px; background: var(--sunk); border: 0; border-radius: var(--r-ctrl); }
.cp-kpi .l { font-size: 12px; font-weight: 700; color: var(--muted); }
.cp-kpi .v { font-family: var(--titulo); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.25; color: var(--ink); }
.cp-grafico { width: 100%; height: 300px; }
.cp-rolagem { max-height: 520px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.cp-rolagem .cp-grafico { height: auto; }
.cp-nota { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: 8px 12px; }
.cp-vazio { margin: 0; padding: 40px 12px; text-align: center; color: var(--muted); font-size: .92rem; }
/* seletor de medida/visão: mesmo controle segmentado das abas (.config-abas) */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--fill); border-radius: 10px; padding: 2px; gap: 0; }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.seg button:hover { background: none; color: var(--ink); border: 0; }
.seg button[aria-pressed="true"] { background: var(--thumb); color: var(--ink); font-weight: 700; box-shadow: 0 2px 6px rgb(0 0 0 / .12), 0 0 0 .5px rgb(0 0 0 / .04); }
@media (max-width: 640px) {
  .cp-cartao { padding: 12px; }
  .cp-kpi { min-width: 0; flex: 1; }
  .cp-grafico { height: 260px; }
}

/* Tabela de Pagamentos (grupo → filial): cabeçalho e totais em cinza, como as outras tabelas (DESIGN.md) */
.tp-rolagem { overflow: auto; max-height: 640px; border: 0; border-radius: 0; }
table.tp { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
table.tp th, table.tp td { padding: 5px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.tp thead th { position: sticky; background: var(--head); color: var(--ink); font-size: 12.5px; font-weight: 700; text-align: center; z-index: 2;
  border-right: 1px solid var(--line); }
table.tp thead tr:first-child th { top: 0; font-size: .95rem; }
table.tp thead tr:nth-child(2) th { top: 31px; font-size: .78rem; white-space: normal; min-width: 76px; }
table.tp th.tp-col1 { left: 0; z-index: 3; min-width: 230px; }
table.tp td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.tp td.num { text-align: right; }
table.tp td.tp-total { background: var(--sunk); font-weight: 700; }
table.tp td:nth-child(5), table.tp td:nth-child(9) { border-right: 1px solid var(--line-forte); }
table.tp tr.tp-grupo td { font-weight: 700; padding-top: 12px; }
table.tp tr.tp-filial td:first-child { padding-left: 34px; color: var(--muted); }
table.tp tfoot td { position: sticky; bottom: 0; font-weight: 800; background: var(--head); border-top: 1px solid var(--line-forte); border-bottom: 0; }
table.tp tfoot td:first-child { z-index: 2; }
table.tp tbody tr:hover td { background: var(--sunk); }
.tp-abrir { min-height: 0; width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; vertical-align: -1px; }
.tp-abrir:hover { color: var(--ink); border: 0; background: none; }

/* Contas a Receber: indicadores que aguardam dados */
.cp-pendente { display: grid; gap: 6px; align-content: center; min-height: 160px; padding: 16px; border: 1px dashed var(--line);
  border-radius: 8px; background: var(--sunk); }
.cp-pendente p { margin: 0; font-size: .85rem; color: var(--muted); }
.cp-selo-pend { justify-self: start; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--warn-soft); color: var(--warn); border-radius: var(--r-ctrl); padding: 2px 10px; }
.cp-cartao .cp-pendente + .cp-grafico { margin-top: 4px; }

/* Contabilidade */
.ct-peso { display: inline-block; margin-left: 6px; font-family: var(--font); font-size: 12px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line-forte); border-radius: 99px; padding: 0 8px; vertical-align: 3px; }
.ct-pesos { display: flex; gap: 3px; border-radius: 8px; overflow: hidden; min-height: 54px; }
.ct-pesos > div { display: grid; align-content: center; gap: 1px; padding: 6px 10px; background: var(--sunk); border-top: 4px solid var(--s1); color: var(--ink); min-width: 0; }
.ct-pesos b { font-size: 1.05rem; }
.ct-pesos span { font-size: 12px; font-weight: 600; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-ir { justify-self: start; margin-top: 4px; }
.ct-def dl { margin: 0; display: grid; grid-template-columns: minmax(150px, 240px) 1fr; gap: 10px 18px; font-size: .9rem; }
.ct-def dt { font-weight: 700; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.ct-def dd { margin: 0; }
.ct-def ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) { .ct-def dl { grid-template-columns: 1fr; gap: 4px; } .ct-def dd { margin-bottom: 8px; } }

/* ===================== Padronização geral: uma escala de tipo para todas as telas =====================
   Fica no fim do arquivo de propósito: vale também sobre os blocos de cada módulo (Contas a Pagar/Receber, Contabilidade).
   Escala: 11 selos · 12 rótulos e textos de apoio · 13 corpo, botões e abas · 14 tabelas e menu · 16 título de bloco · 30 título da página.
   Totais sempre na fonte do sistema. Nada aqui mexe em gráfico, cálculo ou consulta. */
:root { --t-selo: 11px; --t-apoio: 12px; --t-corpo: 13px; --t-tabela: 14px; --t-bloco: 16px; --t-pagina: 30px; }

/* título de bloco igual em todas as telas (era 16px nos gráficos e 19px em Contas a Pagar/Receber e Contabilidade) */
.cartao-topo h2, .cp-topo h3 { font-family: var(--titulo); font-size: var(--t-bloco); font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; color: var(--ink); }

/* textos de apoio, selos e avisos: tamanhos da escala (antes .7rem, .85rem, 12.5px...) */
.cp-sub, .estado, .filtros .estado, .cp-nota, .titulo-sub { font-size: var(--t-apoio); }
.cp-pendente p, .cp-vazio { font-size: var(--t-corpo); }
.menu-rotulo, .cp-selo-pend, .selo { font-size: var(--t-selo); }

/* totais: sempre na fonte do sistema (Contas a Pagar/Receber e Contabilidade usavam a do texto) */
.kpi .v, .cp-kpi .v { font-family: var(--numero); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cp-kpi .v { font-size: 22px; }
/* o total grande acompanha a largura do próprio bloco e não estoura a borda (ex.: 12.756.728,03) */
.kpi { container-type: inline-size; }
.kpi .v { font-size: clamp(17px, 12.5cqi, 30px); white-space: nowrap; }
/* rótulo de duas linhas não desalinha o valor: o número fica sempre no pé do bloco */
.kpi { display: grid; align-content: space-between; }

/* menu: nome longo corta com reticências e o número da rotina fica sempre visível */
.menu-item > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .menu-rotina { flex: none; font-size: var(--t-selo); }

/* Tabela de Pagamentos e Contabilidade na mesma escala das outras tabelas */
table.tp { font-size: var(--t-tabela); }
table.tp thead th, table.tp thead tr:nth-child(2) th { font-size: var(--t-apoio); }
table.tp thead tr:first-child th { font-size: var(--t-corpo); }
.ct-def dl { font-size: var(--t-corpo); }
.ct-def dt { font-size: var(--t-selo); }
.ct-pesos b { font-size: var(--t-bloco); font-family: var(--numero); }

/* ===================== Correções de layout (conferidas em 1920, 1536, 1366 e 375px) ===================== */
/* status da consulta ("502 títulos pagos · dados carregados em…"): linha própria abaixo dos filtros,
   sem ficar por cima do bloco seguinte */
.faixa-topo .filtros { flex-wrap: wrap; row-gap: 6px; }
.faixa-topo .filtros .estado { position: static; flex: 1 0 100%; text-align: right; white-space: normal; margin: 0; }
.faixa-topo { margin-bottom: 4px; }

/* abas de painel e sub-abas: sempre numa linha só. Cabem inteiras em tela de notebook (1536px);
   se faltar espaço, a própria barra rola de lado (a página não), com a borda direita esmaecida */
.painel-abas, .subabas { flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; max-width: 100%;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.painel-abas::-webkit-scrollbar, .subabas::-webkit-scrollbar { display: none; }
.painel-abas > *, .subabas > * { flex: none; white-space: nowrap; }
.painel-abas [role=tab], .subabas [role=tab], .painel-abas button, .subabas button { padding-inline: 8px; font-weight: 500; }
.painel-abas [aria-selected="true"], .subabas [aria-selected="true"] { font-weight: 700; }
.painel-abas.transborda, .subabas.transborda { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.painel-abas.rolada, .subabas.rolada { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px); mask-image: linear-gradient(90deg, transparent, #000 48px); }
.painel-abas.rolada.transborda, .subabas.rolada.transborda { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent); }

/* menu lateral: o anel de foco fica dentro do item (antes saía pela borda do menu) e só aparece no teclado */
.lateral :is(.menu-modulo, .menu-item, .menu-config):focus { outline: none; }
.lateral :is(.menu-modulo, .menu-item, .menu-config):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-item { padding-right: 12px; }
/* a lista de análises é um grid: sem isto cada item cresce até o tamanho do texto e passa da borda do menu */
.menu-sub { grid-template-columns: minmax(0, 1fr); }
.menu-sub > li { min-width: 0; }
/* menu aberto um pouco mais largo (232 → 248px): os nomes das análises cabem inteiros com o número da rotina ao lado */
@media (min-width: 901px) and (hover: hover) { :root { --lat-aberto: 248px; } }
.menu-sub .menu-item { gap: 8px; }
/* nome que ainda não couber quebra em duas linhas, inteiro (sem reticências) */
.menu-sub .menu-item { white-space: normal; height: auto; min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
.menu-sub .menu-item > span:first-child { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
