/* SL-1474: one shared paper layout for "Export PDF" (browser print dialog -> Save as PDF). Nothing here
   applies on screen. Page size/orientation: print.js injects the @page rule (letter, landscape only when
   the grid is wider than the page). */

.print-only { display: none; }

@media print {
    /* --- the app shell and every screen control disappear --- */
    .shell-topbar, .shell-nav, .shell-nav-scrim, .shell-menu-scrim, .shell-nav-resizer,
    .shell-maintenance-banner, .shell-stage-banner, .shell-support-access-banner, .shell-resume-setup-banner,
    #blazor-error-ui,
    .report-breadcrumb, .report-params, .report-actions, .report-pager, .report-warning, .report-tile-grid,
    .kernel-filter-bar, .kernel-pager, .aa-actions, .aa-filters, .aa-tabs, .dashboard-tabs,
    button:not(.data-grid-sort-btn):not(.aa-link), .no-print {
        display: none !important;
    }
    /* a grid's sortable header and a campaign's expand toggle carry text: they print as plain text */
    .data-grid-sort-btn, .aa-link { background: none !important; border: 0 !important; padding: 0 !important; color: #000 !important; font: inherit; }

    /* --- the page flows over as many sheets as it needs (the shell is a 100vh scroller on screen) --- */
    html, body, #app, .shell, .shell-body, .shell-main {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* --- white paper, black ink: no dark theme --- */
    :root, html[data-theme] {
        color-scheme: light !important; background: #fff !important;
        /* the surface, border and text tokens screens paint with, back to paper values (charts keep their series colours) */
        --st-surface: #fff; --st-surface-app: #fff; --st-border: #bbb; --st-border-strong: #888;
        --st-text-secondary: #333; --st-text-muted: #555;
        --surface: #fff; --surface-raised: #fff; --border: #bbb; --text-primary: #000; --text-secondary: #333; --text-muted: #555;
    }
    .aa-card, .aa-tile { break-inside: avoid; box-shadow: none !important; overflow: visible !important; }
    .chart-svg { max-width: 100%; height: auto; }
    html, body, .shell, .shell-main, .report-page, .aa-page, .sub-account-search-page, .dashboard-page, .data-grid-wrapper, .data-grid, .data-grid th,
    .data-grid td, .data-grid tr, .rs-sheet, .rs-head, .rs-wrap {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    .report-page, .aa-page, .sub-account-search-page { max-width: none !important; width: 100% !important; }
    .data-grid-wrapper { overflow: visible !important; border: none !important; }
    .data-grid { width: 100%; border-collapse: collapse; font-size: 9pt; }
    .data-grid th, .data-grid td { border-bottom: 1px solid #999 !important; height: auto !important; white-space: normal; }

    /* statements (Profit and Loss, Balance Sheet, Trial Balance): same layout, paper colours; a negative stays red */
    .rs-wrap {
        --rs-page: #fff; --rs-sheet: #fff; --rs-band: #eee; --rs-total: #f4f4f4; --rs-hair: #bbb;
        --rs-rule: #555; --rs-text: #000; --rs-muted: #444; --rs-code: #444; --rs-final: #e2e2e2;
        --rs-red: #b00020; --rs-green: #0b6b3a;
        margin: 0 !important;
    }
    .rs-scroll { overflow: visible !important; }
    .rs-sheet { border: none !important; border-radius: 0 !important; }
    .rs-wrap *, .rs-wrap *::before, .rs-wrap *::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* --- long tables: header on every sheet, a row is never cut in two --- */
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr, .rs-row, .rs-sheet > * { break-inside: avoid; page-break-inside: avoid; }

    /* --- the report's own heading lines (report, account, range, filters) --- */
    .print-only { display: block; margin: 0 0 12pt; color: #000; }
    .print-only h2 { font-size: 14pt; margin: 0 0 4pt; }
    .print-only p { margin: 0; font-size: 10pt; }
    .print-only .print-label { font-weight: 600; }
}
