@layer components {
  table {
    background: oklch(var(--lch-ink-lightest) / 85%);
    border-collapse: collapse;
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
  }

  thead {
    background: var(--color-ink-lighter);
  }

  th {
    font-size: var(--text-x-small);
    font-weight: 500;
    letter-spacing: 0.08em;
    padding: calc(var(--block-space) * 0.75) var(--block-space);
    text-align: left;
    text-transform: uppercase;
  }

  td {
    border-top: var(--border);
    font-size: var(--text-small);
    padding: calc(var(--block-space) * 0.75) var(--block-space);
  }

  tbody tr {
    cursor: pointer;
    transition: background-color 100ms;

    &:hover {
      background-color: var(--color-canvas);
    }
  }

  @media (max-width: 140ch) {
    th, td {
      padding: calc(var(--block-space) * 0.5) calc(var(--block-space) * 0.5);
      font-size: var(--text-x-small);
    }

    /* Hide Duration column (3rd column) */
    th:nth-child(3),
    td:nth-child(3) {
      display: none;
    }
  }

  @media (max-width: 55ch) {
    /* Hide Time column (4th column) */
    th:nth-child(4),
    td:nth-child(4) {
      display: none;
    }

    th, td {
      padding: calc(var(--block-space) * 0.4) calc(var(--block-space) * 0.4);
    }
  }

  /* Div-based data tables (shared by dashboard views) */
  .data-table {
    background: oklch(var(--lch-ink-lightest) / 85%);
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
  }

  .data-table__header {
    background: var(--color-ink-lighter);
    font-size: var(--text-x-small);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .data-table__row {
    border-top: 1px solid var(--color-ink-lighter);
    transition: background-color 100ms;

    &:hover {
      background-color: var(--color-canvas);
    }
  }

  .data-table__probe {
    align-items: center;
    color: inherit;
    display: flex;
    gap: 0.75em;
    min-width: 0;
    text-decoration: none;

    &:hover {
      color: var(--color-link);
      text-decoration: none;
    }
  }

  .data-table__probe-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Utilities */
  .text-center {
    text-align: center;
  }

  .sticky-left {
    background: inherit;
    left: 0;
    position: sticky;
    z-index: 1;
  }

  .scrollable-x {
    overflow-x: auto;
  }
}
