/* Tema Moderno 2026 - compatível com layout legado */

:root {
  --mod-bg-1: #f4f7fb;
  --mod-bg-2: #eef3f9;
  --mod-card: #ffffff;
  --mod-borda: #d7e1ee;
  --mod-texto: #18212f;
  --mod-muted: #5a6b82;
  --mod-primaria: #1f6fb2;
  --mod-primaria-2: #195f99;
  --mod-ok: #1d8b4f;
  --mod-aviso: #c98214;
  --mod-erro: #be2f3a;
  --mod-sombra: 0 12px 28px rgba(17, 39, 65, 0.12);
}

html {
  background: linear-gradient(180deg, var(--mod-bg-1) 0%, var(--mod-bg-2) 100%);
  color: var(--mod-texto);
}

body {
  background: radial-gradient(circle at 100% -10%, rgba(35, 122, 191, 0.10), transparent 40%),
              radial-gradient(circle at 0% 0%, rgba(17, 94, 89, 0.07), transparent 35%);
  color: var(--mod-texto);
}

#tudo {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 1440px;
  width: calc(100% - 24px);
}

/* Tipografia mais legível */
html, body, table, input, select, textarea, button {
  font-family: "Trebuchet MS", "Segoe UI", Verdana, Tahoma, sans-serif;
}

/* Campos */
html * input,
html * select,
html * textarea {
  border: 1px solid #b8c6d9;
  border-radius: 8px;
  padding: 0.35ex 0.50em;
  background: #ffffff;
  color: #18212f;
  transition: border-color .15s ease, box-shadow .15s ease;
}

html * input:focus,
html * select:focus,
html * textarea:focus {
  border-color: #267ac8;
  box-shadow: 0 0 0 3px rgba(38, 122, 200, 0.18);
  outline: none;
}

#itens * input[readonly],
#itens * select[readonly],
#itens * textarea[readonly],
#itens * input[disabled],
#itens * select[disabled],
#itens * textarea[disabled],
.lancamento_soma * input[readonly],
.lancamento_soma * select[readonly],
.lancamento_soma * textarea[readonly],
.lancamento_soma * input[disabled],
.lancamento_soma * select[disabled],
.lancamento_soma * textarea[disabled],
html * input[readonly],
html * select[readonly],
html * textarea[readonly],
html * input[disabled],
html * select[disabled],
html * textarea[disabled] {
  border: 1px solid #d6deea;
  background: #f4f7fb;
  color: #53637a;
}

/* Cartões principais */
.ui-widget-content.ui-corner-all {
  background: var(--mod-card);
  border: 1px solid var(--mod-borda);
  border-radius: 12px;
  box-shadow: var(--mod-sombra);
}

.ui-widget-header {
  border: 1px solid #d3deee;
  background: linear-gradient(180deg, #f8fbff 0%, #e9f1fb 100%);
  color: #17253a;
}

body.tema-moderno .ui-widget-header.opc {
  border: 1px solid #4297d7 !important;
  background: #2191c0 !important;
  color: #eaf5f7 !important;
  font-weight: bold;
  margin-top: 8px;
  margin-bottom: 8px;
}

body.tema-moderno .ui-widget-header.opc h2,
body.tema-moderno .ui-widget-header.opc a {
  color: #eaf5f7 !important;
}

body.tema-moderno .ui-widget-header.opc .ui-button,
body.tema-moderno .ui-widget-header.opc .botao {
  border: 1px solid #77d5f7 !important;
  background: #0078ae !important;
  color: #ffffff !important;
  opacity: 1 !important;
  filter: none !important;
  box-shadow: none !important;
}

body.tema-moderno .ui-widget-header.opc .ui-button .ui-button-text,
body.tema-moderno .ui-widget-header.opc .botao {
  color: #ffffff !important;
}

body.tema-moderno .ui-widget-header.opc .ui-button:hover,
body.tema-moderno .ui-widget-header.opc .botao:hover,
body.tema-moderno .ui-widget-header.opc .ui-state-hover {
  border: 1px solid #448dae !important;
  background: #79c9ec !important;
  color: #026890 !important;
}

/* Header/Menu */
.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--mod-borda);
  border-radius: 12px;
  padding: 6px !important;
  background: #f7fafe;
  box-shadow: 0 4px 14px rgba(15, 37, 61, 0.08);
}

/* Menu principal: manter card branco */
body.tema-moderno #menu_principal ul.menu.ui-menu.ui-widget.ui-widget-content.ui-corner-all {
  background: #ffffff !important;
  border: 1px solid #c8d5e6 !important;
  box-shadow: none !important;
  border-radius: 12px !important;
  margin: 0 !important;
}

.menu > li > a {
  border-radius: 8px;
}

body.tema-moderno #menu_principal_botao {
  align-self: center;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body.tema-moderno #menu_principal_botao > a {
  display: inline-flex;
  align-items: center;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transform: none !important;
}

body.tema-moderno #menu_principal_botao > a:hover {
  box-shadow: none !important;
  transform: none !important;
}

body.tema-moderno #menu_principal {
  top: 110px;
  left: 12px;
  height: 50px;
  display: flex;
  align-items: center;
}

body.tema-moderno #menu_principal > div {
  margin: 0 !important;
  padding: 0 !important;
}

/* Abas, estados e destaques */
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
  border: 1px solid #c0cedf;
  background: linear-gradient(180deg, #ffffff 0%, #edf3fa 100%);
  color: #1d2b3f;
}

.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
  border: 1px solid #9fb6d4;
  background: linear-gradient(180deg, #ffffff 0%, #e6eef8 100%);
  color: #13243b;
}

.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
  border: 1px solid #6f95c3;
  background: linear-gradient(180deg, #267ac8 0%, #1e659f 100%);
  color: #ffffff;
}

/* Botões */
.botao,
.botao_mini,
a.botao,
a.botao_mini {
  border-radius: 8px !important;
}

.ui-button,
.ui-widget button {
  border-radius: 8px;
  transition: transform .12s ease, box-shadow .12s ease;
}

.ui-button:hover,
.ui-widget button:hover {
  transform: translateY(-1px);
}

/* Links */
a {
  color: #1e659f;
}

a:hover {
  color: #174e7a;
}

/* Elementos do sistema */
a.botao2 div {
  color: #1b2a40;
  border-radius: 9px;
  transition: background .2s ease, color .2s ease;
}

a.botao2:hover {
  text-decoration: none;
}

a.botao2:hover div {
  background: #e8f1fb;
  color: #113b61;
}

.meu_usuario {
  background: #e9f2fd;
  color: #0f2841;
}

/* Login */
#login2 {
  background: transparent;
}

#login2 h1 {
  padding-top: 1.5ex;
}

/* DataTables: mantém leitura clara */
table.display thead th,
table.dataTable thead th {
  background: linear-gradient(180deg, #f9fbff 0%, #e8eff9 100%);
  color: #1d2b3f;
  border-bottom: 1px solid #c8d5e6;
}

table.display tbody tr:nth-child(even),
table.dataTable tbody tr:nth-child(even) {
  background: #f8fbff;
}

/* DataTables legado (evita listras violetas de tr.odd/even e sorting_*) */
body.tema-moderno .crud-datatable-wrapper table.display tr.odd,
body.tema-moderno .crud-datatable-wrapper table.display tr.odd td,
body.tema-moderno .crud-datatable-wrapper table.display tr.odd td.sorting_1,
body.tema-moderno .crud-datatable-wrapper table.display tr.odd td.sorting_2,
body.tema-moderno .crud-datatable-wrapper table.display tr.odd td.sorting_3 {
  background-color: #edf5ff !important;
}

body.tema-moderno .crud-datatable-wrapper table.display tr.even,
body.tema-moderno .crud-datatable-wrapper table.display tr.even td,
body.tema-moderno .crud-datatable-wrapper table.display tr.even td.sorting_1,
body.tema-moderno .crud-datatable-wrapper table.display tr.even td.sorting_2,
body.tema-moderno .crud-datatable-wrapper table.display tr.even td.sorting_3 {
  background-color: #f8fbff !important;
}

table.display tbody tr:hover,
table.dataTable tbody tr:hover {
  background: #e4e7ec;
}

body.tema-moderno .crud-datatable-wrapper table.display tbody tr:hover td,
body.tema-moderno .crud-datatable-wrapper table.display tbody tr:hover td.sorting_1,
body.tema-moderno .crud-datatable-wrapper table.display tbody tr:hover td.sorting_2,
body.tema-moderno .crud-datatable-wrapper table.display tbody tr:hover td.sorting_3 {
  background-color: #e4e7ec !important;
}

table.display td,
table.display th,
table.dataTable td,
table.dataTable th {
  padding-top: 8px;
  padding-bottom: 8px;
}

.ui-widget-content,
.ui-widget-header,
.ui-state-highlight,
.ui-state-error {
  border-radius: 10px;
}

.ui-state-highlight {
  border: 1px solid #bddfca !important;
  background: #ebfaf1 !important;
  color: #155a32 !important;
}

.ui-state-error {
  border: 1px solid #e6b8be !important;
  background: #fff3f5 !important;
  color: #7d1f28 !important;
}

body.tema-moderno .ui-widget-content.faixa-menu {
  height: 50px;
  overflow: hidden;
  display: block;
  width: 100%;
}

body.tema-moderno .ui-widget-content.mini-topo-usuario {
  margin-top: 0;
  margin-bottom: 6px;
  border: 1px solid #c7d6ea;
  box-shadow: none;
  background: linear-gradient(180deg, #f6f9fe 0%, #e8f1fb 100%) !important;
}

body.tema-moderno .mini-topo-usuario-inner {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  min-height: 30px;
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-link {
  font-size: 11px;
  line-height: 1;
  padding: .18em .20em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #1d4268;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-link:hover {
  color: #0f5c93;
  text-decoration: underline;
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-link .ui-icon {
  margin: 0;
  float: none;
  transform: scale(.88);
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-usuario-nome {
  display: inline-flex;
  align-items: center;
  font-weight: bold;
  color: #163a5d;
  margin-right: 3px;
  font-size: 11px;
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-link-sair {
  font-weight: bold;
  color: #a13a3a;
}

body.tema-moderno .mini-topo-usuario-inner .mini-topo-link-sair:hover {
  color: #7d1f28;
}

body.tema-moderno .ui-widget-content.faixa-menu > div {
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding-right: 10px;
}

body.tema-moderno .faixa-menu-inner {
  min-height: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  box-sizing: border-box;
}

body.tema-moderno .faixa-menu-links {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  height: 100%;
  align-items: center;
  align-content: center;
  justify-content: flex-end;
  gap: 6px;
}

body.tema-moderno .faixa-menu-links > * {
  float: none !important;
  margin: 0 !important;
}

body.tema-moderno .faixa-menu-links a.botao2 {
  display: inline-flex;
  height: 100%;
  align-items: center;
  text-decoration: none;
}

body.tema-moderno .faixa-menu-links a.botao2 > div {
  float: none !important;
  display: inline-flex;
  height: 100%;
  align-items: center;
  align-content: center;
  margin: 0 !important;
  padding: 0 .50em !important;
  line-height: 1 !important;
}

body.tema-moderno .faixa-menu-user {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

body.tema-moderno .faixa-menu-user .meu_usuario {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .45em .65em;
}

body.tema-moderno .faixa-menu-user .ui-icon {
  float: none !important;
  margin: 0 !important;
}

/* CRUD moderno */
.crud-toolbar {
  position: sticky;
  top: 8px;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  margin: 0 0 8px 0;
  border: 1px solid var(--mod-borda);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(2px);
  box-shadow: 0 6px 16px rgba(12, 36, 58, 0.08);
}

body.tema-moderno .ui-widget-header.opc .crud-toolbar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  top: 0;
}

.crud-toolbar > .crud-toolbar-item {
  float: none !important;
}

.crud-filtros-wrap {
  border: 1px solid var(--mod-borda);
  border-radius: 10px;
  padding: 6px;
  margin-bottom: 10px;
  background: #fff;
}

.crud-filtros-form {
  margin: 0 !important;
}

.crud-filtros-linha {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 6px;
  overflow: hidden;
}

.crud-filtros-linha > div {
  float: none !important;
  flex: 0 0 auto;
}

.crud-filtros-titulo {
  font-weight: 700;
  color: #22374d;
  margin-right: 6px;
}

.crud-filtro-item {
  border: 1px solid #e3eaf4;
  border-radius: 8px;
  background: #f9fbfe;
}

.crud-filtro-conteudo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crud-filtro-label {
  float: none !important;
  margin: 0 !important;
  font-weight: 600;
  color: #3b4e66;
  white-space: nowrap;
}

.crud-filtro-input {
  float: none !important;
}

.crud-filtro-input input,
.crud-filtro-input select {
  min-width: 120px;
}

.crud-filtros-acao {
  float: none !important;
}

.crud-campos-toggle {
  margin-left: 8px;
  padding-top: 0 !important;
  flex: 0 0 auto;
  white-space: nowrap;
}

.crud-filtros-acao .botao,
.crud-campos-toggle #selecionar_campos {
  display: inline-block;
  white-space: nowrap;
}

.crud-filtros-acao .crud-icone-acao {
  min-width: 34px;
  width: 34px;
  height: 30px;
  padding: 0 !important;
  line-height: 30px;
  text-align: center;
  box-sizing: border-box;
}

.crud-filtros-acao .crud-icone-acao .ui-icon {
  margin: 0 auto;
}

.crud-campos-toggle #selecionar_campos {
  font-size: 18px !important;
  font-weight: bold;
  padding-left: 0.45em !important;
  padding-right: 0.45em !important;
}

.crud-tabela-wrap {
  padding-top: 2px !important;
}

.crud-datatable-wrapper {
  border: 1px solid var(--mod-borda);
  border-radius: 10px;
  overflow-x: hidden;
  overflow-y: hidden;
  background: #fff;
  box-shadow: 0 6px 20px rgba(17, 40, 67, 0.08);
  -webkit-overflow-scrolling: touch;
}

.crud-datatable-wrapper table.crud-table {
  min-width: 100%;
  width: 100% !important;
  table-layout: fixed;
}

.crud-datatable-wrapper .dataTables_wrapper {
  min-width: 0;
  background: #f6fafe;
}

.crud-datatable-wrapper .dataTables_wrapper .dataTables_length,
.crud-datatable-wrapper .dataTables_wrapper .dataTables_filter {
  background: transparent !important;
}

body.tema-moderno .crud-datatable-wrapper .top,
body.tema-moderno .crud-datatable-wrapper .bottom {
  background: #f6fafe !important;
  border: 0 !important;
}

body.tema-moderno .crud-datatable-wrapper table.display thead th,
body.tema-moderno .crud-datatable-wrapper table.display thead th.sorting,
body.tema-moderno .crud-datatable-wrapper table.display thead th.sorting_asc,
body.tema-moderno .crud-datatable-wrapper table.display thead th.sorting_desc,
body.tema-moderno .crud-datatable-wrapper table.display thead th.sorting_asc_disabled,
body.tema-moderno .crud-datatable-wrapper table.display thead th.sorting_desc_disabled {
  background-color: #f6fafe !important;
}

.crud-datatable-wrapper table.crud-table th,
.crud-datatable-wrapper table.crud-table td {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.crud-datatable-wrapper .dataTables_filter,
.crud-datatable-wrapper .dataTables_length,
.crud-datatable-wrapper .dataTables_info,
.crud-datatable-wrapper .dataTables_paginate {
  padding: 8px 10px;
}

.crud-datatable-wrapper .dataTables_filter,
.crud-datatable-wrapper .dataTables_length {
  background: #f6fafe;
}

.crud-datatable-wrapper .dataTables_info,
.crud-datatable-wrapper .dataTables_paginate {
  background: #fbfdff;
  border-top: 1px solid #e2eaf5;
}

.crud-dt-search {
  min-width: 260px;
}

.crud-dt-length {
  min-width: 70px;
}

.crud-datatable-wrapper .paging_full_numbers a.paginate_button,
.crud-datatable-wrapper .paging_full_numbers a.paginate_active {
  border-radius: 7px !important;
  border: 1px solid #c7d5e8 !important;
  background: #fff !important;
  color: #244160 !important;
  margin: 0 2px !important;
}

.crud-datatable-wrapper .paging_full_numbers a.paginate_active {
  border-color: #1f6fb2 !important;
  background: #1f6fb2 !important;
  color: #fff !important;
}

.crud-acoes-moderno {
  display: none;
  position: relative;
}

body.tema-moderno .crud-acoes-classico {
  display: none;
}

body.tema-moderno .crud-acoes-moderno {
  display: inline-block;
}

body.tema-moderno .crud-acao-toggle {
  border-radius: 8px !important;
}

body.tema-moderno .crud-acao-menu {
  position: absolute;
  right: 0;
  top: 24px;
  min-width: 152px;
  z-index: 80;
  background: #fff;
  border: 1px solid #cfdcec;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(16, 36, 58, 0.18);
  padding: 4px;
}

body.tema-moderno .crud-acao-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  color: #244160;
  text-decoration: none;
  padding: 4px 8px;
  white-space: nowrap;
}

body.tema-moderno .crud-acao-item:hover {
  background: #edf4fc;
  color: #193d62;
}

body.tema-moderno .crud-acao-item-excluir {
  color: #a22d36;
}

body.tema-moderno .crud-acao-item-excluir:hover {
  background: #fff1f3;
  color: #7f1f27;
}

.aguarde {
  background: #ffffff;
  border: 1px solid var(--mod-borda);
  border-radius: 12px;
  box-shadow: var(--mod-sombra);
  padding: 12px 14px;
}

.aguarde_mensagem {
  font-weight: 600;
  color: #21354e;
  margin-bottom: 8px;
}

.aguarde_progresso {
  width: 240px;
  max-width: 75vw;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 99999;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--mod-sombra);
  border: 1px solid transparent;
  color: #fff;
  opacity: 1;
  transform: translateY(0);
  transition: all .22s ease;
}

.toast-item.toast-hide {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-item.toast-sucesso {
  background: var(--mod-ok);
  border-color: #177040;
}

.toast-item.toast-aviso {
  background: var(--mod-aviso);
  border-color: #9d6510;
}

.toast-item.toast-erro {
  background: var(--mod-erro);
  border-color: #95252d;
}

.toast-item.toast-info {
  background: var(--mod-primaria);
  border-color: #165685;
}

.toast-msg {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

/* Validacao inline */
.campo-invalido {
  border-color: #c5333f !important;
  box-shadow: 0 0 0 3px rgba(197, 51, 63, 0.16) !important;
  background: #fff8f9 !important;
}

/* Menus autocomplete mais limpos */
.ui-menu {
  border: 1px solid #c8d5e6;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(16, 39, 68, 0.15);
}

.ui-menu .ui-menu-item a {
  color: #1d2b3f;
}

.ui-menu .ui-state-focus,
.ui-menu .ui-state-active {
  border: 1px solid #9fb6d4;
  background: #e8f1fb;
  color: #143d63;
}

/* Mobile */
@media screen and (max-width: 790px) {
  #tudo {
    width: calc(100% - 12px);
    margin-left: 6px !important;
    margin-right: 6px !important;
  }

  html * input,
  html * select,
  html * textarea {
    border-radius: 7px;
  }

  .menu {
    gap: 4px;
    padding: 4px !important;
  }

  .menu > li {
    float: none !important;
  }

  .menu > li > a {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }

  body.tema-moderno .ui-widget-content.faixa-menu {
    height: auto;
    overflow: visible;
  }

  body.tema-moderno .mini-topo-usuario-inner {
    justify-content: center;
    padding: 4px 8px 0 8px;
  }

  body.tema-moderno .mini-topo-usuario-inner .mini-topo-link {
    font-size: 11px;
  }

  body.tema-moderno .faixa-menu-inner {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 6px 8px;
  }

  body.tema-moderno .faixa-menu-user {
    width: 100%;
    justify-content: flex-end;
  }

  .crud-toolbar {
    position: static;
    padding: 6px;
    gap: 4px;
  }

  .crud-toolbar-item {
    width: 100%;
  }

  .crud-toolbar-item .botao {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  .crud-filtro-item {
    width: 100%;
    box-sizing: border-box;
  }

  .crud-filtro-conteudo {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .crud-filtro-input input,
  .crud-filtro-input select {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .crud-datatable-wrapper .dataTables_filter,
  .crud-datatable-wrapper .dataTables_length,
  .crud-datatable-wrapper .dataTables_info,
  .crud-datatable-wrapper .dataTables_paginate {
    float: none !important;
    text-align: left !important;
  }

  .crud-dt-search {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  body.tema-moderno .crud-acao-menu {
    right: auto;
    left: 0;
  }
}
