/* admin-tables.css — stacked cards for tables on phones (loaded after
   admin-theme.css). Works with admin-tables.js, which sets data-label on
   cells and data-stack on the table. Tables without headings keep the
   old sideways-scroll fallback. Wide screens are not changed. */
@media (max-width: 699px) {
  body #pageBody table[data-stack] {
    display: block;
    overflow: visible;
    white-space: normal;
    width: 100%;
    min-width: 0;
  }
  body #pageBody .fdf-table-wrap, body #pageBody .table-container, body #pageBody .tbl-wrap { overflow: visible; border: 0; }
  body #pageBody table[data-stack] thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  body #pageBody table[data-stack] tbody { display: block; }
  body #pageBody table[data-stack] tr {
    display: block;
    margin: 0 0 12px;
    padding: 4px 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--border-color, #e3e8ef);
    border-radius: 14px;
  }
  body #pageBody table[data-stack] tbody tr:hover td { background: transparent; }
  body #pageBody table[data-stack] td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--border-color, #e3e8ef);
    text-align: right;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  body #pageBody table[data-stack] td:last-child { border-bottom: 0; }
  body #pageBody table[data-stack] td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    color: var(--text-muted, #667085);
    font-size: .76rem;
    font-weight: 650;
    text-align: left;
  }
  body #pageBody table[data-stack] td:not([data-label])::before,
  body #pageBody table[data-stack] td[data-label=""]::before { content: none; }
  /* cells with no heading (button columns) span the card */
  body #pageBody table[data-stack] td[data-label=""] { justify-content: flex-end; }
  /* empty-state / full-width rows */
  body #pageBody table[data-stack] td.table-span { display: block; text-align: center; }
  body #pageBody table[data-stack] td.table-span::before { content: none; }
  body #pageBody table[data-stack] td:empty { display: none; }
  body #pageBody table[data-stack] td .cell-val { display: block; min-width: 0; text-align: right; }
  body #pageBody table[data-stack] td .cell-val > div { display: block; }
  /* keep action buttons and wide content inside the card */
  body #pageBody table[data-stack] td button { max-width: 100%; }
  body #pageBody table[data-stack] .fdf-num { text-align: right; }
}
