@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  /* الوضع النهاري الرسمي (Official Executive Day Mode) مستوحى من ألوان شعار تكامل الرسمي */
  --takamul-navy-deep: #061533;
  --takamul-navy: #0b2559;
  --takamul-blue: #124296;
  --takamul-cyan: #0891b2;
  --takamul-cyan-vivid: #06b6d4;
  --moe-emerald-dark: #073b6b;
  --moe-emerald: #0f4c81;
  --moe-emerald-vivid: #0284c7;
  --moe-emerald-light: #e0f2fe;
  --moe-gold: #d4a017;
  --moe-gold-vivid: #f59e0b;
  --moe-gold-light: #fef9c3;

  --bg-page: #eef2f7;
  --bg-card: #ffffff;
  --bg-card-secondary: #f8fafc;
  --bg-card-header: linear-gradient(135deg, #f0f7ff 0%, #ffffff 55%, #fffbeb 100%);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-accent: rgba(18, 66, 150, 0.22);

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --success: #059669;
  --success-bg: #ecfdf5;
  --info: #1d4ed8;
  --info-bg: #eff6ff;

  --shadow-sm: 0 4px 14px rgba(6, 21, 51, 0.06);
  --shadow-md: 0 18px 40px -10px rgba(6, 21, 51, 0.13), 0 6px 16px -4px rgba(15, 23, 42, 0.05);
  --shadow-3d: 0 24px 52px -12px rgba(6, 21, 51, 0.2), 0 8px 20px -6px rgba(6, 21, 51, 0.1);
}

/* ==========================================================================
   الوضع الليلي الملكي الرسمي (Official Royal Night Mode)
   ========================================================================== */
body.dark-mode {
  --bg-page: #060e20;
  --bg-card: #0c1933;
  --bg-card-secondary: #102244;
  --bg-card-header: linear-gradient(135deg, #0f254a 0%, #0c1933 60%, #172a4f 100%);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #1e3a6e;
  --border-accent: rgba(56, 189, 248, 0.28);
  --moe-emerald-dark: #7dd3fc;
  --moe-emerald: #38bdf8;
  --moe-emerald-light: rgba(14, 116, 144, 0.25);
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 20px 44px -10px rgba(0, 0, 0, 0.65);
  --shadow-3d: 0 26px 56px -12px rgba(0, 0, 0, 0.8);
}

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

body {
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(at 12% 8%, rgba(18, 66, 150, 0.11) 0px, transparent 45%),
    radial-gradient(at 88% 12%, rgba(245, 158, 11, 0.1) 0px, transparent 42%),
    radial-gradient(at 50% 85%, rgba(6, 182, 212, 0.09) 0px, transparent 50%);
  color: var(--text-primary);
  direction: rtl;
  line-height: 1.65;
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   الأنيميشن والحركات الإبداعية
   ========================================================================== */
@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(18px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55), 0 0 25px rgba(56, 189, 248, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0), 0 0 35px rgba(56, 189, 248, 0.55); }
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

@keyframes growProgress {
  from { width: 0%; }
}

/* ==========================================================================
   أيقونات المنصة (Duotone) وبلاطاتها اللونية
   ========================================================================== */
.ni { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }
.ni .d { fill: currentColor; opacity: 0.16; stroke: none; }
.btn .ni { margin-inline-end: 2px; }
.ni-tile {
  --t1: #0b2559; --t2: #0284c7;
  width: 46px; height: 46px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 15px 15px 15px 5px;
  color: #fff;
  background: radial-gradient(120% 120% at 20% 10%, rgba(255,255,255,0.32) 0, transparent 45%), linear-gradient(145deg, var(--t2), var(--t1));
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.35), 0 10px 18px -8px var(--t1);
}
.ni-tile .ni .d { opacity: 0.32; }
.t-emerald { --t1: #065f46; --t2: #10b981; }
.t-gold { --t1: #92400e; --t2: #f59e0b; }
.t-navy { --t1: #061533; --t2: #1d4ed8; }
.t-cyan { --t1: #0e7490; --t2: #22d3ee; }
.t-blue { --t1: #1e3a8a; --t2: #3b82f6; }
.t-purple { --t1: #4c1d95; --t2: #8b5cf6; }
.t-rose { --t1: #831843; --t2: #ec4899; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-muted); }

.logo-disc {
  width: 54px; height: 54px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--moe-gold-vivid);
  display: inline-flex; align-items: center; justify-content: center; padding: 6px; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
.logo-disc img { width: 100%; height: 100%; object-fit: contain; }
.logo-disc.sm { width: 46px; height: 46px; padding: 5px; }

/* ==========================================================================
   رأس مساحة العمل
   ========================================================================== */
.app-header {
  background: linear-gradient(120deg, #061533 0%, #0b2559 45%, #124296 100%);
  color: #fff;
  padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-bottom: 3px solid var(--moe-gold-vivid);
}
body.theme-girls .app-header { background: linear-gradient(120deg, #2e0b2b 0%, #5b1747 45%, #8a2a6a 100%); }
.ah-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ah-title { font-size: 18px; font-weight: 900; letter-spacing: 0.2px; }
.ah-school { font-size: 13px; color: #bae6fd; font-weight: 700; }
body.theme-girls .ah-school { color: #fbcfe8; }
.ah-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ah-select {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 12px; padding: 4px 10px; color: #fde68a;
}
.ah-select select {
  background: transparent; border: 0; color: #fff; font: inherit; font-size: 13px; font-weight: 700; max-width: 220px; outline: none;
}
.ah-select select option { color: #0f172a; }
.ah-user { text-align: left; padding-inline: 6px; line-height: 1.3; }
.ah-name { font-weight: 800; font-size: 14px; }
.ah-role { font-size: 12px; color: #fde68a; font-weight: 700; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.1); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s, transform .2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

/* ==========================================================================
   شريط الأقسام المرقّم (بالترتيب)
   ========================================================================== */
.main-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  display: flex; gap: 6px; overflow-x: auto;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 50;
}
.nav-tab {
  background: transparent; border: 1px solid transparent; border-radius: 14px;
  padding: 7px 12px 7px 14px; font: inherit; font-size: 14px; font-weight: 800;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.nav-tab[hidden] { display: none; }
.nav-tab .tab-num {
  font-size: 11px; font-weight: 900; color: var(--text-muted);
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-tab .tab-icon {
  width: 32px; height: 32px; border-radius: 10px 10px 10px 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--moe-emerald-light); color: var(--moe-emerald);
}
.nav-tab:hover { background: var(--bg-card-secondary); border-color: var(--border-accent); color: var(--moe-emerald); }
.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #061533 0%, #0f387d 60%, #0284c7 100%);
  box-shadow: 0 8px 18px -6px rgba(15, 56, 125, 0.45);
}
body.theme-girls .nav-tab.active { background: linear-gradient(135deg, #4a1240 0%, #8a2a6a 60%, #c0418f 100%); }
.nav-tab.active .tab-num { color: #fde68a; }
.nav-tab.active .tab-icon { background: linear-gradient(145deg, #f59e0b, #b45309); color: #fff; }
.nav-tab.active .nav-badge { background: rgba(255,255,255,0.18); color: #fef08a; border-color: rgba(254,240,138,0.4); }
.nav-badge {
  background: var(--moe-emerald-light); color: var(--moe-emerald-dark);
  border: 1px solid var(--border-accent); font-size: 11px; padding: 1px 8px; border-radius: 99px; font-weight: 800;
}

/* ==========================================================================
   بطاقات المؤشرات غير التقليدية ثلاثية الأبعاد (Non-Traditional 3D KPI Pods)
   ========================================================================== */
.workspace-container {
  max-width: 1440px;
  margin: 24px auto;
  padding: 0 28px 70px;
}

#tab-content-area {
  animation: fadeSlideUp 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 22px 24px;
  border: 0;
  box-shadow: 0 2px 6px rgba(6, 21, 51, 0.04), 0 20px 44px -24px rgba(6, 21, 51, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  overflow: hidden;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 6px;
  background: linear-gradient(90deg, #061533, #124296, #06b6d4);
}


.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3d);
}

.kpi-card.gold::before {
  background: linear-gradient(90deg, #92400e, #f59e0b, #fde047);
}
.kpi-card.blue::before {
  background: linear-gradient(90deg, #0c4a6e, #0284c7, #38bdf8);
}
.kpi-card.purple::before {
  background: linear-gradient(90deg, #064e3b, #059669, #34d399);
}

.kpi-card .ni-tile { width: 54px; height: 54px; z-index: 1; }

.kpi-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 800;
}

.kpi-value {
  font-size: 27px;
  font-weight: 900;
  color: var(--text-primary);
  margin: 3px 0;
}

.kpi-sub {
  font-size: 12px;
  color: var(--moe-emerald);
  font-weight: 800;
}

/* ==========================================================================
   البطاقات المعمارية غير التقليدية للأقسام
   ========================================================================== */
.card {
position: relative;
  background: var(--bg-card);
  border-radius: 26px;
  border: 0;
  padding: 26px 28px;
  margin-bottom: 26px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 2px 6px rgba(6, 21, 51, 0.04), 0 22px 48px -24px rgba(6, 21, 51, 0.22);
  transition: box-shadow 0.3s ease;
  animation: fadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  isolation: isolate;
}

.card::before {
content: '';
  position: absolute;
  inset: 0 0 auto auto;
  width: 340px;
  height: 220px;
  background: radial-gradient(closest-side, rgba(2, 132, 199, 0.09), transparent);
  transform: translate(30%, -45%);
  pointer-events: none;
  z-index: -1;
}

.card:hover {
box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 2px 6px rgba(6, 21, 51, 0.05), 0 30px 60px -26px rgba(6, 21, 51, 0.3);
}

.card-header {
display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 0 18px;
  margin: 0 0 22px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-image: linear-gradient(to left, var(--border-accent), transparent) 1;
}

.card-title {
  font-size: 18.5px;
  font-weight: 900;
  color: var(--moe-emerald-dark);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon-jewel {
  width: 46px;
  height: 46px;
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  background: linear-gradient(135deg, #061533 0%, #124296 55%, #0284c7 100%);
  color: #fef08a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 600;
}

/* ==========================================================================
   بطاقات الهوية المهنية للمعلمين (VIP Vertical Academic Shield Cards)
   ========================================================================== */
.teacher-pro-card {
  position: relative;
  border-radius: 28px 8px 28px 18px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  padding: 0 0 18px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.teacher-pro-card:hover {
  transform: translateY(-7px);
  box-shadow: var(--shadow-3d);
}

.teacher-pro-card.active {
  border: 2.5px solid var(--moe-gold-vivid);
}

.teacher-canopy {
  padding: 18px 20px 24px;
  color: #ffffff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teacher-canopy.subj-math {
  background: linear-gradient(135deg, #061533 0%, #124296 55%, #0284c7 100%);
}
.teacher-canopy.subj-arabic {
  background: linear-gradient(135deg, #451a03 0%, #92400e 55%, #d97706 100%);
}
.teacher-canopy.subj-science {
  background: linear-gradient(135deg, #042f20 0%, #0b6e4f 55%, #10b981 100%);
}
.teacher-canopy.subj-english {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 55%, #6366f1 100%);
}
.teacher-canopy.subj-all {
  background: linear-gradient(135deg, #040d21 0%, #0f387d 50%, #d97706 100%);
}

.teacher-avatar-ring {
  width: 64px;
  height: 64px;
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.teacher-card-body {
  padding: 4px 20px 0;
}

/* ==========================================================================
   النماذج والحقول والأزرار الرسمية
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
}

.form-control {
  padding: 10px 14px;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  background: var(--bg-card-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--takamul-cyan-vivid);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 13px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
  background: linear-gradient(135deg, #061533 0%, #124296 55%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(18, 66, 150, 0.32);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(18, 66, 150, 0.45);
}

.btn-gold {
  background: linear-gradient(135deg, #92400e 0%, #d97706 50%, #f59e0b 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.32);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(217, 119, 6, 0.45);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--takamul-cyan-vivid);
  color: var(--moe-emerald);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-sm {
padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 11px;
  white-space: nowrap;
}

/* الشارات */
.badge {
display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-nafes {
  background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
  color: #854d0e;
  border: 1px solid #facc15;
}

.badge-skill {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #075985;
  border: 1px solid #7dd3fc;
}

.badge-sim {
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  color: #6b21a8;
  border: 1px solid #c084fc;
}

.badge-dok {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-critical {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: var(--danger);
  border: 1px solid #fca5a5;
}

.badge-proficient {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: var(--success);
  border: 1px solid #6ee7b7;
}

.badge-developing {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: var(--warning);
  border: 1px solid #fcd34d;
}

/* الجداول وبطاقات الأسئلة */
.table-responsive {
overflow-x: auto;
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: 0 0 0 1px var(--border-color), 0 12px 30px -20px rgba(6, 21, 51, 0.25);
}

.data-table {
width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.data-table th {
background: linear-gradient(135deg, #061533 0%, #0f387d 100%);
  color: #fef08a;
  font-weight: 800;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  padding: 13px 14px;
}

.data-table td {
padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}

.data-table tr:hover td {
background: var(--moe-emerald-light);
}

.question-item-card {
position: relative;
  border: 0;
  border-radius: 22px;
  padding: 20px 22px 18px;
  margin-bottom: 16px;
  background: var(--bg-card);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 14px 34px -22px rgba(6, 21, 51, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
  isolation: isolate;
}

.question-item-card:hover {
transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 22px 44px -22px rgba(6, 21, 51, 0.45);
}

.question-item-card.simulated {
background: linear-gradient(160deg, rgba(245, 158, 11, 0.07), transparent 40%), var(--bg-card);
}

.q-meta-bar {
display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.q-stem-text {
font-size: 17px;
  font-weight: 800;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.q-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.q-option-pill {
position: relative;
  padding: 10px 12px;
  border-radius: 14px;
  border: 0;
  background: var(--bg-card-secondary);
  box-shadow: inset 0 0 0 1px var(--border-color);
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-option-pill.correct {
background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  box-shadow: inset 0 0 0 1.5px #34d399, 0 8px 18px -12px rgba(16, 185, 129, 0.8);
  color: #065f46;
  font-weight: 900;
}

.q-remediation-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  border-radius: 16px 4px 16px 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  font-weight: 700;
}

.skill-progress-row {
  margin-bottom: 16px;
  padding: 18px;
  border: 1.5px solid var(--border-color);
  border-radius: 22px 6px 22px 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.progress-track {
  width: 100%;
  height: 11px;
  background: #cbd5e1;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  animation: growProgress 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* بوابة تكامل مدرستي الرقمية */
.madrasati-share-panel {
  background: linear-gradient(135deg, #040d21 0%, #0a1f4e 45%, #0f387d 100%);
  color: #ffffff;
  border-radius: 32px 8px 32px 20px;
  border: 2.5px solid var(--moe-gold-vivid);
  padding: 24px 28px;
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 22px;
  align-items: center;
  box-shadow: 0 20px 46px -10px rgba(4, 13, 33, 0.45);
}

@media (max-width: 900px) {
  .madrasati-share-panel {
    grid-template-columns: 1fr;
  }
}

.qr-frame-card {
  background: #ffffff;
  color: #0f172a;
  border-radius: 24px 6px 24px 16px;
  padding: 16px;
  text-align: center;
  border: 2.5px solid var(--moe-gold-vivid);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.student-choice-btn {
  width: 100%;
  text-align: right;
  padding: 14px 18px;
  border-radius: 18px 5px 18px 12px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.student-choice-btn.selected {
  border-color: #124296;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #061533;
}

.student-choice-letter {
  width: 36px;
  height: 36px;
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  flex-shrink: 0;
}

.student-choice-btn.selected .student-choice-letter {
  background: linear-gradient(135deg, #061533 0%, #124296 100%);
  color: #fef08a;
}

/* ==========================================================================
   أوراق الطباعة الرسمية A4
   ========================================================================== */
.print-sheets-wrapper {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff !important;
  color: #000000 !important;
  padding: 12mm 14mm;
  border: 1px solid #94a3b8;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
  position: relative;
  box-sizing: border-box;
  border-radius: 4px;
}

.sheet-official-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  align-items: center;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.sheet-header-right p,
.sheet-header-left p {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.55;
}

.sheet-header-center {
  text-align: center;
}

.sheet-header-center .ministry-title {
  font-size: 14px;
  font-weight: 800;
}

.sheet-header-center .exam-main-badge {
  display: inline-block;
  border: 1.5px solid #000;
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
  background: #f1f5f9;
}

.student-barcode-strip {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  align-items: center;
}

.student-meta-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.student-meta-fields .full-row {
  grid-column: 1 / -1;
}

.barcode-box {
  text-align: center;
  border-right: 1.5px dashed #000;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.printed-question-block {
  border-bottom: 1px solid #cbd5e1;
  padding: 9px 4px;
  page-break-inside: avoid;
}

.pq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.pq-num {
  font-weight: 800;
  font-size: 14.5px;
  background: #e2e8f0;
  padding: 2px 9px;
  border-radius: 5px;
  border: 1px solid #000;
}

.pq-skill-tag {
  font-size: 11px;
  color: #334155;
  font-weight: 600;
  border: 1px solid #94a3b8;
  padding: 1px 7px;
  border-radius: 4px;
}

.pq-stem {
  font-size: 14.5px;
  font-weight: 700;
  margin: 5px 0 8px;
}

.pq-options-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pq-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.pq-letter-circle {
  width: 22px;
  height: 22px;
  border: 1.5px solid #000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.omr-fiducial {
  width: 18px;
  height: 18px;
  background: #000;
  position: absolute;
}

.omr-fiducial.tl { top: 8mm; left: 8mm; }
.omr-fiducial.tr { top: 8mm; right: 8mm; }
.omr-fiducial.bl { bottom: 8mm; left: 8mm; }
.omr-fiducial.br { bottom: 8mm; right: 8mm; }

.omr-instructions-box {
  border: 1.5px solid #000;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.omr-bubbles-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 14px;
}

.omr-column-table {
  width: 100%;
  border-collapse: collapse;
}

.omr-column-table th {
  font-size: 12px;
  padding: 6px;
  border-bottom: 1.5px solid #000;
  text-align: center;
}

.omr-column-table td {
  padding: 7px 4px;
  border-bottom: 1px dashed #cbd5e1;
  text-align: center;
}

.omr-q-num {
  font-weight: 800;
  font-size: 13.5px;
  background: #f1f5f9;
  border-left: 1.5px solid #000;
  width: 38px;
}

.omr-bubble {
  width: 25px;
  height: 25px;
  border: 1.8px solid #000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  margin: 0 auto;
  cursor: pointer;
  user-select: none;
}

.omr-bubble.filled {
  background: #000 !important;
  color: #fff !important;
}

.omr-skill-hint {
  font-size: 10.5px;
  color: #334155;
  text-align: right;
  padding-right: 6px !important;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 13, 33, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeSlideUp 0.28s ease;
}

.auth-modal-card {
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 560px;
  border-radius: 30px 8px 30px 18px;
  border: 2.5px solid var(--moe-gold-vivid);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.auth-modal-header {
  background: linear-gradient(135deg, #040d21 0%, #0a1f4e 50%, #0f387d 100%);
  color: #fff;
  padding: 22px 26px;
  text-align: center;
  border-bottom: 3px solid var(--moe-gold-vivid);
}

.auth-modal-body {
  padding: 24px 26px;
}

@keyframes laserSweep {
  0% { top: 4%; opacity: 0.9; }
  50% { top: 92%; opacity: 1; }
  100% { top: 4%; opacity: 0.9; }
}

.omr-scanner-studio {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .omr-scanner-studio {
    grid-template-columns: 1fr;
  }
}

.scanner-viewport {
  background: #060e20;
  border: 3px solid #38bdf8;
  border-radius: 24px 6px 24px 16px;
  min-height: 360px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: #e2e8f0;
}

.laser-scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent 0%, #06b6d4 20%, #38bdf8 50%, #06b6d4 80%, transparent 100%);
  box-shadow: 0 0 18px 4px rgba(56, 189, 248, 0.85);
  z-index: 10;
  pointer-events: none;
  animation: laserSweep 2.4s ease-in-out infinite;
}

.fiducial-guide {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #38bdf8;
  border-style: solid;
  pointer-events: none;
}

.fiducial-guide.tl { top: 12px; left: 12px; border-width: 3px 0 0 3px; }
.fiducial-guide.tr { top: 12px; right: 12px; border-width: 3px 3px 0 0; }
.fiducial-guide.bl { bottom: 12px; left: 12px; border-width: 0 0 3px 3px; }
.fiducial-guide.br { bottom: 12px; right: 12px; border-width: 0 3px 3px 0; }

.report-mode-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: 20px 6px 20px 14px;
  margin-bottom: 20px;
}

.report-mode-btn {
  flex: 1;
  min-width: 200px;
  padding: 12px 18px;
  border: 2px solid transparent;
  border-radius: 16px 4px 16px 10px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.report-mode-btn.active {
  background: linear-gradient(135deg, #061533 0%, #0f387d 100%);
  color: #fef08a;
  border-color: var(--moe-gold-vivid);
  box-shadow: var(--shadow-sm);
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {
  html,
  body,
  body.dark-mode {
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .no-print,
  .app-header,
  .main-nav,
  #portal-root,
  #kpi-summary-bar,
  .auth-modal-overlay,
  #auth-modal-root,
  #student-portal-root,
  footer {
    display: none !important;
  }

  .workspace-container,
  #tab-content-area {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    animation: none !important;
    transform: none !important;
  }

  .print-sheets-wrapper {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .a4-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 194mm !important;
    min-height: auto !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: 1.5px solid #000000 !important;
    box-shadow: none !important;
    margin: 0 auto 8mm auto !important;
    padding: 10mm !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .a4-sheet:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
    margin-bottom: 0 !important;
  }

  .omr-scanner-studio {
    display: none !important;
  }

  .print-only-fallback {
    display: block !important;
  }
}

/* ==========================================================================
   مكونات الصفحات (الإصدار ٧): رؤوس الأقسام، المشاركة، البطاقات، النماذج
   ========================================================================== */
body.theme-girls {
  --moe-emerald-dark: #6b1d55;
  --moe-emerald: #9d2a7a;
  --moe-emerald-light: #fce7f3;
  --border-accent: rgba(157, 42, 122, 0.22);
}
body.theme-girls.dark-mode { --moe-emerald-dark: #f9a8d4; --moe-emerald: #f472b6; --moe-emerald-light: rgba(190, 24, 93, 0.22); }

.sec-head { display: flex; align-items: center; gap: 14px; }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-subtitle strong { color: var(--moe-emerald-dark); }
.form-tinted { background: var(--bg-card-secondary); padding: 14px; border-radius: 14px; margin-bottom: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-end { justify-content: flex-end; }
.card-foot { display: flex; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-color); }
.card-draft { border: 2px solid var(--moe-emerald); }
.builder-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.q-meta-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge-bank { background: #f1f5f9; color: #334155; }
.pill-ok { margin-inline-start: auto; color: #059669; display: inline-flex; }
.btn-light { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.32); text-decoration: none; }
.btn-light:hover { background: rgba(255,255,255,0.26); }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 8px; }
.btn.is-busy { opacity: 0.6; pointer-events: none; }
.btn.wide { width: 100%; }
.empty-note { color: var(--text-muted); padding: 18px; text-align: center; border: 1.5px dashed var(--border-color); border-radius: 14px; }

/* لوحة رابط الاختبار للطلاب */
.share-panel {
  display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center;
  background: linear-gradient(135deg, #061533 0%, #0b2559 50%, #0e5a8a 100%);
  color: #fff; border-radius: 26px; padding: 22px 24px; margin-bottom: 24px;
  border: 0;
  box-shadow: 0 20px 40px -14px rgba(4, 13, 33, 0.5);
}
body.theme-girls .share-panel { background: linear-gradient(135deg, #2e0b2b 0%, #5b1747 55%, #8a2a6a 100%); }
.share-title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.share-title h3 { font-size: 19px; font-weight: 900; color: #fef08a; }
.share-title p { font-size: 13.5px; color: #dbeafe; }
.share-panel .form-group label { color: #fde68a; }
.share-link { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.18); border-radius: 12px; padding: 8px 10px; margin: 10px 0; }
.share-link code { flex: 1; font-size: 13px; word-break: break-all; color: #fff; }
.share-link.small { background: var(--bg-card-secondary); border-color: var(--border-color); margin: 4px 0 0; padding: 5px 8px; }
.share-link.small code { color: var(--text-secondary); font-size: 12px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-frame-card .qr-svg { display: block; border-radius: 8px; }
.qr-caption { font-size: 12px; font-weight: 800; color: #0b2559; margin-top: 6px; }

/* لافتة المدرسة / الأدمن */
.portal-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, #061533 0%, #0f387d 100%); color: #fff;
  border-radius: 26px; padding: 20px 24px; margin-bottom: 22px;
  box-shadow: inset 0 -3px 0 var(--moe-gold-vivid);
}
body.theme-girls .portal-banner { background: linear-gradient(135deg, #3b0d35 0%, #8a2a6a 100%); }
.portal-banner.admin { background: linear-gradient(135deg, #1c1204 0%, #6b3a05 55%, #b45309 100%); }
.pb-text { display: flex; align-items: center; gap: 14px; }
.pb-text h2 { font-size: 21px; font-weight: 900; }
.pb-text p { font-size: 13.5px; color: #dbeafe; }
.pb-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgba(0,0,0,0.25); padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.pb-link span { color: #fde68a; font-weight: 800; }

/* بطاقات المعلمين والمدارس */
.person-grid, .school-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-bottom: 18px; }
.person-card, .school-card {
  background: var(--bg-card); border: 0; border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 16px 36px -24px rgba(6, 21, 51, 0.4);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
}
.person-card:hover, .school-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.school-card.current { box-shadow: 0 0 0 2px var(--moe-gold-vivid), 0 16px 36px -24px rgba(6, 21, 51, 0.4); }
.person-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: #fff; background: linear-gradient(135deg, #0b2559, #124296); }
.person-top.subj-arabic { background: linear-gradient(135deg, #064e3b, #059669); }
.person-top.subj-science { background: linear-gradient(135deg, #0c4a6e, #0891b2); }
.person-top.subj-english { background: linear-gradient(135deg, #4c1d95, #7c3aed); }
.person-top.subj-all { background: linear-gradient(135deg, #78350f, #d97706); }
.person-avatar { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.person-avatar svg { width: 44px; height: 44px; }
.person-name, .school-name { font-weight: 900; font-size: 15.5px; }
.person-sub { font-size: 12.5px; opacity: 0.85; }
.school-card-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.school-meta { font-size: 12.5px; color: var(--text-muted); }
.person-rows { padding: 10px 16px; display: grid; gap: 7px; font-size: 13px; flex: 1; }
.person-rows > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.person-rows code { font-size: 12px; }
.person-actions { display: flex; gap: 8px; padding: 0 16px 14px; }
.person-actions .btn { flex: 1; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.status-chip.ok { background: var(--success-bg); color: var(--success); }
.status-chip.wait { background: var(--warning-bg); color: var(--warning); }
.roster-chip { background: var(--bg-card-secondary); border: 1px solid var(--border-color); padding: 1px 9px; border-radius: 8px; font-weight: 800; }
.split-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.mini-form { background: var(--bg-card-secondary); border: 0; border-radius: 18px; padding: 16px; display: grid; gap: 10px; }
.mini-form.gold { background: var(--warning-bg); }
.mini-form.dashed { margin: 6px 0 16px; background: linear-gradient(135deg, var(--moe-emerald-light), transparent 70%); }
.mini-title { font-weight: 900; font-size: 14px; color: var(--moe-emerald-dark); display: flex; align-items: center; gap: 6px; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-control.slim { width: auto; min-width: 200px; }
body.dark-mode .mini-form.gold { background: rgba(245, 158, 11, 0.1); }

/* إشعار قصير */
.nafes-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); opacity: 0;
  background: #0b2559; color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 800; z-index: 9999;
  transition: all .3s ease; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.nafes-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* التذييل */
.site-footer { background: #061533; color: #e2e8f0; border-top: 3px solid var(--moe-gold-vivid); margin-top: 40px; }
.sf-inner { max-width: 1440px; margin: 0 auto; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sf-brand { display: flex; align-items: center; gap: 12px; }
.sf-title { font-weight: 900; font-size: 14.5px; color: #fff; }
.sf-credit { font-size: 13px; color: #fde68a; font-weight: 700; }
.sf-operator { display: inline-flex; align-items: center; gap: 10px; color: #bae6fd; font-weight: 800; text-decoration: none; font-size: 13.5px; }
.sf-operator:hover { color: #fff; }

/* ==========================================================================
   الصفحات العامة: الرئيسية، بوابة المدرسة، الأدمن، شاشة الطالب
   ========================================================================== */
#portal-root[hidden], #app-shell[hidden], [data-roles][hidden], .kpi-grid[hidden] { display: none !important; }
.portal-page { min-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.portal-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
.portal-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-primary); }
.portal-brand b { display: block; font-size: 19px; font-weight: 900; color: var(--takamul-navy); }
body.dark-mode .portal-brand b { color: #fff; }
.portal-brand small { font-size: 12.5px; color: var(--text-muted); font-weight: 700; }
.portal-link { display: inline-flex; align-items: center; gap: 6px; color: var(--moe-emerald); font-weight: 800; text-decoration: none; font-size: 14px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border-accent); background: var(--bg-card); }
.portal-link:hover { background: var(--moe-emerald-light); }
.portal-main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 10px 32px 40px; }

.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 34px 0 30px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 6px; background: var(--moe-emerald-light); color: var(--moe-emerald-dark); font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 99px; }
.hero h1 { font-size: 40px; line-height: 1.35; font-weight: 900; margin: 14px 0 12px; color: var(--takamul-navy); }
body.dark-mode .hero h1 { color: #fff; }
.hero-text p { font-size: 16.5px; color: var(--text-secondary); max-width: 560px; }
.find-school { margin-top: 24px; background: var(--bg-card); border: 0; border-radius: 22px; padding: 16px; box-shadow: var(--shadow-md); max-width: 520px; }
.find-school label { font-weight: 900; font-size: 14px; color: var(--moe-emerald-dark); display: block; margin-bottom: 8px; }
.find-row { display: flex; gap: 10px; }
.find-row input { flex: 1; font: inherit; font-size: 17px; font-weight: 800; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--border-color); background: var(--bg-card-secondary); color: var(--text-primary); letter-spacing: 1px; }
.find-row input:focus { outline: none; border-color: var(--moe-emerald); }

.hero-art { position: relative; height: 330px; }
.art-sheet { position: absolute; inset: 10px 40px 40px 70px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-3d); padding: 34px 30px; display: grid; gap: 18px; transform: rotate(-4deg); border: 1px solid #e2e8f0; overflow: hidden; }
.art-row { display: flex; gap: 16px; }
.art-row i { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #94a3b8; }
.art-row i.on { background: #0b2559; border-color: #0b2559; }
.art-scan { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, #06b6d4, transparent); box-shadow: 0 0 14px #06b6d4; animation: scanMove 2.8s ease-in-out infinite; }
@keyframes scanMove { 0%, 100% { top: 12%; } 50% { top: 88%; } }
.art-chart { position: absolute; left: 0; bottom: 0; width: 170px; height: 140px; background: linear-gradient(145deg, #0b2559, #124296); border-radius: 18px 18px 18px 6px; padding: 18px; display: flex; align-items: flex-end; gap: 10px; box-shadow: var(--shadow-3d); transform: rotate(3deg); }
.art-chart span { flex: 1; background: linear-gradient(180deg, #fde047, #f59e0b); border-radius: 6px 6px 2px 2px; }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 10px; }
.step-card { position: relative; background: var(--bg-card); border: 0; border-radius: 22px; padding: 18px 16px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 16px 34px -24px rgba(6, 21, 51, 0.4); transition: transform .25s; }
.step-card:hover { transform: translateY(-4px); }
.step-card h3 { font-size: 15.5px; font-weight: 900; margin: 10px 0 4px; }
.step-card p { font-size: 13px; color: var(--text-muted); }
.step-n { position: absolute; top: 12px; left: 14px; font-weight: 900; color: var(--border-color); font-size: 22px; }

.school-hero { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-radius: 26px; color: #fff; background: linear-gradient(135deg, #061533 0%, #0f387d 100%); box-shadow: inset 0 -3px 0 var(--moe-gold-vivid); margin: 8px 0 22px; }
.school-hero.girls { background: linear-gradient(135deg, #3b0d35 0%, #8a2a6a 100%); }
.school-hero h1 { font-size: 26px; font-weight: 900; }
.school-hero p { color: #dbeafe; font-weight: 700; }
.school-hero .ni-tile { width: 62px; height: 62px; }

.auth-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.auth-card { background: var(--bg-card); border: 0; border-radius: 26px; padding: 24px; box-shadow: var(--shadow-md); }
.auth-card.narrow { max-width: 460px; margin: 30px auto; text-align: start; }
.auth-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-head h2 { font-size: 19px; font-weight: 900; color: var(--moe-emerald-dark); }
.auth-head p { font-size: 13px; color: var(--text-muted); }
.auth-card form { display: grid; gap: 12px; }
.auth-card label { display: grid; gap: 5px; font-size: 13.5px; font-weight: 800; color: var(--text-secondary); }
.auth-card input { font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--border-color); background: var(--bg-card-secondary); color: var(--text-primary); }
.auth-card input:focus { outline: none; border-color: var(--moe-emerald); box-shadow: 0 0 0 3px var(--moe-emerald-light); }
.form-error { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; font-weight: 700; }
.portal-note { text-align: center; color: var(--text-muted); margin-top: 18px; font-size: 13.5px; display: flex; align-items: center; justify-content: center; gap: 6px; }

.exam-facts { display: flex; gap: 14px; margin-bottom: 14px; font-weight: 800; color: var(--text-secondary); }
.test-shell { max-width: 760px; margin: 10px auto; }
.test-progress { height: 8px; border-radius: 99px; background: var(--border-color); overflow: hidden; }
.test-progress span { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #f59e0b); transition: width .3s; }
.test-dots { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.test-dots .dot { width: 32px; height: 32px; border-radius: 10px; border: 1.5px solid var(--border-color); background: var(--bg-card); font: inherit; font-weight: 800; color: var(--text-muted); cursor: pointer; }
.test-dots .dot.done { background: var(--moe-emerald-light); color: var(--moe-emerald-dark); border-color: var(--moe-emerald); }
.test-dots .dot.now { outline: 3px solid var(--moe-gold-vivid); }
.test-card { background: var(--bg-card); border-radius: 26px; padding: 24px; box-shadow: var(--shadow-md); border: 0; }
.test-meta { color: var(--text-muted); font-weight: 800; font-size: 13px; }
.test-stem { font-size: 20px; font-weight: 800; margin: 12px 0 18px; line-height: 1.8; }
.test-options { display: grid; gap: 10px; }
.test-opt { display: flex; align-items: center; gap: 12px; text-align: start; font: inherit; font-size: 16.5px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--border-color); background: var(--bg-card-secondary); color: var(--text-primary); cursor: pointer; transition: border-color .15s, background .15s; }
.test-opt b { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-card); border: 2px solid var(--border-color); flex-shrink: 0; }
.test-opt:hover { border-color: var(--moe-emerald); }
.test-opt.picked { border-color: var(--moe-emerald); background: var(--moe-emerald-light); }
.test-opt.picked b { background: var(--moe-emerald); color: #fff; border-color: var(--moe-emerald); }
.test-nav { display: flex; justify-content: space-between; margin-top: 18px; }

.result-card { max-width: 680px; margin: 20px auto; text-align: center; }
.result-card h2 { font-size: 24px; font-weight: 900; margin-top: 12px; }
.result-ring { --p: 0; --c: #10b981; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border-color) 0); }
.result-ring.mid { --c: #f59e0b; }
.result-ring.low { --c: #ef4444; }
.result-ring span { width: 118px; height: 118px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 900; }
.result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: start; margin-top: 18px; }
.result-cols h3 { font-size: 15px; font-weight: 900; display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.result-cols ul { list-style: none; display: grid; gap: 6px; }
.result-cols li { background: var(--bg-card-secondary); border-radius: 10px; padding: 6px 10px; font-size: 13.5px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .hero h1 { font-size: 30px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .auth-pair, .result-cols, .share-panel, .form-grid.two { grid-template-columns: 1fr; }
  .portal-top, .portal-main { padding-inline: 16px; }
  .app-header { padding: 10px 14px; }
  .ah-user { display: none; }
  .nav-tab .tab-text { font-size: 13px; }
}
.person-actions .btn { white-space: nowrap; padding: 8px 10px; font-size: 13px; }

/* ==========================================================================
   الجداول والبطاقات (الإصدار ٧.٦): سطر واحد، عناوين بالوسط، بطاقات بلا إطارات
   ========================================================================== */
.btn, .status-chip, .roster-chip, .nav-badge { white-space: nowrap; }
.data-table th.start, .data-table td.start { text-align: start; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table thead th:first-child { border-start-start-radius: 18px; }
.data-table thead th:last-child { border-start-end-radius: 18px; }
body.theme-girls .data-table th { background: linear-gradient(135deg, #3b0d35 0%, #8a2a6a 100%); }
.rank-dot { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 900; background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); }
.grades-table tbody tr:nth-child(1) .rank-dot { background: linear-gradient(145deg, #fde047, #f59e0b); color: #78350f; box-shadow: none; }
.grades-table tbody tr:nth-child(2) .rank-dot { background: linear-gradient(145deg, #e2e8f0, #94a3b8); color: #1e293b; box-shadow: none; }
.grades-table tbody tr:nth-child(3) .rank-dot { background: linear-gradient(145deg, #fed7aa, #c2410c); color: #fff; box-shadow: none; }
.meter { display: inline-block; vertical-align: middle; width: 86px; height: 8px; border-radius: 99px; background: var(--border-color); overflow: hidden; margin-inline-end: 8px; }
.meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #10b981, #34d399); }
.meter.mid span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.meter.low span { background: linear-gradient(90deg, #ef4444, #f87171); }
.meter-val { font-weight: 900; color: var(--text-primary); }
.count-chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; padding: 3px 11px; border-radius: 99px; }
.count-chip.ok { background: var(--success-bg); color: var(--success); }
.count-chip.bad { background: var(--danger-bg); color: var(--danger); }
.level-chip { display: inline-block; font-weight: 800; font-size: 12.5px; padding: 4px 12px; border-radius: 99px; }
.level-chip.good { background: var(--success-bg); color: var(--success); }
.level-chip.mid { background: var(--warning-bg); color: var(--warning); }
.level-chip.low { background: var(--danger-bg); color: var(--danger); }
.btn-soft { background: var(--moe-emerald-light); color: var(--moe-emerald-dark); border-color: transparent; }
.btn-soft:hover { background: var(--moe-emerald); color: #fff; }

/* بطاقة السؤال: لون المادة يظهر كتوهج ناعم وشريط علوي رفيع بدل الإطار */
.question-item-card { --qc: #124296; }
.question-item-card.subj-arabic { --qc: #059669; }
.question-item-card.subj-science { --qc: #0891b2; }
.question-item-card.subj-english { --qc: #7c3aed; }
.question-item-card.simulated { --qc: #f59e0b; }
.question-item-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(to left, var(--qc), transparent 70%);
}
.question-item-card::after {
  content: ''; position: absolute; top: -80px; right: -60px; width: 220px; height: 160px; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--qc) 14%, transparent), transparent);
}
.q-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--qc) 10%, transparent); color: color-mix(in srgb, var(--qc) 80%, #0f172a); }
.q-chip.strong { background: var(--qc); color: #fff; }
.q-chip.soft { background: var(--bg-card-secondary); color: var(--text-secondary); }
body.dark-mode .q-chip { color: #e2e8f0; }
.q-source { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.opt-letter { width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; background: var(--bg-card); color: var(--qc); box-shadow: 0 2px 6px -2px rgba(15,23,42,0.25); }
.q-option-pill.correct .opt-letter { background: #10b981; color: #fff; }
.q-option-pill .pill-ok { margin-inline-start: auto; color: #059669; }
body.dark-mode .q-option-pill.correct { background: rgba(16, 185, 129, 0.16); color: #a7f3d0; }
.q-remediation-box { border: 0; border-radius: 14px; background: var(--warning-bg); }

/* نتيجة الطالب: المهارات المتقنة بالأخضر والتي تحتاج تدريباً بالأحمر */
.skill-col { --c: #059669; --c2: #10b981; --bg: #ecfdf5; border-radius: 20px; padding: 14px; background: linear-gradient(180deg, var(--bg), transparent 85%); }
.skill-col.gap { --c: #dc2626; --c2: #ef4444; --bg: #fef2f2; }
body.dark-mode .skill-col { --bg: rgba(16, 185, 129, 0.12); }
body.dark-mode .skill-col.gap { --bg: rgba(239, 68, 68, 0.12); }
.skill-col h3 { color: var(--c); font-size: 15.5px; font-weight: 900; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.skill-col .sc-icon { width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(145deg, var(--c2), var(--c)); box-shadow: 0 6px 14px -6px var(--c); }
.skill-col .sc-count { margin-inline-start: auto; min-width: 28px; height: 26px; padding: 0 8px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; background: var(--c); color: #fff; font-size: 13px; }
.skill-col ul { list-style: none; display: grid; gap: 7px; }
.result-cols .skill-col li { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; line-height: 1.7;
  background: var(--bg-card); color: color-mix(in srgb, var(--c) 70%, #0f172a); box-shadow: inset -3px 0 0 var(--c), 0 4px 12px -8px rgba(15, 23, 42, 0.35); }
.skill-col .sc-dot { width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; flex-shrink: 0; background: var(--c2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c2) 22%, transparent); }
.result-cols .skill-col li.empty { color: var(--text-muted); box-shadow: none; background: transparent; }
body.dark-mode .result-cols .skill-col li { color: color-mix(in srgb, var(--c2) 55%, #f1f5f9); }

/* مراجعة الأسئلة المستخرجة من الملفات */
.ingest-review { margin-top: 16px; padding: 18px; border-radius: 20px; background: linear-gradient(180deg, var(--moe-emerald-light), transparent 60%); box-shadow: 0 0 0 1px var(--border-accent); }
.ingest-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ingest-head strong { font-size: 15.5px; color: var(--moe-emerald-dark); display: flex; gap: 6px; align-items: center; }
.ingest-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.status-chip.bad { background: var(--danger-bg); color: var(--danger); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.ingest-list { max-height: 520px; overflow-y: auto; display: grid; gap: 10px; padding-inline-end: 4px; }
.ingest-item { display: flex; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--bg-card); box-shadow: 0 0 0 1px var(--border-color); opacity: 0.6; transition: opacity .2s, box-shadow .2s; }
.ingest-item.on { opacity: 1; box-shadow: 0 0 0 1.5px var(--moe-emerald), 0 10px 24px -18px rgba(6,21,51,.5); }
.ingest-check { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; color: var(--text-muted); cursor: pointer; }
.ingest-check input { width: 20px; height: 20px; accent-color: var(--moe-emerald); }
.ingest-body { flex: 1; min-width: 0; }
.ingest-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ingest-stem { font-weight: 800; margin-bottom: 8px; line-height: 1.8; }
.ingest-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.ingest-opt { display: flex; gap: 8px; align-items: center; text-align: start; font: inherit; font-size: 13.5px; padding: 7px 10px; border-radius: 11px; border: 0; cursor: pointer; background: var(--bg-card-secondary); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-color); }
.ingest-opt b { width: 24px; height: 24px; flex-shrink: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-card); font-size: 12px; }
.ingest-opt:hover { box-shadow: inset 0 0 0 1.5px var(--moe-emerald); }
.ingest-opt.correct { background: #ecfdf5; color: #065f46; box-shadow: inset 0 0 0 1.5px #10b981; font-weight: 800; }
.ingest-opt.correct b { background: #10b981; color: #fff; }
body.dark-mode .ingest-opt.correct { background: rgba(16,185,129,.16); color: #a7f3d0; }

/* قراءة أوراق الإجابة */
.omr-zone-wrap { margin: 10px 0; }
.omr-zone-wrap .omr-zone { width: 100%; height: auto; display: block; }
.bubble-tile.pending { border-radius: 10px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); font-size: 12.5px; }
.bubble-tile.pending.flag { background: var(--warning-bg); box-shadow: inset 0 0 0 1.5px #f59e0b; }
.bubble-tile .bt-state { font-weight: 800; color: var(--text-muted); }
.bubble-tile.flag .bt-state { color: #b45309; }
.bubble-tile .bt-skill { font-size: 11px; color: var(--text-secondary); }
.bubble-tile .bt-bubbles { display: flex; gap: 5px; flex-shrink: 0; }
.omr-bubble.hint { box-shadow: 0 0 0 2px #f59e0b; }
.batch-panel { margin-bottom: 18px; padding: 16px; border-radius: 20px; background: var(--bg-card); box-shadow: 0 0 0 1px var(--border-color), 0 14px 34px -24px rgba(6,21,51,.4); }
.batch-panel .mini-title { margin-bottom: 10px; }
@media print { .omr-zone-wrap .omr-zone { break-inside: avoid; } }

/* طي الأقسام */
.card-header { position: relative; }
.collapse-btn { width: 32px; height: 32px; border-radius: 10px; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--moe-emerald-dark); background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); transition: transform .25s ease, background .2s; flex-shrink: 0; }
.collapse-btn:hover { background: var(--moe-emerald-light); }
.card.collapsed .collapse-btn { transform: rotate(90deg); }
.card.collapsed > :not(.card-header) { display: none !important; }
.card.collapsed > .card-header { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button.portal-link { font: inherit; cursor: pointer; }
.install-btn { background: rgba(245, 158, 11, 0.25); border-color: rgba(253, 230, 138, 0.6); }

/* شاشات الجوال والآيباد */
@media (max-width: 1024px) {
  .workspace-container { padding: 0 16px 60px; }
  .card { padding: 20px 18px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .omr-scanner-studio { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .app-header { position: sticky; top: 0; z-index: 60; padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
  .ah-title { font-size: 15px; }
  .ah-school { font-size: 11.5px; }
  .ah-select { flex: 1 1 100%; }
  .ah-select select { max-width: none; width: 100%; }
  .ah-tools { width: 100%; justify-content: space-between; }
  .main-nav { top: 0; padding: 6px 8px; gap: 4px; }
  .nav-tab { padding: 6px 8px; font-size: 12.5px; }
  .nav-tab .tab-num { display: none; }
  .nav-tab .tab-icon { width: 28px; height: 28px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; border-radius: 18px; }
  .kpi-value { font-size: 21px; }
  .kpi-card .ni-tile { width: 40px; height: 40px; }
  .card { padding: 16px 14px; border-radius: 20px; }
  .card-header { gap: 10px; }
  .card-title { font-size: 16px; }
  .ni-tile { width: 40px; height: 40px; }
  .form-grid { grid-template-columns: 1fr !important; }
  .q-options-grid { grid-template-columns: 1fr 1fr; }
  .q-option-pill { white-space: normal; }
  .share-link code { font-size: 11px; }
  .portal-banner { padding: 16px; }
  .pb-text h2 { font-size: 17px; }
  .data-table th, .data-table td { padding: 9px 10px; font-size: 13px; }
  .person-grid, .school-grid { grid-template-columns: 1fr; }
  .test-stem { font-size: 18px; }
  .test-opt { font-size: 15.5px; }
  .sf-inner { padding: 14px 16px; }
  .a4-sheet { transform-origin: top right; }
}
@media (max-width: 640px) {
  .kpi-card { flex-direction: column-reverse; align-items: flex-start; gap: 8px; }
  .kpi-label { font-size: 12px; }
  .kpi-sub { font-size: 11px; }
  .test-shell { margin: 0; }
  .test-card { padding: 16px; }
  .test-dots .dot { width: 28px; height: 28px; }
  .portal-main { padding: 6px 12px 30px; }
  .auth-card { padding: 18px; }
  .school-hero h1 { font-size: 20px; }
  .hero h1 { font-size: 26px; }
  .steps { grid-template-columns: 1fr; }
}

/* الأوراق المطبوعة (A4): الجداول تلتف داخل الصفحة ولا تخرج منها */
.a4-sheet table { width: 100%; table-layout: fixed; }
.a4-sheet th, .a4-sheet td { white-space: normal !important; word-break: break-word; vertical-align: middle; }
.a4-sheet th { text-align: center; }
.a4-sheet .report-table td:nth-child(1), .a4-sheet .report-table td:nth-child(5) { text-align: center; }
.a4-sheet .report-table td:nth-child(2) { text-align: start; }
.student-barcode-strip { grid-template-columns: 1fr auto; }
.student-meta-fields { gap: 8px 18px; }
.student-meta-fields > div { line-height: 1.6; }
.roster-box { font-size: 16px; border: 2px solid #000; padding: 0 10px; border-radius: 6px; display: inline-block; }

/* بطاقات المدارس: إطار بلون القطاع، والذهبي للمدرسة المفتوحة */
.school-card.boys { box-shadow: 0 0 0 1.5px rgba(29, 78, 216, 0.45), 0 16px 36px -24px rgba(6, 21, 51, 0.4); }
.school-card.girls { box-shadow: 0 0 0 1.5px rgba(219, 39, 119, 0.5), 0 16px 36px -24px rgba(131, 24, 67, 0.4); }
.school-card.boys .school-card-top { background: linear-gradient(180deg, rgba(29, 78, 216, 0.06), transparent); }
.school-card.girls .school-card-top { background: linear-gradient(180deg, rgba(219, 39, 119, 0.07), transparent); }
.school-card.current { box-shadow: 0 0 0 2.5px var(--moe-gold-vivid), 0 16px 36px -24px rgba(6, 21, 51, 0.4); }
.open-chip { display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: var(--warning-bg); color: #b45309; }
.share-link.small code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; }

/* الترويسة الرسمية الهرمية في الأوراق المطبوعة */
.sheet-header-right .official-lines { text-align: center; line-height: 1.5; }
.sheet-header-right .official-lines p { margin: 0; font-size: 12px; font-weight: 700; }
.sheet-header-right .official-lines .ol-kingdom { font-size: 14px; font-weight: 900; }
.sheet-header-right .official-lines .ol-ministry { font-size: 13.5px; font-weight: 900; }
.sheet-header-right .official-lines .ol-school { font-size: 12.5px; font-weight: 800; }
.sheet-header-right .official-lines .ol-sub { font-size: 11px; font-weight: 700; color: #334155; }

/* الوضع الليلي: إطار ذهبي للبطاقات */
body.dark-mode .kpi-card,
body.dark-mode .card,
body.dark-mode .question-item-card,
body.dark-mode .person-card,
body.dark-mode .step-card,
body.dark-mode .auth-card,
body.dark-mode .test-card {
  box-shadow: 0 0 0 1.5px rgba(245, 158, 11, 0.6), 0 0 22px -6px rgba(245, 158, 11, 0.35), 0 20px 44px -24px rgba(0, 0, 0, 0.8);
}
body.dark-mode .kpi-card:hover,
body.dark-mode .card:hover { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.85), 0 0 28px -4px rgba(245, 158, 11, 0.45), 0 24px 50px -24px rgba(0, 0, 0, 0.85); }

/* بطاقات المستودع والصفوف في بنك الأسئلة (تتبع الوضع الليلي) */
.repo-tile { padding: 12px 14px; border-radius: 14px; background: var(--bg-card); box-shadow: 0 0 0 1px var(--border-color); color: var(--text-primary); }
.repo-tile.clickable { cursor: pointer; transition: box-shadow .2s, transform .2s; }
.repo-tile.clickable:hover { transform: translateY(-2px); }
.repo-tile.current { box-shadow: 0 0 0 2px var(--moe-emerald); background: var(--moe-emerald-light); }
body.dark-mode .repo-tile { background: var(--bg-card-secondary); box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35); }
body.dark-mode .repo-tile.current { box-shadow: 0 0 0 2px #f59e0b; background: rgba(245, 158, 11, 0.1); }

/* الوضع الليلي: إطار ذهبي واضح لكل البطاقات */
body.dark-mode .step-card,
body.dark-mode .school-card,
body.dark-mode .mini-form,
body.dark-mode .repo-tile,
body.dark-mode .ingest-item,
body.dark-mode .batch-panel,
body.dark-mode .find-school,
body.dark-mode .result-card,
body.dark-mode .exam-intro,
body.dark-mode .bubble-tile,
body.dark-mode .table-responsive,
body.dark-mode .person-card {
  box-shadow: 0 0 0 1.5px rgba(245, 158, 11, 0.6), 0 0 20px -6px rgba(245, 158, 11, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.8) !important;
}
body.dark-mode .school-card.current { box-shadow: 0 0 0 2.5px #fbbf24, 0 0 26px -4px rgba(245, 158, 11, 0.5) !important; }
body.dark-mode .step-card .step-n { color: rgba(245, 158, 11, 0.55); }

/* لا عنصر يوسّع الصفحة على الجوال: القوائم الطويلة والروابط تلتزم بعرض الشاشة */
select.form-control, .form-control { max-width: 100%; min-width: 0; }
.form-group { min-width: 0; }
.share-panel { grid-template-columns: minmax(0, 1fr) auto; }
.share-main, .share-panel > * { min-width: 0; }
.share-link code { word-break: break-all; }
@media (max-width: 900px) { .share-panel { grid-template-columns: minmax(0, 1fr); } }
/* معاينة ورقة A4 على الجوال: تصغير للعرض فقط، والطباعة بالمقاس الكامل */
@media screen and (max-width: 640px) {
  .print-sheets-wrapper { max-width: 100%; overflow: hidden; }
  .a4-sheet { zoom: 0.44; }
}
@media screen and (min-width: 641px) and (max-width: 900px) {
  .a4-sheet { zoom: 0.8; }
}

/* ===== لوحة التحسّن وبطاقة متابعة الطالب (تحدي نافس) ===== */
.pg-hero { display: flex; gap: 20px; align-items: center; padding: 22px 24px; margin-bottom: 18px; border-radius: 22px; color: #fff;
  background: linear-gradient(120deg, #0b2559 0%, #123a7a 55%, #f28c3a 140%); box-shadow: var(--shadow-md); }
.pg-hero-logo { width: 104px; height: 104px; border-radius: 22px; flex-shrink: 0; box-shadow: 0 10px 26px rgba(0,0,0,.25); }
.pg-hero h2 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.pg-hero p { margin: 0 0 12px; opacity: .9; line-height: 1.8; }
.pg-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pg-steps span { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.14); font-weight: 800; font-size: 13px; }
.pg-steps i { width: 18px; height: 2px; background: #f9a35a; border-radius: 2px; }
.pg-filters .top-actions { margin-top: 6px; }
.pg-kpis { margin-bottom: 18px; }
.pg-subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 18px; }
.pg-subject { background: var(--bg-card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-accent); border-top: 4px solid #f28c3a; }
.pg-subject-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pg-subject-head h4 { margin: 0; font-size: 16px; font-weight: 900; flex: 1; }
.pg-subject-body { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.pg-donut { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-primary); }
.pg-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; font-size: 12px; }
.pg-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; }
.pg-bars-title { font-size: 12px; font-weight: 800; color: var(--text-muted); margin-bottom: 8px; }
.pg-bar { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 44px; gap: 8px; align-items: center; margin-bottom: 7px; font-size: 12.5px; }
.pg-bar-name { color: var(--text-secondary); font-weight: 700; }
.pg-bar-track { height: 10px; border-radius: 99px; background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); overflow: hidden; }
.pg-bar-track i { display: block; height: 100%; border-radius: 99px; }
.pg-muted { color: var(--text-muted); font-size: 12px; }
.pg-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; color: var(--c); background: var(--s); box-shadow: inset 0 0 0 1px var(--c); }
.pg-change { font-weight: 900; font-size: 13px; }
.pg-change.up { color: #059669; } .pg-change.down { color: #dc2626; }
/* بطاقات الطلاب في اللوحة */
.pg-legend-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pg-legend-bar span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--s); color: var(--c); font-weight: 800; font-size: 12.5px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.pg-legend-bar span i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.pg-legend-bar small { font-weight: 700; opacity: .8; }
.pg-legend-bar .pg-legend-note { background: none; box-shadow: none; color: var(--text-muted); font-weight: 600; }
.pg-students { display: grid; gap: 14px; }
.pg-st { position: relative; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); overflow: hidden; }
.pg-st::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: linear-gradient(180deg, var(--lc), color-mix(in srgb, var(--lc) 40%, #f28c3a)); }
.pg-st-head { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 14px 18px 12px 18px; padding-inline-start: 22px;
  background: linear-gradient(90deg, var(--ls) 0%, transparent 70%); border-bottom: 1px dashed var(--border-color); }
.pg-avatar { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #0b2559, #124296); box-shadow: 0 8px 18px -6px rgba(11,37,89,.55), inset 0 0 0 2px rgba(255,255,255,.25); }
.pg-st-id h4 { margin: 0 0 5px; font-size: 16.5px; font-weight: 900; color: var(--text-primary); }
.pg-st-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-st-meta span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-secondary); background: var(--bg-card-secondary); padding: 3px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--border-color); }
.pg-st-avg { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 86px; }
.pg-st-avg small { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.pg-st-avg b { font-size: 20px; font-weight: 900; color: var(--lc); line-height: 1; }
.pg-card-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; border: 0; cursor: pointer; padding: 9px 14px; border-radius: 14px; font: inherit; font-weight: 800; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, #f28c3a, #e0661b); box-shadow: 0 8px 18px -8px rgba(224,102,27,.8); transition: transform .15s ease, box-shadow .15s ease; }
.pg-card-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 22px -8px rgba(224,102,27,.9); }
.pg-sr-head, .pg-sr { display: grid; grid-template-columns: minmax(150px, 1.3fr) 150px 92px 150px minmax(150px, 1fr); gap: 12px; align-items: center; padding-inline: 22px 18px; }
.pg-sr-head { padding-block: 8px 4px; font-size: 11.5px; font-weight: 800; color: var(--text-muted); }
.pg-sr { padding-block: 9px; border-top: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent); transition: background .15s; }
.pg-sr:hover { background: var(--bg-card-secondary); }
.pg-sr-subj { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text-primary); font-size: 13.5px; }
.pg-sr-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--sc); background: var(--ss); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sc) 30%, transparent); flex-shrink: 0; }
.pg-sr-measure { display: flex; align-items: center; gap: 8px; }
.pg-m-first { min-width: 42px; text-align: center; padding: 4px 8px; border-radius: 10px; font-weight: 800; font-size: 12.5px; color: var(--text-secondary); background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); }
.pg-m-arrow { color: var(--text-muted); font-weight: 900; }
.pg-change { display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 900; font-size: 12.5px; }
.pg-change.up { color: #047857; background: #d1fae5; }
.pg-change.down { color: #b91c1c; background: #fee2e2; }
.pg-change.flat { color: var(--text-muted); background: var(--bg-card-secondary); font-weight: 700; }
.pg-path { color: var(--text-secondary); display: flex; align-items: center; }
.pg-path.one { flex-direction: column; align-items: flex-start; gap: 2px; }
.pg-path.one span { font-weight: 900; color: var(--c); }
.pg-path.one small { font-size: 10.5px; color: var(--text-muted); }
.pg-meter { display: flex; flex-direction: column; gap: 5px; }
.pg-meter-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; max-width: 150px; }
.pg-meter-steps i { height: 9px; border-radius: 99px; background: #e2e8f0; }
.pg-meter-steps i.on { background: var(--c); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
.pg-meter b { align-self: flex-start; font-size: 12px; font-weight: 900; color: var(--c); background: var(--s); padding: 2px 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
.pg-meter.compact { align-items: center; }
.pg-meter.compact .pg-meter-steps { width: 100%; max-width: 92px; }
.pg-meter.compact .pg-meter-steps i { height: 7px; }
.pg-meter.compact b { align-self: center; font-size: 10.5px; padding: 1px 8px; }
.pg-ring { display: block; flex-shrink: 0; }
.pc-table .pg-ring { margin: 0 auto 2px; }
.pc-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #0b2559 !important; color: #fff !important; font-weight: 900; font-size: 11px; }
body.dark-mode .pg-meter-steps i:not(.on) { background: #1e335c; }
@media (max-width: 1100px) {
  .pg-sr-head { display: none; }
  .pg-sr { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .pg-sr-subj { grid-column: 1 / -1; }
  .pg-st-head { grid-template-columns: auto 1fr auto; }
  .pg-card-btn { grid-column: 1 / -1; flex-direction: row; justify-content: center; }
}
@media print { .pg-meter-steps i.on, .pg-meter b { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.pg-empty { text-align: center; padding: 36px 20px; }
.pg-empty h3 { margin: 12px 0 6px; }
.pg-card-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pc-sheet { margin: 0 auto 18px; font-size: 11.5px; }
.pc-head { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; border-bottom: 3px solid #0b2559; padding-bottom: 8px; margin-bottom: 10px; }
.pc-head-side:last-child { text-align: left; }
.pc-head-mid { text-align: center; }
.pc-head-mid h2 { margin: 0; font-size: 19px; font-weight: 900; color: #0b2559; }
.pc-head-mid p { margin: 4px 0 0; color: #475569; }
.pc-logo { width: 64px; height: 64px; border-radius: 12px; }
.pc-info { display: grid; grid-template-columns: 2.2fr 1fr 1.6fr .8fr 1.6fr; gap: 6px; margin-bottom: 8px; }
.pc-info div { border: 1.2px solid #0b2559; border-radius: 8px; padding: 5px 8px; }
.pc-info span { display: block; font-size: 10px; color: #64748b; }
.pc-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-weight: 800; }
.pc-legend span { padding: 2px 9px; border-radius: 99px; border: 1.3px solid var(--c); color: var(--c); }
.pc-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pc-table th { background: #0b2559 !important; color: #fff !important; padding: 6px 4px; font-size: 11px; border: 1px solid #0b2559; }
.pc-table td { border: 1px solid #94a3b8; padding: 5px 5px; vertical-align: middle; text-align: center; }
.pc-table td.pc-subj { background: #fff7ed !important; font-weight: 900; color: #9a3412; }
.pc-table td.pc-skills, .pc-table td.pc-actions { text-align: start; line-height: 1.6; }
.pc-small { font-size: 9.5px; color: #64748b; }
.pc-write { height: 46px; }
.pc-foot { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; margin-top: 10px; }
.pc-box { border: 1.2px solid #cbd5e1; border-radius: 10px; padding: 6px 9px; }
.pc-box h5 { margin: 0 0 3px; font-size: 11.5px; color: #0b2559; }
.pc-box p { margin: 0; line-height: 1.7; font-size: 10.5px; }
.pc-parent { border-color: #f28c3a; background: #fff7ed !important; }
.pc-sign { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; font-weight: 800; }
.pc-sign-box { text-align: center; border: 1.2px solid #cbd5e1; border-radius: 10px; padding: 6px 8px 4px; }
.pc-sign-box span { display: block; font-size: 11.5px; color: #0b2559; font-weight: 900; }
.pc-sign-box b { display: block; min-height: 17px; margin-top: 3px; font-size: 11px; font-weight: 800; color: #111827; }
.pc-sign-box i { display: block; border-bottom: 1.3px dotted #0b2559; height: 20px; margin: 0 6px; }
.pc-sign-box small { display: block; font-size: 9.5px; color: #64748b; font-weight: 600; margin-top: 2px; }
@media (max-width: 760px) {
  .pg-hero { flex-direction: column; text-align: center; }
  .pg-steps { justify-content: center; }
  .pg-subjects { grid-template-columns: 1fr; }
  .pg-subject-body { grid-template-columns: 1fr; }
}
.pg-supervisor { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 7px 14px; border-radius: 14px;
  background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.pg-supervisor span { font-size: 12.5px; opacity: .85; font-weight: 700; }
.pg-supervisor b { font-size: 15px; font-weight: 900; color: #ffd2a8; }
.pg-supervisor small { width: 100%; font-size: 11.5px; opacity: .75; }
.pc-supervisor { margin-top: 3px !important; color: #9a3412 !important; font-size: 11.5px; }
/* شكل السؤال (أسئلة المكتبة المشتركة) */
.q-figure { margin: 8px 0 10px; display: flex; justify-content: center; }
.q-figure img { max-width: min(100%, 320px); max-height: 200px; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--border-color); padding: 4px; }
.q-figure.print img { max-height: 130px; border-radius: 4px; box-shadow: none; border: 1px solid #94a3b8; }
/* النص القرائي لأسئلة الفهم */
.q-passage { margin: 6px 0 10px; border-radius: 12px; background: var(--bg-card-secondary); box-shadow: inset 0 0 0 1px var(--border-color); }
.q-passage summary { cursor: pointer; padding: 8px 12px; font-weight: 800; font-size: 13px; color: var(--moe-emerald); display: flex; align-items: center; gap: 6px; }
.q-passage-text { padding: 2px 14px 12px; line-height: 2; font-size: 14.5px; color: var(--text-primary); max-height: 320px; overflow: auto; }
.pq-passage { border: 1.4px solid #0b2559; border-radius: 6px; padding: 8px 10px; margin: 6px 0 10px; line-height: 1.9; font-size: 12.5px; break-inside: avoid; }
.pq-passage strong { display: block; margin-bottom: 4px; color: #0b2559; }
/* ===== تقرير المتابعة كل أسبوعين ===== */
.pg-modes { display: flex; gap: 8px; margin: -6px 0 16px; flex-wrap: wrap; }
.pg-modes button { display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer; padding: 10px 18px; border-radius: 14px; font: inherit; font-weight: 800; font-size: 14px; color: var(--text-secondary); background: var(--bg-card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-color); }
.pg-modes button.on { color: #fff; background: linear-gradient(135deg, #0b2559, #124296); box-shadow: 0 10px 22px -10px rgba(11,37,89,.7); }
.fr-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap; border-top: 4px solid #f28c3a; }
.fr-title { display: flex; gap: 12px; align-items: center; }
.fr-title h3 { margin: 0 0 4px; font-size: 19px; font-weight: 900; }
.fr-title p { margin: 0; color: var(--text-muted); font-size: 13px; }
.fr-score { display: flex; gap: 14px; align-items: center; }
.fr-ring { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; text-align: center; align-content: center;
  background: radial-gradient(closest-side, var(--bg-card) 76%, transparent 78% 100%), conic-gradient(#f28c3a calc(var(--p) * 1%), var(--bg-card-secondary) 0); }
.fr-ring b { font-size: 19px; font-weight: 900; color: var(--text-primary); line-height: 1; }
.fr-ring small { font-size: 10.5px; color: var(--text-muted); }
.fr-mini { display: grid; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.pg-timeline { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 8px; }
.pg-tl { position: relative; flex: 0 0 auto; min-width: 150px; text-align: start; border: 0; cursor: pointer; padding: 10px 12px; border-radius: 14px; font: inherit; background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--border-color); display: grid; gap: 2px; color: var(--text-secondary); }
.pg-tl b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-card-secondary); font-size: 12px; color: var(--text-primary); }
.pg-tl span { font-weight: 800; font-size: 12.5px; color: var(--text-primary); }
.pg-tl small { font-size: 10.5px; color: var(--text-muted); }
.pg-tl i { position: absolute; top: 8px; inset-inline-end: 8px; color: #059669; }
.pg-tl.now { box-shadow: inset 0 0 0 2px #f28c3a; }
.pg-tl.on { background: linear-gradient(135deg, #0b2559, #124296); }
.pg-tl.on span, .pg-tl.on small, .pg-tl.on b { color: #fff; }
.pg-tl.on b { background: #f28c3a; }
.fr-evidence { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 14px; border-radius: 14px; background: var(--moe-emerald-light); color: var(--moe-emerald-dark); font-size: 13px; }
.fr-evidence span { background: var(--bg-card); padding: 3px 10px; border-radius: 99px; font-weight: 800; }
.fr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.fr-card { background: var(--bg-card); border-radius: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); overflow: hidden; }
.fr-card header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(90deg, var(--bg-card-secondary), transparent); border-bottom: 1px dashed var(--border-color); }
.fr-card h4 { margin: 0; flex: 1; font-size: 15px; font-weight: 900; }
.fr-no { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #0b2559; color: #fff; font-weight: 900; font-size: 12px; }
.fr-state { font-size: 11.5px; font-weight: 900; padding: 3px 10px; border-radius: 99px; background: var(--bg-card-secondary); color: var(--text-muted); }
.st-done .fr-state { background: #d1fae5; color: #047857; } .st-part .fr-state { background: #fff7ed; color: #c2410c; } .st-gap .fr-state { background: #fee2e2; color: #b91c1c; }
.fr-body { padding: 12px 14px 14px; display: grid; gap: 9px; }
.fr-line small, .fr-gap small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 800; }
.fr-line p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--text-primary); }
.fr-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
.fr-nums label, .fr-ev { display: grid; gap: 4px; font-size: 11.5px; font-weight: 800; color: var(--text-muted); }
.fr-nums input, .fr-ev input, .fr-ev textarea { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-card-secondary); color: var(--text-primary); }
.fr-gap { text-align: center; padding: 6px; border-radius: 10px; background: var(--bg-card-secondary); }
.fr-gap b { font-size: 18px; font-weight: 900; }
.fr-bar { height: 8px; border-radius: 99px; background: var(--bg-card-secondary); overflow: hidden; }
.fr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f28c3a, #059669); border-radius: 99px; }
.fr-actions { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.fr-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
.fr-table th { background: #6d28d9 !important; color: #fff !important; padding: 7px 5px; border: 1px solid #5b21b6; }
.fr-table td { border: 1px solid #94a3b8; padding: 6px 5px; text-align: center; vertical-align: middle; }
.fr-table td.t { text-align: start; line-height: 1.6; }
.fr-table tr:nth-child(even) td { background: #f5f3ff !important; }
.fr-table th:nth-child(1) { width: 4%; } .fr-table th:nth-child(2) { width: 14%; } .fr-table th:nth-child(3) { width: 20%; } .fr-table th:nth-child(4) { width: 32%; } .fr-table th:nth-child(5), .fr-table th:nth-child(6), .fr-table th:nth-child(7) { width: 10%; }
.fr-evline { font-size: 11px; margin: 8px 0 0; color: #334155; }
/* ===== مكتبة الأدلة التعليمية ===== */
.lib-panel { border-top: 4px solid #6d28d9; }
.lib-head { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; cursor: pointer; }
.lib-head h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.lib-head p { margin: 0; font-size: 13px; color: var(--text-muted); }
.lib-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-stats span { display: grid; text-align: center; padding: 6px 12px; border-radius: 12px; background: var(--bg-card-secondary); font-size: 11px; font-weight: 700; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border-color); }
.lib-stats b { font-size: 17px; font-weight: 900; color: var(--text-primary); }
.lib-panel.open .collapse-btn { transform: rotate(90deg); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; margin-top: 16px; }
.lib-card { border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); overflow: hidden; }
.lib-card header { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 12%, transparent), transparent); border-bottom: 1px dashed var(--border-color); }
.lib-card header div { flex: 1; }
.lib-card h4 { margin: 0; font-size: 14.5px; font-weight: 900; }
.lib-card header small { color: var(--text-muted); font-size: 11.5px; }
.lib-card header strong { display: grid; text-align: center; font-size: 22px; font-weight: 900; color: var(--tone); line-height: 1; }
.lib-card header strong small { font-size: 10.5px; font-weight: 700; }
.lib-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px 14px; }
.lib-cols h5 { margin: 0 0 6px; font-size: 11.5px; color: var(--text-muted); }
.lib-bar { display: grid; grid-template-columns: 1fr; gap: 2px; margin-bottom: 6px; font-size: 11.5px; }
.lib-bar span { color: var(--text-secondary); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-bar i { display: block; height: 7px; border-radius: 99px; background: var(--bg-card-secondary); overflow: hidden; }
.lib-bar i b { display: block; height: 100%; border-radius: 99px; background: var(--tone); }
.lib-bar em { font-style: normal; font-size: 10.5px; color: var(--text-muted); }
.lib-card footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border-color); }
.lib-src { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 800; color: var(--tone); text-decoration: none; }
.lib-note { margin: 14px 0 0; font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
@media (max-width: 760px) { .lib-head { grid-template-columns: auto 1fr; } .lib-stats { grid-column: 1 / -1; } .lib-cols { grid-template-columns: 1fr; } .lib-grid { grid-template-columns: 1fr; } }

/* electronic signature of the student card (v9.8) */
.sg-panel .card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sg-row { display: grid; grid-template-columns: 130px minmax(140px, 1fr) 150px auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid #e8ecf3; }
.sg-role { font-weight: 800; color: #0b2559; }
.sg-name { font: inherit; border: 1px solid #cfd6e3; border-radius: 10px; padding: 7px 10px; background: #fbfcfe; min-width: 0; }
.sg-name:disabled { background: #f3f5f9; color: #334155; }
.sg-state { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 4px 10px; text-align: center; }
.sg-state.ok { background: #e8f6ee; color: #15803d; }
.sg-state.wait { background: #fff7e6; color: #b45309; }
.sg-state.none { background: #f1f3f8; color: #64748b; }
.sg-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sg-thumb { height: 38px; max-width: 140px; object-fit: contain; border: 1px solid #e3e7ef; border-radius: 8px; background: #fff; }
.btn-wa { background: #e7f8ee; color: #128c4a; border-color: #bfe8cf; }
.btn-ghost { background: transparent; }
@media (max-width: 760px) { .sg-row { grid-template-columns: 1fr 1fr; } .sg-actions { grid-column: 1 / -1; } }
.pc-sign-box.is-signed { border-color: #0f8b8d; }
.pc-sig { display: block; height: 34px; max-width: 100%; margin: 0 auto; object-fit: contain; }
.pc-sign-box.is-signed small { color: #0f8b8d; }
.pc-sign-notes { margin-top: 8px; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 6px 10px; font-size: 11px; line-height: 1.7; }
/* semester switch in the two-week report (v9.9) */
.fr-sem { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 10px; border-radius: 14px; background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--border-color); }
.fr-sem button { border: 0; cursor: pointer; padding: 7px 16px; border-radius: 10px; font: inherit; font-weight: 800; font-size: 13px; color: var(--text-secondary); background: transparent; }
.fr-sem button.on { background: #0b2559; color: #fff; }
