/* IFS Hinweisgeber: print layout for the authenticated report history.
 * Only the print medium is affected. The7 retains its normal screen layout.
 */
@page {
    size: A4 portrait;
    margin: 12mm;
}

@media print {
    /* Browser/UI controls and interactive elements are not part of the record. */
    body.ifs-report-view #wpadminbar,
    body.ifs-report-view #page > .page-title,
    body.ifs-report-view #page > .header-space,
    body.ifs-report-view #page > .mobile-header-space,
    body.ifs-report-view #page > .dt-mobile-header,
    body.ifs-report-view #page > .scroll-top,
    body.ifs-report-view #footer,
    body.ifs-report-view #bottom-bar,
    body.ifs-report-view .ifs-report-print-controls,
    body.ifs-report-view .ifs-report #ifs-chat-input,
    body.ifs-report-view .ifs-report #ifs-chat-send,
    body.ifs-report-view .ifs-report .ifs-chat-upload,
    body.ifs-report-view .ifs-report .ifs-chat-actions,
    body.ifs-report-view .ifs-report .ifs-chat-unread-divider {
        display: none !important;
    }

    body.ifs-report-view,
    body.ifs-report-view #page,
    body.ifs-report-view #main {
        background: #fff !important;
        color: #222 !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Don't reserve The7's screen gutters or fixed-header space on paper. */
    body.ifs-report-view #main,
    body.ifs-report-view #main > .wf-wrap,
    body.ifs-report-view #main .wf-container-main,
    body.ifs-report-view #main .wf-container,
    body.ifs-report-view #main .ifs-wrap.ifs-report {
        display: block !important;
        float: none !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    /* Keep the branding, but turn The7's sticky/fixed masthead into normal flow. */
    body.ifs-report-view #page > .masthead {
        position: static !important;
        top: auto !important;
        inset: auto !important;
        transform: none !important;
        box-shadow: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 5mm !important;
    }
    body.ifs-report-view #page > .masthead .header-bar {
        height: auto !important;
        min-height: 0 !important;
        padding: 0 0 3mm !important;
    }
    body.ifs-report-view #page > .masthead .top-bar,
    body.ifs-report-view #page > .masthead .main-nav,
    body.ifs-report-view #page > .masthead .mobile-header-bar {
        display: none !important;
    }
    body.ifs-report-view #page > .masthead .branding img {
        width: auto !important;
        max-width: 90mm !important;
        max-height: 22mm !important;
    }

    /* Single-column print order: company context, report, chat, then sidebar. */
    body.ifs-report-view .ifs-report .ifs-grid,
    body.ifs-report-view .ifs-report .ifs-main,
    body.ifs-report-view .ifs-report .ifs-aside {
        display: block !important;
        float: none !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    body.ifs-report-view .ifs-report .ifs-aside {
        margin: 9mm 0 0 !important;
        padding: 5mm 0 0 !important;
        border-top: 1px solid #bbb;
        clear: both;
    }
    body.ifs-report-view .ifs-report .ifs-aside-box {
        display: block !important;
        margin: 0 0 6mm !important;
        break-inside: auto;
        page-break-inside: auto;
    }
    body.ifs-report-view .ifs-report .ifs-aside-head {
        padding: 2mm 0 !important;
        border-bottom: 1px solid #aaa;
        color: #222 !important;
        background: transparent !important;
    }
    body.ifs-report-view .ifs-report .ifs-aside-body {
        padding: 3mm 0 0 !important;
    }
    body.ifs-report-view .ifs-report .ifs-logo {
        width: 64mm !important;
        max-width: 100% !important;
        height: 48mm !important;
        aspect-ratio: auto !important;
        margin: 0 0 3mm !important;
        padding: 3mm !important;
    }
    body.ifs-report-view .ifs-report .ifs-contact-row {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Let cards and long messages naturally continue on subsequent pages. */
    body.ifs-report-view .ifs-report .ifs-box {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 0 5mm !important;
        padding: 4mm !important;
        box-shadow: none !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
        box-sizing: border-box !important;
    }
    body.ifs-report-view .ifs-report h1,
    body.ifs-report-view .ifs-report h2,
    body.ifs-report-view .ifs-report h3 {
        break-after: avoid;
        page-break-after: avoid;
    }
    body.ifs-report-view .ifs-report .ifs-report-summary .ifs-report-facts {
        grid-template-columns: 35mm minmax(0, 1fr) !important;
        gap: 2mm 4mm !important;
    }
    body.ifs-report-view .ifs-report .ifs-report-original > div {
        display: block !important;
        visibility: visible !important;
    }
    /* Theme print rules must not expose private download proxy URLs on paper. */
    body.ifs-report-view .ifs-report a[href]::after {
        content: none !important;
    }

    body.ifs-report-view .ifs-report .ifs-print-confidential {
        display: block !important;
        margin: 0 0 5mm !important;
        font-size: 9pt;
        font-weight: 700;
        color: #444 !important;
    }

    /* IMPORTANT: flex scroll containers can truncate long conversations in PDF.
       Flow messages as normal blocks with no scrolling, clipping or height cap. */
    body.ifs-report-view .ifs-report #ifs-chat.ifs-chat {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        scrollbar-gutter: auto !important;
        padding: 3mm !important;
        border: 1px solid #bbb !important;
        border-radius: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
        box-sizing: border-box !important;
    }
    body.ifs-report-view .ifs-report #ifs-chat .ifs-chat-msg {
        display: block !important;
        width: fit-content !important;
        max-width: 90% !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 0 3mm !important;
        padding: 2.5mm 3mm !important;
        opacity: 1 !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
        overflow-wrap: anywhere;
    }
    body.ifs-report-view .ifs-report #ifs-chat .ifs-chat-reporter {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
    body.ifs-report-view .ifs-report #ifs-chat .ifs-chat-admin {
        margin-left: auto !important;
        margin-right: 0 !important;
    }
    body.ifs-report-view .ifs-report #ifs-chat .ifs-chat-system {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 85% !important;
    }
    body.ifs-report-view .ifs-report #ifs-chat .ifs-chat-body {
        overflow: visible !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }
}

/* RC2 print hardening: The7's fixed masthead may repeat and overlap pages.
   Print a dedicated in-flow text letterhead once; hide theme sticky headers. */
@media print {
    body.ifs-report-view #page > .masthead,
    body.single-hinweismeldestelle #page > .masthead,
    body.ifs-report-view .sticky-header,
    body.single-hinweismeldestelle .sticky-header,
    body.single-hinweismeldestelle #wpadminbar,
    body.single-hinweismeldestelle #page > .page-title,
    body.single-hinweismeldestelle #page > .header-space,
    body.single-hinweismeldestelle #page > .mobile-header-space,
    body.single-hinweismeldestelle #footer,
    body.single-hinweismeldestelle #bottom-bar,
    body.single-hinweismeldestelle .scroll-top,
    body.single-hinweismeldestelle .dt-mobile-header,
    body.single-hinweismeldestelle .ifs-credentials-actions,
    body.single-hinweismeldestelle .ifs-leave-dialog,
    body.single-hinweismeldestelle .ifs-form-box,
    body.single-hinweismeldestelle .ifs-preform-text,
    body.ifs-report-view .ifs-report-print-controls {
        display:none!important;
    }
    body.single-hinweismeldestelle,
    body.ifs-report-view {
        font-size:9.5pt!important;
        line-height:1.4!important;
        color:#1e281e!important;
        background:#fff!important;
    }
    body.single-hinweismeldestelle #main,
    body.single-hinweismeldestelle #main > .wf-wrap,
    body.single-hinweismeldestelle #main .wf-container,
    body.single-hinweismeldestelle #main .wf-container-main,
    body.single-hinweismeldestelle #main .ifs-wrap {
        display:block!important;
        width:100%!important;
        max-width:none!important;
        min-width:0!important;
        margin:0!important;
        padding:0!important;
        height:auto!important;
        min-height:0!important;
        overflow:visible!important;
    }
    body.single-hinweismeldestelle .ifs-print-letterhead {
        display:flex!important;
        justify-content:space-between;
        align-items:baseline;
        gap:8mm;
        margin:0 0 5mm;
        padding:0 0 2.5mm;
        border-bottom:1px solid #7b9b54;
        font-size:9pt;
        font-weight:600;
        color:#222!important;
        break-after:avoid;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-grid,
    body.single-hinweismeldestelle .ifs-company .ifs-main,
    body.single-hinweismeldestelle .ifs-company .ifs-aside {
        display:block!important;
        width:100%!important;
        max-width:none!important;
        min-width:0!important;
        margin:0!important;
        padding:0!important;
        overflow:visible!important;
        float:none!important;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-title {
        font-size:17pt!important;
        margin:0 0 3mm!important;
        padding:0!important;
        line-height:1.3!important;
    }
    body.single-hinweismeldestelle .ifs-company h2 {font-size:14pt!important;line-height:1.3!important;}
    body.single-hinweismeldestelle .ifs-company h3 {font-size:11pt!important;line-height:1.3!important;}
    body.single-hinweismeldestelle .ifs-company h4 {font-size:10pt!important;}
    body.single-hinweismeldestelle .ifs-company p,
    body.single-hinweismeldestelle .ifs-company dd,
    body.single-hinweismeldestelle .ifs-company dt,
    body.single-hinweismeldestelle .ifs-company li {font-size:9.5pt!important;line-height:1.45!important;}
    body.single-hinweismeldestelle .ifs-company .ifs-editor-copy p {margin-bottom:2mm!important;line-height:1.45!important;}
    body.single-hinweismeldestelle .ifs-company .ifs-logo {
        box-sizing:border-box!important;
        width:65mm!important;
        height:48.75mm!important;
        max-width:65mm!important;
        max-height:48.75mm!important;
        aspect-ratio:4/3!important;
        padding:3mm!important;
        margin:0 0 2mm!important;
        break-inside:avoid;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-logo img {
        object-fit:contain!important;
        max-width:100%!important;
        max-height:100%!important;
        height:100%!important;
        width:100%!important;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-aside {
        margin:6mm 0 0!important;
        padding:3mm 0 0!important;
        border-top:1px solid #aaa;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-aside-head {
        color:#000!important;
        background:transparent!important;
        padding:1mm 0!important;
        font-size:11pt!important;
        font-weight:700!important;
        break-after:avoid;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-aside-body {padding:2mm 0 0!important;}
    body.single-hinweismeldestelle .ifs-company .ifs-aside-box {margin:0 0 4mm!important;}
    body.single-hinweismeldestelle .ifs-company .ifs-credentials {
        padding:4mm!important;
        margin:4mm 0!important;
        break-inside:avoid;
        box-shadow:none!important;
    }
    body.single-hinweismeldestelle .ifs-company .ifs-credentials code,
    body.single-hinweismeldestelle .ifs-company .ifs-credentials a {font-size:9pt!important;overflow-wrap:anywhere;}
    body.single-hinweismeldestelle .ifs-company .ifs-credentials dl {grid-template-columns:35mm minmax(0,1fr)!important;gap:1.5mm 3mm!important;}
    body.single-hinweismeldestelle .ifs-company a[href]::after {content:none!important;}
    body.ifs-report-view .ifs-report .ifs-aside-head {
        color:#000!important;
        font-weight:700!important;
        background:none!important;
        break-after:avoid;
        page-break-after:avoid;
    }
    body.ifs-report-view .ifs-report .ifs-aside-head + .ifs-aside-body {break-before:avoid!important;}
    body.ifs-report-view .ifs-report .ifs-aside-box {
        break-inside:auto!important;
    }
}
