@layer components {
  .table {
    width: 100%;
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    border-collapse: collapse;
  }

  :where(.table) :where(thead th) {
    padding: 0.75rem var(--space-md);
    font-size: var(--text-label);
    font-weight: var(--weight-emphasis);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    text-align: start;
    white-space: nowrap;
    color: var(--ink-muted);
    background: var(--sheet-head);
    border-bottom: 1px solid var(--border);
  }

  :where(.table) :where(td, tbody th) {
    padding: 0.75rem var(--space-md);
    font-weight: inherit;
    text-align: start;
    vertical-align: top;
    border-bottom: 1px solid var(--hairline);
  }

  :where(.table) :where(tbody:last-child tr:last-child > *) {
    border-bottom: 0;
  }

  .table__group th {
    padding-top: var(--space-md);
    padding-bottom: var(--space-sm);
    font-size: var(--text-md);
    font-weight: var(--weight-display);
    color: var(--ink);
    background: var(--sheet-group);
    border-bottom: 1px solid var(--border);
  }

  .table__row {
    transition: background var(--transition-fast);

    &:hover {
      background: var(--sheet-head);
    }
  }

  .table__row--muted {
    color: var(--ink-muted);

    & .table__name {
      color: var(--ink-muted);
    }
  }

  .table__name {
    display: block;
    max-width: 40rem;
    font-size: var(--text-md);
    font-weight: var(--weight-emphasis);
    line-height: 1.3;
    color: var(--ink);
  }

  a.table__name:hover {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .table__detail {
    display: block;
    max-width: 60ch;
    margin-top: var(--space-xs);
    line-height: 1.45;
    color: var(--ink-muted);
  }

  .table__number {
    text-align: end;
    white-space: nowrap;
  }

  .table :where(th.table__number) {
    text-align: end;
  }

  .table .icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  .table__nowrap {
    white-space: nowrap;
  }

  .table__muted {
    color: var(--ink-muted);
  }

  .table__actions {
    width: 1%;
    white-space: nowrap;
    text-align: end;
  }

  .table__menu {
    position: relative;
    display: inline-block;

    & > .button {
      justify-content: center;
      width: var(--control-height);
      padding-inline: 0;
    }
  }

  .table :where(.table__actions, td:has(> .dropdown, > .input)) {
    padding-block: var(--space-xs);
  }

  .table__more {
    padding: 0.75rem var(--space-md);
    border-top: 1px solid var(--hairline);
  }

  .table__more-toggle {
    font-size: var(--text-sm);
    font-weight: var(--weight-emphasis);
    color: var(--blue);
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &:hover {
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  .status {
    white-space: nowrap;
  }

  .status--strong {
    font-weight: var(--weight-display);
    color: var(--ink);
  }

  .status--muted {
    color: var(--ink-muted);
  }

  .status__note {
    display: block;
    margin-top: var(--space-xs);
    font-weight: var(--weight-text);
    white-space: normal;
    color: var(--ink-muted);
  }
}
