
/* ==========================================================================
   الطباعة بهوية تِم — تنطبق على أي شاشة في لوحة التحكم (التقارير، الرواتب، الجداول…)
   ========================================================================== */
.mw-print-header { display: none; }

@media print {
  html, body { background: #fff !important; color: #1F2A2A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 10pt; }

  /* إخفاء عناصر الواجهة */
  .layout-menu, .layout-navbar, .content-footer, .layout-overlay, .drag-target, .content-backdrop,
  .no-print, .btn, .dropdown-menu, .pagination, .btn-close, .apexcharts-toolbar, .navbar-search-wrapper { display: none !important; }

  /* شريط التنقل العلوي (عليه كلاس container-xxl كمان) والخلفية الضبابية اللي وراه */
  html .layout-wrapper .layout-navbar.layout-navbar, .layout-page::before { display: none !important; }

  /* الثيم بيدّي .layout-page عرض صفر وحشوة علوية للـ navbar الثابت: نلغيهم في الطباعة */
  html[dir] body .layout-wrapper, html[dir] body .layout-container,
  html[dir] body .layout-wrapper .layout-container .layout-page.layout-page.layout-page,
  html[dir] body .content-wrapper, html[dir] body .content-wrapper > .container-xxl {
    display: block !important; inline-size: 100% !important; width: 100% !important; max-width: 100% !important; min-inline-size: 0 !important;
    padding: 0 !important; margin: 0 !important; min-height: 0 !important; min-block-size: 0 !important;
  }

  /* توزيع الأعمدة زي الشاشة الكبيرة بدل ما كل بطاقة تاخد سطر لوحدها */
  .row > .col-lg-3, .row > .col-xl-3 { flex: 0 0 auto !important; width: 25% !important; }
  .row > .col-lg-4, .row > .col-xl-4 { flex: 0 0 auto !important; width: 33.3333% !important; }
  .row > .col-lg-6, .row > .col-xl-6 { flex: 0 0 auto !important; width: 50% !important; }
  .row > .col-lg-8, .row > .col-xl-8 { flex: 0 0 auto !important; width: 66.6667% !important; }
  .row > .col-lg-12, .row > .col-xl-12 { flex: 0 0 auto !important; width: 100% !important; }

  /* الرسوم البيانية: تتصغّر على عرض الورقة (السكربت بيضيف viewBox قبل الطباعة) */
  .apexcharts-canvas, .apexcharts-canvas > svg { width: 100% !important; height: auto !important; max-width: 100% !important; }

  /* الترويسة */
  .mw-print-header {
    display: flex !important; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 0 10px; margin: 0 0 14px;
    border-bottom: 3px solid #0E7C7B; outline: none;
    background-image: linear-gradient(#E9B949, #E9B949); background-size: 100% 1.5px; background-repeat: no-repeat; background-position: bottom 3px left 0; padding-bottom: 12px !important;
  }
  .mw-ph-company { display: flex; align-items: center; gap: 12px; }
  .mw-ph-company img { height: 46px; width: auto; max-width: 140px; object-fit: contain; }
  .mw-ph-name { font-size: 13pt; font-weight: 700; color: #073B3A; }
  .mw-ph-doc { text-align: end; }
  .mw-ph-title { font-size: 15pt; font-weight: 700; color: #0E7C7B; line-height: 1.3; }
  .mw-ph-sub { font-size: 9.5pt; color: #073B3A; margin-top: 2px; }
  .mw-ph-meta { font-size: 8.5pt; color: #5B6B6A; margin-top: 2px; }

  /* العناوين والبطاقات */
  h1, h2, h3, h4, h5, h6, .card-title { color: #073B3A !important; }
  .card { box-shadow: none !important; border: 1px solid #D9E6E5 !important; border-radius: 8px !important; break-inside: avoid; margin-bottom: 10px !important; }
  .card-header { background: #F4EFE6 !important; border-bottom: 1px solid #E6DCCB !important; padding: 8px 12px !important; }
  .card-body { padding: 10px 12px !important; }
  /* البطاقات الكبيرة (فيها جداول) تتقسم على الصفحات بدل ما تنزل كلها لصفحة جديدة */
  .card:has(table), .card:has(.table-responsive) { break-inside: auto; }
  .row { --bs-gutter-y: 10px; }

  /* الجداول */
  .table-responsive { overflow: visible !important; }
  .table { width: 100% !important; border-collapse: collapse !important; font-size: 9.5pt; }
  .table > thead { display: table-header-group; }
  .table > thead > tr > th {
    background: #0E7C7B !important; color: #fff !important; font-weight: 600 !important;
    border-color: #0E7C7B !important; padding: 6px 8px !important; text-transform: none !important; letter-spacing: 0 !important;
  }
  .table > :not(caption) > * > * { padding: 5px 8px !important; border-bottom: 1px solid #E3ECEB !important; box-shadow: none !important; }
  .table > tbody > tr:nth-child(even) > * { background: #F8F5EF !important; }
  .table > tfoot > tr > * { background: #F4EFE6 !important; font-weight: 700 !important; color: #073B3A !important; }
  .table tr { break-inside: avoid; }

  /* الشارات والروابط */
  a { color: inherit !important; text-decoration: none !important; }
  .badge { border: 1px solid currentColor !important; background: transparent !important; }
  .text-primary, .text-brand { color: #0E7C7B !important; }
  .print-only { display: block !important; }
  .report-chart, .apexcharts-canvas { break-inside: avoid; }
}
