@page { size: A4; margin: 2.2cm; }

body{
  font-family: 'Simplified Arabic','Traditional Arabic', Arial, sans-serif;
  line-height: 1.8;
  color: #333;
  max-width: 21cm;
  margin: 0 auto;
  padding: 18px;
  background: #fff;
}

.no-print { }
@media print { .no-print{display:none} body{padding:0;margin:0} }

.header{
  text-align:center;
  border-bottom: 3px solid #1a5490;
  padding-bottom: 16px;
  margin-bottom: 22px;
}
.header h1{ color:#1a5490; font-size:22pt; margin:8px 0; font-weight:800;}
.header h2{ color:#2c5f2d; font-size:17pt; margin:6px 0;}
.header h3{ color:#666; font-size:13pt; margin:6px 0; font-weight:normal;}

h2{
  color:#1a5490; font-size:16pt; margin:22px 0 10px;
  border-right:5px solid #1a5490; padding-right:12px; font-weight:800;
}
h3{ color:#2c5f2d; font-size:14pt; margin:16px 0 8px; font-weight:800; }
h4{ color:#444; font-size:13pt; margin:14px 0 6px; font-weight:800; }
p{ text-align:justify; margin:8px 0; font-size:12pt; }
ul{ margin:8px 0; padding-right:28px; }
li{ margin:6px 0; font-size:12pt; line-height:1.6; }

table{ width:100%; border-collapse:collapse; margin:12px 0; font-size:11pt; }
table,th,td{ border:1px solid #666; }
th{ background:#1a5490; color:#fff; padding:9px; text-align:center; font-weight:800; }
td{ padding:8px; vertical-align: top; }

.kcell{
  text-align:right;
  font-weight:800;
  background:#f0f0f0;
  width: 32%;
}

.section{ margin-bottom: 18px; page-break-inside: avoid; }

.note-box{
  background:#fff8dc;
  border-right: 4px solid #f0ad4e;
  padding: 12px;
  margin: 12px 0;
  border-radius: 6px;
}
.note-box strong{ color:#8b4513; }

.message-box{
  background:#e8f4f8;
  border:1px solid #1a5490;
  padding:10px 12px;
  margin: 8px 0;
  border-radius:6px;
  font-size:11.5pt;
}

.toolbar{
  background:#f5f5f5;
  border-radius:12px;
  padding:14px;
  margin: 0 0 18px;
}
.toolbar .row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  justify-content:space-between;
}
.field{
  flex: 1 1 180px;
  min-width: 180px;
}
label{ display:block; font-size:11pt; margin-bottom:6px; color:#333; font-weight:700; }
input, select{
  width:100%;
  padding:10px;
  border:1px solid #ccc;
  border-radius:8px;
  font-size:11.5pt;
  font-family: inherit;
  box-sizing:border-box;
}
.btns{
  display:flex; gap:10px; flex-wrap:wrap;
  justify-content:center; margin-top:12px;
}
button{
  border:none; border-radius:10px; cursor:pointer;
  padding:12px 18px; font-size:12.5pt; font-weight:800;
  font-family: inherit;
}
.btn-primary{ background:#1a5490; color:#fff; }
.btn-primary:hover{ background:#2c5f2d; }
.btn-secondary{ background:#2c5f2d; color:#fff; }
.btn-secondary:hover{ background:#1a5490; }
.btn-ghost{ background:#fff; border:1px solid #ccc; color:#333; }
.status{ text-align:center; margin-top:10px; font-weight:800; }

.footer{
  text-align:center; margin-top:26px; padding-top:14px;
  border-top:2px solid #1a5490;
}
.footer-title{ font-size:14pt; color:#1a5490; font-weight:900; margin:0; }
.footer-sub{ font-size:12pt; color:#666; margin:6px 0 0; }
.footer-signatures{
  display:flex;
  gap:18px;
  justify-content:space-between;
  align-items:flex-start;
  margin-top:14px;
  padding-top:12px;
  border-top:1px dashed #b7c7d6;
}

.footer-signatures .sig{
  width:48%;
  text-align:right;
}

.footer-signatures .sig-title{
  font-weight:900;
  color:#1a5490;
  margin-bottom:6px;
}

.footer-signatures .sig-line{
  font-size:12pt;
  color:#333;
}

.footer-credit{
  margin-top:14px;
  font-size:10.5pt;
  color:#666;
}


/* ضبط القوائم داخل جدول الأدوار والمسؤوليات */
table ul{
  margin: 0;
  padding-right: 2px;
  list-style-position: inside;
}
table ul li{
  margin: 4px 0;
  line-height: 1.6;
  font-size: 12pt;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}
.modal.open{ display:flex; }
.modal-card{
  background:#fff;
  width: min(900px, 100%);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  overflow: hidden;
}
.modal-header{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #e6e6e6;
}
.modal-title{ font-size:14pt; font-weight:900; color:#1a5490; }
.modal-subtitle{ color:#666; margin-top:4px; }

.modal-body{
  padding: 14px;
  max-height: 70vh;
  overflow: auto;
}
.modal-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:center;
  padding: 12px 14px;
  border-top: 1px solid #e6e6e6;
}
.modal textarea{
  width:100%;
  min-height: 72px;
  resize: vertical;
}

/* عناصر تظهر فقط عند طباعة صفحات التقارير 
.print-only{ display:none; }
@media print{
  .print-only{ display:block; }
}
*/
/* صفحات التقارير الرسمية: مخفية دائمًا (شاشة + طباعة الصفحة الكاملة) */
.print-only{ display:none; }

@media print{
  /* أثناء طباعة الصفحة الكاملة (زر طباعة/PDF): تبقى مخفية */
  .print-only{ display:none !important; }

  /* أثناء طباعة تقرير محدد من الأزرار: تظهر فقط لما يكون body عليه الكلاس */
  body.show-print-only .print-only{
    display:block !important;
  }
}

@media screen{
  #donateModal button.btn-secondary{
    padding:10px 14px;
    font-size:12pt;
  }
}
input[readonly]{
  background:#f7f7f7;
  color:#333;
  cursor: default;
}

/* تحسينات طباعة */
@media print{
  th{ -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media print{

  /* نسمح للأقسام تتمدد عادي */
  .section{
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* ===== فواصل صفحات إجبارية ===== */

  /* ملحق (4) */
  #appendix4{
    page-break-before: always !important;
    break-before: page !important;
  }

  /* نموذج (5): سجل الأنشطة */
  #model5Block{
    page-break-before: always !important;
    break-before: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* التقرير الأسبوعي – صفحة مستقلة */
  #weeklyReportBlock{
    page-break-before: always !important;
    break-before: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* التقرير الختامي – صفحة مستقلة */
  #finalReportBlock{
    page-break-before: always !important;
    break-before: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* منع كسر الجداول داخل التقارير */
  #weeklyReportBlock table,
  #finalReportBlock table,
  #model5Block table{
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}
