/* Data tables. Under 640px each row becomes a stacked card, using the data-label on each
   cell (same markup, CSS only). */

.table {
  width: 100%;
  margin-bottom: var(--space-5);
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table--dense th,
.table--dense td {
  padding: var(--space-2) var(--space-3);
}

.table__actions {
  text-align: right;
}

.table__actions form {
  display: inline;
}

.audit-detail {
  overflow-wrap: anywhere;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 639px) {
  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }

  .table {
    border: 0;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  .table tr {
    margin-bottom: var(--space-3);
    padding: var(--space-2) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
  }

  .table td,
  .table tbody tr:last-child td {
    padding: var(--space-1) var(--space-4);
    border: 0;
  }

  .table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
  }

  .table__actions {
    text-align: left;
  }
}
