html, body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}
h1:focus { outline: none; }
.blazor-error-boundary { background: #b91c1c; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An unexpected error occurred."; }

/* Statement & Ledger Table Formatting */
.ledger-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 11px;
}

.ledger-table th,
.ledger-table td {
    padding: 6px 8px;
    vertical-align: top;
}

.ledger-table td.ledger-subject,
.ledger-table td.ledger-remarks {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.ledger-table tr {
    break-inside: avoid;
}

/* Print Rules - Critical for High-Quality Multi-Page Printing & Thermal Roll */
@media print {
    .no-print,
    nav,
    aside,
    .app-header,
    .sidebar,
    .page-heading,
    .layout-footer {
        display: none !important;
    }

    html,
    body,
    main,
    .app-layout,
    .content-area,
    .page-container {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: A4 portrait;
        margin: 8mm 12mm 10mm 12mm;
    }

    /* A4 invoice print display */
    body:not(.print-mode-thermal) #invoice-a4-sheet {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    body:not(.print-mode-thermal) #invoice-thermal-sheet {
        display: none !important;
    }

    /* Thermal 80mm roll print display */
    body.print-mode-thermal #invoice-a4-sheet {
        display: none !important;
    }

    body.print-mode-thermal #invoice-thermal-sheet {
        display: block !important;
        width: 76mm !important;
        max-width: 76mm !important;
        margin: 0 auto !important;
        padding: 2mm 1mm !important;
        border: none !important;
        box-shadow: none !important;
    }

    .barcode-wrapper svg {
        height: 38px !important;
    }
}
