/* ============================================================
   أنماط صفحات التقرير — مطابقة لتصميم بست شيلد الأصلي
   مقاس A4: 794 × 1123 px @96dpi
   ============================================================ */

:root {
  --bs-red: #ea272c;
  --bs-red-dark: #c81e23;
  --bs-amber: #b07414;
  --bs-amber-band: #f7b322;
  --bs-green: #17a45b;
  --bs-black: #000000;
  --bs-ink: #111111;
  --bs-gray: #8b8b8b;
  --bs-gray-light: #aaaaaa;
  --bs-divider: #dbdbdb;
  --bs-divider-light: #e8e8e8;
  --bs-pill-red-bg: #fdeeee;
  --bs-hdr-pill: #1d1d1d;
}

.report-page {
  width: 794px;
  height: 1123px;
  background: #ffffff;
  direction: rtl;
  font-family: 'Alexandria', sans-serif;
  color: var(--bs-ink);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.report-page * { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- هيدر تقرير الفرع (الكبير) ---------- */
.rp-hero {
  background: var(--bs-black);
  color: #fff;
  padding: 12px 58px 0;
  height: 145px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex: 0 0 auto;
}
.rp-hero-right { display: flex; flex-direction: column; align-items: flex-start; }
.rp-hero-right .rp-logo { height: 38px; margin-bottom: 12px; align-self: flex-start; }
.rp-hero-kicker { color: var(--bs-red); font-size: 10px; font-weight: 500; margin-bottom: 6px; }
.rp-hero-title { color: #fff; font-size: 30px; font-weight: 800; line-height: 1.15; }

.rp-hero-score { text-align: center; margin-top: 14px; margin-left: 6px; }
.rp-hero-score-label { color: #9a9a9a; font-size: 9px; font-weight: 400; margin-bottom: 8px; }
.rp-hero-score-value { color: #fff; font-weight: 800; line-height: 1; direction: ltr; }
.rp-hero-score-value .num { font-size: 46px; letter-spacing: -1px; }
.rp-hero-score-value .pct { font-size: 18px; font-weight: 700; }
.rp-hero-badge {
  margin-top: 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bs-hdr-pill);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 9.5px;
  font-weight: 700;
}
.rp-hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rp-hero-badge.c-yellow { color: var(--bs-amber-band); }
.rp-hero-badge.c-yellow .dot { background: var(--bs-amber-band); }
.rp-hero-badge.c-green { color: #2ecc80; }
.rp-hero-badge.c-green .dot { background: #2ecc80; }
.rp-hero-badge.c-red { color: #ff5a5f; }
.rp-hero-badge.c-red .dot { background: #ff5a5f; }

/* ---------- شريط الميتا ---------- */
.rp-meta {
  display: flex;
  padding: 0 58px;
  border-bottom: 1px solid var(--bs-divider);
  flex: 0 0 auto;
}
.rp-meta-cell {
  padding: 12px 0 11px;
  flex: 1 1 auto;
  border-left: 1px solid var(--bs-divider-light);
  padding-left: 18px;
  padding-right: 18px;
}
.rp-meta-cell:first-child { padding-right: 0; }
.rp-meta-cell:last-child { border-left: none; padding-left: 0; }
.rp-meta-label { color: var(--bs-gray); font-size: 8.5px; font-weight: 400; margin-bottom: 6px; }
.rp-meta-value { color: var(--bs-ink); font-size: 11.5px; font-weight: 700; white-space: nowrap; }

/* ---------- جسم الصفحة ---------- */
.rp-body { padding: 0 58px; flex: 1 1 auto; }

/* عنوان قسم */
.rp-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  margin-bottom: 2px;
}
.rp-section-title { display: flex; align-items: center; gap: 10px; }
.rp-section-title .bar { width: 5px; height: 17px; background: var(--bs-red); border-radius: 1px; }
.rp-section-title h2 { font-size: 16px; font-weight: 800; color: var(--bs-ink); }
.rp-section-note {
  color: var(--bs-gray);
  font-size: 8.5px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rp-section-note::before { content: ''; display: block; width: 150px; height: 1px; background: var(--bs-divider-light); }

/* ---------- جدول المؤشرات ---------- */
.rp-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.rp-table th {
  color: var(--bs-gray);
  font-size: 8.5px;
  font-weight: 400;
  text-align: right;
  padding: 6px 0 8px;
  border-bottom: 2px solid var(--bs-ink);
}
.rp-table th.c-target, .rp-table td.c-target { text-align: right; width: 150px; }
.rp-table th.c-actual, .rp-table td.c-actual { text-align: right; width: 150px; }
.rp-table th.c-status, .rp-table td.c-status { text-align: right; width: 92px; }
.rp-table td { border-bottom: 1px solid var(--bs-divider); padding: 8px 0; }
.rp-table tr.group-row td {
  border-bottom: 1px solid var(--bs-divider);
  padding: 11px 0 7px;
}
.rp-group-title { color: var(--bs-red); font-size: 12.5px; font-weight: 800; display: inline-block; }
.rp-group-note { color: var(--bs-gray); font-size: 8.5px; font-weight: 400; margin-right: 10px; }
.rp-kpi-name { font-size: 11px; font-weight: 700; color: var(--bs-ink); }
.rp-kpi-name .zero-pill {
  background: var(--bs-pill-red-bg);
  color: var(--bs-red-dark);
  font-size: 8px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  margin-right: 8px;
  position: relative;
  top: -1px;
}
.rp-val { font-size: 11px; font-weight: 400; color: #222; }
.rp-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; }
.rp-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.rp-status.c-green { color: var(--bs-green); }
.rp-status.c-green .dot { background: var(--bs-green); }
.rp-status.c-yellow { color: var(--bs-amber); }
.rp-status.c-yellow .dot { background: #eab308; }
.rp-status.c-red { color: var(--bs-red-dark); }
.rp-status.c-red .dot { background: var(--bs-red-dark); }

/* ---------- الفوتر ---------- */
.rp-footer {
  flex: 0 0 auto;
  margin-top: auto;
  margin-left: 58px;
  margin-right: 58px;
  border-top: 1px solid var(--bs-divider);
  padding: 11px 0 20px;
  display: flex;
  justify-content: space-between;
  color: var(--bs-gray);
  font-size: 8.5px;
  font-weight: 400;
}
.rp-footer b { color: var(--bs-ink); font-weight: 700; }

/* ============================================================
   الهيدر المضغوط (صفحة الخطة + التشيك ليست)
   ============================================================ */
.rp-band {
  background: var(--bs-black);
  color: #fff;
  padding: 14px 58px;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
}
/* العنوان يسار — مطابق للأصل */
.rp-band-left { direction: rtl; }
.rp-band-title { font-size: 19px; font-weight: 800; color: #fff; margin-bottom: 5px; }
.rp-band-sub { font-size: 9px; font-weight: 400; color: #b5b5b5; white-space: nowrap; }
.rp-band-sub b { color: #fff; font-weight: 700; }
.rp-band .rp-logo { height: 32px; }
.rp-band-wrap { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; width: 100%; }

/* ---------- صفحة الخطة ---------- */
.rp-plan-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
}
.rp-plan-item + .rp-plan-item { border-top: 1px solid var(--bs-divider-light); }
.rp-plan-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  background: var(--bs-black);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.rp-plan-text { flex: 1 1 auto; font-size: 11.5px; font-weight: 400; line-height: 1.85; color: var(--bs-ink); padding-left: 26px; }
.rp-plan-text b { font-weight: 700; }
.rp-plan-side { flex: 0 0 auto; text-align: right; min-width: 110px; }
.rp-plan-side-label { color: var(--bs-gray); font-size: 8.5px; margin-bottom: 6px; }
.rp-plan-side-value { color: var(--bs-ink); font-size: 11px; font-weight: 700; }
.rp-task-status { font-size: 10px; font-weight: 700; margin-top: 6px; }
.rp-task-status.c-ongoing { color: var(--bs-amber); }
.rp-task-status.c-late { color: var(--bs-red-dark); }
.rp-task-status.c-done { color: var(--bs-green); }

/* ============================================================
   صفحة التشيك ليست
   ============================================================ */
.rp-check-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.rp-check-table th {
  color: var(--bs-gray); font-size: 8.5px; font-weight: 400; text-align: right;
  padding: 6px 0 8px; border-bottom: 2px solid var(--bs-ink);
}
.rp-check-table th.c-result, .rp-check-table td.c-result { width: 120px; }
.rp-check-table td { border-bottom: 1px solid var(--bs-divider); padding: 7px 0; }
.rp-check-table tr.group-row td { padding: 11px 0 7px; }
.rp-check-item { font-size: 10.5px; font-weight: 600; color: var(--bs-ink); }
.rp-check-mark { font-size: 13px; font-weight: 700; }
.rp-check-mark.ok { color: var(--bs-green); }
.rp-check-mark.fail { color: var(--bs-red-dark); }

/* جولة التقييم — عمودان */
.rp-eval-grid { display: flex; gap: 40px; margin-top: 8px; }
.rp-eval-col { flex: 1 1 0; }
.rp-eval-group { margin-bottom: 16px; }
.rp-eval-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px solid var(--bs-ink);
  padding-bottom: 8px;
}
.rp-eval-head .t { color: var(--bs-red); font-size: 12.5px; font-weight: 800; }
.rp-eval-head .s { color: var(--bs-ink); font-size: 12px; font-weight: 700; direction: ltr; }
.rp-eval-row {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--bs-divider);
  padding: 7.5px 0;
}
.rp-eval-row .label { font-size: 9.5px; font-weight: 500; color: var(--bs-ink); }
.rp-eval-row .score { font-size: 11px; font-weight: 700; color: var(--bs-ink); }
.rp-eval-row .score.v1 { color: var(--bs-amber); }
.rp-eval-row .score.v0 { color: var(--bs-red-dark); }

/* شريط النتيجة */
.rp-result-band {
  border-radius: 14px;
  padding: 18px 30px;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.rp-result-band.c-yellow { background: var(--bs-amber-band); color: var(--bs-ink); }
.rp-result-band.c-green { background: var(--bs-green); color: #fff; }
.rp-result-band.c-red { background: var(--bs-red); color: #fff; }
.rp-result-title { font-size: 14px; font-weight: 800; margin-bottom: 7px; }
.rp-result-note { font-size: 10px; font-weight: 500; opacity: 0.85; }
.rp-result-score { display: flex; align-items: center; gap: 14px; direction: ltr; }
.rp-result-score .pct { font-size: 28px; font-weight: 800; }
.rp-result-score .frac { font-size: 10px; font-weight: 500; opacity: 0.7; }

/* ============================================================
   ملحق صور المخالفات
   ============================================================ */
.rp-photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 20px;
}
.rp-photo {
  border: 1px solid var(--bs-divider);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.rp-photo-img {
  height: 300px;
  background: #f4f4f4;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.rp-photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-photo figcaption {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--bs-ink);
  border-top: 2px solid var(--bs-ink);
  display: flex; align-items: center; gap: 9px;
  line-height: 1.7;
}
.rp-photo figcaption .n {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  background: var(--bs-black); color: #fff;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
