/* ========================================================================
   طباعة احترافية موحّدة لكل الكشوف (الخزينة / الضريبي / أي كشف)
   نفس مستوى كشف حساب العميل/المورد: ترويسة + صندوق معلومات + شريط ملخّص +
   جدول يملأ A4 بلا تجاوز + توقيعات، ومقروء حتى بلا ألوان خلفية.
   ======================================================================== */
@media print {
    @page { size: A4 portrait; margin: 12mm 12mm 16mm; }

    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .stmt-page { font-family: 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif; color: #1f2733; }

    /* شريط KPI الشاشي مخفي في الطباعة (نعتمد شريط الملخّص المطبوع) — نتغلّب على قاعدة الجوال display:grid!important */
    .no-print,
    .inv-kpi-bar.no-print { display: none !important; }

    /* الترويسة */
    .stmt-print-head { margin: 0 0 10px; }
    .stmt-letterhead {
        display: flex; justify-content: space-between; align-items: flex-end;
        padding-bottom: 8px; border-bottom: 2.5px solid #1F3A5F; margin-bottom: 12px;
    }
    .stmt-brand-mark { font-size: 22px; font-weight: 800; color: #1F3A5F; letter-spacing: .3px; line-height: 1.1; }
    .stmt-brand-sub { font-size: 9.5px; color: #5b6472; margin-top: 3px; }
    .stmt-doc { text-align: left; }
    .stmt-doc-title { font-size: 18px; font-weight: 700; color: #1F3A5F; }
    .stmt-doc-period, .stmt-doc-date { font-size: 9.5px; color: #5b6472; margin-top: 2px; }

    /* صندوق المعلومات */
    .stmt-meta { display: flex; border: 1px solid #cfd6e0; border-radius: 5px; overflow: hidden; margin-bottom: 9px; }
    .stmt-meta-item { flex: 1; padding: 6px 11px; border-inline-start: 1px solid #e6eaf0; }
    .stmt-meta-item:first-child { border-inline-start: none; }
    .stmt-meta-item span { display: block; font-size: 8.5px; color: #6b7280; margin-bottom: 2px; }
    .stmt-meta-item strong { font-size: 12px; color: #111827; font-weight: 700; }

    /* شريط الملخّص */
    .stmt-summary { display: flex; gap: 9px; margin-bottom: 14px; }
    .stmt-sum-cell { flex: 1; text-align: center; padding: 8px 6px; border: 1.5px solid #cfd6e0; border-radius: 5px; background: #f5f7fb; }
    .stmt-sum-cell span { display: block; font-size: 9px; color: #51596a; margin-bottom: 4px; }
    .stmt-sum-cell b { font-size: 14px; color: #14233b; font-variant-numeric: tabular-nums; font-weight: 700; }
    .stmt-sum-net { border: 2.5px solid #1F3A5F !important; background: #eef2f7; }
    .stmt-sum-net span { color: #1F3A5F; }
    .stmt-sum-net b { color: #1F3A5F; font-size: 15px; }

    /* الجدول — يُجبَر على ملء عرض A4 بلا تجاوز أفقي */
    .stmt-table { border: none !important; box-shadow: none !important; background: none !important; overflow: visible !important; margin-bottom: 10px; }
    .stmt-table .card-header { font-size: 12px; font-weight: 700; color: #1F3A5F; padding: 8px 0 6px; border: none; background: none; }
    .stmt-table table { table-layout: fixed !important; width: 100% !important; min-width: 0 !important; border-collapse: collapse; font-size: 9px; }
    .stmt-table th, .stmt-table td { white-space: normal !important; word-break: break-word; overflow-wrap: anywhere; min-width: 0 !important; }
    .stmt-table .no-print { display: none !important; }
    .stmt-table thead th {
        background: #eef2f7; color: #1F3A5F !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;
        padding: 6px 4px; font-weight: 700; border: .5px solid #c4ccd8; border-bottom: 2px solid #1F3A5F; text-align: center;
    }
    .stmt-table thead th.text-end { text-align: end; }
    .stmt-table tbody td { padding: 4px 5px; border: .5px solid #d7dde6; vertical-align: top; }
    .stmt-table tbody tr:nth-child(even) td { background: #f7f9fc; }
    .stmt-table .statement-detail-row td { background: #eef2f7 !important; }
    .stmt-table .statement-mov-icon { display: none !important; }
    .stmt-table .movement-code, .stmt-table .fs-xs { font-size: 7px; color: #9aa3b2; margin-top: 1px; }
    .stmt-table .statement-mov-link, .stmt-table .statement-mov-label { color: #1f2733; text-decoration: none; font-weight: 600; }
    .stmt-table tfoot td { background: #eef2f7; font-weight: 700; padding: 7px 5px; border: .5px solid #c4ccd8; border-top: 2px solid #1F3A5F; color: #1F3A5F; font-variant-numeric: tabular-nums; }
    .stmt-table .money, .stmt-table td.text-end { font-variant-numeric: tabular-nums; }
    .stmt-table .text-danger { color: #b3261e !important; }
    .stmt-table .text-success { color: #166534 !important; }
    .stmt-table .text-warning { color: #92600a !important; }

    /* أعمدة سباعية (# / تاريخ / نوع / ملاحظات / رقم / رقم / رصيد) */
    .stmt-table.cols-7 th:nth-child(1), .stmt-table.cols-7 td:nth-child(1) { width: 4%; text-align: center; }
    .stmt-table.cols-7 th:nth-child(2), .stmt-table.cols-7 td:nth-child(2) { width: 11%; }
    .stmt-table.cols-7 th:nth-child(3), .stmt-table.cols-7 td:nth-child(3) { width: 25%; }
    .stmt-table.cols-7 th:nth-child(4), .stmt-table.cols-7 td:nth-child(4) { width: 17%; }
    .stmt-table.cols-7 th:nth-child(5), .stmt-table.cols-7 td:nth-child(5) { width: 14%; text-align: end; }
    .stmt-table.cols-7 th:nth-child(6), .stmt-table.cols-7 td:nth-child(6) { width: 14%; text-align: end; }
    .stmt-table.cols-7 th:nth-child(7), .stmt-table.cols-7 td:nth-child(7) { width: 15%; text-align: end; }

    /* أعمدة ثمانية (تقرير ضريبي: تاريخ/مرجع/نوع/طرف/رقم/نسبة/رقم/رقم) */
    .stmt-table.cols-8 th:nth-child(1), .stmt-table.cols-8 td:nth-child(1) { width: 11%; }
    .stmt-table.cols-8 th:nth-child(2), .stmt-table.cols-8 td:nth-child(2) { width: 13%; }
    .stmt-table.cols-8 th:nth-child(3), .stmt-table.cols-8 td:nth-child(3) { width: 11%; }
    .stmt-table.cols-8 th:nth-child(4), .stmt-table.cols-8 td:nth-child(4) { width: 21%; }
    .stmt-table.cols-8 th:nth-child(5), .stmt-table.cols-8 td:nth-child(5) { width: 12%; text-align: end; }
    .stmt-table.cols-8 th:nth-child(6), .stmt-table.cols-8 td:nth-child(6) { width: 9%; text-align: end; }
    .stmt-table.cols-8 th:nth-child(7), .stmt-table.cols-8 td:nth-child(7) { width: 11%; text-align: end; }
    .stmt-table.cols-8 th:nth-child(8), .stmt-table.cols-8 td:nth-child(8) { width: 12%; text-align: end; }

    /* التوقيعات */
    .stmt-signatures { display: flex; justify-content: space-between; gap: 20px; margin-top: 30px; }
    .stmt-signatures .sig-box { flex: 1; text-align: center; }
    .stmt-signatures .sig-title { font-size: 10px; color: #374151; margin-bottom: 30px; font-weight: 600; }
    .stmt-signatures .sig-line { border-top: 1px solid #9aa3b2; padding-top: 4px; }

    .stmt-table tr { page-break-inside: avoid; }
    .stmt-table thead { display: table-header-group; }
    .stmt-table tfoot { display: table-footer-group; }
}
