/* قرابة — طبقة الطباعة الرسمية (A4/A3/A2) — تُحمَّل بعد styles.css */
.doc-chrome{ display:none }

@media print{
  *, *::before, *::after{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important }
  html, body{ background:#F5EFE3 !important; margin:0 !important; padding:0 !important }

  /* إخفاء كل الواجهة */
  .sidebar, .topbar, .docs-sidebar, .docs-stage-toolbar, .modal-backdrop, .modal,
  .toast, .toast-wrap, .notif-drop, .tree-toolbar, .tree-legend, .fab, .btn-primary, .btn-ghost, .btn-icon{ display:none !important }

  .app-shell, .page-area, .page-content, .docs-page, .docs-stage{
    display:block !important; width:auto !important; height:auto !important; max-height:none !important;
    min-height:0 !important; overflow:visible !important; padding:0 !important; margin:0 !important;
    background:transparent !important; border:0 !important; box-shadow:none !important
  }

  /* الوثيقة نفسها — الرَّق يصبح الورقة (نفس شكل الشاشة) */
  .parchment{
    max-width:none !important; width:auto !important; margin:0 !important;
    box-sizing:border-box !important; padding:13mm 14mm 11mm !important;
    background:linear-gradient(180deg,#FBF6EA 0%,#F3EADA 100%) !important;
    box-shadow:none !important; border-radius:0 !important; overflow:hidden !important
  }
  .parchment::before{ display:none !important }
  .parchment::after{
    display:block !important; content:'' !important; position:absolute !important; inset:3mm !important;
    border:.9pt solid rgba(140,111,63,.45) !important; border-radius:0 !important
  }
  .pmt-corner{
    display:block !important; position:absolute !important; width:9mm !important; height:9mm !important;
    border:1.3pt solid #8C6F3F !important; opacity:.9 !important; z-index:3 !important
  }
  .pmt-corner-tl{ top:5.4mm !important; right:5.4mm !important; bottom:auto !important; left:auto !important; border-bottom:none !important; border-left:none !important }
  .pmt-corner-tr{ top:5.4mm !important; left:5.4mm !important; bottom:auto !important; right:auto !important; border-bottom:none !important; border-right:none !important }
  .pmt-corner-bl{ bottom:5.4mm !important; right:5.4mm !important; top:auto !important; left:auto !important; border-top:none !important; border-left:none !important }
  .pmt-corner-br{ bottom:5.4mm !important; left:5.4mm !important; top:auto !important; right:auto !important; border-top:none !important; border-right:none !important }

  /* الترويسة/التذييل المكرران — ملغاة: الوثيقة تحمل إطارها */
  .doc-chrome{ display:none !important }

  /* الإطار والترويسة والتذييل — تتكرر في كل صفحة */
  .doc-chrome, .dpc-frame, .dpc-corner, .dpc-head, .dpc-foot{ display:none !important }
  .dpc-unused{ position:absolute; inset:-9mm -7mm -8mm; border:1.1pt solid rgba(140,111,63,.55) }
  .dpc-frame::after{ content:''; position:absolute; inset:1.6mm; border:.4pt solid rgba(140,111,63,.4) }
  .dpc-corner{ position:absolute; width:7mm; height:7mm; border:1.2pt solid #8C6F3F }
  .dpc-tl{ top:-9mm; right:-7mm; border-bottom:none; border-left:none }
  .dpc-tr{ top:-9mm; left:-7mm; border-bottom:none; border-right:none }
  .dpc-bl{ bottom:-8mm; right:-7mm; border-top:none; border-left:none }
  .dpc-br{ bottom:-8mm; left:-7mm; border-top:none; border-right:none }

  .dpc-head{
    position:absolute; top:-17mm; right:0; left:0; display:flex; align-items:center; justify-content:space-between;
    padding-bottom:2mm; border-bottom:.5pt solid rgba(140,111,63,.35)
  }
  .dpc-brand{ display:flex; align-items:center; gap:2.5mm }
  .dpc-brand-name{ font-family:'Amiri',serif; font-weight:700; font-size:11pt; color:#8C6F3F; line-height:1 }
  .dpc-brand-sub{ font-family:'Cairo',sans-serif; font-size:6pt; letter-spacing:.3em; color:rgba(42,35,24,.55); margin-top:.6mm }
  .dpc-head-left{ text-align:left; font-family:'Cairo',sans-serif; font-size:7pt; color:rgba(42,35,24,.6); line-height:1.7 }
  .dpc-head-fam{ font-family:'Amiri',serif; font-size:9.5pt; font-weight:700; color:#2A2318 }

  .dpc-foot{
    position:absolute; bottom:-13mm; right:0; left:0; display:flex; align-items:center; justify-content:space-between;
    padding-top:1.8mm; border-top:.5pt solid rgba(140,111,63,.35);
    font-family:'Cairo',sans-serif; font-size:6.5pt; letter-spacing:.08em; color:rgba(42,35,24,.6)
  }
  .dpc-foot-id{ font-variant-numeric:tabular-nums; letter-spacing:.14em }

  /* مقاسات الطباعة — ١٢pt فأعلى للنصوص */
  .pmt-header{ margin-bottom:6mm; flex:0 0 auto }
  .pmt-tughra svg{ width:46px; height:54px }
  .pmt-bismillah{ font-size:12pt; margin-bottom:6mm }
  .pmt-eyebrow{ font-size:8pt; letter-spacing:.5em; margin-bottom:3mm }
  .pmt-family{ font-size:30pt }
  .pmt-prose{ font-size:12pt; line-height:1.9; margin-bottom:5mm; orphans:3; widows:3 }
  .pmt-name{ font-size:14pt }
  .pmt-chain{ break-inside:auto; padding:3.5mm 6mm; margin-bottom:5mm; background:rgba(140,111,63,.05) !important }
  .pmt-chain-row{ break-inside:avoid; page-break-inside:avoid; padding:2.2mm 0 }
  .pcr-name{ font-size:12.5pt }
  .pcr-num, .pcr-yr{ font-size:10pt }
  .pmt-quote{ font-size:13pt; break-inside:avoid; padding:4mm 0; margin:3mm 0 4mm }
  .pmt-quote-cite{ font-size:8pt }
  .cert-grid{ break-inside:avoid }
  .cert-label{ font-size:8pt }
  .cert-value{ font-size:12pt }
  .pmt-footer{
    break-inside:avoid; page-break-inside:avoid; padding-top:4mm;
    display:grid !important; grid-template-columns:1fr auto !important; gap:8mm !important;
    align-items:center !important; flex-wrap:nowrap !important
  }
  .pmt-signoff{ min-width:26mm !important; margin-top:0 !important }
  .pmt-seal-ring{ width:17mm !important; height:17mm !important }
  .pmt-seal-meta{ font-size:8.5pt; line-height:1.8 }
  .pmt-sig-label{ font-size:8pt }

  /* وثيقة الشجرة */
  .doc-tree{ break-inside:avoid; page-break-inside:avoid; text-align:center }
  .doc-tree svg{ width:100%; height:auto }
  .doc-legend{ break-inside:avoid; page-break-inside:avoid }
  .doc-page-break{ break-before:page; page-break-before:always }
}
