/* ==========================================================================
   G WORLD — data tables and the responsive card fallback
   --------------------------------------------------------------------------
   A table is only used for genuinely tabular data (admin lists). Below 48rem it
   re-flows into stacked cards: each row becomes a block and every cell uses the
   `data-label` attribute as an inline label, so nothing is lost on a phone and
   no horizontal scrolling is required.
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}

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

.table caption {
  text-align: start;
  padding: var(--space-4) var(--space-4) 0;
  font-weight: 600;
  color: var(--text);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  vertical-align: middle;
  border-block-end: 1px solid var(--border);
}

.table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background-color: var(--surface-2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  white-space: nowrap;
}

.table tbody tr:hover {
  background-color: var(--surface-2);
}

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

.table__numeric {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

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

/* Row-level status colouring, kept subtle so text stays the focus. */
.table tr[data-status='suspended'] td,
.table tr[data-status='revoked'] td {
  background-color: color-mix(in srgb, var(--danger-100) 40%, transparent);
}

.table tr[data-status='pending_verification'] td {
  background-color: color-mix(in srgb, var(--warning-100) 40%, transparent);
}

@media (max-width: 48rem) {
  .table-wrap {
    border: 0;
    background: none;
    overflow: visible;
  }

  .table thead {
    /* Visually hidden but still announced: the labels move inline. */
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    inline-size: 100%;
  }

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

  .table td {
    border: 0;
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-2);
  }

  .table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-subtle);
    font-weight: 600;
  }

  .table td:empty {
    display: none;
  }

  .table__actions {
    justify-content: flex-start;
  }
}

/* Definition lists used on detail pages (student profile, certificate). */
.detail-list {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin: 0;
}

.detail-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  font-weight: 500;
}
