/* Native WordPress tables: one shared foundation, with editor overrides preserved. */
.wp-block-table:not(.is-style-pcr-comparison) {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--wp--preset--color--border);
    border-radius: var(--wp--custom--radius);
    background: var(--wp--preset--color--background);
    -webkit-overflow-scrolling: touch;
}

.wp-block-table:not(.is-style-pcr-comparison) table {
    width: 100%;
    margin: 0;
    border: 0;
    border-spacing: 0;
    border-collapse: separate;
    color: var(--wp--preset--color--foreground);
    font-size: var(--wp--preset--font-size--base);
    line-height: 1.5;
}

.wp-block-table:not(.is-style-pcr-comparison) :is(th, td) {
    padding: var(--wp--preset--spacing--4) var(--wp--preset--spacing--6);
    border: 0;
    vertical-align: middle;
    text-align: left;
    overflow-wrap: break-word;
}

.wp-block-table:not(.is-style-pcr-comparison) :is(thead, tfoot) {
    border: 0;
}

.wp-block-table:not(.is-style-pcr-comparison) table:not(.has-background) thead {
    background: var(--wp--preset--color--gray-light);
}

.wp-block-table:not(.is-style-pcr-comparison) thead th {
    border-bottom: 1px solid var(--wp--preset--color--border);
    font-size: var(--wp--preset--font-size--sm);
    font-weight: 600;
}

.wp-block-table:not(.is-style-pcr-comparison) tbody tr + tr > :is(th, td) {
    border-top: 1px solid var(--wp--preset--color--border);
}

.wp-block-table:not(.is-style-pcr-comparison) table:not(.has-background) tfoot {
    background: var(--wp--preset--color--coral-light);
}

.wp-block-table:not(.is-style-pcr-comparison) tfoot :is(th, td) {
    border-top: 1px solid var(--wp--preset--color--border);
    font-weight: 600;
}

.wp-block-table:not(.is-style-pcr-comparison) [data-align="center"] {
    text-align: center;
}

.wp-block-table:not(.is-style-pcr-comparison) [data-align="right"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* The amount column keeps its space while longer descriptions wrap naturally. */
.wp-block-table:not(.is-style-pcr-comparison) table:has(thead tr > :nth-child(2):last-child[data-align="right"]) thead th:first-child {
    width: 68%;
}

.wp-block-table.is-style-stripes:not(.is-style-pcr-comparison) tbody tr:nth-child(odd) {
    background: var(--wp--preset--color--gray-light);
}

.wp-block-table.is-style-stripes:not(.is-style-pcr-comparison) tbody tr + tr > :is(th, td) {
    border-top: 0;
}

.wp-block-table:not(.is-style-pcr-comparison) figcaption {
    margin: 0;
    padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--6);
    border-top: 1px solid var(--wp--preset--color--border);
    color: var(--wp--preset--color--muted-foreground);
    font-size: var(--wp--preset--font-size--sm);
    line-height: 1.5;
    text-align: left;
}

.wp-block-table:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .wp-block-table:not(.is-style-pcr-comparison) :is(th, td, figcaption) {
        padding: var(--wp--preset--spacing--4);
    }

    .wp-block-table:not(.is-style-pcr-comparison) table:has(tr > :nth-child(3)) {
        min-width: 600px;
    }

    .wp-block-table:not(.is-style-pcr-comparison) figcaption {
        position: sticky;
        left: 0;
        padding-top: var(--wp--preset--spacing--2);
        padding-bottom: var(--wp--preset--spacing--2);
    }
}
