/* =========================
   ADMIN – tabela sem “largura infinita”
   ========================= */

#grid .table-wrap,
#grid {
  overflow: auto;
}

/* No admin, a tabela ocupa o container (não max-content) */
#grid table.sheet {
  width: 100%;
  min-width: 100%;
  table-layout: fixed; /* chave pra não estourar */
}

/* Header compacto e legível */
#grid table.sheet thead th {
  font-size: 11px;
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}

/* Células: não expandir infinito */
#grid table.sheet td {
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inputs: SEM min-width gigante */
#grid td input {
  width: 100%;
  min-width: 0; /* importante */
  border: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: #fff;
}

/* Coluna “#” fixa */
#grid table.sheet th:first-child,
#grid table.sheet td:first-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
}

/* Larguras padrão por tipo */
#grid th.col--tiny,
#grid td.col--tiny {
  width: 70px;
}
#grid th.col--sm,
#grid td.col--sm {
  width: 86px;
}
#grid th.col--md,
#grid td.col--md {
  width: 110px;
}
#grid th.col--lg,
#grid td.col--lg {
  width: 140px;
}

/* Popover de colunas */
.cols-pop {
  position: relative;
}
.cols-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(520px, 92vw);
  max-height: 60vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--grid);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  padding: 10px;
  display: none;
  z-index: 50;
}
.cols-panel.is-open {
  display: block;
}

.cols-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.cols-row:last-child {
  border-bottom: 0;
}

.cols-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 6px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 6px;
}
.cols-actions button {
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
}
