/*
 * A4 official reports — light formal colors (print-safe in B&W too).
 * Use soft fills + clear borders; avoid solid black blocks that blot ink.
 */
* {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0 auto;
    padding: 4px 4px;
    width: 100%;
    max-width: 204mm;
    font-family: Tahoma, Arial, "Segoe UI", sans-serif;
    font-size: 13.5px;
    line-height: 1.42;
    font-weight: 600;
    color: #12263a !important;
    background: #fff !important;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.report-wrap {
    width: 100%;
    color: #12263a !important;
}

/* —— Official letterhead —— */
.letterhead {
    width: 100%;
    border: 1px solid #9eb6c9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #fff;
}

.letterhead-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 14px;
    align-items: flex-start;
    padding: 10px 12px;
    background: linear-gradient(180deg, #eef6fa 0%, #ffffff 100%);
    border-bottom: 1px solid #c5d6e3;
}

.letterhead-brand {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    flex: 1 1 240px;
}

.letterhead-logo {
    height: 48px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    background: transparent;
    border: 0;
    box-shadow: none;
    filter: none;
    flex-shrink: 0;
}

.letterhead-name {
    font-size: 16px;
    font-weight: 900;
    color: #0d3b4d !important;
    margin-bottom: 2px;
}

.letterhead-meta {
    font-size: 11px;
    font-weight: 600;
    color: #334155 !important;
    line-height: 1.4;
}

.letterhead-side {
    flex: 1 1 200px;
    min-width: 0;
    text-align: start;
}

.letterhead-doc-title {
    font-size: 15px;
    font-weight: 900;
    color: #0d3b4d !important;
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

.letterhead-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 7px 12px;
    background: #f3f8fb;
    border-top: 1px solid #d7e4ee;
}

.letterhead-period-label {
    font-size: 10px;
    font-weight: 800;
    color: #1a5f7a !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.letterhead-period-value {
    font-size: 13px;
    font-weight: 900;
    color: #0d3b4d !important;
    border: 1px solid #9eb6c9;
    background: #fff;
    border-radius: 4px;
    padding: 3px 10px;
}

.letterhead-ribbon {
    height: 3px;
    background: linear-gradient(90deg, #a8c5d4, #d5e6ef, #e8d9a8, #a8c5d4);
}

.report-section-title {
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 900;
    color: #0d3b4d !important;
    border-bottom: 1px solid #c5d6e3;
    padding-bottom: 4px;
}

.report-header {
    border-bottom: 1px solid #c5d6e3;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.report-header h1 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 900;
    color: #0d3b4d !important;
}

/* —— Statement cards —— */
.statement-block {
    border: 1px solid #b7c9d8;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    page-break-inside: avoid;
    background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 55%);
    width: 100%;
}

.statement-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 8px;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid #c5d6e3;
    color: #0d3b4d !important;
    font-weight: 800;
}

.statement-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-bottom: 6px;
    font-size: 11.5px;
    font-weight: 700;
}

.statement-grid > div {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.statement-remain-after {
    grid-column: 1 / -1;
    background: #d1fae5 !important;
    border: 1.5px solid #065f46;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12.5px;
}
.statement-remain-after strong {
    color: #065f46 !important;
    font-size: 14px;
}
.pkg-status-chip {
    display: block;
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    border: 2px solid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
.pkg-status-chip.is-active {
    background: #d1fae5 !important;
    border-color: #065f46 !important;
    color: #065f46 !important;
}
.pkg-status-chip.is-expired {
    background: #fee2e2 !important;
    border-color: #991b1b !important;
    color: #991b1b !important;
}
.statement-block.is-pkg-active,
.statement-pkg-card.is-active {
    background: #ecfdf5 !important;
    border: 2px solid #065f46 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
.statement-block.is-pkg-expired,
.statement-pkg-card.is-expired {
    background: #fef2f2 !important;
    border: 2px solid #991b1b !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
.statement-block.is-pkg-expired .statement-head,
.statement-pkg-card.is-expired {
    color: #991b1b;
}
.statement-block.is-pkg-active .statement-head {
    color: #065f46 !important;
    border-bottom-color: #065f46;
}
.statement-block.is-pkg-expired .statement-head {
    color: #991b1b !important;
    border-bottom-color: #991b1b;
}
.statement-pkg-card {
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    page-break-inside: avoid;
}
.statement-pkg-note {
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #334e68;
}

.statement-lines {
    margin-top: 4px;
    width: 100%;
    overflow: hidden;
}

.statement-footer-totals {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #9eb6c9;
    border-radius: 8px;
    background: #eef6fa;
    font-weight: 900;
    font-size: 11.5px;
    color: #0d3b4d !important;
}

/* —— Tables —— */
.report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    color: #12263a !important;
}

.report-table th,
.report-table td,
.bs-kpi-table th,
.bs-kpi-table td,
.bs-result-table th,
.bs-result-table td {
    border: 1px solid #b7c9d8;
    padding: 6px 7px;
    vertical-align: middle !important;
    text-align: center !important;
    color: #12263a !important;
    background: #fff !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 12px;
}

.report-table th {
    background: #e8f2f7 !important;
    color: #0d3b4d !important;
    font-weight: 900;
    font-size: 11.5px;
}

.report-table tbody tr:nth-child(even) td {
    background: #f7fafc !important;
}

.report-table tbody tr.row-unpaid td {
    background: #fff4e8 !important;
    color: #7a2e0b !important;
    font-weight: 800;
}

.statement-unpaid {
    border-color: #d9a066 !important;
    background: linear-gradient(180deg, #fff6ec 0%, #ffffff 55%) !important;
}

.statement-unpaid .statement-head {
    color: #7a2e0b !important;
    border-bottom-color: #e0b27a;
}

.report-table tbody td {
    font-weight: 700;
}

table th,
table td {
    text-align: center !important;
    vertical-align: middle !important;
}

.report-footer {
    margin-top: 10px;
    font-size: 12px;
    font-weight: 800;
    color: #0d3b4d !important;
    border: 1px solid #c5d6e3;
    border-radius: 8px;
    background: #f3f8fb;
    padding: 8px 10px;
}

.badge-paid,
.status-paid {
    font-weight: 900;
    text-decoration: underline;
    color: #0f5c45 !important;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 7mm 4mm 9mm 4mm;
    }
    html, body {
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #12263a !important;
        font-size: 13.5px !important;
    }
    .report-wrap,
    .statement-block,
    .letterhead,
    .statement-lines,
    .report-table {
        max-width: 100% !important;
        width: 100% !important;
    }
    .statement-block {
        break-inside: avoid;
    }
    .statement-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .letterhead-logo {
        filter: none !important;
        box-shadow: none !important;
        border: 0 !important;
    }
    .report-table th {
        background: #e8f2f7 !important;
        color: #0d3b4d !important;
    }
    .report-table tbody tr.row-unpaid td {
        background: #fff4e8 !important;
        color: #7a2e0b !important;
    }
    .statement-unpaid {
        border-color: #d9a066 !important;
        background: #fff6ec !important;
    }
    .report-table tr {
        page-break-inside: avoid;
    }
}

/* Balance Sheet official print — stamp + signatures (hotel stamp asset) */
.bs-print-h {
    margin: 14px 0 6px;
    font-size: 14px;
    font-weight: 800;
    color: #0d3b4d;
    border-bottom: 1px solid #9eb6c9;
    padding-bottom: 4px;
}
.bs-total-row td {
    font-weight: 900;
    font-size: 13px;
    background: #dceef6 !important;
    color: #0d3b4d !important;
}
.bs-net-row td {
    font-weight: 900;
    font-size: 15px;
    background: #dcf5ee !important;
}
.bs-result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 8px;
}
.bs-result-table td {
    padding: 9px 10px !important;
    font-size: 13px;
    font-weight: 800;
}
.bs-result-table .bs-net-row td {
    font-size: 16px;
    padding: 12px 10px !important;
}
.bs-net-pos { color: #0f766e !important; }
.bs-net-neg { color: #b91c1c !important; }
.bs-sign-table {
    width: 100%;
    margin-top: 28px;
    border-collapse: collapse;
}
.bs-sign-table td {
    vertical-align: bottom;
    text-align: center;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
}
.bs-sign-col { width: 38%; }
.bs-stamp-col { width: 24%; }
.bs-sign-line {
    border-bottom: 1px solid #334155;
    height: 42px;
    margin-bottom: 6px;
}
.bs-stamp {
    max-width: 110px;
    max-height: 110px;
    object-fit: contain;
}
.bs-print-note {
    font-size: 11px;
    color: #334155;
    margin: 6px 0 10px;
}
.bs-kpi-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 6px;
    margin: 4px 0 10px;
}
.bs-kpi-table td {
    width: 33.33%;
    background: #eef5f9;
    border: 1px solid #9eb6c9;
    padding: 8px 10px;
    vertical-align: middle;
    text-align: center;
}
.bs-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: #0d3b4d;
    margin-bottom: 4px;
}
.bs-kpi-val {
    font-size: 15px;
    font-weight: 900;
}
.bs-kpi-val-sm {
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 2px;
}
.bs-insight {
    background: #f8fafc;
    border: 1px solid #9eb6c9;
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 12px;
}
.bs-h-sub {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}
.bs-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    border-bottom: 1px solid #9eb6c9;
    margin: 8px 0 6px;
    padding: 0 4px 4px;
}
.bs-chart-col {
    flex: 1;
    min-width: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
}
.bs-chart-col.is-best .bs-chart-lbl {
    font-weight: 900;
    color: #0f766e;
}
.bs-chart-val {
    font-size: 8px;
    font-weight: 700;
    margin-bottom: 2px;
}
.bs-chart-bar {
    width: 72%;
    max-width: 28px;
    background: #0f766e;
}
.bs-chart-bar.is-pos { background: #0f766e; }
.bs-chart-bar.is-neg { background: #b91c1c; }
.bs-chart-bar.is-rev { background: #0e7490; }
.bs-chart-bar.is-exp { background: #b45309; }
.bs-chart-group {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: 130px;
}
.bs-chart-group .bs-chart-bar {
    width: 10px;
    max-width: none;
}
.bs-chart-lbl {
    font-size: 8px;
    margin-top: 4px;
    line-height: 1.15;
    word-break: break-word;
}
.bs-hcmp {
    border: 1px solid #9eb6c9;
    border-radius: 8px;
    padding: 10px 12px 8px;
    margin: 6px 0 14px;
    background: #f7fafc;
    page-break-inside: avoid;
}
.bs-hcmp-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 12px;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #c5d6e3;
}
.bs-hcmp-title {
    font-size: 13px;
    font-weight: 900;
    color: #0d3b4d;
}
.bs-hcmp-keys {
    font-size: 11px;
    font-weight: 700;
}
.bs-hcmp-keys span {
    margin-inline-end: 12px;
    white-space: nowrap;
}
.bs-hcmp-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-inline-end: 4px;
    vertical-align: -1px;
}
.bs-hcmp-swatch.is-cur,
.bs-hcmp-fill.is-cur { background: #0f766e !important; }
.bs-hcmp-swatch.is-prev,
.bs-hcmp-fill.is-prev { background: #64748b !important; }
.bs-hcmp-fill.is-neg { background: #b91c1c !important; }
.bs-hcmp-sub {
    font-size: 11px;
    font-weight: 800;
    color: #0d3b4d;
    margin: 8px 0 6px;
    background: #e8f2f7;
    border: 1px solid #c5d6e3;
    padding: 3px 8px;
    text-align: center;
}
.bs-hcmp-item {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #d7e4ee;
}
.bs-hcmp-item:last-child { border-bottom: 0; margin-bottom: 0; }
.bs-hcmp-item.is-net {
    background: #ecfdf5;
    border: 1px solid #99d6c4;
    border-radius: 6px;
    padding: 6px 8px 4px;
    margin-top: 4px;
}
.bs-hcmp-name {
    font-size: 12px;
    font-weight: 900;
    color: #0d3b4d;
    text-align: center;
    margin-bottom: 4px;
}
.bs-hcmp-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.bs-hcmp-period {
    width: 34%;
    min-width: 0;
    font-size: 10px;
    font-weight: 700;
    color: #334155;
    text-align: start;
}
.bs-hcmp-track {
    flex: 1;
    height: 14px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    overflow: hidden;
}
.bs-hcmp-fill {
    height: 100%;
    min-width: 4px;
}
.bs-hcmp-amt {
    width: 22%;
    font-size: 11px;
    font-weight: 900;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.bs-hcmp-change {
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    margin-top: 2px;
}
.bs-chart-vals {
    display: flex;
    justify-content: center;
    gap: 4px;
    font-size: 7.5px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2px;
}
.bs-chart-vals .is-rev { color: #0e7490; }
.bs-chart-vals .is-exp { color: #b45309; }
.bs-chart-legend {
    font-size: 11px;
    margin: 4px 0 12px;
}
.bs-chart-legend span {
    margin-inline-end: 12px;
    font-weight: 700;
}
.bs-leg {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-inline-end: 4px;
    vertical-align: middle;
}
.bs-leg.is-rev { background: #0e7490; }
.bs-leg.is-exp { background: #b45309; }
.bs-leg.is-pos { background: #0f766e; }
.bs-best-row td {
    background: #ecfdf5 !important;
    font-weight: 800;
}
.bs-chart-bar,
.bs-kpi-table td,
.bs-best-row td,
.bs-insight,
.bs-leg,
.bs-hcmp,
.bs-hcmp-fill,
.bs-hcmp-swatch,
.bs-hcmp-item.is-net,
.bs-hcmp-sub {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
.bs-kpi-table,
.bs-chart,
.bs-insight,
.bs-hcmp {
    page-break-inside: avoid;
}
.pl-kind-h {
    margin: 18px 0 8px;
    font-size: 16px;
    font-weight: 900;
    color: #0d3b4d;
    background: #e8f1f6;
    border: 1px solid #9eb6c9;
    padding: 6px 10px;
    text-align: center;
}
.pl-kind-break {
    page-break-before: always;
    margin-top: 8px;
}

@media print {
    .letterhead-top,
    .letterhead-period,
    .statement-block,
    .statement-footer-totals,
    .report-footer,
    .bs-total-row td,
    .bs-net-row td,
    .bs-result-table td,
    .bs-hcmp,
    .bs-hcmp-fill,
    .bs-hcmp-swatch,
    .bs-hcmp-item.is-net {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .report-table th,
    .report-table td,
    table th,
    table td {
        text-align: center !important;
        vertical-align: middle !important;
    }
}

.rpt-cmp { margin: 8px 0 16px; }
.rpt-cmp-row { margin-bottom: 8px; }
.rpt-cmp-label { font-size: 11px; font-weight: 800; margin-bottom: 3px; }
.rpt-cmp-bars { display: flex; flex-direction: column; gap: 3px; }
.rpt-cmp-track {
    height: 10px;
    background: #e8eef3;
    border: 1px solid #9aa8b5;
    border-radius: 3px;
    overflow: hidden;
}
.rpt-cmp-fill { display: block; height: 100%; }
.rpt-cmp-cur { background: #0b4f78; }
.rpt-cmp-prev { background: #7a9aaa; }
.rpt-cmp-vals { font-size: 11px; margin-top: 2px; }
.report-note { font-size: 11px; color: #445566; margin: 0 0 8px; }
