/* LifeaaS ARTICLE-TABLES-01 v1.0.0 — public article body only. */
article.prose.r4-reading-prose table {
  display: table;
  width: 100%;
  max-width: var(--r4-reading-measure, 76ch);
  margin: 1.5rem 0;
  border: 1px solid var(--border, #1b3658);
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: auto;
  background: var(--card, #06162e);
  color: var(--foreground, #f6f7ff);
  font: inherit;
  line-height: 1.5;
  overflow: visible;
}

article.prose.r4-reading-prose table th,
article.prose.r4-reading-prose table td {
  padding: .75rem .85rem;
  border: 1px solid var(--border, #1b3658);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
}

article.prose.r4-reading-prose table thead th,
article.prose.r4-reading-prose table thead td {
  background: var(--muted, #102440);
  color: var(--foreground, #f6f7ff);
  font-weight: 700;
}

/* The renderer may strip scope="row"; retain the same presentation without it. */
article.prose.r4-reading-prose table tbody th {
  font-weight: 600;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

article.prose.r4-reading-prose table tbody tr:nth-child(even) {
  background: var(--background, #031021);
}

article.prose.r4-reading-prose table caption {
  caption-side: top;
  padding: 0 0 .75rem;
  color: var(--muted-foreground, #bdc7dc);
  font-size: .9rem;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
}

/* Also support article HTML in which the original wrapper survives. */
article.prose.r4-reading-prose .table-wrap {
  width: 100%;
  max-width: var(--r4-reading-measure, 76ch);
  margin: 1.5rem 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

article.prose.r4-reading-prose .table-wrap table {
  display: table;
  width: 100%;
  max-width: none;
  min-width: 100%;
  margin: 0;
  overflow: visible;
}

@media (max-width: 720px) {
  /* Bare tables survive sanitization: keep their horizontal scroll local. */
  article.prose.r4-reading-prose table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  article.prose.r4-reading-prose table th,
  article.prose.r4-reading-prose table td {
    min-width: 8.5rem;
    padding: .65rem .75rem;
  }

  article.prose.r4-reading-prose table th:first-child,
  article.prose.r4-reading-prose table td:first-child {
    min-width: 14rem;
  }

  article.prose.r4-reading-prose .table-wrap {
    max-width: 100%;
  }
}
