/* Tables that become one card per row on a phone, and the pager under a long table.
   Used with assets/js/table-tools.js, which copies each column heading into the cell's
   data-label so the card can name every value. Wave 11 U10: at 390 px a URL column was
   squeezed to a few letters per line and the row actions sat off-screen. */
@media (max-width: 575.98px) {
  table.table-stack thead { display: none; }
  table.table-stack { --bs-table-bg: transparent; }
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td {
    display: block; width: 100%;
  }
  table.table-stack tr {
    border: 1px solid var(--color-border, #dee2e6); border-radius: var(--radius-md, .5rem);
    padding: .5rem .75rem; margin-bottom: .75rem; background: var(--color-surface, #fff);
  }
  table.table-stack tr[hidden] { display: none; }
  table.table-stack td {
    border: 0; padding: .25rem 0; display: flex; justify-content: space-between;
    align-items: baseline; gap: 1rem; text-align: end !important; min-width: 0;
    /* Bare text in a cell (an email address) is a flex item too: let it break. */
    overflow-wrap: anywhere;
  }
  table.table-stack td[data-label]::before {
    content: attr(data-label); color: var(--color-muted-fg, #6c757d); text-align: start;
    flex: 0 0 auto; max-width: 45%;
  }
  table.table-stack td[data-label=""]::before { content: none; }
  /* A long value (a link, a URL) keeps to its own line and breaks anywhere, not the label. */
  table.table-stack td > * { min-width: 0; overflow-wrap: anywhere; }
  /* The first cell is the card's title: full width, no label beside it. */
  table.table-stack td:first-child { display: block; text-align: start !important; font-weight: 600; }
  table.table-stack td:first-child::before { content: none; }
  /* The actions cell (table-tools.js marks it): buttons a thumb can hit, no label. */
  table.table-stack td.table-stack-actions { justify-content: flex-start; flex-wrap: wrap; gap: .5rem; padding-top: .5rem; }
  table.table-stack td.table-stack-actions::before { content: none; }
  table.table-stack td.table-stack-actions .btn { min-height: 2.75rem; margin: 0 !important; }
  table.table-stack td.table-stack-actions .btn:not(.btn-link) { flex: 1 1 auto; }
  .table-responsive:has(> table.table-stack) { overflow-x: visible; }
}

.table-pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; padding: .75rem 1rem; }
.table-pager[hidden] { display: none; }
.table-pager .btn { min-height: 2.75rem; min-width: 2.75rem; }
.table-pager-status { color: var(--color-muted-fg, #6c757d); font-size: var(--font-size-sm, .875rem); }
