/* =============================================================================
   Table Components
   ============================================================================= */

/* Table Wrapper */
.table-wrapper {
  overflow-x: auto;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

/* Table Controls */

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem var(--space-md);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.2);
}

.data-table th.numeric,
.data-table td.numeric {
  text-align: right;
}

/* =============================================================================
 * Data Grid — the markup shared/data-grid.js emits (#1316)
 * =============================================================================
 * `renderGridHtml` is the ONLY place in the tree allowed to write <table> markup
 * (hygiene rule `js.table-markup-outside-data-grid`), and it ALWAYS puts
 * `data-grid` on the table. Columns mark numeric cells with `tdClass: () => 'num'`.
 *
 * So there are two naming conventions in this file's reach: `.data-table`/`.numeric`
 * above, written by hand, and `.data-grid`/`.num`, emitted by the helper. Only the
 * second one is guaranteed to be on the page, because every new grid goes through
 * the helper — and for a long time NOTHING styled it. Each page right-aligned `.num`
 * under its own grid class instead, and `/aksje` shipped five sections with
 * left-aligned numbers because `.rrg-grid` was the one class nobody added.
 *
 * One rule here ends that: the alignment follows the markup the helper guarantees,
 * not a per-page class someone has to remember. `tests/hygiene/grid-css.test.mjs`
 * pins it to a stylesheet the layout actually links — a rule in an unlinked file
 * (the deprecated `site.css`) styles nothing.
 *
 * Every line of this block starts with `*` on purpose: the hex-literal ratchet skips
 * lines that LOOK like comment lines, and a bare continuation line holding `#1316`
 * is counted as a colour. It cost one red test.
 *
 * Anything else about a grid — width, min-width, nowrap, colours — stays per page:
 * those differ by table and each consumer already passes its own `tableClass`. */
.data-grid th.num,
.data-grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
  background: rgba(60, 194, 255, 0.04);
}

.data-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.data-table th[data-sort]:hover {
  color: var(--accent);
}

/* Filters Table */

/* Symbol Link */
.symbol-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.symbol-link:hover {
  text-decoration: underline;
}

/* Score Cell */

/* Status Cell */
.status-cell {
  font-weight: 500;
  font-size: 0.85rem;
}

/* Metric Cell */

.metric-pass {
  color: var(--success);
}

.metric-fail {
  color: var(--danger);
}

/* Users Table */
.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: var(--space-md) 1.25rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.users-table th {
  background: rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.users-table td {
  font-size: 0.875rem;
  color: var(--text);
}

.users-table tbody tr {
  transition: background var(--transition-fast);
}

.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Role Badge */
.role-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
}

.role-admin {
  background: rgba(60, 194, 255, 0.15);
  color: var(--accent);
}

.role-user {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

/* Status Badges for Tables */
.status-active {
  color: var(--success);
}

.status-locked {
  color: var(--danger);
}

/* Action Buttons in Tables */
.action-buttons {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 1.25rem;
  background: rgba(0, 0, 0, 0.15);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-dim);
}

.pagination-buttons {
  display: flex;
  gap: var(--space-sm);
}

/* =============================================================================
   Responsive — Tables
   ============================================================================= */

@media (max-width: 768px) {
  .table-wrapper {
    margin: 0 calc(-1 * var(--space-sm));
    padding: 0 var(--space-sm);
    -webkit-overflow-scrolling: touch;
  }

  

  .data-table th,
  .data-table td {
    padding: 0.5rem var(--space-sm);
    font-size: 0.8125rem;
  }

  .data-table th {
    font-size: 0.7rem;
  }

  .users-table th,
  .users-table td {
    padding: var(--space-sm) var(--space-sm);
    font-size: 0.8125rem;
  }

  .users-table th {
    font-size: 0.7rem;
  }

  

  

  

  .pagination {
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
    text-align: center;
  }

  .action-buttons {
    gap: 0.25rem;
  }
}

@media (max-width: 480px) {
  .data-table th,
  .data-table td {
    padding: 0.375rem var(--space-xs);
    font-size: 0.75rem;
  }

  
}
