@page {
  size: A4 landscape;  /* أفقي */
  margin: 8mm;         /* هوامش قليلة حتى تتسع الصفحة */
}

@media print {
  .no-print, .no-print * { display: none !important; }

  html, body { background: #fff; }
  body { font-size: 10px; line-height: 1.3; }

  .container { max-width: none; margin: 0; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; margin: 0 0 6px; }

  h1 { font-size: 15px; margin: 0 0 6px; }
  h2 { font-size: 13px; margin: 6px 0 4px; }

  .report .grid2 { grid-template-columns: 1fr 1fr; gap: 6px; }

  .table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .table th, .table td {
    border: 1px solid #999;
    padding: 4px 6px;              /* تصغير الحشوات */
    vertical-align: top;
    word-break: break-word;        /* لف الكلمات الطويلة */
  }
  .table thead th { background: #f3f4f6; }

  table, tr, td, th { page-break-inside: avoid; } /* لا تقسيم داخل الجدول */
  section.report { page-break-after: auto; }
}

/* ===== Print: لا تمرير، ولا nowrap قسري ===== */
@media print{
  .table-wrap{ overflow: visible !important; }
  .table{ table-layout: fixed; width: 100%; }
  .table th, .table td{
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
}
/* ===== Print overrides: keep pages clean and readable ===== */
@media print {
  /* أخفِ العناصر غير القابلة للطباعة (موجودة مسبقًا غالبًا) */
  .no-print { display: none !important; }

  /* اسمح بمحتوى كامل بدون شريط تمرير */
  html, body { overflow: visible !important; }
  .table-wrap { overflow: visible !important; }

  /* رجّع الجداول للوضع الطبيعي في الطباعة */
  .table { width: 100% !important; table-layout: auto !important; border-collapse: collapse; }
  .table.compact { table-layout: auto !important; }

  /* عطّل أي قيود عرض آتية من colgroup */
  .table col { width: auto !important; }

  /* لفّ النص بشكل طبيعي للطباعة */
  .table th,
  .table td {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* تجنّب تقطيع البطاقات/الأقسام بين الصفحات */
  .card, .report, section, table, tr, td, th { break-inside: avoid; }

  /* طباعة ألوان أنظف (إن لم تكن لديك بالفعل) */
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.no-print {
  display: none !important;
}
