/* MX-Gestor — mx-grid: tema visual único das listas (DataTables + tabelas simples). */

/* Envoltório em card para toda lista mx-grid */
.mx-grid-tools { padding: .25rem .1rem .5rem; }

/* Busca PADRÃO (única em todo o sistema): ícone de lupa + arredondado.
   Vale para a busca do DataTable E para os campos de busca server-side (name="busca"). */
.mx-grid-tools .dataTables_filter input,
.mx-content input[name="busca"] {
  border: 1px solid #d5dbe6; border-radius: 999px; padding: .4rem .8rem .4rem 2.1rem; min-width: 240px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .7rem center; background-size: 15px;
}
.mx-grid-tools .dataTables_filter input:focus,
.mx-content input[name="busca"]:focus { border-color: #0d6efd; box-shadow: 0 0 0 .18rem rgba(13,110,253,.15); outline: none; }
.mx-grid-tools .dataTables_filter { text-align: left; }
.mx-grid-tools .dataTables_filter label { width: 100%; margin: 0; }
.mx-grid-tools .dataTables_length select {
  border: 1px solid #d5dbe6; border-radius: 8px; padding: .25rem 1.6rem .25rem .5rem;
}
.dataTables_filter, .dataTables_length { font-size: .85rem; color: #64748b; }
.dataTables_info { font-size: .8rem; color: #94a3b8; padding-top: .4rem !important; }

/* Cabeçalho: pequeno, maiúsculo, discreto */
table.mx-grid > thead th,
table.mx-table > thead th {
  background: #f5f7fb; color: #64748b; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid #e5e9f2;
  white-space: nowrap; vertical-align: middle;
}
table.mx-grid, table.mx-table { border-color: #eef1f6; }
table.mx-grid > tbody td,
table.mx-table > tbody td { vertical-align: middle; border-color: #f0f2f7; }

/* Linhas: zebra suave + hover consistente */
table.mx-grid > tbody tr:nth-child(even),
table.mx-table > tbody tr:nth-child(even) { background: #fafbfd; }
table.mx-grid > tbody tr:hover,
table.mx-table > tbody tr:hover { background: #eef4ff; }

/* Célula de entidade (razão + fantasia + CNPJ) */
.mx-ent-nome { font-weight: 600; line-height: 1.15; }
.mx-ent-fant { color: #64748b; font-size: .8rem; line-height: 1.1; }
.mx-ent-doc  { color: #94a3b8; font-size: .72rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Paginação DataTables no estilo do sistema */
.dataTables_paginate .pagination { margin: 0; justify-content: flex-end; }
.dataTables_paginate .page-link { border-radius: 8px !important; margin: 0 2px; border-color: #e5e9f2; color: #0d6efd; }
/* ⚠️ A regra acima pinta o texto de azul; sem forçar branco aqui, a página ATIVA
   ficava com número azul sobre fundo azul — o botão parecia vazio (todas as telas). */
.dataTables_paginate .active .page-link { background: #0d6efd; border-color: #0d6efd; color: #fff !important; }
.dataTables_paginate .disabled .page-link { color: #adb5bd; }

/* Botões de ação padronizados dentro das linhas */
table.mx-grid .btn-sm,
table.mx-table .btn-sm { padding: .15rem .5rem; }
.mx-acoes { white-space: nowrap; display: inline-flex; gap: .25rem; justify-content: flex-end; }

/* Setas de ordenação discretas */
table.mx-grid > thead th.sorting:after,
table.mx-grid > thead th.sorting_asc:after,
table.mx-grid > thead th.sorting_desc:after { opacity: .35; }

/* Rolagem horizontal segura em telas estreitas */
.mx-grid-tools + .table-responsive, table.mx-grid { width: 100% !important; }

/* ===== FASE 3: tema base para TODA tabela de conteúdo (consistência global) =====
   Aplica a mesma "cara" às ~66 listas simples sem editar cada arquivo. Escopo: .mx-content
   (não afeta impressões/DANFE, que ficam fora do shell). */
.mx-content table.table > thead th,
.mx-content table.table > thead > tr > th {
  background: #f5f7fb; color: #64748b; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid #e5e9f2;
  vertical-align: middle;
}
.mx-content table.table > tbody > tr:hover { background: #eef4ff; }
.mx-content table.table > tbody > tr > td { vertical-align: middle; }
/* linhas de total/rodapé preservam o destaque (não aplicar o cabeçalho pequeno nelas) */
.mx-content table.table tfoot th, .mx-content table.table tfoot td,
.mx-content table.table .table-light.fw-bold td { text-transform: none; font-size: inherit; }

/* "Buscar por [campo]" ao lado da busca (estilo fluxo desktop) */
.mx-tools-left { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.mx-busca-campo { display: inline-flex; align-items: center; gap: .35rem; }
.mx-busca-campo .mx-lbl { font-size: .8rem; color: #64748b; }
.mx-buscar-por { width: auto; min-width: 130px; border-radius: 8px; }
.mx-tools-left .dataTables_filter { margin: 0 !important; }
.mx-cols-menu label { cursor: pointer; white-space: nowrap; }
.mx-cols-menu label:hover { background: #f1f5fb; border-radius: 6px; }

/* Cores de LINHA por status + legenda (reaproveita a cor do badge do status) */
tr[data-mx-status] > td:first-child { position: relative; }
tr[data-mx-status="success"]   > td:first-child::before,
tr[data-mx-status="danger"]    > td:first-child::before,
tr[data-mx-status="warning"]   > td:first-child::before,
tr[data-mx-status="secondary"] > td:first-child::before,
tr[data-mx-status="primary"]   > td:first-child::before,
tr[data-mx-status="info"]      > td:first-child::before,
tr[data-mx-status="dark"]      > td:first-child::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
tr[data-mx-status="success"]   > td:first-child::before { background: #198754; }
tr[data-mx-status="danger"]    > td:first-child::before { background: #dc3545; }
tr[data-mx-status="warning"]   > td:first-child::before { background: #ffc107; }
tr[data-mx-status="secondary"] > td:first-child::before { background: #94a3b8; }
tr[data-mx-status="primary"]   > td:first-child::before { background: #0d6efd; }
tr[data-mx-status="info"]      > td:first-child::before { background: #0dcaf0; }
tr[data-mx-status="dark"]      > td:first-child::before { background: #343a40; }
tr[data-mx-status="danger"]  { background: #fff5f5 !important; }
tr[data-mx-status="warning"] { background: #fffbeb !important; }

.mx-legenda { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; font-size: .78rem; color: #64748b; margin: .1rem 0 .6rem; }
.mx-legenda .lg { display: inline-flex; align-items: center; gap: .3rem; }
.mx-legenda .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Chips de filtro instantâneo (cliente) */
.mx-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.mx-chips .mx-lbl { font-size: .8rem; color: #64748b; margin-right: .2rem; }
.mx-chip {
  border: 1px solid #d5dbe6; background: #fff; color: #475569; border-radius: 999px;
  padding: .2rem .8rem; font-size: .82rem; font-weight: 600; cursor: pointer; transition: .12s;
}
.mx-chip:hover { border-color: #0d6efd; color: #0d6efd; }
.mx-chip.active { background: #0d6efd; border-color: #0d6efd; color: #fff; }
.mx-chip .badge { font-weight: 700; }
