/* Fit the actual panel, including when a sidebar or modal reduces its width. */
.table-scroll-container { min-width: 0; max-width: 100%; }
.hud-table.table-adaptive {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: auto;
  white-space: normal;
  font-variant-numeric: tabular-nums;
}
.hud-table.table-adaptive th,
.hud-table.table-adaptive td {
  padding: 10px 7px;
  white-space: normal !important;
  overflow-wrap: break-word;
  vertical-align: middle;
  line-height: 1.45;
  min-width: 0;
}
.hud-table.table-adaptive th { font-size: 12px; width: auto !important; }
.hud-table.table-adaptive td { font-family: Inter, system-ui, sans-serif; font-size: 12px; }
.hud-table.table-adaptive td > * { max-width: 100%; white-space: normal; }
.hud-table.table-adaptive .btn { padding: 7px; white-space: normal; }
.adaptive-table-sort { display: none; }
.adaptive-table-sort.is-visible {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; color: var(--text-muted); font-size: 12px;
  border-bottom: 1px solid var(--border-color); background: var(--bg-card);
}
.adaptive-table-sort select {
  flex: 1; min-width: 0; max-width: 100%; width: auto;
  border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 8px;
}
.adaptive-table-sort button {
  background: var(--bg-subtle); color: var(--text-heading);
  border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 10px;
}
.hud-table.table-stacked { display: block; }
.hud-table.table-stacked thead {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.hud-table.table-stacked tbody,
.hud-table.table-stacked tfoot { display: block; width: 100%; }
.hud-table.table-stacked tbody > tr,
.hud-table.table-stacked tfoot > tr {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 0; margin: 12px; border: 1px solid var(--border-color); border-radius: 12px;
  background: var(--bg-card); overflow: hidden;
}
.hud-table.table-stacked td {
  display: block; padding: 10px 12px; text-align: left !important;
  border: 0; min-width: 0; font-size: 13px; overflow-wrap: anywhere;
}
.hud-table.table-stacked td::before {
  content: attr(data-column-label); display: block; margin-bottom: 4px;
  font-family: Inter, sans-serif; font-weight: 500; font-size: 11px;
  color: var(--text-muted); line-height: 1.4;
}
.hud-table.table-stacked td:first-child {
  grid-column: 1 / -1; background: var(--bg-subtle); font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}
.hud-table.table-stacked td[colspan]:not([colspan="1"]) { grid-column: 1 / -1; }
.hud-table.table-stacked td[colspan]:not([colspan="1"])::before { display: none; }
.hud-table.table-stacked tr.row-anomaly { border-color: var(--color-red); }
@media print {
  .adaptive-table-sort { display: none !important; }
}
