/* ورقة الاختبار ونموذج الإجابة: A4، تُعرض في المعاينة وتُطبع كما هي */
.sheet{box-sizing:border-box;flex:none;width:210mm;height:297mm;background:#fff;position:relative;overflow:hidden;padding:14mm 16mm 16mm;box-shadow:0 2px 10px rgba(0,0,0,.18);font-family:"IBM Plex Sans Arabic",Tahoma,sans-serif;color:#000;direction:rtl;font-size:11.5pt;line-height:1.6;page-break-after:always;break-after:page}
.sheet:last-child{page-break-after:auto;break-after:auto}
.ph{text-align:center;margin-bottom:5mm;border-bottom:1.5px solid #000;padding-bottom:3mm}
.ph-title{font-weight:700;font-size:16pt}
.ph-sub{font-size:11pt}
.ph-sub.strong{font-weight:700;margin-top:2mm}
.cover .logo{display:block;margin:0 auto 4mm;height:24mm;object-fit:contain}
.info{margin:4mm 0;font-size:11pt}
.info div{margin:1mm 0}
table.idt{width:100%;border-collapse:collapse;margin:4mm 0 5mm}
table.idt th,table.idt td{border:1px solid #000;padding:2mm 3mm;font-size:11pt;text-align:start;font-weight:600;height:8mm}
table.idt th{width:24mm;background:#f2f4f7}
.rules{border:1px solid #000;padding:3mm 5mm;margin-bottom:5mm}
.rules .rt{font-weight:700;margin-bottom:1mm}
.rules ul{margin:0;padding-inline-start:18px;font-size:10.5pt}
table.gt{width:100%;border-collapse:collapse;font-size:10pt;margin-top:3mm}
table.gt th,table.gt td{border:1px solid #000;padding:1.2mm 2mm;text-align:center;height:6.5mm}
table.gt th{background:#f2f4f7;font-weight:600}
table.gt tr.filled td{font-weight:700}
table.gt tr.tot td{font-weight:700}
.sh{margin:2mm 0 3mm;border-bottom:1.5px solid #000;padding-bottom:1.5mm}
.st{font-weight:700;font-size:14pt;text-decoration:underline double;text-underline-offset:.18em}
.st-single,.si-underlined{text-decoration:underline solid;text-underline-offset:.18em}
.si{font-size:11pt;margin-top:1mm}
.q{margin:0 0 4mm;break-inside:avoid;position:relative}
.qh{display:flex;gap:3mm;align-items:flex-start;font-size:13pt}
.qn{flex:none;font-weight:700}
.qt{flex:1;min-width:0;overflow-wrap:anywhere;font-weight:700}
.task-emphasis{font-weight:800;text-decoration-line:underline;text-decoration-style:dotted;text-decoration-thickness:.08em;text-underline-offset:.16em}
ol.opts{list-style:none;margin:2mm 0 0 0;padding:0 10mm;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.5mm 8mm}
ol.opts.opts-wide{grid-template-columns:1fr}
ol.opts li{font-size:11.5pt;overflow-wrap:anywhere}
.ol{font-weight:700;margin-inline-end:1mm;white-space:nowrap}
.ol::before{content:"";display:inline-block;width:2.6mm;height:2.6mm;border:1px solid;border-radius:50%;margin-inline-end:1.2mm;vertical-align:middle}
.ln{border-bottom:1px solid #888;height:7mm}
.end{position:absolute;bottom:14mm;left:0;right:0;text-align:center;font-weight:700}
.pn{position:absolute;bottom:8mm;left:16mm;right:16mm;text-align:center;font-size:10pt;border-top:1px solid #000;padding-top:2mm}
.wm{position:absolute;top:45%;left:0;right:0;text-align:center;transform:rotate(-30deg);font-size:30pt;font-weight:700;color:rgba(160,30,20,.12);pointer-events:none;z-index:5}
table.kt{width:100%;table-layout:fixed;overflow-wrap:anywhere;border-collapse:collapse;font-size:10.5pt}
table.kt th,table.kt td{border:1px solid #000;padding:1.6mm 2mm;text-align:center;vertical-align:top}
table.kt th{background:#f2f4f7}
table.kt th:nth-child(1),table.kt th:nth-child(3),table.kt th:nth-child(6){width:9%}
table.kt th:nth-child(2),table.kt th:nth-child(4){width:13%}
table.kt td.l{text-align:start}
/* أزرار التحرير — تظهر في المعاينة فقط */
.ctl{position:absolute;top:2px;left:2px;display:flex;gap:3px;z-index:10}
.ctl button{width:26px;height:26px;border:1px solid #d0d0d0;border-radius:4px;background:rgba(255,255,255,.92);cursor:pointer;font-size:13px;line-height:1;color:#555;display:flex;align-items:center;justify-content:center;padding:0;transition:background .15s,color .15s;backdrop-filter:blur(2px)}
.ctl button:hover{background:#0f4c81;color:#fff;border-color:#0f4c81}
.ctl button[data-act="del"]:hover{background:#b91c1c;border-color:#b91c1c}
.measure-block{display:flow-root}
.paper-measure{position:absolute;visibility:hidden;inset:0 auto auto 0;height:auto;contain:layout style;pointer-events:none}
.directorate{text-align:center;font-size:14pt;font-weight:700}
@page{size:A4;margin:0}
@media print{
  html,body{background:#fff;margin:0;padding:0;width:210mm}
  .no-print,.top,.topbar,.sidebar,.foot,.paper-measure{display:none!important}
  body:has(.stage) main > :not(.stage){display:none!important}
  body:has(.stage) .app-shell,body:has(.stage) .app-body,body:has(.stage) main{display:block;margin:0;padding:0;max-width:none}
  .stage{background:none;padding:0;gap:0;display:block;transform:none!important}
  .sheet{box-shadow:none;margin:0;print-color-adjust:exact;-webkit-print-color-adjust:exact}
}

.item-material{display:block;max-width:100%;margin:2mm 0}
.item-figure{object-fit:contain}
.item-code{padding:2mm;border:1px solid #888;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left;font-size:9pt}
.item-table{display:table;width:100%;border-collapse:collapse;table-layout:fixed}
.item-table th,.item-table td{border:1px solid #555;text-align:center;padding:1.5mm;height:9mm}
.item-table th:first-child{width:24%}
.item-prompt{font-weight:700;margin:2mm 0}
.pdf-preview-card{width:min(100%,900px);background:#fff;box-shadow:0 2px 10px rgba(0,0,0,.18);padding:10px;box-sizing:border-box}
.pdf-preview-label{text-align:center;font-size:13px;font-weight:700;color:#334155;padding:4px 0 10px}
.pdf-preview-mount{width:100%;height:min(82vh,1100px);min-height:560px;background:#e5e7eb}
.pdf-preview-frame{display:block;width:100%;height:100%;border:0;background:#fff}
.pdf-preview-loading,.pdf-preview-error{display:flex;align-items:center;justify-content:center;height:100%;padding:16px;text-align:center;color:#334155}
.pdf-preview-error{color:#a11;background:#fff4f4}
.preview-edit-note{max-width:210mm;background:#fff7df;border:1px solid #ead28c;border-radius:6px;padding:8px 12px;color:#604b10;font-size:13px}
/* HTML interactive preview follows the PDF export's A4 grid and typography. */
.sheet{padding:10mm 12mm 14mm;font-size:11.25pt;line-height:1.45}
.cover .logo{height:22mm;margin-bottom:4mm}
.cover-authority{text-align:center;font-size:16pt;font-weight:700;line-height:1.45}
.cover-divider{width:126mm;margin:3mm auto 8mm;border-top:.4mm solid #000}
.cover-titles{text-align:center;font-size:18pt;font-weight:700;line-height:1.45;margin-bottom:6mm}
.cover-titles>div{margin-bottom:1mm}
.cover-info{display:grid;grid-template-columns:1fr 1fr;gap:2mm 4mm;margin:0 0 8mm;font-size:12.5pt;font-weight:700}
.cover-info>div:nth-child(odd){text-align:right}.cover-info>div:nth-child(even){text-align:left}
table.idt{width:100%;border-collapse:collapse;margin:0 0 8mm}
table.idt td{border:1px solid #000;padding:2mm 3mm;font-size:11.5pt;font-weight:700;height:10mm}
table.gt{width:174mm;margin:0 auto;border-collapse:collapse;table-layout:fixed;font-size:11.5pt}
table.gt th,table.gt td{border:1px solid #000;text-align:center;padding:1mm 1.5mm;height:8mm}
table.gt tbody td{height:9mm}
table.gt th{background:#ebebeb;font-weight:700}
table.gt tr.subtotal td{font-weight:700}table.gt tr.subtotal td:nth-last-child(-n+2){background:#e1e1e1}
table.gt tr.grand-total td{font-weight:700;height:9mm}
.content-page{padding:10mm 12mm 14mm}
.content-page .ph{margin:0;padding:0 0 2mm;border:0;line-height:1.45}
.content-page .ph-title,.content-page .ph-sub{font-size:13pt;font-weight:700;line-height:1.45}
.content-frame{box-sizing:border-box;width:100%;height:257.5mm;border:.5mm solid #000;padding:8mm 4mm 0;overflow:hidden}
.content-frame.has-banner{padding-top:0}
.pdf-banner{height:7mm;margin:0 -4mm 9mm;background:#e6e6e6;text-align:center;font-size:12pt;font-weight:700;line-height:7mm;text-decoration:underline;text-underline-offset:.7mm}
.sh{position:relative;margin:0 0 3mm;padding:0;border:0;line-height:1.45}
.sh.has-mark{padding-left:22mm;min-height:21mm;margin-bottom:0}
.st{display:table;margin-right:0;margin-left:auto;text-align:right;font-size:13pt;line-height:1.45;text-decoration:underline double;text-underline-offset:.18em}
.st-single{text-decoration:underline solid}
.si{font-size:11.25pt;font-weight:700;line-height:1.45;margin:0}
.group-mark{position:absolute;left:0;top:0;box-sizing:border-box;width:18mm;height:18mm;border:1px solid #000;border-radius:2mm;text-align:center;font-size:10.5pt;font-weight:700;padding-top:7mm}
.group-mark::before{content:"";position:absolute;left:0;right:0;top:8mm;border-top:1px solid #000}
.pdf-layout-group{display:flow-root;margin-bottom:var(--pdf-gap,0mm)}
.pdf-layout-group.last{margin-bottom:0}
.pdf-layout-block{margin:0}
.pdf-layout-block.mcq{padding-bottom:3mm}.pdf-layout-block.essay{padding-bottom:8mm}
.q{margin:0;break-inside:avoid;position:relative}
.qh{display:flex;gap:3mm;align-items:flex-start;justify-content:space-between;font-size:12pt;line-height:1.45}
.qt{flex:1;min-width:0;overflow-wrap:anywhere;font-weight:700}
.question-mark{flex:none;min-width:8mm;text-align:left;font-size:10.5pt;font-weight:700;direction:ltr}
ol.opts{margin:2mm 0 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1mm 8mm}
ol.opts li{font-size:11.25pt;line-height:1.45;overflow-wrap:anywhere}
.ln{height:7mm;margin:0 5mm;border-bottom:1px dashed #999}
.item-material{margin:2mm 0 2mm 12mm}
.item-figure{width:min(58mm,100%);height:auto;object-fit:contain;margin-inline-start:0}
.item-code{font-size:10pt}
.item-table{width:calc(100% - 12mm)}
.pn{bottom:6.5mm;left:12mm;right:12mm;border:0;padding:0;font-size:10pt}
@media print{.content-frame{height:257.5mm}}
