@supports selector(:has(table)) {
  /* To ensure matching row height of nested table and parent table */
  table:has(table) :is(td, th) { white-space: nowrap; }

  /* To move even row background to nested table only */
  table:has(table) tr:nth-child(even) :is(th, td) {
    background: var(--global-color-background--app);
  }
  td:has(table) tr:nth-child(even) :is(th, td) {
    background: var(--global-color-primary--x-light);
  }

  /* To align nested table cells with parent table cells */
  td:has(table) { padding: 0; }
}
@supports not selector(:has(table)) {
  /* To ensure matching row height of nested table and parent table */
  table.has-table :is(td, th) { white-space: nowrap; }

  /* To move even row background to nested table only */
  table.has-table tr:nth-child(even) :is(th, td) {
    background: var(--global-color-background--app);
  }
  td.has-table tr:nth-child(even) :is(th, td) {
    background: var(--global-color-primary--x-light);
  }

  /* To align nested table cells with parent table cells */
  td.has-table { padding: 0; }
}

/* To replace any parent table columns above with nested table columns */
/* FAQ: Pulls nested table up by the height of the parent table head */
thead + tbody tr table {
  --offset-distance: calc(
    var(--cell-pad-vert) * 2
    +
    var(--cell-line-height) * var(--font-size)
    +
    var(--global-border-width--normal)
  );
  --offset: calc( var(--offset-distance) * -1 );

  transform: translateY(var(--offset));
  margin-bottom: var(--offset);
}
/* FAQ: Hides any parent table head underneath nested table head */
thead + tbody tr:first-of-type thead {
  background: var(--global-color-background--app);
}
/* FAQ: Hides all successive (thus redundant) nested table heads */
thead + tbody tr:not(:first-of-type) thead {
  visibility: hidden;
}
/* FAQ: Re-colors border of all successive nested rows (to match parent row) */
thead + tbody tr:not(:first-of-type) tbody :is(td,th) {
  border-color: var(--global-color-primary--light);
}

/* To reduce inline padding
   at start and end of nested table
   unless at start or end of parent table */
td:not(:first-child) th:first-child,
td:not(:first-child) td:first-child {
  padding-inline-start: 8px;
}
td:not(:last-child) th:last-child,
td:not(:last-child) td:last-child {
  padding-inline-end: 8px;
}
