@media print {

    #wpadminbar,
    #masthead,
    #mobile-header,
    .site-footer,
    #footer-widgets,
    .generate-back-to-top {
        display: none !important;
    }

    .entry-content > * {
        display: none !important;
    }

    .entry-content > .billunits-calculator-wrapper {
        display: block !important;
    }

    .billunits-calculator-wrapper > .calc-header,
    .billunits-calculator-wrapper > .calc-form,
    .billunits-calculator-wrapper > .calc-insights,
    .billunits-calculator-wrapper > .calc-forecast,
    .billunits-calculator-wrapper > .calc-errors {
        display: none !important;
    }

    .billunits-calculator-wrapper > .calc-results {
        display: block !important;
    }

    .results-card {
        display: block !important;
        margin: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* NEW — the bill breakdown table itself, its wrapper, and every
       row inside it must individually refuse to split across a page
       break. Without this, the table can break mid-row even when
       the outer .results-card is marked break-inside:avoid, because
       browsers treat tables as their own breaking context. */
    .bill-table-wrap,
    .bill-table,
    .bill-table tbody,
    .bill-table tr,
    .slab-viz,
    .slab-viz__bars,
    .slab-bar,
    .bill-hero {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* Force the WHOLE card to be treated as one unbreakable unit
       as the primary rule — this is the strongest signal to the
       print engine. If the card is taller than one page, it will
       still need to break somewhere, but it will prefer to do so
       between major sections (hero / slabs / table) rather than
       mid-row. */
    .results-card {
        break-inside: avoid-page !important;
    }

}