/* ── Tables — ARKAN Design System v2 ─────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--surface-primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

/* Header */
.table thead {
  background: var(--bg-secondary);
}

.table th {
  padding: 0 var(--space-4);
  height: 40px;
  text-align: left;
  font-size: 12px;
  font-weight: var(--font-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  user-select: none;
}

/* Sortable column header */
.table th[data-sort],
.table th[aria-sort] {
  cursor: pointer;
}
.table th[data-sort]:hover,
.table th[aria-sort]:hover {
  color: var(--text-primary);
}
.table th[aria-sort="ascending"]::after  { content: ' ↑'; opacity: 0.7; }
.table th[aria-sort="descending"]::after { content: ' ↓'; opacity: 0.7; }

/* Cells */
.table td {
  padding: 0 var(--space-4);
  height: 48px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

/* Row hover */
.table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent-primary) 5%, transparent);
}

/* Active row */
.table tbody tr.row--active td,
tbody tr.row--active td {
  background: color-mix(in srgb, var(--accent-primary) 7%, transparent);
}

/* Selected row */
.table tbody tr.row--selected td,
tbody tr.row--selected td {
  background: color-mix(in srgb, var(--accent-primary) 6%, transparent);
}

/* Compact variant */
.table--compact td,
.table--compact th {
  height: 40px;
  padding: 0 var(--space-3);
}

/* Action column — revealed on hover */
.table .table-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.table tbody tr:hover .table-actions {
  opacity: 1;
}

/* Checkbox column */
.table th:first-child:has(input[type="checkbox"]),
.table td:first-child:has(input[type="checkbox"]) {
  width: 40px;
  text-align: center;
  padding: 0 var(--space-2);
}

/* No-wrap utility for table cells */
.table .cell-nowrap { white-space: nowrap; }
