/* ===== Base ===== */
.tb-wrap { font-family: "Source Sans Pro", Arial, sans-serif; font-size: 13px; color: #333; background: #fff; border: 1px solid #ddd; border-radius: 4px; }
.tb-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #eee; }
.tb-btn { border: 1px solid #bbb; background: #f7f7f7; border-radius: 3px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.tb-btn:hover:not(:disabled) { background: #e9eef5; }
.tb-btn:disabled { opacity: .4; cursor: default; }
.tb-btn.active { background: #009845; color: #fff; border-color: #009845; }

/* ===== Grid (estilo Qlik Sense nativo) ===== */
.tb-scroll { overflow: auto; max-height: 660px; --tb-head-h: 58px; }  /* --tb-head-h é atualizado pelo JS */
.tb-table { border-collapse: collapse; width: 100%; min-width: 1400px; }

/* Cabeçalho: SÓ ele quebra linha */
.tb-table th {
  position: sticky; top: 0; z-index: 2;
  background: #fff;
  text-align: left;
  padding: 2px 5px;
  white-space: normal;
 /* word-break: break-word;*/
  line-height: 1.2;
  vertical-align: middle;
  font-weight: 400;
  color: #404040;
  border-left: 1px solid #ccc;
  box-shadow: inset 0 -1px 0 #ccc;   /* borda inferior que não some com sticky */
}
.tb-table th .tb-th { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

/*.tb-table th .tb-th-txt { min-width: 50%; }   /* permite o texto quebrar dentro do flex */

.tb-table th.num { text-align: right; }
.tb-table th.num .tb-th { justify-content: flex-end; }

/* Linha de totais: gruda logo abaixo do cabeçalho */
.tb-table tr.tb-total td {
  position: sticky; top: var(--tb-head-h); z-index: 1;
  height: 36px; line-height: 36px;
  background: #fff;
  font-weight: 700;
  border-bottom: 1px solid #ccc;
}

/* Corpo: linhas altas, uma linha de texto, divisória horizontal fina */
.tb-table td {
  height: 39px;
  line-height: 39px;
  padding: 0 8px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #404040;
  border-bottom: 1px solid #e6e6e6;
  border-left: 1px solid #ccc;
}
.tb-table tbody tr:hover { background: #f4f8fb; }

/* Números e datas: fonte de largura fixa, à direita */
.tb-table td.num {
  text-align: right;
  font-family: "Source Code Pro", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.tb-empty { text-align: center; padding: 30px !important; color: #888; line-height: normal !important; }

/* ===== Botão de filtro da coluna ===== */
.tb-fbtn { border: 0; background: transparent; cursor: pointer; padding: 2px 4px; border-radius: 3px; font-size: 13px; color: #777; flex: 0 0 auto; }
.tb-fbtn:hover { background: #e3e3e3; }
.tb-fbtn.on { color: #fff; background: #009845; }

/* ===== Popup de filtro ===== */
.tb-pop { position: fixed; z-index: 9999; width: 280px; background: #fff; border: 1px solid #bbb; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.25); padding: 8px; font-size: 13px; }
.tb-pop input[type=text] { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid #bbb; border-radius: 3px; margin-bottom: 6px; }
.tb-pop-actions { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.tb-list { max-height: 240px; overflow: auto; border: 1px solid #eee; }
.tb-item { display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer; }
.tb-item:hover { background: #eef3f9; }
.tb-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-item.alt { color: #999; }
.tb-pop-info { color: #888; font-size: 11px; padding: 4px 0 0; }

/* ===== Rodapé / paginação ===== */
.tb-footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid #eee; }
.tb-pager { display: flex; gap: 8px; align-items: center; }

.tb-pg {
  font-family: inherit;
  font-size: 14px;
  color: #444;
  background: #fff;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  line-height: 1.2;
  transition: background .15s, border-color .15s;
}
.tb-pg:hover:not(:disabled) { background: #f0f3f6; border-color: #b9c0c8; }
.tb-pg:focus-visible { outline: 2px solid #86b7fe; outline-offset: 1px; }
.tb-pg:disabled { cursor: default; }
.tb-pg:disabled:not(.tb-pg-current) { opacity: .5; }

/* "Página 6 de 485" (cinza, só informativo) */
.tb-pg-current { background: #e9ecef; color: #6c757d; border-color: #e1e4e8; opacity: 1; }

/* ===== Barras de rolagem (grid) ===== */
.tb-scroll::-webkit-scrollbar { height: 18px; width: 18px; }
.tb-scroll::-webkit-scrollbar-track { background: #eceff1; border-radius: 9px; }
.tb-scroll::-webkit-scrollbar-thumb { background: #8a949e; border-radius: 9px; border: 3px solid #eceff1; }
.tb-scroll::-webkit-scrollbar-thumb:hover { background: #5f6b76; }
.tb-scroll::-webkit-scrollbar-corner { background: #eceff1; }

/* Firefox */
@supports (-moz-appearance: none) {
  .tb-scroll { scrollbar-width: auto; scrollbar-color: #8a949e #eceff1; }
}

/* ===== Card da tabela de contratos ===== */
.card-tabela > .card-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.15rem 0.75rem;
  margin-bottom: 0;
  min-height: 0;
  border-bottom: 0;
}
.card-tabela > .card-header .btn-tool { padding: 0.1rem 0.4rem; line-height: 1; }
.card-tabela > .card-header .card-tools { display: flex; align-items: center; gap: 4px; margin: 0 0 0 auto; float: none; }
.card-tabela > .card-header .card-tools .btn-tool { float: none; margin: 0; }
.card-tabela > .card-body { padding-top: 0; }

/* ===== Ações na toolbar (Limpar + Exportar + Maximizar) ===== */
.tb-actions { display: flex; align-items: center; gap: 6px; }
.tb-actions .btn-tool {
  float: none; margin: 0; padding: 4px 10px; line-height: 1.2;
  background: #f7f7f7; border: 1px solid #bbb; border-radius: 3px;
  color: #555; cursor: pointer; font-size: 12px;
}
.tb-actions .btn-tool:hover { background: #e9eef5; color: #222; }
.tb-actions .tb-btn { padding: 4px 10px; line-height: 1.2; font-size: 12px; }