/* ==========================================================
   رحلة التحسين — نظام التصميم الأساسي
   هوية مستوحاة من وزارة التعليم: أبيض أساسي، أخضر/تركوازي، رمادي فاتح.
   ========================================================== */

:root {
  /* الهوية — مأخوذة من ألوان الشعار */
  --brand-900: #00403a;
  --brand-800: #004f47;
  --brand-700: #006158;
  --brand-600: #00766b;
  --brand-500: #0b8a7c;
  --brand-400: #35a596;
  --brand-300: #7cc6bb;
  --brand-200: #bfe3dd;
  --brand-100: #e2f2ef;
  --brand-50: #f2f9f8;
  --accent-gray: #939393;

  /* الحبر */
  --ink: #14211f;
  --ink-2: #3f4d4a;
  --ink-3: #66736f;
  --ink-4: #95a09d;

  /* الأسطح والخطوط */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #edf1f0;
  --line: #e3e9e7;
  --line-2: #d2dbd8;

  /* أدوار القيم — تمييز بصري بين خط الأساس والمستهدف والنتيجة الفعلية */
  --role-baseline: #56646f;
  --role-baseline-bg: #f1f4f6;
  --role-baseline-line: #8795a1;
  --role-target: #8a5800;
  --role-target-bg: #fdf6e6;
  --role-target-line: #d79b22;
  --role-actual: #00685e;
  --role-actual-bg: #e5f4f1;
  --role-actual-line: #0b8a7c;
  --role-delta: #25589e;
  --role-delta-bg: #ebf1fa;
  --role-delta-line: #4f83cc;

  /* الحالات */
  --good: #0d6e37;
  --good-bg: #e6f4ea;
  --good-line: #0ca30c;
  --info: #22549b;
  --info-bg: #e9f0fa;
  --warn: #9a4a0a;
  --warn-bg: #fdf0e3;
  --warn-line: #ec835a;
  --muted: #5f6b76;
  --muted-bg: #f1f3f5;
  --neutral: #3f4d4a;
  --neutral-bg: #edf1f0;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(10, 40, 36, .06), 0 1px 1px rgba(10, 40, 36, .03);
  --shadow: 0 6px 18px -8px rgba(10, 40, 36, .14), 0 2px 5px rgba(10, 40, 36, .05);
  --shadow-lg: 0 22px 48px -18px rgba(10, 40, 36, .22);
  --ring: 0 0 0 3px rgba(11, 138, 124, .28);

  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
  --container: 1200px;
  --gutter: 16px;
  --header-h: 72px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (min-width: 768px) { :root { --gutter: 24px; } }

/* ---------- أساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 130px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.75; font-weight: 400;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html.no-scroll, html.no-scroll body { overflow: hidden; }
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; color: var(--ink); text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
bdi { unicode-bidi: isolate; }
.i { flex: none; vertical-align: middle; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.page { padding-block: 28px 64px; }
@media (min-width: 768px) { .page { padding-block: 40px 80px; } }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row > * { min-width: 0; }
.spacer { flex: 1; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.eyebrow { color: var(--brand-600); font-weight: 600; font-size: .85rem; letter-spacing: 0; margin-bottom: 4px; }

/* ---------- الشبكات ---------- */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
@media (min-width: 768px) { .grid { gap: 20px; } }

/* ---------- ترويسة الصفحة ---------- */
.page-head { margin-bottom: 28px; }
.page-head-row { display: flex; align-items: flex-start; gap: 16px; }
.page-head-icon {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(145deg, var(--brand-50), var(--brand-100)); color: var(--brand-700);
  border: 1px solid var(--brand-200);
}
.page-head-text { min-width: 0; flex: 1; }
.page-title { font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.35; }
.page-lead { margin-top: 8px; color: var(--ink-2); font-size: clamp(1rem, .95rem + .3vw, 1.15rem); max-width: 60ch; }
.page-head-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 520px) { .page-head-icon { width: 46px; height: 46px; border-radius: 13px; } .page-head-icon .i { width: 22px; height: 22px; } }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--brand-700); }
.crumbs-sep { display: inline-flex; color: var(--ink-4); }
.crumbs [aria-current] { color: var(--ink-2); font-weight: 500; }

/* ---------- الأقسام ---------- */
.section { margin-top: 44px; }
.section:first-child { margin-top: 0; }
@media (min-width: 768px) { .section { margin-top: 64px; } }
.section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head-text { flex: 1; min-width: min(100%, 240px); }
.section-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.section-title { font-size: clamp(1.25rem, 1.1rem + .7vw, 1.6rem); }
.section-lead { margin-top: 4px; color: var(--ink-2); }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.band { background: var(--surface-2); border-block: 1px solid var(--line); padding-block: 40px; }
@media (min-width: 768px) { .band { padding-block: 56px; } }

/* ---------- البطاقات ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; overflow-wrap: anywhere;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
@media (min-width: 768px) { .card { padding: 22px; } }
.card-link { display: block; color: inherit; }
.card-link:hover, .card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-200); color: inherit; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head > div { min-width: 0; flex: 1; }
.card-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.card-title { font-size: 1.1rem; line-height: 1.5; }
.card-sub { color: var(--ink-3); font-size: .9rem; margin-top: 2px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-soft { background: var(--surface-2); box-shadow: none; }
.card-brand { background: linear-gradient(160deg, var(--brand-700), var(--brand-900)); color: #fff; border-color: transparent; }
.card-brand h2, .card-brand h3, .card-brand .card-title { color: #fff; }
.card-accent { border-top: 4px solid var(--brand-500); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: .95rem; line-height: 1.3; cursor: pointer;
  text-align: center; transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .15s; white-space: normal;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 6px 16px -8px rgba(0, 118, 107, .7); }
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-outline { background: #fff; color: var(--brand-700); border-color: var(--brand-200); }
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-800); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-light { background: #fff; color: var(--brand-800); }
.btn-light:hover { background: var(--brand-50); color: var(--brand-900); }
.btn-danger { background: #fff; color: #b42318; border-color: #f4c7c3; }
.btn-danger:hover { background: #fef3f2; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.02rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand-100); color: var(--brand-800); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn-primary .count-pill { background: rgba(255, 255, 255, .22); color: #fff; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ---------- الشارات ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  line-height: 1.5; border: 1px solid transparent; white-space: nowrap;
}
.badge-sm { font-size: .75rem; padding: 2px 8px; gap: 4px; }
.badge-good { background: var(--good-bg); color: var(--good); border-color: #bfe5cb; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: #c9daf3; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #f6d3b3; }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--line-2); }
.badge-muted { background: var(--muted-bg); color: var(--muted); border-color: #e1e5e9; }
.badge-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }

/* «بانتظار تحديث البيانات» */
.awaiting {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--muted-bg); color: var(--muted); border: 1px dashed #c9d0d6; font-size: .85rem; font-weight: 500; line-height: 1.6;
  max-width: 100%; white-space: normal;
}
.awaiting .i { color: #8a96a1; }

/* ---------- قيم بأدوار (خط الأساس / المستهدف / الفعلية / التحسن) ---------- */
.triple { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.triple-compact { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); }
.rv {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; border-inline-start-width: 4px; min-width: 0;
}
.rv-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.rv-value { font-size: 1.35rem; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.triple-compact .rv-value { font-size: 1.12rem; }
.rv-empty .rv-value { font-size: 1rem; }
.rv-note { font-size: .78rem; color: var(--ink-3); }
.rv-baseline { background: var(--role-baseline-bg); border-color: #dfe5ea; border-inline-start-color: var(--role-baseline-line); }
.rv-baseline .rv-label { color: var(--role-baseline); }
.rv-target { background: var(--role-target-bg); border-color: #f3e2bb; border-inline-start-color: var(--role-target-line); border-style: dashed; border-inline-start-style: solid; }
.rv-target .rv-label { color: var(--role-target); }
.rv-actual { background: var(--role-actual-bg); border-color: #c4e5de; border-inline-start-color: var(--role-actual-line); }
.rv-actual .rv-label { color: var(--role-actual); }
.rv-delta { background: var(--role-delta-bg); border-color: #d3e0f3; border-inline-start-color: var(--role-delta-line); }
.rv-delta .rv-label { color: var(--role-delta); }
.rv-target-text { display: block; font-size: .92rem; font-weight: 600; line-height: 1.5; color: var(--ink-2); }
.rv-target-num { display: block; }
.delta { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.delta-up { color: var(--good); }
.delta-down { color: var(--warn); }
.delta-flat { color: var(--ink-3); }
/* مفتاح الألوان */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .82rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend .lg-baseline { background: var(--role-baseline-line); }
.legend .lg-target { background: var(--role-target-bg); border: 2px dashed var(--role-target-line); }
.legend .lg-actual { background: var(--role-actual-line); }
.legend .lg-delta { background: var(--role-delta-line); }

/* ---------- رقائق ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; font-weight: 500; line-height: 1.5; max-width: 100%;
}
a.chip:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.chip.active, .chip[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
button.chip { cursor: pointer; }

/* ---------- مفتاح/قيمة ---------- */
.kv { display: grid; gap: 0; margin: 0; }
.kv-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); font-size: .9rem; font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- نصوص ---------- */
.txt p + p { margin-top: .6em; }
.txt-list { list-style: none; display: grid; gap: 6px; margin-block: .4em; }
.txt-list li { position: relative; padding-inline-start: 18px; }
.txt-list li::before { content: ''; position: absolute; inset-inline-start: 2px; top: .7em; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-400); }
.prose { font-size: 1.05rem; color: var(--ink-2); max-width: 70ch; }

/* ---------- الجداول (قابلة للتمرير أفقيًا على الجوال) ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .92rem; }
.table th, .table td { padding: 12px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.table th { background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: .85rem; white-space: nowrap; position: sticky; top: 0; }
.table tr:last-child td, .table tr:last-child th { border-bottom: 0; }
.table tbody tr:hover { background: var(--brand-50); }
.scroll-hint { display: none; font-size: .8rem; color: var(--ink-3); margin-top: 6px; }
@media (max-width: 720px) { .scroll-hint { display: flex; align-items: center; gap: 4px; } }

/* ---------- مسار الخطوات (رحلة) ---------- */
.flow { list-style: none; display: grid; gap: 0; counter-reset: flow; }
.flow-step { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding-bottom: 22px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step::before {
  content: ''; position: absolute; inset-inline-start: 23px; top: 48px; bottom: 0; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--brand-200) 0 6px, transparent 6px 11px);
}
.flow-step:last-child::before { display: none; }
.flow-num {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--brand-700);
  border: 2px solid var(--brand-200); font-weight: 700; font-size: 1.05rem; z-index: 1; font-variant-numeric: tabular-nums;
}
.flow-step.is-key .flow-num { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.flow-body { min-width: 0; padding-top: 8px; }
.flow-title { font-size: 1.05rem; font-weight: 700; }
.flow-text { color: var(--ink-2); font-size: .95rem; margin-top: 2px; }
.flow-arrow { display: none; }

/* ---------- حالة فارغة ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 18px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--ink-3); }
.empty-compact { padding: 16px; gap: 4px; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--ink-4); border: 1px solid var(--line); margin-bottom: 4px; }
.empty-compact .empty-icon { width: 40px; height: 40px; }
.empty-title { font-weight: 600; color: var(--ink-2); }
.empty-text { font-size: .92rem; max-width: 50ch; }
.empty-admin { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--brand-700); background: var(--brand-50); padding: 4px 10px; border-radius: 999px; margin-top: 4px; }

/* ---------- تقدم ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); transition: width .8s var(--ease); }

/* ---------- الصور ---------- */
.img-ph { display: grid; place-items: center; background: var(--surface-3); color: var(--ink-4); border-radius: var(--radius-sm); min-height: 120px; }
img.lazy { background: var(--surface-3); }
img.img-missing { opacity: .4; }

/* ---------- حقول النماذج ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff;
  font: inherit; font-size: 16px; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); }
.select { appearance: none; -webkit-appearance: none; padding-inline-start: 12px; padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366736f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon .input { padding-inline-start: 44px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-600); }

/* ---------- تبويبات ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 14px; }
.seg button, .seg a { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; min-height: 38px; }
.seg .active, .seg [aria-selected="true"] { background: #fff; color: var(--brand-800); box-shadow: var(--shadow-sm); }

/* ==========================================================
   الترويسة والقائمة
   ========================================================== */
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--brand-700); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip:focus { top: 12px; color: #fff; }
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 12px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-logo { height: 54px; width: auto; flex: none; }
.brand-sep { width: 1px; align-self: stretch; margin-block: 16px; background: var(--line-2); flex: none; }
.brand-text { display: grid; min-width: 0; line-height: 1.35; }
.brand-name { font-size: 1.2rem; font-weight: 700; color: var(--brand-800); }
.brand-sub { font-size: .8rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.menu-btn { display: none; }

.site-nav { border-top: 1px solid var(--line); }
.nav-list { list-style: none; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding-block: 6px; }
.nav-list::-webkit-scrollbar { display: none; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  color: var(--ink-2); font-weight: 500; font-size: .93rem; transition: background .2s, color .2s;
}
.nav-link .i { color: var(--ink-4); transition: color .2s; }
.nav-link:hover { background: var(--surface-2); color: var(--brand-800); }
.nav-link:hover .i { color: var(--brand-500); }
.nav-link.active { background: var(--brand-50); color: var(--brand-800); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand-500); }
.nav-link.active .i { color: var(--brand-600); }
@media (min-width: 1025px) and (max-width: 1240px) { .nav-link { padding: 8px 9px; font-size: .88rem; gap: 5px; } .nav-link .i { display: none; } }

@media (max-width: 1024px) {
  :root { --header-h: 64px; }
  .menu-btn { display: inline-grid; }
  .brand-logo { height: 44px; }
  .brand-sep { margin-block: 14px; }
  .site-nav {
    position: fixed; inset-inline: 0; top: var(--header-h); bottom: 0; background: #fff; border-top: 1px solid var(--line);
    overflow-y: auto; visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .25s var(--ease), visibility .25s;
  }
  html.menu-open .site-nav { visibility: visible; opacity: 1; transform: none; }
  html.menu-open { overflow: hidden; }
  .nav-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; overflow: visible; padding-block: 16px 32px; }
  .nav-link { padding: 14px 14px; border: 1px solid var(--line); border-radius: 14px; font-size: 1rem; white-space: normal; }
  .nav-link .i { color: var(--brand-500); }
  .nav-link.active { box-shadow: none; border-color: var(--brand-300); }
}
@media (max-width: 420px) {
  .brand { gap: 8px; }
  .brand-logo { height: 42px; }
  .brand-name { font-size: 1.05rem; }
  .brand-sub { font-size: .72rem; }
}
@media (max-width: 340px) { .brand-sub { display: none; } }

.net-banner { background: var(--warn-bg); color: var(--warn); font-size: .88rem; text-align: center; padding: 8px 16px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.net-banner[hidden] { display: none; }

.admin-fab { position: fixed; inset-inline-start: 16px; bottom: 16px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); }
.admin-fab:hover { color: #fff; background: #000; }
.admin-fab[hidden] { display: none; }

/* ==========================================================
   التذييل
   ========================================================== */
.site-footer { margin-top: 32px; background: var(--surface-2); border-top: 1px solid var(--line); }
.footer-grid { display: grid; gap: 24px; padding-block: 36px 28px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.2fr 1fr 1.3fr; align-items: start; } }
.footer-brand { display: flex; align-items: center; gap: 16px; }
.footer-logo-card { flex: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; box-shadow: var(--shadow-sm); }
.footer-logo-card img { display: block; height: 52px; width: auto; }
.footer-school { font-weight: 700; font-size: 1.05rem; }
.footer-plan { color: var(--ink-2); font-size: .92rem; }
.footer-people p { font-size: .95rem; }
.footer-people p + p { margin-top: 4px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--brand-700); }
.footer-tagline { background: var(--brand-800); color: #e6f4f1; text-align: center; font-weight: 600; font-size: .95rem; padding-block: 14px; }

/* ==========================================================
   نافذة منبثقة وإشعارات
   ========================================================== */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(8, 28, 25, .45); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-backdrop.open { opacity: 1; }
.modal {
  width: 100%; max-width: 640px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: #fff;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transform: translateY(12px) scale(.98); transition: transform .25s var(--ease); overflow: hidden;
}
.modal-backdrop.open .modal { transform: none; }
.modal-lg { max-width: 880px; }
.modal-xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 1.1rem; flex: 1; min-width: 0; }
.modal-body { padding: 18px; overflow-y: auto; overflow-x: hidden; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 92dvh; border-radius: 20px 20px 0 0; }
}
.toasts { position: fixed; z-index: 100; inset-inline: 16px; bottom: 16px; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; max-width: 520px; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: .92rem; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: #0d5e33; }
.toast-error { background: #9b1c1c; }

/* ==========================================================
   الحركة
   ========================================================== */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
html:not(.booted) .reveal { opacity: 1; transform: none; }
.page-enter { animation: pageIn .35s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* شاشة التحميل */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--brand-800); font-weight: 700; font-size: 1.2rem; }
.boot img { width: 200px; }
.boot-bar { width: 160px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brand-100), var(--brand-500), var(--brand-100)); background-size: 200% 100%; animation: bootBar 1.2s linear infinite; }
@keyframes bootBar { to { background-position: -200% 0; } }

/* ==========================================================
   الطباعة
   ========================================================== */
@media print {
  .site-header, .site-nav, .admin-fab, .toasts, .net-banner, .footer-links, .page-head-actions, .btn { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  body { font-size: 12pt; }
  a { color: inherit; }
}

/* ==========================================================
   الرسوم البيانية (charts.js)
   ========================================================== */
.ch { margin: 0; min-width: 0; }
.ch-legend { margin-top: 10px; }
/* مخطط «من ← إلى» */
.ch-range { padding: 4px 6px 0; }
.ch-range-top, .ch-range-labels { position: relative; height: 26px; }
.ch-range-labels.two-rows { height: 50px; }
.ch-range-track { position: relative; height: 28px; margin-inline: 8px; }
.ch-range-track::before { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--line-2); border-radius: 2px; }
.ch-grid { position: absolute; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.ch-conn { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 6px; background: var(--brand-300); }
.ch-conn.up { background: linear-gradient(to left, var(--brand-500), var(--brand-200)); }
.ch-conn.down { background: repeating-linear-gradient(45deg, #f3c9a6 0 4px, #fbe6d4 4px 8px); }
.ch-target-line { position: absolute; top: -6px; bottom: -6px; width: 0; border-inline-start: 2px dashed var(--role-target-line); transform: translateX(50%); }
.ch-dot { position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; border: 2px solid #fff; transform: translateX(50%); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.ch-dot-baseline { background: var(--role-baseline-line); }
.ch-dot-actual { background: var(--role-actual-line); width: 20px; height: 20px; margin-top: -10px; }
.ch-lbl { position: absolute; top: 2px; white-space: nowrap; font-size: .8rem; font-weight: 600; color: var(--ink-2); line-height: 1.6; }
.ch-lbl bdi { font-weight: 700; color: var(--ink); }
.ch-lbl-target { color: var(--role-target); }
.ch-lbl-actual { color: var(--role-actual); }
.ch-lbl-baseline { color: var(--role-baseline); }
.ch-lbl.row2 { top: 26px; }
.ch-axis { position: relative; height: 20px; margin-inline: 8px; border-top: 1px solid var(--line); margin-top: 2px; }
.ch-axis span { position: absolute; top: 2px; font-size: .72rem; color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 400px) { .ch-lbl { font-size: .72rem; } }
/* أعمدة قبل/بعد */
.ch-cols-plot { position: relative; height: 190px; display: flex; justify-content: center; align-items: flex-end; gap: clamp(8px, 5vw, 40px); padding-inline-start: 34px; border-bottom: 1px solid var(--line-2); }
.ch-hgrid { position: absolute; inset-inline: 0; height: 0; border-top: 1px solid var(--line); }
.ch-hgrid bdi { position: absolute; inset-inline-start: 0; top: -9px; font-size: .7rem; color: var(--ink-4); background: #fff; padding-inline-end: 4px; }
.ch-htarget { position: absolute; inset-inline: 30px 0; height: 0; border-top: 2px dashed var(--role-target-line); z-index: 2; }
.ch-htarget > span { position: absolute; inset-inline-end: 0; top: -22px; font-size: .74rem; font-weight: 600; color: var(--role-target); background: rgba(255, 255, 255, .92); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.ch-col-slot { position: relative; height: 100%; width: clamp(84px, 26vw, 120px); display: flex; justify-content: center; align-items: flex-end; z-index: 1; }
.ch-col { position: relative; width: 24px; min-height: 2px; border-radius: 4px 4px 0 0; transition: height .8s var(--ease); }
.ch-col-pre { background: var(--role-baseline-line); }
.ch-col-post { background: var(--role-actual-line); }
.ch-cap { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: .82rem; font-weight: 700; white-space: nowrap; color: var(--ink); }
.ch-cols-x { display: flex; justify-content: center; gap: clamp(8px, 5vw, 40px); padding-inline-start: 34px; margin-top: 6px; }
.ch-cols-x span { width: clamp(84px, 26vw, 120px); text-align: center; font-size: .8rem; font-weight: 600; line-height: 1.45; color: var(--ink-2); }
/* منحنى */
.ch-trend svg { width: 100%; max-width: 560px; height: auto; display: block; margin-inline: auto; overflow: visible; font-family: var(--font); }
.ch-trend .tg { stroke: var(--line); stroke-width: 1; }
.ch-trend .tt { fill: var(--ink-4); font-size: 10px; }
.ch-trend .tb { stroke: var(--role-baseline-line); stroke-width: 1.5; }
.ch-trend .tr { stroke: var(--role-target-line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ch-trend .tl { fill: none; stroke: var(--role-actual-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-trend .td { fill: var(--role-actual-line); stroke: #fff; stroke-width: 2; }
.ch-trend .tx { fill: var(--ink-3); font-size: 10.5px; }
.ch-trend .tv { fill: var(--ink); font-size: 12px; font-weight: 700; }

/* ==========================================================
   مكونات مشتركة: بطاقة المؤشر، بطاقة الشاهد، مقارنة الصور
   ========================================================== */
.ic { display: flex; flex-direction: column; }
.ic .card-head { flex-wrap: wrap; }
.ic .card-head .badge { margin-inline-start: auto; }
.ic-name { color: var(--ink); }
.ic-name:hover { color: var(--brand-700); }
.ic .triple { margin-top: 2px; }
.ic .card-foot { margin-top: auto; padding-top: 14px; }
.ic > .triple + .card-foot, .ic > .ic-metrics + .card-foot { margin-top: 16px; }
.ic-progs { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.ic-sep { height: 1px; background: var(--line); margin-block: 12px; }
.ic-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ic-metric { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.ic-metric-wide { grid-column: 1 / -1; }
.ic-metric-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--ink-3); }
.ic-metric-value { font-size: 1.25rem; font-weight: 700; }
.ic-metric-text { font-size: .95rem; font-weight: 500; line-height: 1.6; }

.ec-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ec-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; }
.ec-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ec-thumb-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand-500); background: linear-gradient(160deg, var(--brand-50), var(--surface-2)); }
.ec-k-pdf { color: #b42318; background: linear-gradient(160deg, #fff4f2, var(--surface-2)); }
.ec-k-video { color: #6941c6; background: linear-gradient(160deg, #f6f3ff, var(--surface-2)); }
.ec-k-link { color: var(--info); background: linear-gradient(160deg, var(--info-bg), var(--surface-2)); }
.ec-type { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(255, 255, 255, .94); }
.ec-body { padding: 14px 16px 4px; display: grid; gap: 6px; }
.ec-title { font-size: 1rem; font-weight: 700; line-height: 1.55; overflow-wrap: anywhere; }
.ec-title a { color: var(--ink); }
.ec-title a:hover { color: var(--brand-700); }
.ec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .82rem; color: var(--ink-3); }
.ec-desc { font-size: .9rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ec-rels .chip { font-size: .76rem; padding: 3px 9px; }
.ec-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; margin-top: auto; }
.ec-list { display: grid; gap: 8px; }
.ec-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; flex-wrap: wrap; }
.ec-row-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); }
.ec-row-body { flex: 1 1 160px; min-width: 0; }
.ec-row .ec-title { font-size: .95rem; }
.ec-row .ec-title:hover { color: var(--brand-700); }
.ec-row a.ec-title { color: var(--ink); }
.ec-row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.ec-more { margin-top: 12px; }
.ec-empty { margin: 4px 0; }

.pc { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.pc-stage, .pc-single { position: relative; aspect-ratio: 4 / 3; background: var(--surface-3); overflow: hidden; user-select: none; -webkit-user-select: none; }
.pc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-before-wrap { position: absolute; inset: 0; clip-path: inset(0 0 0 calc(100% - var(--pos))); }
.pc-handle { position: absolute; top: 0; bottom: 0; right: var(--pos); width: 2px; margin-right: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none; }
.pc-handle > span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--brand-700); box-shadow: var(--shadow); }
.pc-range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; direction: rtl; touch-action: pan-y; }
.pc-tag { position: absolute; top: 10px; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff; pointer-events: none; }
.pc-tag.static { position: static; display: inline-block; margin-inline-end: 8px; }
.pc-tag-before { right: 10px; background: rgba(86, 100, 111, .92); }
.pc-tag-after { left: 10px; background: rgba(0, 118, 107, .94); }
.pc-body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; color: var(--ink-3); }
.pc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pc-desc { font-size: .92rem; color: var(--ink-2); }
.pc-full { justify-self: start; }
.pc-side { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.pc-side figure { margin: 0; display: grid; gap: 8px; }
.pc-side figcaption { font-size: .88rem; color: var(--ink-3); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pc-side-img { width: 100%; height: auto; border-radius: var(--radius-sm); background: var(--surface-3); object-fit: contain; max-height: 70vh; }
