:has(> table:first-child) {
  overflow-x: auto;
  width: 100%;
}

table {
  background-color: white;
  height: fit-content;
  overflow-x: auto;
  border-radius: var(--table-radius);
  outline: solid 1px var(--neutral-100);
  table-layout: fixed;
  border-collapse: collapse;
  width: 100%;
  padding-inline: 1rem;
  max-width: 100%;
  column-count: 20;
  min-width: fit-content;
}

thead,
tbody,
tr {
  max-width: 100%;
}

thead > tr > th:first-of-type,
tbody > tr > td:first-of-type {
  padding-left: 1rem;
}

thead > tr > th:last-of-type,
tbody > tr > td:last-of-type {
  padding-right: 1rem;
}

th, td {
  text-wrap: nowrap;
  text-align: left;
  font-variation-settings: 'wght' var(--text-regular);
}

th {
  font-size: var(--rem-13);
  color: var(--text-label);
  horizontal-align: left;
  vertical-align: center;
  padding-block: .75rem;

  &:has(a) > a {
    display: flex;
    flex-direction: row;
    text-decoration: none;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    color: var(--text-label);

    .tables--sorting-icon-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
  }

  &:has(a) > a > .tables--sorting-icon-container {
    svg:nth-of-type(1) {
      display: block;
    }

    svg:nth-of-type(2),
    svg:nth-of-type(3) {
      display: none;
    }
  }

  &:has(a)[data-current-direction="asc"] > a > .tables--sorting-icon-container {
    svg:nth-of-type(3) {
      display: block;
    }

    svg:nth-of-type(1),
    svg:nth-of-type(2) {
      display: none;
    }
  }

  &:has(a)[data-current-direction="desc"] > a > .tables--sorting-icon-container {
    svg:nth-of-type(2) {
      display: block;
    }

    svg:nth-of-type(1),
    svg:nth-of-type(3) {
      display: none;
    }
  }
}

td {
  padding-block: .75rem;
  font-size: var(--rem-14);
  color: var(--neutral-950);
  box-shadow: 0 1px 0 0 var(--neutral-100) inset;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding-right: .5rem;

  &:not([data-type="status"]):not([data-type="actions"]):not([data-type="recipients"]) {
    overflow: hidden;
  }

  * {
    font-size: var(--rem-14);
    color: var(--neutral-950);
    text-decoration: none;
  }
}

.tables--row-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: fit-content;
}

.tables--table-wrapper {
  width: 100%;
  max-width: 100%;
  padding: 1px;
  height: fit-content;
  max-height: calc(100% - 4.75rem);
}

.tables--pagination-container {
  width: fit-content;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  margin: 2rem auto 0;
  gap: 1.5rem;

  a[role="button"] {
    padding: .5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    text-decoration: none;
    color: var(--neutral-950);
    outline: solid 1px var(--neutral-100);
    box-shadow: 0 1px 4px 0 var(--neutral-50);
    background-color: white;

    &[disabled] {
      color: var(--neutral-300);
      pointer-events: none;
      cursor: not-allowed;

      svg {
        opacity: 25%;
      }
    }
  }

  span {
    font-size: var(--rem-14);
    color: var(--text-information);
  }
}

.tables--pagination-arrows-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.tables--filters-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  margin-bottom: 2rem;
  padding: 1px;
  max-width: 100%;
  overflow-x: auto;
}

td[data-type="name"] > a {
  font-variation-settings: 'wght' var(--text-semibold);
  color: var(--neutral-950);
}

.tables--patients-table-container {
  width: 100%;
  padding: 1px;
  overflow-x: auto;
}

.tables--tasks-table-container {
  width: 100%;
  padding: 1px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
}

td[data-type="direction"] > span {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  width: fit-content;
}