/* ═════════════════════════════════════════════════════════════
   «مسار» — هوية الطباعة الخامسة
   ─────────────────────────────────────────────────────────────
   الفكرة: الحصة رحلة. خطُّ سيرٍ عمودي بمحطات مرقّمة
   (تهيئة ← ١ ٢ ٣ ٤ ← غلق)، وبعد الوصول يتفرّع الطريق
   (إثراء ↗ / علاج ↺)، والتقويم خطُّ سيرٍ أفقي صغير يردّد
   الفكرة. لون المسار يرثُ لون مستوى الطالب تلقائيًا.
   ─────────────────────────────────────────────────────────────
   الخطوط : El Messiri (لافتات الطريق) · Amiri (العنوان والأرقام)
            Tajawal (المتن)
   الكثافة: mp-d1 مريح · mp-d2 متوسط · mp-d3 مضغوط — صفحة واحدة دائمًا
   ملاحظة : التخطيط متعدد الأعمدة كله جداول CSS — أثبت طريقة
            للطباعة عبر كل المحركات.
   ═════════════════════════════════════════════════════════════ */

#preview.theme-masar .a4-masar {
  --mp-paper: #FEFCF7;
  --mp-ink:   #20302C;
  --mp-ink2:  #5E6F6A;
  --mp-ink3:  #8C9A95;
  --mp-gold:  #B8923E;
  --mp-line:  #E5DDCC;
  /* مقياس الكثافة */
  --s: 1;
  background: var(--mp-paper);
  color: var(--mp-ink);
  font-family: 'Tajawal', 'Noto Sans Arabic', sans-serif;
  padding: 0 11mm 0 9mm; /* الأيمن أوسع: مسافة أمان للعقد عن حافة الطباعة */
  position: relative;
  display: flex; flex-direction: column;
}
#preview.theme-masar .a4-masar.mp-d2 { --s: .92; }
#preview.theme-masar .a4-masar.mp-d3 { --s: .815; }

/* ════ الترويسة ════ */
#preview.theme-masar .mp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6mm; padding: 4.6mm 4mm 0 0;
}
#preview.theme-masar .mp-brand { display: flex; align-items: center; gap: 3.6mm; min-width: 0; }
#preview.theme-masar .mp-brand img { height: 12.5mm; width: auto; }
#preview.theme-masar .mp-brand-t b {
  display: block; font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(12.5pt * var(--s)); font-weight: 700; color: var(--mp-ink);
  letter-spacing: .2px; line-height: 1.3;
}
#preview.theme-masar .mp-brand-t span {
  font-size: calc(7.4pt * var(--s)); font-weight: 600; color: var(--mp-ink2); letter-spacing: .4px;
}
/* بطاقة الطالب: تذكرة الرحلة */
#preview.theme-masar .mp-student {
  text-align: center; padding: 1.8mm 4.6mm 1.5mm;
  border: 1.6px solid var(--pc); border-radius: 3.2mm;
  background: linear-gradient(160deg, var(--pc-tint), #fff 130%);
  position: relative; flex-shrink: 0; max-width: 62mm;
}
#preview.theme-masar .mp-student::before,
#preview.theme-masar .mp-student::after { /* ثقبا التذكرة */
  content: ""; position: absolute; top: 50%; width: 3mm; height: 3mm;
  background: var(--mp-paper); border: 1.6px solid var(--pc); border-radius: 50%;
  transform: translateY(-50%);
}
#preview.theme-masar .mp-student::before { right: -1.8mm; }
#preview.theme-masar .mp-student::after  { left:  -1.8mm; }
#preview.theme-masar .mp-stu-k {
  display: block; font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: 6.6pt; font-weight: 600; color: var(--pc-deep); letter-spacing: 1.5px;
}
#preview.theme-masar .mp-student b {
  display: block; font-family: 'Amiri','Noto Naskh Arabic',serif;
  font-size: calc(13.5pt * var(--s)); font-weight: 700; color: var(--mp-ink);
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#preview.theme-masar .mp-stu-lv {
  display: inline-block; margin-top: .6mm; padding: .5mm 2.6mm;
  font-size: 6.8pt; font-weight: 800; color: #fff;
  background: var(--pc-deep); border-radius: 99px;
}

/* ════ العنوان ════ */
#preview.theme-masar .mp-title { padding: 2.5mm 4mm 0 0; }
#preview.theme-masar .mp-title h1 {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: calc(18.5pt * var(--s)); font-weight: 700; line-height: 1.22;
  color: var(--mp-ink);
}
#preview.theme-masar .mp-meta {
  display: flex; flex-wrap: wrap; gap: 1.7mm; margin-top: 1.4mm;
}
#preview.theme-masar .mp-meta span {
  font-size: calc(7.9pt * var(--s)); font-weight: 700; color: var(--mp-ink);
  background: #fff; border: 1px solid var(--mp-line);
  border-radius: 99px; padding: .6mm 2.8mm;
}
#preview.theme-masar .mp-meta b {
  color: var(--mp-ink3); font-weight: 700; margin-left: 1.4mm;
  font-size: calc(6.7pt * var(--s));
}
#preview.theme-masar .mp-dates {
  display: flex; align-items: center; gap: 2.4mm; margin-top: 1.4mm;
  font-size: calc(8.1pt * var(--s)); font-weight: 700; color: var(--mp-ink);
}
#preview.theme-masar .mp-dt b {
  display: inline-block; color: var(--pc-deep); margin-left: 2.2mm; font-weight: 800;
  font-family: 'El Messiri','Noto Naskh Arabic',serif; font-size: calc(7pt * var(--s));
}
#preview.theme-masar .mp-dt-arrow {
  flex: 0 0 9mm; height: 1.1mm; border-radius: 2px; position: relative;
  background: repeating-linear-gradient(to left, var(--pc) 0 1.6mm, transparent 1.6mm 3.2mm);
}
#preview.theme-masar .mp-dt-arrow::after {
  content: ""; position: absolute; left: -.6mm; top: 50%; transform: translateY(-50%);
  border: 1.4mm solid transparent; border-right-color: var(--pc);
}
#preview.theme-masar .mp-dur { color: var(--mp-ink2); font-weight: 700; font-size: calc(7.5pt * var(--s)); }

/* ════ الهدف العام — لوحة الوجهة ════ */
#preview.theme-masar .mp-goal {
  display: flex; align-items: center; gap: 3.6mm;
  margin: 2.2mm 4mm 0 0; padding: 1.8mm 3.6mm;
  background: #fff; border: 1px solid var(--mp-line); border-radius: 2.6mm;
  border-right: 2.4mm solid var(--mp-gold);
}
#preview.theme-masar .mp-goal-k {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.3pt * var(--s)); font-weight: 700; color: var(--mp-gold);
  white-space: nowrap; letter-spacing: .5px;
}
#preview.theme-masar .mp-goal p {
  font-size: calc(9.2pt * var(--s)); font-weight: 600; line-height: 1.45; color: var(--mp-ink);
}

/* ════ جسد الصفحة ════ */
#preview.theme-masar .mp-body { padding: 2.2mm 4mm 0 0; }
#preview.theme-masar .mp-body > * { margin-bottom: calc(2.5mm * var(--s)); }
#preview.theme-masar .mp-body > *:last-child { margin-bottom: 0; }

/* رأس كل حزام (لافتة كوفية) */
#preview.theme-masar .mp-band-h {
  display: flex; align-items: baseline; gap: 3mm; margin-bottom: calc(1.2mm * var(--s));
}
#preview.theme-masar .mp-band-k {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(10pt * var(--s)); font-weight: 700; color: var(--pc-deep);
  letter-spacing: .4px;
}
#preview.theme-masar .mp-band-s {
  font-size: calc(7.3pt * var(--s)); font-weight: 600; color: var(--mp-ink3);
}

/* ── ١) الأهداف: ثلاث ركائز (جدول ثلاثي) ── */
#preview.theme-masar .mp-obj-grid { display: table; width: 100%; table-layout: fixed; }
#preview.theme-masar .mp-objc { display: table-cell; vertical-align: top; }
#preview.theme-masar .mp-objc:not(:last-child) { padding-left: 2.4mm; }
#preview.theme-masar .mp-obj {
  background: #fff; border: 1px solid var(--mp-line); border-radius: 2.4mm;
  border-top: 1.8mm solid var(--oc, var(--pc));
  padding: calc(1.5mm * var(--s)) 2.4mm calc(1.6mm * var(--s));
}
#preview.theme-masar .mp-obj.cog { --oc: #C36B50; }
#preview.theme-masar .mp-obj.ski { --oc: #2F8F82; }
#preview.theme-masar .mp-obj.emo { --oc: #4A7B9B; }
#preview.theme-masar .mp-obj h5 {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.7pt * var(--s)); font-weight: 700; color: var(--oc);
  margin-bottom: calc(.7mm * var(--s));
}
#preview.theme-masar .mp-obj p {
  font-size: calc(7.9pt * var(--s)); line-height: 1.45; font-weight: 500;
  color: var(--mp-ink); margin-bottom: calc(.7mm * var(--s));
  text-align: right;
}
#preview.theme-masar .mp-obj p:last-child { margin-bottom: 0; }
#preview.theme-masar .mp-obj p i {
  font-style: normal; font-weight: 800; color: var(--oc);
  font-size: calc(6.8pt * var(--s)); margin-left: 1.3mm;
  border-radius: 1.6mm; padding: 0 1.2mm;
}
#preview.theme-masar .mp-obj.cog p i { background: #F8EDE9; }
#preview.theme-masar .mp-obj.ski p i { background: #E8F3F1; }
#preview.theme-masar .mp-obj.emo p i { background: #ECF2F6; }

/* ── ٢) العمودان: المسار + العتاد (جدول ثنائي) ── */
#preview.theme-masar .mp-cols { display: table; width: 100%; table-layout: fixed; border-spacing: 0; }
#preview.theme-masar .mp-main { display: table-cell; vertical-align: top; padding-left: 3.6mm; }
#preview.theme-masar .mp-side { display: table-cell; vertical-align: top; width: 48mm; }

/* المسار العمودي */
#preview.theme-masar .mp-track { position: relative; padding-right: 7.2mm; }
#preview.theme-masar .mp-track::before { /* خط الرحلة */
  content: ""; position: absolute; right: 2.5mm; top: 2mm; bottom: 2.4mm; width: 1.1mm;
  background: var(--pc); border-radius: 2px; opacity: .85;
}
#preview.theme-masar .mp-station { position: relative; margin-bottom: calc(1.9mm * var(--s)); }
#preview.theme-masar .mp-station:last-child { margin-bottom: 0; }
#preview.theme-masar .mp-node {
  position: absolute; right: -7.05mm; top: .1mm;
  width: 5.8mm; height: 5.8mm; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--pc-deep);
  color: var(--pc-deep);
  font-family: 'Amiri','Noto Naskh Arabic',serif;
  font-size: calc(9.5pt * var(--s)); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1.4mm var(--mp-paper); /* يفصل العقدة عن الخط */
}
#preview.theme-masar .mp-station.go .mp-node,
#preview.theme-masar .mp-station.end .mp-node {
  background: var(--pc-deep); color: #fff; font-size: calc(8.2pt * var(--s));
}
#preview.theme-masar .mp-st-body h4 {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.8pt * var(--s)); font-weight: 700; color: var(--mp-ink);
  display: flex; align-items: baseline; gap: 2.2mm; margin-bottom: calc(.4mm * var(--s));
}
#preview.theme-masar .mp-st-body h4 em {
  font-style: normal; font-size: calc(6.5pt * var(--s)); font-weight: 700;
  color: var(--pc-deep); background: var(--pc-tint);
  padding: .3mm 2mm; border-radius: 99px;
}
#preview.theme-masar .mp-st-body p {
  font-size: calc(8.1pt * var(--s)); line-height: 1.46; font-weight: 500;
  color: var(--mp-ink); text-align: justify;
}
#preview.theme-masar .mp-stp { /* شارة الخطوة داخل السطر */
  font-style: normal; font-weight: 800; color: var(--pc-deep);
  background: var(--pc-tint); border-radius: 1.5mm;
  padding: 0 1.3mm; margin: 0 .3mm; font-size: calc(7.1pt * var(--s));
}

/* العمود الجانبي: العتاد */
#preview.theme-masar .mp-side > * { margin-bottom: calc(2.2mm * var(--s)); }
#preview.theme-masar .mp-side > *:last-child { margin-bottom: 0; }
#preview.theme-masar .mp-kit {
  background: #fff; border: 1px solid var(--mp-line); border-radius: 2.4mm;
  padding: calc(1.7mm * var(--s)) 2.5mm calc(1.8mm * var(--s));
}
#preview.theme-masar .mp-kit h5 {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.3pt * var(--s)); font-weight: 700; color: var(--pc-deep);
  margin-bottom: calc(.9mm * var(--s)); display: flex; align-items: center; gap: 1.8mm;
}
#preview.theme-masar .mp-kit h5 span { color: var(--mp-gold); font-size: calc(8pt * var(--s)); }
#preview.theme-masar .mp-kit ul { list-style: none; }
#preview.theme-masar .mp-kit li {
  position: relative; padding-right: 3.4mm;
  font-size: calc(7.6pt * var(--s)); line-height: 1.45; font-weight: 500;
  color: var(--mp-ink); margin-bottom: calc(.6mm * var(--s));
}
#preview.theme-masar .mp-kit li:last-child { margin-bottom: 0; }
#preview.theme-masar .mp-kit li::before {
  content: ""; position: absolute; right: 0; top: .5em;
  width: 1.7mm; height: 1.7mm; border-radius: 50%;
  border: 1.2px solid var(--pc); background: var(--pc-tint);
}

/* ── ٣) مفترق نهاية الرحلة: إثراء ↗ / علاج ↺ (صف ثنائي بعرض الصفحة) ── */
#preview.theme-masar .mp-fork { display: table; width: 100%; table-layout: fixed; }
#preview.theme-masar .mp-fkc { display: table-cell; vertical-align: top; }
#preview.theme-masar .mp-fkc:not(:last-child) { padding-left: 2.8mm; }
#preview.theme-masar .mp-fk {
  border-radius: 2.4mm; padding: calc(1.6mm * var(--s)) 2.6mm calc(1.7mm * var(--s));
  border: 1px solid var(--mp-line); background: #fff;
}
#preview.theme-masar .mp-fk.up { border-right: 1.8mm solid #2F8F82; }
#preview.theme-masar .mp-fk.re { border-right: 1.8mm solid var(--mp-gold); }
#preview.theme-masar .mp-fk h5 {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.2pt * var(--s)); font-weight: 700;
  display: flex; align-items: baseline; gap: 2mm; margin-bottom: calc(.7mm * var(--s));
}
#preview.theme-masar .mp-fk.up h5 { color: #256F65; }
#preview.theme-masar .mp-fk.re h5 { color: #93702A; }
#preview.theme-masar .mp-fk h5 em {
  font-style: normal; font-size: calc(6.4pt * var(--s)); font-weight: 700; color: var(--mp-ink3);
}
#preview.theme-masar .mp-fk p {
  font-size: calc(7.8pt * var(--s)); line-height: 1.46; font-weight: 500;
  color: var(--mp-ink); text-align: right;
}

/* ── ٤) التقويم: المسار الأفقي (جدول ثلاثي) ── */
#preview.theme-masar .mp-eval-line {
  display: table; width: 100%; table-layout: fixed;
  position: relative;
}
#preview.theme-masar .mp-eval-line::before { /* الخط الأفقي */
  content: ""; position: absolute; top: 1mm; right: 1mm; left: 1mm; height: 1mm;
  background: var(--pc); opacity: .8; border-radius: 2px;
}
#preview.theme-masar .mp-ev { display: table-cell; vertical-align: top; }
#preview.theme-masar .mp-ev:not(:last-child) { padding-left: 3mm; }
#preview.theme-masar .mp-ev-dot {
  display: block; width: 3.2mm; height: 3.2mm; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--pc-deep);
  box-shadow: 0 0 0 1.1mm var(--mp-paper);
  position: relative; /* فوق الخط */
}
#preview.theme-masar .mp-ev:last-child .mp-ev-dot { background: var(--pc-deep); }
#preview.theme-masar .mp-ev h5 {
  font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: calc(8.3pt * var(--s)); font-weight: 700; color: var(--mp-ink);
  display: flex; align-items: baseline; gap: 2mm;
  margin: calc(.7mm * var(--s)) 0 calc(.4mm * var(--s));
}
#preview.theme-masar .mp-ev h5 em {
  font-style: normal; font-size: calc(6.4pt * var(--s)); font-weight: 600; color: var(--mp-ink3);
}
#preview.theme-masar .mp-ev p {
  font-size: calc(7.7pt * var(--s)); line-height: 1.45; font-weight: 500;
  color: var(--mp-ink); text-align: right;
}

/* ════ التذييل (جدول ثلاثي) ════ */
#preview.theme-masar .mp-foot {
  display: table; width: calc(100% - 4mm); table-layout: fixed;
  margin: auto 4mm 0 0;  /* يلتصق بأسفل الصفحة في الخطط الخفيفة */
  padding: 2mm 0 4.6mm;
  border-top: 1px solid var(--mp-line);
}
#preview.theme-masar .mp-foot > div { display: table-cell; vertical-align: bottom; }
#preview.theme-masar .mp-f-t { width: 64mm; }
#preview.theme-masar .mp-f-t span,
#preview.theme-masar .mp-f-sign span {
  display: block; font-family: 'El Messiri','Noto Naskh Arabic',serif;
  font-size: 6.7pt; font-weight: 600; color: var(--mp-ink3); letter-spacing: 1px;
  margin-bottom: .5mm;
}
#preview.theme-masar .mp-f-t b {
  font-family: 'Amiri','Noto Naskh Arabic',serif;
  font-size: 11.5pt; font-weight: 700; color: var(--mp-ink);
}
#preview.theme-masar .mp-f-mid {
  font-size: 7pt; font-weight: 600; color: var(--mp-ink3); letter-spacing: .6px;
  text-align: center; padding-bottom: 1mm;
}
#preview.theme-masar .mp-f-sign { width: 40mm; }
#preview.theme-masar .mp-f-sign i {
  display: block; height: 0; border-bottom: 1.2px solid var(--mp-ink2); margin-top: 4mm;
}

/* ════ كثافة d2: لمسة وسطية ════ */
#preview.theme-masar .a4-masar.mp-d2 .mp-side { width: 47mm; }

/* ════ كثافة d3: لمسات إضافية للضغط بلا فقدان مقروئية ════ */
#preview.theme-masar .a4-masar.mp-d3 .mp-head { padding-top: 4.4mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-title { padding-top: 2.4mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-title h1 { font-size: calc(19pt * var(--s)); }
#preview.theme-masar .a4-masar.mp-d3 .mp-goal { margin-top: 2mm; padding: 1.8mm 3.2mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-goal p  { line-height: 1.42; }
#preview.theme-masar .a4-masar.mp-d3 .mp-body { padding-top: 2.2mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-obj p,
#preview.theme-masar .a4-masar.mp-d3 .mp-st-body p,
#preview.theme-masar .a4-masar.mp-d3 .mp-kit li,
#preview.theme-masar .a4-masar.mp-d3 .mp-fk p,
#preview.theme-masar .a4-masar.mp-d3 .mp-ev p { line-height: 1.42; }
#preview.theme-masar .a4-masar.mp-d3 .mp-station { margin-bottom: 1.6mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-side { width: 44mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-main { padding-left: 3.2mm; }
#preview.theme-masar .a4-masar.mp-d3 .mp-foot { padding-bottom: 3.8mm; }

/* ════ الطباعة ════ */
@media print {
  #preview.theme-masar .a4-masar { box-shadow: none; }
  #preview.theme-masar .mp-head,
  #preview.theme-masar .mp-title,
  #preview.theme-masar .mp-goal,
  #preview.theme-masar .mp-objs,
  #preview.theme-masar .mp-station,
  #preview.theme-masar .mp-kit,
  #preview.theme-masar .mp-fk,
  #preview.theme-masar .mp-eval,
  #preview.theme-masar .mp-foot {
    break-inside: avoid; page-break-inside: avoid;
  }
}

/* حبّة اللون في زر اختيار الستايل: رحلة عبر ألوان المستويات الثلاثة */
.sc-swatch.masar { background: linear-gradient(135deg, #e76f51, #2a9d8f 52%, #457b9d) !important; }
