/* Overrides globais controlados por Configuracoes > Aparencia. */

:root {
  --prolar-button-bg: #fff8ef;
  --prolar-button-text: #202829;
  --prolar-button-border: var(--prolar-border, #a9c9c2);
  --prolar-button-primary-bg: var(--prolar-red, #58A171);
  --prolar-button-primary-text: #ffffff;
  --prolar-table-row-odd: #ffffff;
  --prolar-table-row-even: #f2fbf6;
  --prolar-table-text: var(--prolar-text, #202829);
  --prolar-table-hover: #fff4bf;
  --prolar-table-border: var(--prolar-border, #a9c9c2);
  --prolar-table-header-bg: var(--prolar-red, #58A171);
  --prolar-table-header-text: #ffffff;
  --prolar-table-header-separator: var(--prolar-table-border, #a9c9c2);
  --prolar-table-sorted-bg: #2f3f39;
  --prolar-table-sorted-text: #ffffff;
  --prolar-page-title-text: #ffffff;
  --prolar-page-subtitle-text: #ffffff;
}

main [class$="-header"] h1,
main [class*="-header "] h1,
main [class$="-header"] h2,
main [class*="-header "] h2 {
  color: var(--prolar-page-title-text) !important;
}

main [class$="-header"] p,
main [class*="-header "] p {
  color: var(--prolar-page-subtitle-text) !important;
  opacity: 1 !important;
}

button[class^="btn-"]:not(.shell-menu-button):not(.shell-shortcut),
button[class*=" btn-"]:not(.shell-menu-button):not(.shell-shortcut),
body.modulo-compras .pagina button:not(.shell-menu-button):not(.shell-shortcut),
body.modulo-compras .compras-modal button,
body.modulo-compras .revisao-pedido-acoes button,
body.modulo-compras .compras-pedido-local-acoes button {
  background: var(--prolar-button-bg) !important;
  background-image: none !important;
  border-color: var(--prolar-button-border) !important;
  color: var(--prolar-button-text) !important;
  box-shadow: none !important;
}

button[class^="btn-"].primario:not(.shell-menu-button),
button[class*=" btn-"].primario:not(.shell-menu-button),
button[class^="btn-"].salvo:not(.shell-menu-button),
button[class*=" btn-"].salvo:not(.shell-menu-button),
body.modulo-compras .pagina button.primario,
body.modulo-compras .pagina button[data-revisao-confirmar],
body.modulo-compras .pagina button#btnExibir,
body.modulo-compras .pagina button.btnExibir,
body.modulo-compras .pagina button.btnSalvarLinha,
body.modulo-compras .botoes-relatorio-compras button:last-child {
  background: var(--prolar-button-primary-bg) !important;
  background-image: none !important;
  border-color: var(--prolar-button-primary-bg) !important;
  color: var(--prolar-button-primary-text) !important;
}

button[class^="btn-"]:not(.shell-menu-button):not(.shell-shortcut):hover,
button[class*=" btn-"]:not(.shell-menu-button):not(.shell-shortcut):hover,
body.modulo-compras .pagina button:not(.shell-menu-button):not(.shell-shortcut):hover {
  filter: brightness(0.97) !important;
}

html[data-theme="grafite"] body.modulo-compras {
  --compras-row-white: var(--prolar-table-row-odd);
  --compras-row-red: var(--prolar-table-row-even);
  --compras-row-hover: var(--prolar-table-hover);
  --compras-border: var(--prolar-table-border);
  --compras-border-dark: var(--prolar-table-border);
  --compras-text: var(--prolar-table-text);
  --compras-red: var(--prolar-table-header-bg);
  --compras-red-dark: var(--prolar-table-header-bg);
}

main table:not(.preview-table) thead th,
body.modulo-compras .janela-tabela thead th,
body.modulo-compras .pendentes-tabela thead th {
  background: var(--prolar-table-header-bg) !important;
  border-color: var(--prolar-table-header-separator) !important;
  border-right-color: var(--prolar-table-header-separator) !important;
  color: var(--prolar-table-header-text) !important;
  box-shadow:
    inset -1px 0 0 var(--prolar-table-header-separator),
    inset 0 -1px 0 var(--prolar-table-header-separator) !important;
}

main table:not(.preview-table) thead th *,
body.modulo-compras .janela-tabela thead th *,
body.modulo-compras .pendentes-tabela thead th * {
  color: var(--prolar-table-header-text) !important;
}

main table:not(.preview-table) thead th.ordenacao-ativa,
main table:not(.preview-table) thead th[aria-sort="ascending"],
main table:not(.preview-table) thead th[aria-sort="descending"],
body.modulo-compras .janela-tabela thead th.ordenacao-ativa,
body.modulo-compras .janela-tabela thead th[aria-sort="ascending"],
body.modulo-compras .janela-tabela thead th[aria-sort="descending"],
body.modulo-compras .pendentes-tabela thead th.ordenacao-ativa,
body.modulo-compras .pendentes-tabela thead th[aria-sort="ascending"],
body.modulo-compras .pendentes-tabela thead th[aria-sort="descending"] {
  background: var(--prolar-table-sorted-bg) !important;
  border-color: var(--prolar-table-header-separator) !important;
  color: var(--prolar-table-sorted-text) !important;
  box-shadow:
    inset -1px 0 0 var(--prolar-table-header-separator),
    inset 0 -1px 0 var(--prolar-table-header-separator),
    0 2px 0 var(--prolar-table-sorted-bg) !important;
}

main table:not(.preview-table) thead th.ordenacao-ativa *,
main table:not(.preview-table) thead th[aria-sort="ascending"] *,
main table:not(.preview-table) thead th[aria-sort="descending"] *,
body.modulo-compras .janela-tabela thead th.ordenacao-ativa *,
body.modulo-compras .janela-tabela thead th[aria-sort="ascending"] *,
body.modulo-compras .janela-tabela thead th[aria-sort="descending"] *,
body.modulo-compras .pendentes-tabela thead th.ordenacao-ativa *,
body.modulo-compras .pendentes-tabela thead th[aria-sort="ascending"] *,
body.modulo-compras .pendentes-tabela thead th[aria-sort="descending"] * {
  color: var(--prolar-table-sorted-text) !important;
}

main table:not(.preview-table) thead th.ordenacao-ativa .th-sort,
main table:not(.preview-table) thead th[aria-sort="ascending"] .th-sort,
main table:not(.preview-table) thead th[aria-sort="descending"] .th-sort,
body.modulo-compras .janela-tabela thead th.ordenacao-ativa .th-sort,
body.modulo-compras .janela-tabela thead th[aria-sort="ascending"] .th-sort,
body.modulo-compras .janela-tabela thead th[aria-sort="descending"] .th-sort {
  background: var(--prolar-table-sorted-bg) !important;
  color: var(--prolar-table-sorted-text) !important;
}

main table:not(.preview-table) tbody tr:nth-child(odd),
main table:not(.preview-table) tbody tr:nth-child(odd) > td,
body.modulo-compras .janela-tabela tbody tr:nth-child(odd) td,
body.modulo-compras .pendentes-tabela tbody tr:nth-child(odd) td {
  background: var(--prolar-table-row-odd) !important;
  color: var(--prolar-table-text) !important;
}

main table:not(.preview-table) tbody tr:nth-child(even),
main table:not(.preview-table) tbody tr:nth-child(even) > td,
body.modulo-compras .janela-tabela tbody tr:nth-child(even) td,
body.modulo-compras .pendentes-tabela tbody tr:nth-child(even) td {
  background: var(--prolar-table-row-even) !important;
  color: var(--prolar-table-text) !important;
}

main table:not(.preview-table) tbody tr:hover,
main table:not(.preview-table) tbody tr:hover > td,
body.modulo-compras .janela-tabela tbody tr:hover td,
body.modulo-compras .janela-tabela tbody tr.linha-selecionada td,
body.modulo-compras .pendentes-tabela tbody tr:hover td {
  background: var(--prolar-table-hover) !important;
}

main table:not(.preview-table) td,
main table:not(.preview-table) th,
body.modulo-compras .janela-tabela td,
body.modulo-compras .janela-tabela th,
body.modulo-compras .pendentes-tabela td,
body.modulo-compras .pendentes-tabela th {
  border-color: var(--prolar-table-border) !important;
}

main table:not(.preview-table) thead th,
body.modulo-compras .janela-tabela thead th,
body.modulo-compras .pendentes-tabela thead th {
  border-color: var(--prolar-table-header-separator) !important;
  border-right-color: var(--prolar-table-header-separator) !important;
  box-shadow:
    inset -1px 0 0 var(--prolar-table-header-separator),
    inset 0 -1px 0 var(--prolar-table-header-separator) !important;
}

main table:not(.preview-table) thead th.ordenacao-ativa,
main table:not(.preview-table) thead th[aria-sort="ascending"],
main table:not(.preview-table) thead th[aria-sort="descending"],
body.modulo-compras .janela-tabela thead th.ordenacao-ativa,
body.modulo-compras .janela-tabela thead th[aria-sort="ascending"],
body.modulo-compras .janela-tabela thead th[aria-sort="descending"],
body.modulo-compras .pendentes-tabela thead th.ordenacao-ativa,
body.modulo-compras .pendentes-tabela thead th[aria-sort="ascending"],
body.modulo-compras .pendentes-tabela thead th[aria-sort="descending"] {
  box-shadow:
    inset -1px 0 0 var(--prolar-table-header-separator),
    inset 0 -1px 0 var(--prolar-table-header-separator),
    0 2px 0 var(--prolar-table-sorted-bg) !important;
}

/* As janelas fiscais usam cabecalho claro; mantenha o texto legivel. */
main .xml-previa-card > .xml-detalhe-header h2,
main .xml-vinculos-card > .xml-detalhe-header h2 {
  color: var(--modelo2-primary-dark, #2f6f4b) !important;
}

main .xml-previa-card > .xml-detalhe-header p,
main .xml-vinculos-card > .xml-detalhe-header p {
  color: #4f6259 !important;
}

/* As diferenças de custo são alertas e precisam prevalecer sobre o zebrado global. */
main .xml-previa-tabela tbody td.xml-custo-diferenca.custo-dif-maior {
  background: #ffe2df !important;
  color: #a11212 !important;
}

main .xml-previa-tabela tbody td.xml-custo-diferenca.custo-dif-menor {
  background: #dff5e7 !important;
  color: #087234 !important;
}

main .xml-previa-tabela tbody td.xml-custo-diferenca.custo-dif-igual {
  background: #fff4bf !important;
  color: #785400 !important;
}

main .xml-previa-tabela tbody td.xml-custo-diferenca strong {
  color: inherit !important;
}

main .faturamento-tabela tbody tr.faturamento-linha-excesso > td.faturamento-quantidade-excesso {
  background: #ffe3e3 !important;
  color: #981f1f !important;
}

main .faturamento-tabela tbody tr.faturamento-linha-excesso > td.faturamento-quantidade-excesso small {
  color: #981f1f !important;
}
