/* Table - data table per docs/design-system.md, Components. Framed, it is its own
   white panel; line-soft lines separate the rows. A table wider than its
   column scrolls sideways inside its own box, never the page. */

.table {
  overflow-x: auto;
}

.table--framed {
  background: var(--color-bg-surface);
  border-radius: var(--border-radius);
}

.table__table {
  width: 100%;
  border-collapse: collapse;
}

.table__head {
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-note);
  font-weight: var(--weight-regular);
  text-align: left;
  white-space: nowrap;
  color: var(--color-text-muted);
  border-bottom: var(--border-width) solid var(--color-border);
}

.table__head--right {
  text-align: right;
}

.table__head--center {
  text-align: center;
}

/* Sortable header: the label is a button, the active column is in the text
   color with a chevron for the direction. */
.table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.table__sort:hover,
.table__sort--active {
  color: var(--color-text);
}

.table__sort:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.table__cell {
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  text-align: left;
  white-space: nowrap;
  color: var(--color-text);
  border-bottom: var(--border-width) solid var(--color-border-subtle);
}

.table__row:last-child .table__cell {
  border-bottom: 0;
}

.table__cell--numeric {
  font-variant-numeric: tabular-nums;
}

.table__cell--right {
  text-align: right;
}

.table__cell--center {
  text-align: center;
}

.table__cell--success {
  color: var(--color-success);
  font-weight: var(--weight-semibold);
}

.table__cell--error {
  color: var(--color-error);
  font-weight: var(--weight-semibold);
}

.table__cell--warning {
  color: var(--color-warning);
  font-weight: var(--weight-semibold);
}

.table__cell--muted {
  color: var(--color-text-muted);
}

.table__cell--truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table__row--clickable {
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
}

.table__row--clickable:hover {
  background: var(--color-bg-page);
}

.table__row--clickable:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: -2px;
}
