/* ============================================================================
   DrK Gestão — Design System
   ERP corporativo claro e denso. Paleta Azul Petróleo.
   ========================================================================== */

:root {
    /* Marca / cores */
    --petroleo: #0E6E78;
    --petroleo-700: #0A565E;
    --petroleo-600: #0C616B;
    --petroleo-100: #D6EAEC;
    --petroleo-50: #EAF4F5;

    --verde: #0E9F6E;
    --verde-700: #047857;
    --verde-50: #E7F6EF;

    --vermelho: #DC2626;
    --vermelho-50: #FDECEC;

    --ambar: #B45309;
    --ambar-50: #FDF4E7;

    /* Cobre — acento cerimonial da marca (cessão/fundo, destaques); nunca semântica de estado */
    --cobre: #B8641F;
    --cobre-50: #F7ECE0;

    /* Séries de gráfico (par da casa, VALIDADO p/ daltonismo e contraste nos dois temas):
       1 = petróleo vivo (entradas/principal), 2 = cobre (saídas/segunda série). */
    --chart-1: #00919F;
    --chart-2: #B8641F;

    /* Tinta / superfícies — cinzas com viés petróleo (DNA da marca), não azul neutro */
    --ink: #13242B;
    --ink-2: #475B63;
    --ink-3: #7C8F96;
    --bg: #FFFFFF;
    --surface: #F4F7F7;
    --surface-2: #EDF2F2;
    --border: #DCE5E6;
    --border-2: #E9EFEF;

    /* Forma */
    --r-sm: 6px;
    --r: 8px;
    --r-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);

    /* Densidade (ERP) */
    --topbar-h: 56px;
    --sidebar-w: 240px;
    --row-h: 38px;

    --font: 'Hanken Grotesk', -apple-system, system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'Spline Sans Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
    --display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;

    /* Trilho (marca + sidebar): petróleo profundo, constante nos dois temas — é a identidade do app */
    --rail: #0B2F35;
    --rail-2: #10404A;
    --rail-line: #1B4A53;
    --rail-ink: #CBDEE1;
    --rail-ink-2: #7FA6AC;
    --rail-accent: #3BC8D6;
}

/* ===== Tema escuro ===== Sobrepõe só os tokens — o resto da folha herda. As tintas -50
   viram fundos escuros e os tons -700/cores ganham brilho para contraste nos badges. */
[data-theme="dark"] {
    color-scheme: dark;

    --petroleo: #1AA6B4;
    --petroleo-700: #41CEDB;   /* texto/realce: badges, sidebar ativo, abas */
    --petroleo-600: #1AA6B4;
    --petroleo-100: #1E4751;   /* bordas suaves */
    --petroleo-50: #15323A;    /* fundo suave: selecionado/hover/badge/síntese */

    --verde: #2BD27A;
    --verde-700: #34D399;
    --verde-50: #14302A;

    --vermelho: #F77272;
    --vermelho-50: #3A2220;

    --ambar: #F0A93C;
    --ambar-50: #352B19;

    --cobre: #E09A55;
    --cobre-50: #33261A;

    --chart-1: #1D96A6;
    --chart-2: #C87E37;

    /* Escuro re-derivado com viés PETRÓLEO (era azul de fábrica #121A27) — o app inteiro
       passa a ser da mesma família do trilho da marca. */
    --ink: #E3EDEE;
    --ink-2: #A3B9BD;
    --ink-3: #6C8388;
    --bg: #0E191C;
    --surface: #132327;
    --surface-2: #182A2F;
    --border: #24393F;
    --border-2: #1C3034;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
}

[data-theme="dark"] #blazor-error-ui { background: #4A3A12; color: #F4E5B8; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--petroleo); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
h1 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; }

/* Números: monoespaçados, tabulares, alinhados à direita ----------------------*/
.num, .money, td.num, th.num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
    letter-spacing: -.02em;
}
.val-pos { color: var(--verde-700); }
.val-neg { color: var(--vermelho); }
.muted { color: var(--ink-3); }

/* ============================================================================
   Estrutura: sidebar + topbar + conteúdo
   ========================================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "brand topbar" "sidebar content";
    height: 100vh;
    overflow: hidden;
}

/* Marca (canto superior esquerdo) — mora no trilho petróleo */
.brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--rail);
    border-right: 1px solid var(--rail-line);
    border-bottom: 1px solid var(--rail-line);
}
.brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.brand .b-name { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1; color: #fff; }
.brand .b-sub { font-size: 11px; color: var(--rail-accent); font-weight: 600; letter-spacing: .02em; }

/* Topbar */
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.topbar .search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0 10px; height: 34px;
    color: var(--ink-3); min-width: 240px;
    font-size: 13px; cursor: pointer; text-align: left;
}
.topbar .search:hover { border-color: var(--petroleo); color: var(--ink-2); }
.topbar .search span { flex: 1; }
.topbar .search kbd { margin-left: auto; }

kbd {
    font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
    background: var(--bg); border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 4px; padding: 1px 5px; line-height: 1.4; white-space: nowrap;
}
.topbar .spacer { flex: 1; }

.selector {
    display: flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: var(--r);
    background: var(--bg); color: var(--ink-2);
}
.selector i { color: var(--petroleo); }
.selector select { border: 0; background: transparent; outline: none; font-size: 13px; color: var(--ink); font-weight: 600; cursor: pointer; }

/* Popup nativo dos selects: sem fundo/cor explícitos nas <option>, o Chromium/Windows
   renderiza o popup branco com o texto herdado do tema (invisível no claro sobre transparente
   e no escuro sobre branco). Vale para todos os selects do app. */
select option { background: var(--bg); color: var(--ink); }

.user-chip { display: flex; align-items: center; gap: 8px; padding: 0 6px; color: var(--ink-2); font-weight: 600; }
.user-chip i { font-size: 20px; color: var(--petroleo); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r);
    border: 1px solid var(--border); background: var(--bg); color: var(--ink-2);
    cursor: pointer; transition: .12s; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

/* Sidebar (módulos) — trilho petróleo profundo, constante nos dois temas */
.sidebar {
    grid-area: sidebar;
    background: var(--rail);
    border-right: 1px solid var(--rail-line);
    overflow-y: auto;
    padding: 10px 10px 24px;
}
.sidebar { scrollbar-color: var(--rail-line) transparent; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group > .g-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .09em; color: var(--rail-ink-2);
    padding: 5px 10px;
}
.g-label .g-ico { font-size: 12px; margin-right: 7px; color: var(--rail-ink-2); opacity: .85; vertical-align: -1px; }
.nav-group.is-ativo > .g-label { color: var(--rail-ink); }
.nav-group.is-ativo > .g-label .g-ico { color: var(--rail-accent); opacity: 1; }
/* Subseção dentro de um módulo longo (Receber / Pagar / Caixa…): rótulo mínimo, sem caixa */
.nav-sub { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--rail-ink-2); opacity: .7; padding: 9px 12px 3px; }
.g-label + .nav-sub { padding-top: 2px; }
html.menu-collapsed .nav-sub { display: none; }
html.menu-collapsed .g-label .g-ico { display: none; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: 1px 0;
    border-radius: var(--r-sm);
    color: var(--rail-ink); font-weight: 550; font-size: 13px;
    border-left: 3px solid transparent;
    cursor: pointer; transition: .12s; text-decoration: none;
}
.nav-link i { font-size: 16px; width: 18px; text-align: center; color: var(--rail-ink-2); }
.nav-link:hover { background: var(--rail-2); color: #fff; text-decoration: none; }
.nav-link:hover i { color: var(--rail-ink); }
.nav-link.active {
    background: var(--rail-2);
    color: #fff;
    border-left-color: var(--rail-accent);
    font-weight: 700;
}
.nav-link.active i { color: var(--rail-accent); }

/* Grupos recolhíveis (accordion) */
.g-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; background: none; border: 0; cursor: pointer;
    text-align: left; font: inherit; margin-bottom: 1px;
}
.g-toggle:hover { color: var(--rail-ink); }
.g-toggle > i { font-size: 10px; color: var(--rail-ink-2); transition: .12s; }
.nav-group.is-recolhido .nav-item-row { display: none; }
.nav-group.is-recolhido .nav-sub { display: none; }
/* No modo só-ícone os rótulos somem; mostre todos os ícones independentemente do recolhimento. */
html.menu-collapsed .nav-group.is-recolhido .nav-item-row { display: block; }

/* Linha de item com estrela de favoritar */
.nav-item-row { position: relative; }
.nav-item-row .nav-link { padding-right: 28px; }
.nav-star {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--rail-ink-2);
    padding: 3px 4px; border-radius: 4px; cursor: pointer;
    font-size: 11.5px; line-height: 1; opacity: 0;
    transition: opacity .12s, color .12s, background .12s;
}
.nav-item-row:hover .nav-star { opacity: .5; }
.nav-star:hover { opacity: 1; color: var(--ambar); background: var(--rail-2); }
.nav-star.on { opacity: 1; color: var(--ambar); }

/* Seções Favoritos / Recentes */
.nav-quick > .g-label { display: flex; align-items: center; gap: 6px; cursor: default; }
.nav-quick > .g-label .bi-star-fill { color: var(--ambar); }
.nav-quick > .g-toggle { cursor: pointer; justify-content: space-between; }
.nav-quick > .g-toggle > span { display: inline-flex; align-items: center; gap: 6px; }
html.menu-collapsed .nav-star { display: none; }
html.menu-collapsed .nav-item-row .nav-link { padding-right: 0; }
html.menu-collapsed .nav-quick { display: none; }

/* Anexos (títulos / notas) */
.anexos { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-2); }
.anexos-head { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.anexo-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.anexo-list li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm); }
.anexo-ico { color: var(--ink-3); font-size: 15px; }
.anexo-nome { flex: 1; color: var(--petroleo-700); font-size: 12.5px; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anexo-nome:hover { text-decoration: underline; }
.anexo-meta { font-size: 11px; white-space: nowrap; }
.anexo-del { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 2px 5px; border-radius: 4px; line-height: 1; }
.anexo-del:hover { color: var(--vermelho); background: var(--vermelho-50); }
.anexo-add { cursor: pointer; }

/* Conteúdo */
.content { grid-area: content; overflow-y: auto; padding: 16px 20px 40px; }

/* ============================================================================
   Trilha (breadcrumb) + título de página + abas
   ========================================================================== */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.crumbs .sep { opacity: .5; }
.crumbs b { color: var(--ink-2); font-weight: 600; }

.page-head, .p-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 14px; }
.page-head h1, .p-head h1 { font-size: 22px; font-optical-sizing: auto; letter-spacing: -.02em; }
.page-head .sub, .p-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; max-width: 860px; }

/* ============================================================================
   Contrato de página (piloto: Receber/Pagar/Antecipação)
   Cabeçalho em 1 linha com as ações à direita · indicadores em FAIXA compacta
   (não cards altos) · filtros em chips numa linha — a grade herda a altura.
   ========================================================================== */
.p-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 10px; margin-bottom: 12px; }
.st { padding-right: 22px; margin-right: 22px; border-right: 1px solid var(--border); }
.st:last-child { border-right: none; margin-right: 0; }
.st .l { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.st .v { font-family: var(--mono); font-weight: 600; font-size: 19px; margin-top: 1px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.st .d { font-size: 11.5px; color: var(--ink-3); }
.st.neg .v { color: var(--vermelho); }
.st.cob .v { color: var(--cobre); }
.fbar { display: flex; align-items: center; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.fchip { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.fchip:hover { background: var(--surface-2); }
.fchip.on { background: var(--petroleo-50); border-color: var(--petroleo); color: var(--petroleo-700); }
/* Ações de seleção: aparecem na linha de filtros só quando há linhas marcadas */
.selbar { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); background: var(--petroleo-50); border: 1px solid var(--petroleo-100); border-radius: 999px; padding: 3px 6px 3px 12px; }

/* Abas: mesma família visual dos .fchip (Régua, Contábil, Crédito) — o sistema tinha duas
   linguagens de aba (sublinhada no Comercial/Conciliação, chip nas telas novas). */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
    appearance: none; font-family: var(--font); border: 1px solid var(--border); background: var(--bg);
    border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2);
    cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.tab.active { background: var(--petroleo-50); border-color: var(--petroleo); color: var(--petroleo-700); }

/* ============================================================================
   Cartões / KPIs
   ========================================================================== */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.card-head h3 { font-size: 13.5px; font-weight: 700; }

/* KPIs = FAIXA compacta em todo o app (formato aprovado no Receber/Pagar): sem card alto,
   itens separados por filete, rótulo alto, valor mono. Mesmo DOM antigo (.kpi/.k-label/
   .k-value/.k-foot) — as 20 telas mudam por CSS, sem tocar em markup. */
.kpis { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 10px; margin-bottom: 14px; }
.kpi { padding: 0 22px 0 0; margin-right: 22px; border-right: 1px solid var(--border); position: relative; }
.kpi:last-child { border-right: none; margin-right: 0; }
.kpi .k-label { font-size: 10.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; display: flex; align-items: center; gap: 6px; }
.kpi .k-label i { display: none; }   /* os ícones eram decoração de card; na faixa viram ruído */
.kpi .k-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin-top: 1px; color: var(--ink); white-space: nowrap; }
.kpi .k-foot { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.kpi.is-neg .k-value { color: var(--vermelho); }
.kpi.is-pos .k-value { color: var(--verde-700); }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
/* Filho de grid tem min-width:auto por padrão e NÃO encolhe abaixo do próprio conteúdo — em tela
   menor o card da direita saía da tela (Cockpit "posição"). min-width:0 deixa a coluna encolher. */
.grid-2 > * { min-width: 0; }

/* ============================================================================
   Barra de ações (toolbar)
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 0; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 13px;
    border-radius: var(--r); border: 1px solid var(--border);
    background: var(--bg); color: var(--ink-2);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: .12s; white-space: nowrap; text-decoration: none;
}
.btn i { font-size: 15px; }
.btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.btn-primary:hover { background: var(--petroleo-700); color: #fff; }
.btn-success { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-success:hover { background: var(--verde-700); color: #fff; }
.btn-danger { color: var(--vermelho); border-color: var(--border); }
.btn-danger:hover { background: var(--vermelho-50); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }

/* ============================================================================
   Grade de dados (densa)
   ========================================================================== */
/* overflow AUTO (não hidden): em tela estreita a grade rola na horizontal em vez de espremer
   as colunas até o texto quebrar — a linha nunca engorda. */
.grid-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: auto; box-shadow: var(--shadow-sm); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid thead th {
    background: var(--surface-2);
    text-align: left; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
    color: var(--ink-2); padding: 9px 12px;
    border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.grid thead th.num { text-align: right; }
/* Célula = SEMPRE uma linha: sem quebra de texto (que engordava a linha e desalinhava a grade);
   texto maior que o teto trunca com reticências — o inteiro está no title/ficha, e a alça de
   redimensionar coluna segue disponível. --row-h vira altura exata de novo. */
table.grid tbody td { padding: 0 12px; height: var(--row-h); border-bottom: 1px solid var(--border-2); color: var(--ink); vertical-align: middle; white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }

/* Tabelas de EDIÇÃO (células com .input/select): layout fixo — as colunas seguem as larguras
   declaradas nos cabeçalhos e os campos preenchem a célula. Sem isso, a largura intrínseca dos
   inputs/selects engorda a tabela além do contêiner e as últimas colunas (Valor, remover)
   somem atrás de uma rolagem horizontal que ninguém percebe. */
table.grid:has(tbody .input) { table-layout: fixed; }
/* SÓ filho direto do td: o DataInput tem DOIS inputs dentro de um wrapper (.dt-wrap) e o
   width:100% nos dois colapsava o campo de data (bug na ficha da NF). Select/MoedaBox
   ficam direto no td e continuam preenchendo a célula. */
table.grid tbody td > .input { width: 100%; min-width: 0; max-width: 100%; }

/* Colunas FIXAS nas grades roláveis: o identificador (esquerda) e as ações (direita) seguem
   visíveis quando a grade rola na horizontal — sem "puxar a barra" p/ enxergar a linha ou
   usar os botões. Fundo sólido (senão o conteúdo passa por baixo) + hover acompanhando. */
table.grid th.col-fix-l, table.grid td.col-fix-l { position: sticky; left: 0; z-index: 2; background: var(--bg); box-shadow: 1px 0 0 var(--border-2); }
table.grid th.col-fix-r, table.grid td.col-fix-r { position: sticky; right: 0; z-index: 2; background: var(--bg); box-shadow: -1px 0 0 var(--border-2); }
table.grid thead th.col-fix-l, table.grid thead th.col-fix-r { background: var(--surface-2); z-index: 3; }
table.grid tbody tr:hover td.col-fix-l, table.grid tbody tr:hover td.col-fix-r { background: var(--petroleo-50); }

/* Densidade adaptativa: em resoluções menores, menos respiro e fonte um ponto menor — as mesmas
   colunas cabem na horizontal sem rolagem na maioria das telas. */
@media (max-width: 1680px) {
    table.grid { font-size: 12.5px; }
    table.grid thead th, table.grid tbody td { padding-left: 7px; padding-right: 7px; }
    table.grid tbody td { max-width: 260px; }
}
@media (max-width: 1400px) {
    table.grid { font-size: 12px; }
    table.grid thead th { font-size: 11px; }
    table.grid thead th, table.grid tbody td { padding-left: 6px; padding-right: 6px; }
    table.grid tbody td { max-width: 188px; }
    /* Botões de ação da linha mais compactos — eram eles que empurravam a grade p/ fora por ~15px.
       (!important porque .sq-28 fixa o tamanho com !important.) */
    .row-actions { gap: 3px; }
    .row-actions .sq-28 { width: 26px !important; height: 26px !important; }
}
table.grid tbody tr:hover { background: var(--petroleo-50); }
table.grid tbody tr.sel { background: var(--petroleo-100); }
table.grid .col-check { width: 36px; text-align: center; }
table.grid tfoot td { padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); font-weight: 700; }
.cell-strong { font-weight: 650; }
.row-actions { display: flex; gap: 4px; opacity: 0; transition: .1s; }
table.grid tbody tr:hover .row-actions { opacity: 1; }

/* Badges de situação */
/* ===== Skeleton loaders (shimmer) ===== */
.sk {
    position: relative; overflow: hidden;
    background: var(--surface-2); border-radius: 6px;
}
.sk::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    animation: sk-shimmer 1.3s infinite;
}
[data-theme="dark"] .sk::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
.sk-row { display: flex; gap: 14px; align-items: center; padding: 9px 0; }
.sk-row + .sk-row { border-top: 1px solid var(--border-2); }
.sk-row .sk:first-child { margin-right: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-aberto { background: var(--petroleo-50); color: var(--petroleo-700); }
.badge-baixado { background: var(--verde-50); color: var(--verde-700); }
.badge-parcial { background: var(--ambar-50); color: var(--ambar); }
.badge-atraso { background: var(--vermelho-50); color: var(--vermelho); }
/* Cessão a fundo = COBRE (acento da marca): distingue "está com o fundo" de estado do título */
.badge-cedido { background: var(--cobre-50); color: var(--cobre); }
.badge-cancelado { background: var(--surface-2); color: var(--ink-3); }

/* Paginação */
/* flex-wrap de segurança: fileira comprida de páginas quebra linha em vez de vazar da tela. */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pager .pg { min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); color: var(--ink-2); cursor: pointer; font-size: 12px; }
.pager .pg.active { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
/* extremos sem para onde ir e reticências: visíveis, mas sem cara de botão */
.pager .pg.off { opacity: .45; cursor: default; }

/* ============================================================================
   Formulários
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, .field input, .field select, .field textarea {
    height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--r);
    background: var(--bg); font-size: 13.5px; font-family: var(--font); color: var(--ink); outline: none; transition: .12s;
}
.field textarea { height: auto; padding: 9px 11px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--petroleo); box-shadow: 0 0 0 3px var(--petroleo-50); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================================
   Login
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--rail); padding: 20px; }

/* ---- Login: painel de marca (trilho) + formulário ---- */
.login-split { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-hero {
    background: var(--rail);
    display: grid; place-items: center;
    padding: 44px 56px;
    border-right: 1px solid var(--rail-line);
    position: relative; overflow: hidden;
}
/* Rosa-dos-ventos em silêncio: anéis concêntricos quase invisíveis e UM arco de cobre
   (o leme) que se fecha no load. Nada de gradiente roxo, nada de ilustração genérica. */
.login-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 50% 46%, rgba(26, 166, 180, .14), transparent 42%),
        repeating-radial-gradient(circle at 50% 46%, transparent 0 92px, rgba(255, 255, 255, .035) 92px 93px);
}
.login-hero::after {
    content: ""; position: absolute; left: 50%; top: 46%; width: min(78vh, 680px); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
    border: 1.5px solid transparent; border-top-color: var(--cobre); border-right-color: color-mix(in srgb, var(--cobre) 28%, transparent);
    transform: translate(-50%, -50%) rotate(-28deg); opacity: .85;
    animation: lh-arco 1.3s cubic-bezier(.3, .9, .3, 1) both;
}
@keyframes lh-arco { from { transform: translate(-50%, -50%) rotate(-110deg); opacity: 0; } }
.lh-centro { position: relative; z-index: 1; }
.lh-rodape { position: absolute; left: 32px; right: 32px; bottom: 34px; z-index: 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 0; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--rail-ink); opacity: .75; }
.lh-rodape span { padding: 0 14px; }
.lh-rodape span + span { border-left: 1px solid color-mix(in srgb, var(--cobre) 45%, transparent); }
.login-col { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; animation: lg-in .55s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lg-in { from { opacity: 0; transform: translateY(10px); } }
.login-foot { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.login-foot a { color: var(--ink-3); text-decoration: none; }
.login-foot a:hover { color: var(--petroleo); }
@media (prefers-reduced-motion: reduce) { .login-hero::after, .login-col { animation: none; } }
/* Login = palco da marca: símbolo grande, nome em Bricolage e a LINHA-NÍVEL de cobre
   (a assinatura do Leme) que se traça uma única vez no load. Resto em silêncio. */
.lh-centro { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.lh-centro img { width: 104px; height: 104px; border-radius: 26px; box-shadow: 0 14px 44px rgba(0, 0, 0, .4); }
.lh-nome { font-family: var(--display); font-weight: 750; font-size: clamp(40px, 4.4vw, 62px); letter-spacing: -.02em; color: #fff; line-height: 1; }
.lh-linha { width: 120px; height: 3px; border-radius: 2px; background: var(--cobre); animation: lh-nivel .7s cubic-bezier(.3, .9, .3, 1) both; transform-origin: left; }
@keyframes lh-nivel { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lh-linha { animation: none; } }
.lh-tag { font-size: 12.5px; color: var(--rail-ink); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.lh-tag b { color: #fff; font-weight: 700; }
.login-form { display: grid; place-items: center; background: var(--surface); padding: 32px 20px; }
.login-form .auth-card { border: 1px solid var(--border); box-shadow: var(--shadow); }
@media (max-width: 900px) {
    .login-split { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .login-form { min-height: 100vh; background: var(--rail); }
}
.auth-card { width: 100%; max-width: 380px; background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 30px 28px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand img { width: 56px; height: 56px; border-radius: 14px; box-shadow: var(--shadow); }
.auth-brand .t { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.auth-brand .s { font-size: 12.5px; color: var(--petroleo); font-weight: 600; }
.auth-err { background: var(--vermelho-50); color: var(--vermelho); border-radius: var(--r); padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; }
.auth-ok { background: var(--verde-50); color: var(--verde-700); border-radius: var(--r); padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; }
.auth-card .btn-primary { width: 100%; justify-content: center; height: 40px; margin-top: 6px; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; margin: 2px 0 4px; }
.auth-remember input { width: 15px; height: 15px; accent-color: var(--petroleo); cursor: pointer; }

/* ============================================================================
   Misc / utilitários
   ========================================================================== */
/* Estado vazio: ícone num quadrado petróleo suave, título, explicação curta, ação. */
.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); font-size: 13px; line-height: 1.55; max-width: 560px; margin: 0 auto; }
.empty > i { font-size: 20px; width: 48px; height: 48px; border-radius: 14px; background: var(--petroleo-50); color: var(--petroleo); display: grid; place-items: center; margin: 0 auto 12px; }
.empty b { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink); margin-bottom: 4px; letter-spacing: -.01em; }
.empty .e-acoes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--verde-50); color: var(--verde-700); font-size: 11.5px; font-weight: 700; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--verde); }
.flex { display: flex; align-items: center; gap: 8px; }
.mt-16 { margin-top: 16px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 100; padding: 20px; }
/* Confirmação global fica ACIMA de qualquer outro modal (ex.: "Confirma?" sobre um form aberto). */
.modal-overlay.on-top { z-index: 500; }
.modal { width: 100%; max-width: 560px; background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-height: 92vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal .resumo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-2); }
.filtros { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 10px; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.sep-vert { display: inline-block; width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }

/* Painel executivo (geração on-demand) */
.spin { display: inline-block; animation: dg-spin 0.9s linear infinite; }
@keyframes dg-spin { to { transform: rotate(360deg); } }
.ok-msg { background: var(--verde-50, #eafaf2); border: 1px solid var(--verde, #2E7D5B); color: var(--verde-700, #1f6347); border-radius: var(--r); padding: 9px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.painel-log { background: #0f172a; color: #cbd5e1; border-radius: var(--r); padding: 10px 12px; font-size: 11.5px; line-height: 1.5; max-height: 260px; overflow: auto; white-space: pre-wrap; margin: 8px 0 0; font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Detalhe do lançamento (modal "abrir") */
/* Modal largo (fichas/detalhes com tabelas): usa a tela — 760px escondia as últimas colunas
   (Estado/ações) atrás de rolagem. Teto 1200px p/ não virar um telão em monitor grande. */
.modal.modal-lg { max-width: min(1200px, 100%); }

/* GAVETA (drawer): a ficha desliza pela direita e a grade continua visível atrás —
   navega-se entre registros pelas setas do cabeçalho sem fechar. Mesmo DOM do modal;
   só o contêiner muda. */
.modal-overlay.gaveta { place-items: stretch end; padding: 0; background: rgba(11, 31, 35, .35); }
.modal.gaveta-painel {
    max-width: min(880px, 94vw) !important; width: 100%;
    height: 100vh; max-height: 100vh; border-radius: 0;
    box-shadow: -24px 0 60px rgba(11, 47, 53, .25);
    animation: gaveta-in .22s cubic-bezier(.3, .9, .3, 1);
}
[data-theme="dark"] .modal.gaveta-painel { box-shadow: -24px 0 60px rgba(0, 0, 0, .55); }
.modal.gaveta-painel .modal-foot { border-radius: 0; }
@keyframes gaveta-in { from { transform: translateX(60px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal.gaveta-painel { animation: none; } }
.lnk-abrir { color: var(--petroleo, var(--ink-1)); font-weight: 600; text-decoration: none; }
.lnk-abrir:hover { text-decoration: underline; }
.det-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.det-grid > div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.det-grid .det-full { grid-column: 1 / -1; }
.det-lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.det-valores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.det-valores > div { display: flex; flex-direction: column; gap: 3px; }
.det-valores b { font-size: 17px; }
/* Número-herói: o valor que decide a ação (saldo em aberto, líquido em conta, vencido…) fala mais alto */
.det-valores > div.hero .det-lbl { color: var(--ink-2); font-weight: 700; }
.det-valores > div.hero b { font-size: 24px; letter-spacing: -.02em; line-height: 1.1; }
.det-valores .det-sub { font-size: 11px; color: var(--ink-3); }
.det-valores b.cell-ellipsis { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.ficha-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; color: var(--ink-2); margin: 10px 0 4px; }
.ficha-meta .det-lbl { margin-right: 4px; }
html.compact .det-valores > div.hero b { font-size: 20px; }

/* Ficha do título: faixa de status + seções expansíveis */
.ficha-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.det-sec { border: 1px solid var(--border); border-radius: var(--r); margin-top: 12px; background: var(--surface); }
.det-sec > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 13.5px; color: var(--ink-1); list-style: none; display: flex; align-items: center; gap: 8px; }
.det-sec > summary::-webkit-details-marker { display: none; }
.det-sec > summary::before { content: "\F285"; font-family: "bootstrap-icons"; font-weight: 400; color: var(--ink-3); transition: transform .15s ease; }
.det-sec[open] > summary::before { transform: rotate(90deg); }
.det-sec[open] > summary { border-bottom: 1px solid var(--border); }
.det-sec > *:not(summary) { margin-left: 14px; margin-right: 14px; }
.det-sec > *:last-child { margin-bottom: 14px; }
/* Aviso "editar na origem" na ficha do título gerado por NF */
.callout-origem { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r); background: var(--petroleo-50); border: 1px solid var(--petroleo-100); font-size: 12.5px; color: var(--ink-2); }
.callout-origem > i { color: var(--petroleo); font-size: 15px; }
.callout-origem > span { flex: 1; min-width: 220px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

:focus-visible { outline: 2px solid var(--petroleo); outline-offset: 1px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 980px) {
    .grid-2 { grid-template-columns: 1fr; }
}

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 3px rgba(0,0,0,.2); display: none; left: 0; padding: 10px 18px; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }

/* ============================================================================
   Menu lateral retrátil (toggle via classe em <html>)
   ========================================================================== */
.app { transition: grid-template-columns .15s ease; }
html.menu-collapsed .app { grid-template-columns: 56px 1fr; }
html.menu-collapsed .brand { padding: 0; justify-content: center; }
html.menu-collapsed .brand > div { display: none; }
html.menu-collapsed .sidebar { padding: 10px 6px 24px; }
html.menu-collapsed .sidebar .g-label { display: none; }
html.menu-collapsed .sidebar .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rail-line); }
html.menu-collapsed .sidebar .nav-group:first-child { border-top: 0; padding-top: 0; }
html.menu-collapsed .nav-link { justify-content: center; gap: 0; padding: 9px 0; font-size: 0; border-left-width: 0; border-radius: var(--r); }
html.menu-collapsed .nav-link i { font-size: 17px; width: auto; }
html.menu-collapsed .nav-link.active { border-left-width: 0; box-shadow: inset 0 0 0 1.5px var(--rail-accent); }

/* ============================================================================
   Fluxo de Caixa Gerencial (SAGG hierárquico)
   ========================================================================== */
.lnk-exp { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 0 4px 0 0; width: 18px; line-height: 1; }
.lnk-exp:hover { color: var(--petroleo); }
.lnk-exp i { font-size: 11px; }
.mono-cod { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-right: 4px; }

/* Linhas de grupo (nível 1) e contas-pai (rollup) */
.grid tr.row-grupo > td { background: var(--surface-2); font-weight: 700; }
.grid tr.row-grupo .mono-cod { color: var(--ink-2); }
.grid tr.row-pai > td { font-weight: 600; }

/* Sínteses calculadas — a "tesoura" (3/5/7/9/13.x/14) */
.grid tr.row-sintese > td { background: var(--petroleo-50); font-weight: 700; color: var(--petroleo-700); border-top: 1px solid var(--petroleo-100); border-bottom: 1px solid var(--petroleo-100); }
.grid tr.row-sintese .mono-cod { color: var(--petroleo); }

/* Linha de registro inativo (estoque, cadastros) — esmaecida */
.grid tr.row-inativo > td { opacity: .55; }
.grid tr.row-inativo .cell-strong { font-weight: 500; }

/* ============================================================================
   Aging / vencimentos + Concentração (Pareto / ABC / matriz)
   ========================================================================== */
/* Barra empilhada de aging */
.aging-bar { display: flex; width: 100%; height: 26px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.aging-seg { height: 100%; min-width: 2px; }
.aging-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.leg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.leg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* Badge ABC */
.abc { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.abc-a { background: var(--verde-50); color: var(--verde-700); }
.abc-b { background: var(--ambar-50); color: var(--ambar); }
.abc-c { background: var(--surface-2); color: var(--ink-3); }

/* Tiles de classificação */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile { border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-sm); }
.tile-name { font-size: 12.5px; font-weight: 650; opacity: .92; }
.tile-val { font-size: 19px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.tile-sub { font-size: 11px; opacity: .82; margin-top: 2px; }

/* Heatmap da matriz */
.grid.heat td.heat-strong { color: #fff; font-weight: 600; }

@media print {
    .aging-bar, .tile, .grid.heat td, .agbar-fill, .bl-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Cockpit: badge de variação, mini-aging e top parceiros ---- */
.k-delta { display: inline-flex; align-items: center; gap: 1px; font-weight: 700; font-size: 12px; }
.k-delta i { font-size: 15px; margin-right: -2px; }
.k-delta.up { color: var(--verde-700); }
.k-delta.down { color: var(--vermelho); }

/* Aging — barras horizontais rotuladas (uma por faixa de vencimento) */
.agbars { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.agbar { display: grid; grid-template-columns: 84px 1fr minmax(116px, auto); align-items: center; gap: 12px; }
.agbar-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.agbar-lbl i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.agbar-track { height: 9px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.agbar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width .4s ease; }
.agbar-val { text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.agbar-val.zero { color: var(--ink-3); font-weight: 600; }
.agbar-val .pct { color: var(--ink-3); font-weight: 600; font-size: 10.5px; margin-left: 5px; }

/* Bar list (ranking) — barra suave atrás, nome à esquerda, valor à direita */
.top-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; margin: 16px 0 8px; }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.bl-row { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); overflow: hidden; }
.bl-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: color-mix(in srgb, var(--chart-1) 13%, transparent); border-right: 2.5px solid var(--chart-1); z-index: 0; transition: width .4s ease; }
.bl-rank { position: relative; z-index: 1; font-size: 11px; font-weight: 700; color: var(--chart-1); width: 13px; flex: none; }
.bl-name { position: relative; z-index: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bl-meta { position: relative; z-index: 1; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.bl-val { position: relative; z-index: 1; font-family: var(--mono); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.bl-row:hover .bl-bar { filter: brightness(.96); }
/* Linha de barra clicável (filtro por tipo no Faturamento) */
.bl-click { cursor: pointer; }
.bl-click:hover .bl-bar { filter: brightness(.96); }
.bl-click.bl-active { box-shadow: inset 0 0 0 1.5px var(--petroleo); }
.bl-click.bl-active .bl-name { font-weight: 700; color: var(--petroleo-700); }

/* Integração: dica de sugestão sob o select + linha expansível de itens */
.sug-hint { font-size: 10.5px; color: var(--petroleo); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.grid tbody tr.row-itens > td { background: var(--surface); border-top: 0; }
.grid tbody tr.row-itens table.grid { box-shadow: none; }

/* Célula que trunca o texto com reticências (ex.: nome do cliente longo) — title mostra o inteiro */
.cell-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Redimensionamento de colunas: alça no cabeçalho + truncagem quando a tabela foi redimensionada */
table.grid th { position: relative; }
.col-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; user-select: none; }
/* No ÚLTIMO cabeçalho a alça vazava 3px além da tabela — com o grid-wrap rolável isso criava uma
   barrinha de rolagem horizontal fantasma em TODAS as grades. Alça do último th fica p/ dentro. */
table.grid th:last-child .col-resizer { right: 0; width: 5px; }
.col-resizer:hover { background: var(--petroleo-100); }
body.dg-col-resizing, body.dg-col-resizing * { cursor: col-resize !important; user-select: none !important; }
table.grid.grid-resized { table-layout: fixed; }
table.grid.grid-resized td, table.grid.grid-resized th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Linha de tabela clicável (drill-down) */
.grid tbody tr.row-clic { cursor: pointer; }
.grid tbody tr.row-clic:hover { background: var(--surface); }

/* ---- Sino de pendências (topbar) ---- */
/* Chip "Caixa conciliado até" (topbar): semáforo da posição de tesouraria. */
.chip-tes { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--ink-2); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.chip-tes:hover { border-color: var(--petroleo); color: var(--ink); }
.chip-tes i { color: var(--petroleo); }
.chip-tes b { color: var(--ink); font-weight: 700; }
.chip-tes .ct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.chip-tes.sem-ok .ct-dot { background: var(--verde); }
.chip-tes.sem-atencao .ct-dot { background: var(--ambar); }
.chip-tes.sem-critico .ct-dot { background: var(--vermelho); }
.chip-tes .ct-n { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; color: #fff; background: var(--ink-3); }
.chip-tes.sem-atencao .ct-n { background: var(--ambar); }
.chip-tes.sem-critico .ct-n { background: var(--vermelho); }
@media (max-width: 900px) { .chip-tes span:not(.ct-dot):not(.ct-n) { display: none; } }

/* Semáforo de conciliação por conta (página Contas / posição de tesouraria). */
.sem-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.sem-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sem-badge.sem-ok { background: var(--verde-50); color: var(--verde-700); }
.sem-badge.sem-atencao { background: var(--ambar-50); color: var(--ambar); }
.sem-badge.sem-critico { background: var(--vermelho-50); color: var(--vermelho); }
.sem-badge.sem-neutro { background: var(--surface-2); color: var(--ink-3); }
.dif-link { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

.sino { position: relative; display: inline-flex; }
.sino-btn { position: relative; }
.sino-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--vermelho); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.sino-backdrop { position: fixed; inset: 0; z-index: 60; }
.sino-panel { position: absolute; top: calc(100% + 9px); right: 0; z-index: 61; width: 340px; max-height: 70vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; }
.sino-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 10px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border-2); margin-bottom: 4px; }
.sino-vazio { padding: 22px 12px; text-align: center; color: var(--ink-2); font-size: 13px; }
.sino-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r); text-decoration: none; color: var(--ink); }
.sino-item:hover { background: var(--surface); }
.sino-item .si-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 15px; }
.sino-item .si-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sino-item .si-txt { font-size: 13px; font-weight: 600; }
.sino-item .si-det { font-size: 11.5px; color: var(--ink-3); }
.sino-item .si-chev { color: var(--ink-3); font-size: 12px; }
.sino-item.sev-alta .si-ico { background: var(--vermelho-50); color: var(--vermelho); }
.sino-item.sev-media .si-ico { background: var(--ambar-50); color: var(--ambar); }
.sino-item.sev-baixa .si-ico { background: var(--petroleo-50); color: var(--petroleo); }

/* ---- Cards de ação do Cockpit (pendências acionáveis) ---- */
.acoes { margin-bottom: 16px; }
.acoes-head { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.acoes-head i { color: var(--ambar); }
.acoes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.acao { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .12s; }
.acao:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.acao-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 17px; }
.acao-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acao-txt { font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.acao-det { font-size: 11.5px; color: var(--ink-3); }
.acao-chev { color: var(--ink-3); font-size: 13px; flex: none; }
.acao.sev-alta { border-color: color-mix(in srgb, var(--vermelho) 35%, var(--border)); }
.acao.sev-alta .acao-ico { background: var(--vermelho-50); color: var(--vermelho); }
.acao.sev-media { border-color: color-mix(in srgb, var(--ambar) 30%, var(--border)); }
.acao.sev-media .acao-ico { background: var(--ambar-50); color: var(--ambar); }
.acao.sev-baixa { border-color: var(--border); }
.acao.sev-baixa .acao-ico { background: var(--petroleo-50); color: var(--petroleo); }

/* ---- Ficha 360º do parceiro: semáforo + gauge de crédito ---- */
.cred-semaforo { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; }
.cred-semaforo i { font-size: 18px; }
.cred-verde { background: var(--verde-50); color: var(--verde-700); }
.cred-amarelo { background: var(--ambar-50); color: var(--ambar); }
.cred-vermelho { background: var(--vermelho-50); color: var(--vermelho); }
.cred-box { margin-top: 14px; }
.cred-bar { height: 8px; border-radius: 5px; background: var(--border-2); overflow: hidden; margin-top: 6px; }
.cred-fill { height: 100%; border-radius: 5px; }
.cred-fill.cred-verde { background: var(--verde); }
.cred-fill.cred-amarelo { background: var(--ambar); }
.cred-fill.cred-vermelho { background: var(--vermelho); }

/* ---- Antecipação de recebíveis ---- */
.input-sm { height: 30px; padding: 3px 8px; font-size: 13px; }
.lbl-mini { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 6px; }
tr.row-sel { background: var(--petroleo-50); }
tr.row-total td { border-top: 1px solid var(--border-2); font-weight: 600; }
.det-sec { font-size: 13px; font-weight: 700; margin: 16px 0 8px; color: var(--ink-2); }
.ant-resumo { display: flex; gap: 20px; align-items: center; margin-top: 12px; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.ant-resumo b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ant-resumo .pos { color: var(--verde); }
/* BLOCK, não flex: com flex, cada trecho solto de texto e cada <b> virava um item lado a lado
   ("colunas" quebradas em hints longos). Em bloco o texto flui normal com o ícone inline. */
.hint { display: block; font-size: 12.5px; color: var(--ink-3); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin: 2px 0 8px; line-height: 1.5; }
.hint i { color: var(--petroleo); margin-right: 4px; }
.hint b { color: var(--ink-2); font-weight: 650; }
.input-ro { display: flex; align-items: center; background: var(--surface-2); color: var(--ink-2); font-family: var(--mono); font-size: 13px; }

/* Grade embutida em .card: sem moldura própria (usada pelo <DataGrid Embutida>) */
.grid-wrap.flat { border: 0; border-radius: 0; box-shadow: none; }

/* ---- Command palette (Ctrl+K) ---- */
.pal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    display: flex; justify-content: center; align-items: flex-start;
    padding: 12vh 20px 20px; z-index: 200;
}
.pal {
    width: 100%; max-width: 560px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
    display: flex; flex-direction: column; max-height: 60vh;
}
.pal-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pal-input i { color: var(--ink-3); font-size: 15px; }
.pal-input input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14.5px; color: var(--ink); }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: transparent; color: var(--ink); font-size: 13.5px;
    cursor: pointer; text-align: left;
}
.pal-item i { color: var(--ink-3); width: 18px; text-align: center; }
.pal-item .pal-texto { flex: 1; }
.pal-item .pal-grupo { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pal-item.sel { background: var(--petroleo-50); }
.pal-item.sel i, .pal-item.sel .pal-texto { color: var(--petroleo-700); }
.pal-vazio { display: flex; align-items: center; gap: 8px; padding: 18px 14px; color: var(--ink-3); font-size: 13px; }
.pal-foot {
    display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border);
    background: var(--surface); color: var(--ink-3); font-size: 11.5px;
}
.pal-foot span { display: flex; align-items: center; gap: 4px; }

/* ---- Fechamento do mês (rotina guiada) ---- */
.fech-resumo { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.fech-barra { flex: 1; min-width: 220px; max-width: 420px; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.fech-fill { height: 100%; background: var(--petroleo); border-radius: 99px; transition: width .3s; }
.fech-lista { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.fech-passo { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.fech-num { font-family: var(--mono); font-size: 12px; color: var(--ink-3); width: 18px; text-align: right; }
.fech-ico i { font-size: 20px; }
.fech-passo.st-ok .fech-ico i { color: var(--verde); }
.fech-passo.st-atencao .fech-ico i { color: var(--ambar); }
.fech-passo.st-pendente .fech-ico i { color: var(--ink-3); }
.fech-txt { flex: 1; }
.fech-txt b { font-size: 13.5px; }
.fech-txt .muted { font-size: 12.5px; margin-top: 2px; }
.fech-passo .btn { white-space: nowrap; }

/* ---- PIX na cobrança ---- */
.pix-bloco { display: flex; gap: 16px; align-items: flex-start; }
.pix-qr { flex: none; background: #fff; padding: 8px; border: 1px solid var(--border); border-radius: var(--r); }
.pix-qr:empty { display: none; }
.pix-copia { flex: 1; }
.pix-copia textarea { font-family: var(--mono); font-size: 11px; word-break: break-all; cursor: pointer; }

/* ---- Papéis de acesso (matriz de permissões) ---- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 18px; margin-bottom: 6px; }
.perm-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.perm-item i { color: var(--ink-3); width: 18px; text-align: center; margin-right: 4px; }
.perm-item select { width: 108px; flex: none; }

/* ---- Utilitários (extraídos dos estilos inline mais repetidos do app) ----
   Manter esta lista PEQUENA: só padrões que aparecem 3+ vezes. O !important
   reproduz a precedência que o style inline tinha antes da faxina. */
.m-0 { margin: 0 !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-14 { margin-bottom: 14px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-14 { margin-top: 14px !important; }
.ml-6 { margin-left: 6px !important; }
.pl-12 { padding-left: 12px !important; }
.pl-24 { padding-left: 24px !important; }
.pt-10 { padding-top: 10px !important; }
.p-14 { padding: 14px !important; }
.gap-6 { gap: 6px !important; }
.gap-8 { gap: 8px !important; }
.w-auto { width: auto !important; }
.sq-28 { width: 28px !important; height: 28px !important; }
.fs-11 { font-size: 11px !important; }
.fs-12 { font-size: 12px !important; }
.fs-18 { font-size: 18px !important; }
.bold { font-weight: 700 !important; }
.txt-mini { font-size: 11.5px !important; color: var(--ink-3) !important; }
.bg-soft { background: var(--surface-2) !important; }
.sec-title { margin: 18px 0 8px !important; }
.empty-cell { text-align: center !important; color: var(--ink-3) !important; padding: 18px !important; }

/* ---- DataInput: data digitável (dd/mm/aaaa) + calendário nativo (só o ícone) ---- */
.dt-wrap { display: inline-flex; align-items: stretch; max-width: 100%; vertical-align: top; }
.dt-wrap .dt-txt { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dt-wrap .dt-pick { flex: 0 0 auto; width: 32px; min-width: 32px; margin-left: -1px; padding: 0; cursor: pointer;
  border-top-left-radius: 0; border-bottom-left-radius: 0; color-scheme: light dark; }
.dt-compact .dt-txt, .dt-compact .dt-pick { height: 30px; }
.dt-wrap .dt-pick::-webkit-datetime-edit, .dt-wrap .dt-pick::-webkit-inner-spin-button, .dt-wrap .dt-pick::-webkit-clear-button { display: none; -webkit-appearance: none; }
.dt-wrap .dt-pick::-webkit-calendar-picker-indicator { margin: 0 auto; opacity: .55; cursor: pointer; }
.dt-wrap .dt-pick:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* ---- Baixas: agrupamento por operacao ---- */
.grid tr.row-grupo > td { background: rgba(99,102,241,.07); cursor: pointer; }
.grid tr.row-grupo:hover > td { background: rgba(99,102,241,.13); }
.grid tr.row-grupo .bi { color: #6366f1; }
.grid tr.row-filho > td { background: rgba(127,127,127,.055); }
.grid tr.row-filho > td:nth-child(2) { border-left: 2px solid rgba(99,102,241,.4); }

/* B4 — baixa estornada fica na ficha, riscada */
.bx-estornada td { text-decoration: line-through; opacity: .6; }
.bx-estornada td:last-child { text-decoration: none; opacity: .85; }

/* D1 — cabeçalho ordenável */
.grid th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.grid th.th-sort:hover { color: var(--petroleo-700); }
.grid th.th-sort .sort-off { opacity: .35; }

/* F9 — linha do tempo do título */
.tl { list-style: none; margin: 8px 0 0; padding: 0 0 0 4px; position: relative; font-size: 12.5px; }
.tl::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl li { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; position: relative; }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--bg); border: 2px solid var(--border); font-size: 12px; color: var(--ink-2); z-index: 1; }
.tl-when { width: 118px; flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 4px; }
.tl-body { flex: 1; min-width: 0; padding-top: 4px; }
.tl-tipo { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); margin-right: 6px; min-width: 84px; }
.tl-verde .tl-dot { border-color: var(--verde-700); color: var(--verde-700); }
.tl-ambar .tl-dot { border-color: var(--ambar); color: var(--ambar); }
.tl-vermelho .tl-dot { border-color: var(--vermelho); color: var(--vermelho); }
.tl-petroleo .tl-dot { border-color: var(--petroleo); color: var(--petroleo); }
.tl-roxo .tl-dot { border-color: #7c5cbf; color: #7c5cbf; }
.tl-cinza .tl-dot { opacity: .7; }
.tl-cinza .tl-body { color: var(--ink-2); }

/* ============================================================================
   Resolução / densidade (rodada visual): a tela se ajusta à máquina.
   - html.compact: escolhido no botão da topbar, ou automático em tela baixa (<= 820px) / estreita (< 1400px)
   - gaveta da ficha cresce em monitores largos; tabelas apertam em telas estreitas
   ========================================================================== */
html.compact { --row-h: 32px; --topbar-h: 48px; }
html.compact body { font-size: 13px; }
html.compact .content { padding: 10px 14px 32px; }
html.compact .page-head { margin: 0 0 8px; }
html.compact .page-head h1 { font-size: 17px; }
html.compact .page-head .sub { font-size: 12px; }
html.compact .crumbs { margin-bottom: 4px; }
html.compact .stats, html.compact .kpis { margin-bottom: 8px; row-gap: 6px; }
html.compact .st { padding-right: 14px; margin-right: 14px; }
html.compact .st .v, html.compact .kpi .k-value { font-size: 16px; }
html.compact .st .l, html.compact .kpi .k-label { font-size: 10.5px; }
html.compact .st .d, html.compact .kpi .k-foot { font-size: 11px; }
html.compact .kpi { padding-right: 14px; margin-right: 14px; }
html.compact .fbar { padding-bottom: 8px; gap: 6px; }
html.compact .fchip { padding: 3px 10px; font-size: 11.5px; }
html.compact table.grid { font-size: 12px; }
html.compact table.grid thead th { font-size: 10.5px; height: 32px; }
html.compact table.grid thead th, html.compact table.grid tbody td { padding-left: 7px; padding-right: 7px; }
html.compact .toolbar { padding: 6px 0; }
html.compact .card-pad { padding: 10px 12px; }
html.compact .det-valores { padding: 8px 12px; gap: 10px; margin-top: 10px; }
html.compact .det-valores b { font-size: 15px; }
html.compact .modal-body { padding: 12px 14px; }
html.compact .modal-head { padding: 10px 14px; }
html.compact .modal-foot { padding: 10px 14px; }
html.compact .tl li { padding: 2px 0; }
html.compact .fech-passo { padding: 8px 12px; }
html.compact .acoes-grid { gap: 6px; }
html.compact .acao { padding: 8px 10px; }

/* Telas estreitas (laptop 1280–1366 sem menu): tabelas mais apertadas, sem estourar a largura */
@media (max-width: 1300px) {
    table.grid { font-size: 11.5px; }
    table.grid thead th, table.grid tbody td { padding-left: 5px; padding-right: 5px; }
    table.grid tbody td { max-width: 160px; }
    .page-head .sub { display: none; }
}

/* Gaveta da ficha acompanha o monitor: 880px no laptop, mais larga onde cabe */
@media (min-width: 1600px) { .modal.gaveta-painel { max-width: min(1000px, 62vw) !important; } }
@media (min-width: 1900px) { .modal.gaveta-painel { max-width: min(1120px, 60vw) !important; } }

/* ============================================================================
   Rodada visual 2 — shell: menu do usuário, barra de filtros em linhas, linguagem única de chips
   ========================================================================== */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13px; border: 1px solid transparent; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.um-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--rail); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 12.5px; }
.um-chev { font-size: 11px; color: var(--ink-3); }
.um-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 300; display: flex; flex-direction: column; }
.um-panel form { display: contents; }
.um-panel button, .um-panel a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--r); color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; text-decoration: none; }
.um-panel button:hover, .um-panel a:hover { background: var(--surface-2); text-decoration: none; }
.um-panel i { width: 16px; text-align: center; color: var(--petroleo); }
.um-panel form button i { color: var(--vermelho); }
.fbar-break { flex-basis: 100%; height: 0; }
.fbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
@media (max-width: 1300px) { .um-nome { display: none; } .um-chev { display: none; } }

/* ============================================================================
   Rodada visual 4 — pendências e ações do dia como LISTA compacta (não cards)
   ========================================================================== */
.acoes-grid { display: flex; flex-direction: column; gap: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.acao { border: 0 !important; border-radius: 0; border-bottom: 1px solid var(--border-2) !important; padding: 7px 12px; gap: 10px; }
.acao:last-child { border-bottom: 0 !important; }
.acao:hover { box-shadow: none; transform: none; background: var(--surface); }
.acao-ico { width: 28px; height: 28px; border-radius: 7px; font-size: 14px; }
.acao-body { flex-direction: row; align-items: baseline; gap: 8px; min-width: 0; }
.acao-txt { font-size: 13px; white-space: nowrap; }
.acao-det { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acoes-mais { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
html.compact .acao { padding: 5px 10px; }

/* ============================================================================
   Rodada visual 5 — ficha com âncoras, colunas configuráveis, Ctrl+K nível 2
   ========================================================================== */
.modal-facets { display: flex; gap: 2px; padding: 4px 12px; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; flex: none; }
.modal-facets a { padding: 6px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.modal-facets a:hover { background: var(--surface-2); color: var(--petroleo-700); text-decoration: none; }
.anc { display: block; position: relative; top: -8px; height: 0; }
.col-menu { position: relative; }
.col-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.col-menu > summary::-webkit-details-marker { display: none; }
.col-panel { position: absolute; left: 0; top: calc(100% + 6px); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 8px 10px; z-index: 50; display: flex; flex-direction: column; gap: 6px; min-width: 170px; font-size: 12.5px; }
.col-panel label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.grid-wrap.hide-unidade .col-unidade, .grid-wrap.hide-classif .col-classif, .grid-wrap.hide-valor .col-valor, .grid-wrap.hide-carteira .col-carteira { display: none; }
.pal-det { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }

/* C2 — auditoria antes → depois */
.aud-diff { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.aud-chip { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--ink-2); }
.aud-chip s { opacity: .6; }

/* ---- C3: DRE em três visões ---- */
.dre-grid td.num { white-space: nowrap; }
.dre-grid tr.row-mc { background: var(--petroleo-50); }
.dre-grid tr.row-ebitda { background: var(--verde-50); }
.cell-lnk { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; border-bottom: 1px dotted transparent; }
.cell-lnk:hover { border-bottom-color: var(--petroleo); color: var(--petroleo-700); }
.fchip.is-off { opacity: .45; cursor: not-allowed; }

/* ---- F4: régua automática ---- */
.grid tr.row-off td { opacity: .55; }
.pill-n { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--petroleo); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.regua-msg { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.5; margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; max-height: 60vh; overflow: auto; }

/* ---- G9: Fiscal do mês ---- */
/* KPI clicável: continua sendo um KPI da faixa (sem caixa), só ganha afford de clique
   no hover e um sublinhado petróleo quando é o filtro ativo. */
.kpi.kpi-btn { cursor: pointer; text-align: left; font: inherit; background: transparent; border: 0; border-right: 1px solid var(--border); border-radius: 0; padding: 4px 22px 4px 8px; margin-left: -8px; transition: background .15s; }
.kpi.kpi-btn:last-child { border-right: 0; }
.kpi.kpi-btn:hover { background: var(--surface-2); border-radius: 8px; }
.kpi.kpi-btn.on { box-shadow: inset 0 -2px 0 var(--petroleo); }
.kpi.kpi-btn.on .k-label { color: var(--petroleo-700); }
.kpi.is-warn .k-value { color: var(--ambar); }
/* ==========================================================================
   Configurações em grade (blocos lado a lado, salvar fixo no rodapé)
   ========================================================================== */
.cfg-grid { columns: 2 520px; column-gap: 14px; }
.cfg-sec { break-inside: avoid; margin-bottom: 14px; }
@media (max-width: 1150px) { .cfg-grid { columns: 1; } }
.cfg-sec .form-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cfg-sec .field { max-width: none !important; }
.cfg-sec h3 { margin: 0 0 6px; scroll-margin-top: 70px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cfg-sec h3 i { color: var(--petroleo); }
.cfg-save { position: sticky; bottom: -40px; z-index: 5; margin-top: 12px; padding: 12px 0 44px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -10px 18px -14px rgba(0, 0, 0, .35); }

/* ==========================================================================
   Fechamento: checklist + coluna lateral (travas, histórico)
   ========================================================================== */
.fech-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.fech-layout .fech-lista { max-width: none; }
.fech-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }
.side-t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.side-t i { color: var(--petroleo); }
.trava-lista { display: flex; flex-direction: column; gap: 6px; }
.trava-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.trava-item.on { background: var(--petroleo-50); color: var(--petroleo-700); }
.trava-item b { font-family: var(--mono); font-weight: 600; }
.hist-lista { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.hist-item { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: start; }
@media (max-width: 1100px) { .fech-layout { grid-template-columns: 1fr; } .fech-side { position: static; } }

/* ==========================================================================
   Cockpit: ações do dia por urgência, valor em coluna própria
   ========================================================================== */
.acoes-sec { display: flex; align-items: center; gap: 6px; padding: 6px 12px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--border-2); }
.acoes-sec.sev-alta .acoes-sec-t { color: var(--vermelho); }
.acoes-sec.sev-media .acoes-sec-t { color: var(--ambar); }
.acoes-sec.sev-baixa .acoes-sec-t { color: var(--petroleo); }
.acao-val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; margin-left: auto; padding-left: 12px; }
.acao.sev-alta .acao-val { color: var(--vermelho); }

/* ==========================================================================
   Movimento: curto (150–180 ms) e só onde o olho já está
   ========================================================================== */
.btn, .fchip, .tab, .chip, .icon-btn, .nav-link, .kpi.kpi-btn, .acao, .trava-item, table.grid tbody tr { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.modal { animation: modal-in .18s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.fech-fill { transition: width .45s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } .btn, .fchip, .tab, .chip, .icon-btn, .nav-link, .acao, table.grid tbody tr { transition: none; } }

/* ==========================================================================
   Ajuda embutida (/ajuda) — manual de uso. Tipografia um pouco mais larga que
   o resto do ERP: aqui se LÊ, não se opera; o resto da linguagem é a mesma.
   ========================================================================== */
.aj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }

.aj-card {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); padding: 14px 16px; color: var(--ink);
}
.aj-card:hover { border-color: var(--petroleo); box-shadow: var(--shadow); text-decoration: none; }
.aj-card > div:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.aj-card b { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.aj-card span { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.aj-card .aj-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .04em; }

.aj-ico {
    flex: none; width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center; font-size: 15px;
    background: var(--petroleo-50); color: var(--petroleo);
}

.aj-cap { max-width: 880px; }
.aj-cap-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.aj-cap-head h2 { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.aj-cap-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

.aj-bloco + .aj-bloco { margin-top: 12px; }
.aj-corpo { padding: 14px 16px 16px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.aj-corpo > * + * { margin-top: 11px; }
.aj-corpo p { margin: 0; }              /* o espaçamento é do container, não do <p> do navegador */
.aj-corpo b { color: var(--ink); font-weight: 600; }
.aj-corpo a { font-weight: 600; }
.aj-corpo .hint { margin: 0; }
.aj-corpo .btn { font-size: 12px; }

/* passo a passo: a numeração é sequência real de operação */
.aj-passos { margin: 0; padding: 0; list-style: none; counter-reset: ajp; display: flex; flex-direction: column; gap: 9px; }
.aj-passos > li { counter-increment: ajp; position: relative; padding-left: 32px; }
.aj-passos > li::before {
    content: counter(ajp); position: absolute; left: 0; top: 0;
    width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    background: var(--cobre-50); color: var(--cobre); border: 1px solid var(--cobre);
}

.aj-lista { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.aj-lista li::marker { color: var(--ink-3); }

/* pares "nome → explicação" (telas de um módulo, termos do glossário) */
.aj-defs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.aj-defs > li { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 3px 14px; align-items: baseline; }
.aj-defs > li > span:first-child { color: var(--ink); }

/* avisos: trava (o que impede), regra (o desenho), cuidado (ação irreversível) */
.aj-trava, .aj-reg, .aj-cuid { display: flex; gap: 10px; border-radius: var(--r); padding: 10px 13px; border: 1px solid; }
.aj-trava { background: var(--ambar-50); border-color: var(--ambar); }
.aj-reg { background: var(--petroleo-50); border-color: var(--petroleo-100); }
.aj-cuid { background: var(--vermelho-50); border-color: var(--vermelho); }
.aj-trava p, .aj-reg p, .aj-cuid p { margin: 0; }
.aj-trava p { color: var(--ambar); }
.aj-reg p { color: var(--petroleo-700); }
.aj-cuid p { color: var(--vermelho); }
.aj-trava b, .aj-reg b, .aj-cuid b { color: inherit; font-weight: 700; }
.aj-lab {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
    font-weight: 600; flex: none; padding-top: 3px; line-height: 1.4;
    width: 94px;                         /* coluna fixa: rótulo longo quebra em vez de comer o texto */
}
.aj-trava .aj-lab { color: var(--ambar); }
.aj-reg .aj-lab { color: var(--petroleo-700); }
.aj-cuid .aj-lab { color: var(--vermelho); }

.aj-k {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; white-space: nowrap;
    border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
    padding: 0 5px; background: var(--surface); color: var(--ink-2);
}

.aj-tbl { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
.aj-tbl table.grid { margin: 0; }
.aj-tbl table.grid td { white-space: normal; vertical-align: top; line-height: 1.5; }

.aj-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }

html.compact .aj-corpo { font-size: 13px; line-height: 1.58; }
html.compact .aj-card { padding: 11px 13px; }
/* ---- V3: resumo da ficha do título — a pergunta respondida no topo ---- */
.tit-resumo { margin-top: 14px; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--r); }
.tit-resumo.tom-ok { border-left-color: var(--verde); }
.tit-resumo.tom-neg { border-left-color: var(--vermelho); }
.tit-resumo.tom-meio { border-left-color: var(--ambar); }
.tit-resumo.tom-aberto { border-left-color: var(--petroleo); }
.tit-resumo.tom-off { border-left-color: var(--ink-3); }
.tit-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.tit-id { font-size: 12px; color: var(--ink-3); }
.tit-id b { color: var(--ink); font-family: var(--mono, ui-monospace, monospace); font-weight: 600; }
.tit-frase { font-size: 20px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; margin-top: 2px; }
.tom-ok .tit-frase { color: var(--verde-700, var(--verde)); }
.tom-neg .tit-frase { color: var(--vermelho); }
.tom-meio .tit-frase { color: var(--ambar-700, var(--ambar)); }
.tom-off .tit-frase { color: var(--ink-3); }
.tit-venc { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.tit-venc b { font-size: 17px; }
.tit-barra { height: 8px; border-radius: 4px; background: var(--surface-2); margin: 12px 0 10px; overflow: hidden; }
.tit-barra .pago { display: block; height: 100%; background: var(--verde); border-radius: 4px; transition: width .3s ease; }
.tom-neg .tit-barra { background: color-mix(in srgb, var(--vermelho) 22%, var(--surface-2)); }
.tit-nums { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 14px; }
.tit-nums > div { display: flex; flex-direction: column; gap: 3px; }
.tit-nums b { font-size: 17px; }
.tit-nums .num { text-align: left; }
.tit-nums > div.hero .det-lbl { color: var(--ink-2); font-weight: 700; }
.tit-nums > div.hero b { font-size: 26px; letter-spacing: -.02em; line-height: 1.1; }
.tit-nums .det-sub { font-size: 11px; color: var(--ink-3); }
.tit-baixas { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 720px) { .tit-nums { grid-template-columns: 1fr 1fr; } .tit-nums > div.hero { grid-column: 1 / -1; } .tit-venc { text-align: left; } }
/* ---- antecipação: prazo e taxa calculados no lançamento ---- */
.ant-indic { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.ant-indic > div { display: flex; flex-direction: column; gap: 2px; }
.ant-indic b { font-size: 17px; }
.ant-indic .det-sub { font-size: 11px; color: var(--ink-3); }
.ant-indic > div.alerta { border-left: 3px solid var(--ambar); padding-left: 10px; }
.ant-indic > div.hero b { font-size: 24px; letter-spacing: -.02em; }
.ant-indic > div.hero .det-lbl { color: var(--ink-2); font-weight: 700; }
/* ---- V3: faixa de vencimento no topo da grade de títulos ---- */
.kpis-aging { grid-template-columns: repeat(5, 1fr); }
.kpi.clicavel { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.kpi.clicavel:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--petroleo) 35%, transparent); transform: translateY(-1px); }
.kpi.clicavel:focus-visible { outline: 2px solid var(--petroleo); outline-offset: 2px; }
.kpi.kpi-total { border-left: 3px solid var(--petroleo); }
.aging-barra { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); margin: 6px 0 4px; }
.aging-barra span { display: block; height: 100%; }
.aging-barra .seg-venc { background: var(--vermelho); }
.aging-barra .seg-hoje { background: var(--ambar); }
.aging-barra .seg-sem { background: var(--petroleo); }
.aging-barra .seg-dep { background: color-mix(in srgb, var(--petroleo) 40%, var(--surface-2)); }
@media (max-width: 980px) { .kpis-aging { grid-template-columns: repeat(2, 1fr); } .kpi.kpi-total { grid-column: 1 / -1; } }

.kpi.is-sel { box-shadow: 0 0 0 2px var(--petroleo); }

/* emissão na grade de títulos: some em tela estreita */
@media (max-width: 1180px) { .col-emissao { display: none; } }
/* ---- Rotina da manhã: três cartões na ordem do trabalho ---- */
.rotina { margin-bottom: 16px; }
.rotina-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.rotina-head i { color: var(--ambar); margin-right: 4px; }
.rotina-head .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rotina-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rotina-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease; min-height: 96px; }
a.rotina-card:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--petroleo) 35%, transparent); transform: translateY(-1px); }
.rotina-card.tem { border-left-color: var(--petroleo); }
.rotina-card.alerta { border-left-color: var(--vermelho); }
.rotina-n { font-size: 20px; color: var(--ink-3); line-height: 1; margin-top: 2px; }
.rotina-card.tem .rotina-n { color: var(--petroleo); }
.rotina-card.alerta .rotina-n { color: var(--vermelho); }
.rotina-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rotina-t { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.rotina-v { font-size: 19px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rotina-v a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
.rotina-v a:hover, .rotina-d a:hover { color: var(--petroleo); }
.rotina-d { font-size: 12.5px; color: var(--ink-3); }
.rotina-d a { color: inherit; text-decoration: underline dotted; }
.rotina-d .lnk { text-decoration: underline dotted; }
.rotina-chev { color: var(--ink-3); align-self: center; }
@media (max-width: 900px) { .rotina-grid { grid-template-columns: 1fr; } }
/* ---- Gráficos SVG (barras, cascata, linha) ---- */
.grafico { width: 100%; }
.grafico svg { display: block; }
.grafico-legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin: 0 0 6px 62px; }
.grafico-legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.gr-grade { stroke: var(--border-2); stroke-width: 1; }
.gr-zero { stroke: var(--ink-3); stroke-width: 1; }
.gr-liga { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.gr-eixo { font-size: 10px; fill: var(--ink-3); font-family: var(--font); }
.gr-eixo.forte { fill: var(--ink); font-weight: 700; }
.gr-valor { font-size: 10.5px; fill: var(--ink-2); font-family: var(--mono); font-weight: 600; }
.gr-valor.neg { fill: var(--vermelho); }
.gr-barra { transition: opacity .12s ease; }
.gr-barra:hover { opacity: .8; }
.gr-barra.clicavel { cursor: pointer; }
.gr-area { fill: color-mix(in srgb, var(--chart-1) 14%, transparent); }
.gr-linha { stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gr-hit { fill: transparent; }
.gr-hit:hover { fill: color-mix(in srgb, var(--chart-1) 35%, transparent); }
.gr-min { fill: var(--vermelho); stroke: var(--bg); stroke-width: 2; }

/* ===== V3.5 — página de módulo, dica de 1ª visita, crumbs com link, cabeçalho do grupo ===== */
.crumbs a { color: inherit; text-decoration: none; border-bottom: 1px dotted transparent; }
.crumbs a:hover { color: var(--petroleo); border-bottom-color: currentColor; }
.g-toggle .g-link { flex: 1; color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-toggle .g-link:hover { color: var(--rail-ink); text-decoration: none; }
.g-chev { background: none; border: 0; cursor: pointer; color: var(--rail-ink-2); padding: 2px 4px; margin: -2px -4px; font: inherit; border-radius: 4px; }
.g-chev:hover { color: var(--rail-ink); background: var(--rail-2); }
.g-chev i { font-size: 10px; transition: .12s; }
html.menu-collapsed .g-chev { display: none; }
.mod-h1-ico { color: var(--petroleo); font-size: 19px; margin-right: 4px; vertical-align: -2px; }
.mod-sec { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin: 18px 0 8px; }
.mod-sec:first-of-type { margin-top: 6px; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-bottom: 6px; }
.mod-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.mod-card:hover { border-color: var(--petroleo); transform: translateY(-1px); text-decoration: none; color: var(--ink); }
.mod-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--petroleo-50); color: var(--petroleo); display: grid; place-items: center; font-size: 17px; flex: none; }
.mod-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.mod-t { font-weight: 700; font-size: 13.5px; letter-spacing: -.01em; }
.mod-d { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.mod-chev { color: var(--ink-3); align-self: center; }
a.kpi, a.kpi:hover { text-decoration: none; color: inherit; }
.dica-tela { display: flex; align-items: center; gap: 12px; padding: 8px 14px; margin-bottom: 12px; background: var(--petroleo-50); border: 1px solid var(--border); border-left: 3px solid var(--petroleo); border-radius: var(--r-lg); font-size: 12.5px; color: var(--ink-2); }
.dica-tela .dica-ico { color: var(--petroleo); font-size: 15px; }
.dica-tela b { color: var(--ink); }
.dica-tela .spacer { flex: 1; }
.dica-tela a { color: var(--petroleo); font-weight: 600; text-decoration: none; white-space: nowrap; }
.saldo-contas td, .saldo-contas th { padding: 7px 10px; }
.mxm { display: flex; flex-direction: column; gap: 10px; }
.mxm-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; }
.mxm-l { font-size: 12.5px; color: var(--ink-2); }
.mxm-v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.mxm-a { font-size: 11px; color: var(--ink-3); }

/* ---- BuscaBox: campo de pesquisa sob comando (Enter ou lupa) ---- */
.busca-box.input { display: inline-flex; align-items: center; padding: 0 0 0 10px; gap: 0; min-width: 160px; }
.busca-box.input:focus-within { border-color: var(--petroleo); box-shadow: 0 0 0 3px var(--petroleo-50); }
.busca-box input, .field .busca-box input {
    flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent;
    font: inherit; color: inherit; outline: none; box-shadow: none;
}
.busca-box input:focus, .field .busca-box input:focus { border: 0; box-shadow: none; }
.busca-box .busca-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 100%; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--border);
    border-radius: 0 var(--r) var(--r) 0; background: transparent; color: var(--ink-2); cursor: pointer; transition: .12s;
}
.busca-box .busca-btn:hover { background: var(--petroleo-50); color: var(--petroleo); }
.busca-box .busca-btn i { font-size: 14px; }

/* ============================================================================
   K9 — Portal do cliente (página pública, sem shell)
   ========================================================================== */
.portal { min-height: 100vh; background: var(--surface); color: var(--ink); font-size: 14px; }
.portal-wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }
.portal-top { background: var(--rail); color: #fff; border-bottom: 3px solid var(--cobre); }
.portal-top-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; flex-wrap: wrap; }
.portal-emp { font-family: var(--display); font-weight: 750; font-size: 22px; letter-spacing: -.01em; }
.portal-sub { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--rail-ink); opacity: .85; margin-top: 2px; }
.portal-quem { font-size: 13px; color: #fff; opacity: .95; }
.portal-msg { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--r); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.portal-msg.ok { background: var(--verde-50); color: var(--verde-700); }
.portal-msg.err { background: var(--vermelho-50); color: var(--vermelho); }
.portal-msg.info { background: var(--petroleo-50); color: var(--petroleo); }
.portal-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.portal-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.portal-kpi span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.portal-kpi b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.portal-kpi small { font-size: 12px; color: var(--ink-3); }
.portal-kpi.neg b { color: var(--vermelho); }
.portal-kpi.pos b { color: var(--verde-700); }
.portal-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 14px; }
.portal-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.portal-card h2 i { color: var(--petroleo); }
.portal-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.portal-tbl-wrap { overflow-x: auto; }
.portal-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.portal-tbl th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.portal-tbl td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.portal-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.portal-tbl tr.row-neg td { background: color-mix(in srgb, var(--vermelho-50) 60%, transparent); }
.portal-tbl tr.row-off td { opacity: .55; }
.portal-tbl .acoes { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.portal-tbl .mono, .portal .mono { font-family: var(--mono); font-size: 12px; }
.portal .chave { word-break: break-all; font-size: 12px; }
.portal-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--petroleo-50); color: var(--petroleo); white-space: nowrap; }
.portal-badge.neg { background: var(--vermelho-50); color: var(--vermelho); }
.portal-badge.warn { background: #fff4e0; color: #9a5b00; }
.portal-badge.pos { background: var(--verde-50); color: var(--verde-700); }
.portal-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--petroleo); background: var(--petroleo); color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.portal-btn:hover { filter: brightness(1.08); }
.portal-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.portal-btn.ghost { background: transparent; color: var(--petroleo); }
.portal-det { display: inline-block; position: relative; }
.portal-det summary { list-style: none; }
.portal-det summary::-webkit-details-marker { display: none; }
.portal-inline { display: flex; gap: 6px; margin-top: 6px; }
.portal-inline input { height: 28px; border: 1px solid var(--border); border-radius: var(--r); padding: 0 8px; font-size: 12px; min-width: 220px; }
.portal-form { display: flex; flex-direction: column; gap: 8px; }
.portal-form textarea { border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical; }
.portal-form .portal-btn { align-self: flex-start; }
.portal-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.portal-lista small { color: var(--ink-3); margin-left: 6px; }
.portal-muted { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 0; }
.portal-grid3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; margin-bottom: 14px; }
.portal-grid3 > div { display: flex; flex-direction: column; gap: 2px; }
.portal-grid3 span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.portal-grid3 small { font-size: 12px; color: var(--ink-3); }
.portal-totais { display: flex; justify-content: flex-end; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.portal-totais > div { display: flex; flex-direction: column; align-items: flex-end; }
.portal-totais span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.portal-totais b { font-variant-numeric: tabular-nums; }
.portal-totais .tot b { font-size: 18px; color: var(--petroleo); }
.portal-vazio { text-align: center; padding: 48px 20px; margin-top: 40px; }
.portal-vazio i { font-size: 34px; color: var(--petroleo); }
.portal-vazio h2 { justify-content: center; }
.portal-foot { font-size: 11.5px; color: var(--ink-3); text-align: center; margin-top: 18px; }
@media (max-width: 860px) { .portal-kpis { grid-template-columns: 1fr 1fr; } .portal-2col, .portal-grid3 { grid-template-columns: 1fr; } .portal-tbl .acoes { flex-wrap: wrap; } }
.portal-select, .portal-form input[type="text"], .portal-form input:not([type]) { height: 36px; border: 1px solid var(--border); border-radius: var(--r); padding: 0 10px; font: inherit; font-size: 13px; background: var(--bg); color: var(--ink); }
.portal-form input[type="file"] { font-size: 13px; color: var(--ink-2); }
.portal-form input[type="file"]::file-selector-button { height: 32px; margin-right: 10px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--petroleo); background: transparent; color: var(--petroleo); font-weight: 600; cursor: pointer; }
\n
.portal-acordo { border: 2px solid var(--cobre); }
.portal-acordo-acoes { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.portal-destaque { font-size: 20px; color: var(--petroleo); }

.mural-item { padding: 8px 10px; border-radius: var(--r); margin: 6px 0; border-left: 3px solid var(--border); background: var(--surface-2); }
.mural-item.lado-contador { border-left-color: var(--cobre); }
.mural-item.lado-financeiro { border-left-color: var(--petroleo); }

/* ---- PlanoSelect: conta do plano com busca (código ou nome), lista flutuante estilo palette ---- */
.psel { position: relative; }
.psel-box.input { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 9px; }
.psel-box.input.input-sm { padding: 0 4px 0 7px; }
.psel-box > i { color: var(--ink-3); font-size: 12px; flex: none; }
.psel-box.tem > i { color: var(--petroleo); }
.psel-box input, .field .psel-box input {
    flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent;
    font: inherit; color: inherit; outline: none; box-shadow: none; text-overflow: ellipsis;
}
.psel-box input:focus, .field .psel-box input:focus { border: 0; box-shadow: none; }
.psel-box:focus-within { border-color: var(--petroleo); box-shadow: 0 0 0 3px var(--petroleo-50); }
.psel-x { flex: none; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 0 2px; line-height: 1; font-size: 11px; }
.psel-x:hover { color: var(--vermelho); }
.psel-lista {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 80; min-width: 280px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 4px;
}
.psel-lista .pal-item { display: flex; align-items: baseline; gap: 10px; padding: 5px 8px 5px 10px; font-size: 13px; white-space: nowrap; }
.psel-lista .pal-item .pal-texto { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.psel-lista .pal-item > i { width: auto; color: var(--petroleo); }
.psel-cod { flex: none; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--petroleo-700); min-width: 62px; }
.psel-grp {
    font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
    padding: 8px 8px 3px; margin-top: 4px; border-top: 1px solid var(--border);
}
.psel-grp.first { border-top: 0; margin-top: 0; padding-top: 4px; }
.psel-lista .pal-item.atual .pal-texto { font-weight: 600; }
.psel-lista .pal-vazio { padding: 10px 8px; }

/* ---- Fiscal do Mês: esteira de passos ---- */
.esteira { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.passo {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); cursor: pointer;
}
.passo:hover { border-color: var(--petroleo); }
.passo.on { border-color: var(--petroleo); box-shadow: 0 0 0 3px var(--petroleo-50); }
.passo-n { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; font-family: var(--mono); }
.passo-t { font-weight: 600; font-size: 13px; }
.passo-s { font-size: 11.5px; color: var(--ink-3); }
.passo.st-ok .passo-n { background: var(--verde-50); color: var(--verde-700); }
.passo.st-ok .passo-s { color: var(--verde-700); }
.passo.st-crit .passo-n { background: var(--vermelho-50); color: var(--vermelho); }
.passo.st-crit .passo-s { color: var(--vermelho); font-weight: 600; }
.passo.st-pend .passo-n { background: var(--ambar-50); color: var(--ambar); }
.passo.st-pend .passo-s { color: var(--ambar); font-weight: 600; }
.passo.st-neutro .passo-n { background: var(--petroleo-50); color: var(--petroleo-700); }
.chip-pend { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 12.5px; cursor: pointer; }
.chip-pend.is-neg { border-color: var(--vermelho); color: var(--vermelho); }
.chip-pend.is-warn { border-color: var(--ambar); color: var(--ambar); }
.chip-pend.is-pos { color: var(--verde-700); }
.chip-pend.on { box-shadow: 0 0 0 3px var(--petroleo-50); border-color: var(--petroleo); }
