/* Shared print layout for Module.Reporting financial report pages (Ctrl+P).
   Loaded after app.css. Scoped to known page roots only. */

@media print {
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        ) {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .table-wrapper {
        flex: none !important;
        overflow: visible !important;
        max-height: none !important;
        min-height: 0 !important;
        height: auto !important;
        display: block !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .table-scroll-container,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .table-scroll-inner {
        flex: none !important;
        overflow: visible !important;
        max-height: none !important;
        min-height: 0 !important;
        height: auto !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-table-container,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-table-scroll-container,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-table-body-wrapper,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-table-body,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-paper.mud-table-root,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .mud-table-root {
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .sticky-column,
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        thead th {
        position: static !important;
        left: auto !important;
        top: auto !important;
        z-index: auto !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        table
        thead {
        display: table-header-group;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        table
        tbody {
        display: table-row-group;
    }

    /* Smaller type + tighter cells so more columns fit (overrides scoped report CSS via !important) */
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(
            .balance-sheet-table,
            .cash-flow-table,
            .profit-loss-table,
            .trial-balance-table,
            .portfolio-table
        ) {
        font-size: 8pt !important;
        min-width: 0 !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(
            .balance-sheet-table,
            .cash-flow-table,
            .profit-loss-table,
            .trial-balance-table,
            .portfolio-table
        )
        :is(thead th, thead td, tbody th, tbody td) {
        font-size: 8pt !important;
        padding: 0.1rem 0.28rem !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(.balance-sheet-table, .cash-flow-table, .profit-loss-table, .trial-balance-table)
        :is(.mud-table-cell, .mud-th) {
        font-size: 8pt !important;
        padding: 0.1rem 0.28rem !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(
            .month-column,
            .month-group-header,
            .company-column,
            .amount-column,
            .total-column,
            .ytd-total-column,
            .dimension-column,
            .company-name-header
        ) {
        min-width: 2.75rem !important;
        max-width: none !important;
        width: auto !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(.account-column, .account-number-column, .account-name-column, .sticky-col) {
        min-width: 5rem !important;
        max-width: 12rem !important;
        width: auto !important;
    }

    /* Smaller font for amount / numeric columns only (print; account labels stay 8pt) */
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(
            .balance-sheet-table,
            .cash-flow-table,
            .profit-loss-table,
            .trial-balance-table,
            .portfolio-table
        )
        :is(thead th, thead td, tbody th, tbody td):is(
            .month-column,
            .month-group-header,
            .company-column,
            .amount-column,
            .total-column,
            .ytd-total-column,
            .dimension-column,
            .company-name-header
        ) {
        font-size: 7pt !important;
    }

    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        :is(.balance-sheet-table, .cash-flow-table, .profit-loss-table, .trial-balance-table)
        :is(.mud-table-cell, .mud-th):is(
            .month-column,
            .company-column,
            .amount-column,
            .total-column,
            .ytd-total-column,
            .dimension-column
        ) {
        font-size: 7pt !important;
    }

    /* Collapse all / Export toolbar (screen-only) */
    :is(
            .balance-sheet-page,
            .profit-loss-page,
            .cash-flow-page,
            .trial-balance-page,
            .pnl-dimension-page,
            .ai-assistance-page
        )
        .report-print-hide {
        display: none !important;
    }
}
