@media print {
    /* Hide everything except our print host */
    body > *:not(#print-host) {
        display: none !important;
    }

    /* The print host fills the page */
    #print-host {
        display: block !important;
        position: static;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    #print-host * {
        visibility: visible;
    }

    /* ── RoofEditor layout fixes ── */

    /* Break the flex layout — force everything to stack vertically */
    #print-host div[style*="display: flex"],
    #print-host div[style*="display:flex"] {
        display: block !important;
    }

    /* Remove scroll container constraints */
    #print-host #svg-scroll-container {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Force SVG to fill the page width — override inline width/height attributes */
    #print-host #roof-svg {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }

    /* Hide interactive controls, toolbars, scale bar, sidebar panels */
    #print-host .rz-panel,
    #print-host .controls,
    #print-host .btn-group,
    #print-host .btn,
    #print-host .form-control,
    #print-host .form-select,
    #print-host .form-range,
    #print-host .alert,
    #print-host .no-print,
    #print-host details > summary {
        display: none !important;
    }

    /* Hide scale bar and any absolute-positioned overlays */
    #print-host [style*="position: absolute"] {
        display: none !important;
    }

    /* But keep the SVG and report content visible (they may be position:relative) */
    #print-host #roof-svg,
    #print-host #roof-svg * {
        display: initial !important;
    }

    /* Kill any element hidden in preview mode */
    #print-host [style*="display:none"],
    #print-host [style*="display: none"] {
        display: none !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ── Prevent horizontal overflow ── */
    #print-host #export-report {
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    #print-host #export-report * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ── Page break support ── */
    .html2pdf__page-break {
        page-break-before: always;
    }

    [style*="page-break-before: always"] {
        page-break-before: always !important;
    }

    #print-host [style*="break-inside: avoid"] {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ── Tables ── */
    #print-host table {
        width: 100% !important;
    }

    #print-host .table tr {
        page-break-inside: avoid;
    }

    /* ── Clean page ── */
    @page {
        margin: 10mm;
        size: A4 portrait;
    }
}