:root {
  --doc-font-family: "Noto Naskh Arabic", serif;
  --doc-color: #24353c;
  --doc-accent: #446E7D;
  --doc-border: #c5d4d9;
  --page-margin: 10mm;
  --page-margin-x: 10mm;
  --page-margin-y: 18mm;
  --section-gap: 4.5mm;
  --doc-font-size: 11.5pt;
  --doc-title-size: 15pt;
  --doc-header-size: 14pt;
  --doc-line-height: 1.75;
  --stamp-size: 32mm;
  --stamp-opacity: 0.5;
  --stamp-right: 4mm;
  --stamp-bottom: 4mm;
  --stamp-rotation: 0deg;
  --logo-size: 28mm;
  --logo-opacity: 0.9;
  --logo-right: 4mm;
  --logo-top: 4mm;
}

@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/static/fonts/NotoNaskhArabic-Regular.ttf");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/static/fonts/NotoNaskhArabic-Bold.ttf");
  font-weight: 700;
  font-style: normal;
}

@page {
  size: A4;
  margin: 0;
}



* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  direction: rtl;
  text-align: right;
  font-family: var(--doc-font-family);
  font-weight: 400;
  font-size: var(--doc-font-size);
  line-height: var(--doc-line-height);
  color: var(--doc-color);
  background: #fff;
}

.page[data-density="comfortable"] {
  --doc-font-size: 12.5pt;
  --doc-title-size: 16pt;
  --doc-line-height: 1.85;
  --section-gap: 5.5mm;
}

.page[data-density="compact"] {
  --doc-font-size: 10.5pt;
  --doc-title-size: 13.5pt;
  --doc-line-height: 1.65;
  --section-gap: 3.6mm;
}

.page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  overflow: visible;
  padding: 0;
  background: #fff;
}

.page-inner {
  padding: 18mm 10mm;
}

[data-field][contenteditable],
[data-sec-title][contenteditable],
[data-sec-content][contenteditable],
[data-sec-cell][contenteditable],
[data-sec-item][contenteditable],
[data-col-title][contenteditable],
[data-col-content][contenteditable] {
  outline: none;
  min-height: 1em;
}

.header-text {
  text-align: center;
  font-size: var(--doc-header-size);
  font-weight: 700;
  color: var(--doc-accent);
  margin: 0 0 var(--section-gap);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.doc-date-row {
  position: absolute;
  top: 4mm;
  left: 4mm;
  margin: 0;
  z-index: 3;
  pointer-events: none;
}

.doc-date {
  text-align: right;
  font-size: 11pt;
  line-height: 1.6;
  white-space: nowrap;
}

.doc-date .date-value {
  direction: ltr;
  unicode-bidi: isolate;
}

.body, .party-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  margin: 0 0 var(--section-gap);
}

.section-title {
  margin: 0 0 2.5mm;
  font-size: 12pt;
  font-weight: 700;
  color: var(--doc-accent);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--section-gap);
  page-break-inside: avoid;
}

.info-table th,
.info-table td {
  border: 0.3mm solid var(--doc-border);
  padding: 2mm 3mm;
  text-align: right;
  overflow-wrap: anywhere;
}

.requests {
  margin: 0 0 var(--section-gap);
  padding: 0 6mm 0 0;
}

.requests li {
  margin: 0 0 2mm;
  overflow-wrap: anywhere;
}

.parties {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  margin-top: 6mm;
  overflow: visible;
  page-break-inside: avoid;
  break-inside: avoid;
}

.party-card {
  position: relative;
  overflow: hidden;
  border: 0.4mm solid var(--doc-border);
  padding: 5mm 4mm 8mm;
  background: #fff;
  width: 48%;
  page-break-inside: avoid;
}

.party-card h3 {
  margin: 0 0 3mm;
  font-size: 11pt;
  font-weight: 700;
  color: var(--doc-accent);
  text-align: center;
}

.party-text {
  font-size: 10.5pt;
  text-align: center;
}

.stamp {
  position: absolute;
  width: var(--stamp-size);
  height: var(--stamp-size);
  right: 4mm !important;
  bottom: 4mm !important;
  left: auto !important;
  top: auto !important;
  opacity: var(--stamp-opacity);
  transform: rotate(var(--stamp-rotation));
  pointer-events: none;
  z-index: 5;
}

.stamp img {
  width: var(--stamp-size);
  height: var(--stamp-size);
  object-fit: contain;
}

.logo {
  position: absolute;
  top: 4mm !important;
  right: 4mm !important;
  left: auto !important;
  bottom: auto !important;
  width: var(--logo-size);
  max-width: var(--logo-size);
  opacity: var(--logo-opacity);
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
  margin: 0;
}

.logo img {
  display: block;
  width: var(--logo-size);
  height: auto;
  max-height: var(--logo-size);
  object-fit: contain;
}