
.cadastro-filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.cadastro-filters select{padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:#fff;min-width:150px}
.cadastro-grid td,.cadastro-grid th{vertical-align:middle}
.cadastro-grid .mono{font-family:Consolas,monospace;font-size:12px}
.cadastro-grid .nowrap{white-space:nowrap}
.modalbox.wide{width:min(980px,100%)}
.lookup-wrap{display:flex;align-items:stretch;gap:6px}.lookup-wrap input{flex:1;min-width:0}.lookup-btn{width:42px;min-width:42px;border:1px solid var(--line);background:#fff;border-radius:9px;color:var(--navy);font-size:20px;font-weight:800;cursor:pointer}.lookup-btn:hover{background:var(--pale)}

/* Padrão dos grids de cadastro */
.cadastro-card{display:flex;flex-direction:column;min-height:0}
.cadastro-toolbar{
  position:sticky;
  top:72px;
  z-index:12;
  background:#fff;
}
.cadastro-tablewrap{
  overflow-x:auto;
  overflow-y:visible;
  position:relative;
}
.cadastro-grid thead th{
  
  
  z-index:10;
  background:#fafbfc;
  box-shadow:0 1px 0 var(--line);
}
.cadastro-pager{
  position:relative;
  z-index:11;
  background:#fff;
  gap:14px;
}
.cadastro-pager,.pager-left,.pager-right{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.pager-left,.pager-right{gap:10px;flex-wrap:wrap}
.pager-left label{display:flex;align-items:center;gap:7px}
.pager-left select{
  padding:7px 9px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}
.pager-btn{padding:7px 10px}
.pager-btn:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:760px){
  .cadastro-toolbar{top:72px}
  .cadastro-pager{align-items:flex-start;flex-direction:column}
}

/* O grid mantém visualmente 10 linhas mesmo quando não há registros. */
.cadastro-grid tbody tr{height:44px}
.cadastro-grid tbody tr.cad-placeholder td{
  height:44px;
  color:transparent;
  pointer-events:none;
  background:#fff;
}
.cadastro-grid tbody tr.cad-placeholder:last-child td{
  border-bottom:0;
}

/* Cabeçalho do grid: sempre imediatamente acima da primeira linha. */
.cadastro-grid thead{
  display:table-header-group;
}
.cadastro-grid thead th{
  position:relative !important;
  top:auto !important;
  background:#dbe7f3 !important;
  color:#17324d !important;
  font-weight:700 !important;
  border-top:1px solid #c2d2e2 !important;
  border-bottom:1px solid #aebfd0 !important;
  height:42px;
  vertical-align:middle;
}
.cadastro-grid tbody tr{
  height:44px;
}

/* Correção definitiva do fluxo visual do cadastro */
.cadastro-toolbar{
  position:relative !important;
  top:auto !important;
  z-index:2 !important;
  background:#fff !important;
}
.cadastro-tablewrap{
  position:relative !important;
  overflow-x:auto !important;
  overflow-y:visible !important;
}
.cadastro-grid{
  margin-top:0 !important;
}
.cadastro-grid thead{
  display:table-header-group !important;
}
.cadastro-grid thead th{
  position:static !important;
  top:auto !important;
  background:#c8d9ea !important;
  color:#17324d !important;
  font-weight:700 !important;
  height:42px !important;
  vertical-align:middle !important;
  border-top:1px solid #afc3d7 !important;
  border-bottom:1px solid #96aec5 !important;
}

/* Navegação: resposta visual imediata enquanto os dados são carregados */
.cadastro-loading{
  min-height:120px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:10px;
  padding:24px;
}
.cad-loading-line{
  height:4px;
  width:100%;
  border-radius:4px;
  background:linear-gradient(90deg,#dbe7f3 0%,#0d3a63 50%,#dbe7f3 100%);
  background-size:200% 100%;
  animation:mmxLoading 1s linear infinite;
}
.cad-loading-text{font-size:13px;color:#61758a}
@keyframes mmxLoading{from{background-position:100% 0}to{background-position:-100% 0}}

/* Botão de consulta CNPJ/CEP */
.lookup-btn{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:16px !important;
}

.cad-loading-line,.cad-loading-text,.cadastro-loading{display:none!important}


/* Padrão MMX OS: todos os cabeçalhos dos grids na mesma cor */
.tablewrap table thead th,
.cadastro-grid thead th{
  background:#062d55 !important;
  color:#ffffff !important;
  border-top:1px solid #062d55 !important;
  border-bottom:1px solid #062d55 !important;
  font-weight:800 !important;
}
.wrapcell{white-space:normal!important;min-width:220px;line-height:1.35}
.module-tabs{display:flex;gap:4px;padding:12px 18px 0;background:#fff;border-bottom:1px solid var(--line)}
.module-tabs button{border:0;background:transparent;padding:10px 14px;font-weight:800;color:var(--muted);border-bottom:3px solid transparent}
.module-tabs button.active{color:var(--navy);border-bottom-color:var(--navy)}
.form-section{margin:18px 0 12px;padding-top:14px;border-top:1px solid var(--line);font-size:12px;font-weight:900;color:var(--navy)}
.supplier-form .field textarea{min-height:85px}


/* MMX OS - grade com cabecalho fixo ao exibir 20/50/100 registros */
.tablewrap.mmx-scroll-grid,
.cadastro-tablewrap.mmx-scroll-grid{
  max-height:560px !important;
  overflow-y:auto !important;
  overflow-x:auto !important;
  scrollbar-gutter:stable;
}
.tablewrap.mmx-scroll-grid table thead th,
.cadastro-tablewrap.mmx-scroll-grid .cadastro-grid thead th{
  position:sticky !important;
  top:0 !important;
  z-index:30 !important;
  background:#062d55 !important;
  color:#fff !important;
  box-shadow:0 1px 0 #062d55;
}
.tablewrap.mmx-scroll-grid::-webkit-scrollbar,
.cadastro-tablewrap.mmx-scroll-grid::-webkit-scrollbar{width:12px;height:12px}
.tablewrap.mmx-scroll-grid::-webkit-scrollbar-thumb,
.cadastro-tablewrap.mmx-scroll-grid::-webkit-scrollbar-thumb{background:#a8b7c6;border-radius:8px;border:3px solid #f5f7f9}
.tablewrap.mmx-scroll-grid::-webkit-scrollbar-track,
.cadastro-tablewrap.mmx-scroll-grid::-webkit-scrollbar-track{background:#f5f7f9}

/* Mensagens proprias do MMX OS */
.mmx-dialog-text{font-size:14px;line-height:1.55;color:#33485d;white-space:pre-line}
.mmx-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
.mmx-dialog-warning{padding:12px 14px;border-radius:9px;background:#fff6f6;color:#9d2020;border:1px solid #f3c9c9;margin-top:12px}

/* MMX OS - padrão definitivo: vazio compacto; grade de 10 linhas somente após existir cadastro */
.cad-empty-message,.mmx-empty-row{height:92px!important}
.cad-empty-message td,.mmx-empty-row td{height:92px!important;text-align:center!important;color:#6b7d90!important;background:#fff!important}
.cadastro-grid tbody tr.empty-only{height:92px!important}
.grid-link{border:0;background:transparent;padding:0;color:#0b4a7d;font:inherit;font-weight:700;cursor:pointer;text-align:left}.grid-link:hover{text-decoration:underline}
.contract-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px 18px}.contract-summary .full{grid-column:1/-1}.contract-summary .span2{grid-column:span 2}.contract-summary .item{border-bottom:1px solid #dbe4ec;padding:0 0 10px}.contract-summary .label{font-size:11px;text-transform:uppercase;color:#64748b;margin-bottom:4px}.contract-summary .value{font-size:13px;color:#0f172a;white-space:pre-wrap}.contract-summary-actions{display:flex;justify-content:flex-end;margin-top:18px}
@media(max-width:900px){.contract-summary{grid-template-columns:1fr 1fr}.contract-summary .span2{grid-column:span 2}}


/* Ativos: grade compacta para tentar exibir todas as colunas sem espaços excessivos.
   Textos longos quebram linha e a altura cresce conforme o conteúdo. */
.cadastro-grid-ativos{
  width:100%;
  min-width:1380px;
  table-layout:fixed;
  font-size:11px;
}
.cadastro-grid-ativos thead th{
  white-space:normal !important;
  overflow-wrap:anywhere;
  line-height:1.15;
  padding:8px 6px !important;
  height:auto !important;
}
.cadastro-grid-ativos tbody tr{
  height:auto !important;
  min-height:64px;
}
.cadastro-grid-ativos tbody td{
  height:auto !important;
  min-height:64px;
  vertical-align:middle !important;
  white-space:normal !important;
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.25;
  padding:8px 6px !important;
}
/* Código */
.cadastro-grid-ativos th:nth-child(1),
.cadastro-grid-ativos td:nth-child(1){width:72px;white-space:nowrap!important}
/* Empresa: nome longo em 2/3 linhas. */
.cadastro-grid-ativos th:nth-child(2),
.cadastro-grid-ativos td:nth-child(2){width:158px}
/* Estabelecimento */
.cadastro-grid-ativos th:nth-child(3),
.cadastro-grid-ativos td:nth-child(3){width:105px}
/* Setor */
.cadastro-grid-ativos th:nth-child(4),
.cadastro-grid-ativos td:nth-child(4){width:92px}
/* Local */
.cadastro-grid-ativos th:nth-child(5),
.cadastro-grid-ativos td:nth-child(5){width:128px}
/* Ativo */
.cadastro-grid-ativos th:nth-child(6),
.cadastro-grid-ativos td:nth-child(6){width:180px}
/* Categoria */
.cadastro-grid-ativos th:nth-child(7),
.cadastro-grid-ativos td:nth-child(7){width:145px}
/* Fabricante / Modelo: compactos quando não há informação. */
.cadastro-grid-ativos th:nth-child(8),
.cadastro-grid-ativos td:nth-child(8){width:92px}
.cadastro-grid-ativos th:nth-child(9),
.cadastro-grid-ativos td:nth-child(9){width:82px}
/* Série / Patrimônio */
.cadastro-grid-ativos th:nth-child(10),
.cadastro-grid-ativos td:nth-child(10){width:86px}
.cadastro-grid-ativos th:nth-child(11),
.cadastro-grid-ativos td:nth-child(11){width:82px}
/* Criticidade / Status */
.cadastro-grid-ativos th:nth-child(12),
.cadastro-grid-ativos td:nth-child(12){width:82px;text-align:center}
.cadastro-grid-ativos th:nth-child(13),
.cadastro-grid-ativos td:nth-child(13){width:72px;text-align:center}
/* Ações */
.cadastro-grid-ativos th:nth-child(14),
.cadastro-grid-ativos td:nth-child(14){width:54px;white-space:nowrap!important;text-align:center}
/* Células vazias não criam aparência de blocos grandes. */
.cadastro-grid-ativos tbody td:empty{padding-left:3px!important;padding-right:3px!important}
@media(min-width:1800px){
  .cadastro-grid-ativos{min-width:100%}
}
@media(max-width:1200px){
  .cadastro-grid-ativos{min-width:1320px;font-size:10.5px}
}

/* Ativos: filtros encadeados por Empresa > Estabelecimento > Ativo */
.cadastro-grid-ativos~*{}
.cadastro-filters .cad-extra-filter-empresa_id{min-width:250px;max-width:320px}
.cadastro-filters .cad-extra-filter-estabelecimento_id{min-width:210px;max-width:280px}
.cadastro-filters .cad-extra-filter-descricao{min-width:230px;max-width:320px}
@media(max-width:1200px){
 .cadastro-filters .cad-extra-filter-empresa_id,
 .cadastro-filters .cad-extra-filter-estabelecimento_id,
 .cadastro-filters .cad-extra-filter-descricao{min-width:180px;max-width:240px}
}

/* Fornecedores: grid compacto com endereço completo e quebra de linha */
.cadastro-grid-fornecedores{table-layout:fixed;min-width:1170px;font-size:11px}
.cadastro-grid-fornecedores tbody tr{height:58px}
.cadastro-grid-fornecedores td,.cadastro-grid-fornecedores th{padding:8px 7px}
.cadastro-grid-fornecedores td{white-space:normal;overflow-wrap:anywhere;line-height:1.25}
.cadastro-grid-fornecedores th:nth-child(1),.cadastro-grid-fornecedores td:nth-child(1){width:118px;white-space:nowrap}
.cadastro-grid-fornecedores th:nth-child(2),.cadastro-grid-fornecedores td:nth-child(2){width:190px}
.cadastro-grid-fornecedores th:nth-child(3),.cadastro-grid-fornecedores td:nth-child(3){width:78px}
.cadastro-grid-fornecedores th:nth-child(4),.cadastro-grid-fornecedores td:nth-child(4){width:225px}
.cadastro-grid-fornecedores th:nth-child(5),.cadastro-grid-fornecedores td:nth-child(5){width:118px}
.cadastro-grid-fornecedores th:nth-child(6),.cadastro-grid-fornecedores td:nth-child(6){width:112px;white-space:nowrap}
.cadastro-grid-fornecedores th:nth-child(7),.cadastro-grid-fornecedores td:nth-child(7){width:150px}
.cadastro-grid-fornecedores th:nth-child(8),.cadastro-grid-fornecedores td:nth-child(8){width:165px}
.cadastro-grid-fornecedores th:nth-child(9),.cadastro-grid-fornecedores td:nth-child(9){width:76px;text-align:center}
.cadastro-grid-fornecedores th:nth-child(10),.cadastro-grid-fornecedores td:nth-child(10){width:56px;text-align:center;white-space:nowrap}

/* Contratos: documentos, aditivos e ZapSign */
.contract-modal-subtitle{font-size:12px;color:#5d7186;margin:-4px 0 16px;line-height:1.45}
.contract-upload-row{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(180px,.8fr) auto;gap:10px;align-items:end;padding-bottom:16px;border-bottom:1px solid var(--line)}
.contract-save-file{height:40px;margin-bottom:1px}
.contract-list{margin-top:16px;border:1px solid var(--line);border-radius:10px;overflow:auto;max-height:300px}
.contract-list table{width:100%;min-width:650px;border-collapse:collapse}
.contract-list th,.contract-list td{padding:9px 10px;height:auto!important;vertical-align:middle}
.contract-list th{background:#f3f6f9!important;color:#17324d!important;font-size:11px}
.contract-file-actions{white-space:nowrap!important;text-align:right}
.contract-file-actions .btn{padding:6px 9px;margin-left:4px;font-size:11px}
.contract-modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.contract-aditivo-grid,.zapsign-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px 12px}
.contract-aditivo-grid .full,.zapsign-grid .full{grid-column:1/-1}
.contract-aditivo-save{display:flex;justify-content:flex-end;margin:10px 0 4px}
.zs-ok{display:inline-block;background:#e7f6ee;color:#117845;border:1px solid #bfe7d0;border-radius:999px;padding:4px 8px;font-weight:800;font-size:10px}
.zs-off{display:inline-block;background:#fff0f0;color:#a12626;border:1px solid #f0c9c9;border-radius:999px;padding:4px 8px;font-weight:800;font-size:10px}
@media(max-width:900px){.contract-upload-row{grid-template-columns:1fr}.contract-aditivo-grid,.zapsign-grid{grid-template-columns:1fr 1fr}.contract-save-file{width:100%}}
@media(max-width:620px){.contract-aditivo-grid,.zapsign-grid{grid-template-columns:1fr}}
