/* ═══════════════════════════════════════════
   صفحة الترحيب (الرئيسية) — بطاقتان: إنشاء / المحفوظة
   تتبع نفس هوية الموقع (زجاجي + ألوان المستويات + Cairo)
   ═══════════════════════════════════════════ */
.home-screen {
  display: none; position: fixed; inset: 0; z-index: 280;
  padding: 24px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(245,240,231,0.62);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.home-screen.show { display: flex; }

.home-card {
  background: rgba(255,255,255,0.80);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 28px; padding: 40px 34px 30px;
  width: 100%; max-width: 640px; text-align: center; margin: auto;
  box-shadow: var(--sh-lg); position: relative; overflow: hidden;
  animation: cardIn 0.6s cubic-bezier(0.16,1,0.3,1);
}
.home-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--l1), var(--l2), var(--l3));
}
.home-logo img { width: 124px; height: auto; display: block; margin: 4px auto 14px; }
.home-card h1 {
  font-family: 'Cairo', sans-serif; font-size: 26px; font-weight: 800;
  color: var(--ink); margin-bottom: 6px; letter-spacing: -0.3px;
}
.home-sub { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 28px; }

.home-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }

.choice-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 178px; max-width: 100%;
  background: #fff; border: 1.5px solid var(--line-2);
  border-radius: 20px; padding: 26px 18px 20px; cursor: pointer;
  text-align: center; font-family: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.choice-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  background: linear-gradient(135deg, var(--l2-tint), transparent 70%);
}
.choice-card:hover { transform: translateY(-4px); box-shadow: var(--sh-md); border-color: var(--l2-soft); }
.choice-card:hover::before { opacity: 1; }
.choice-card.alt::before { background: linear-gradient(135deg, var(--l3-tint), transparent 70%); }
.choice-card.alt:hover { border-color: var(--l3-soft); }

.cc-ic {
  width: 62px; height: 62px; border-radius: 18px; display: flex;
  align-items: center; justify-content: center; font-size: 30px;
  background: linear-gradient(135deg, var(--l2-tint), var(--l1-tint));
  box-shadow: var(--sh-sm); position: relative; z-index: 1;
}
.choice-card.alt .cc-ic { background: linear-gradient(135deg, var(--l3-tint), var(--l2-tint)); }
.cc-title { font-family: 'Cairo', sans-serif; font-size: 18px; font-weight: 800; color: var(--ink); position: relative; z-index: 1; }
.cc-desc { font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.55; position: relative; z-index: 1; }
.cc-go { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--l2-deep); position: relative; z-index: 1; }
.choice-card.alt .cc-go { color: var(--l3-deep); }

.home-logout {
  margin-top: 26px; background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3);
  transition: color .15s;
}
.home-logout:hover { color: var(--l1-deep); }

@media (max-width: 560px) {
  .choice-card { width: 100%; }
  .home-card { padding: 32px 22px 24px; }
  .home-card h1 { font-size: 23px; }
}

/* شاشات قصيرة الارتفاع: ضغط لطيف حتى تظهر كل البطاقات بلا تمرير */
@media (max-height: 720px) {
  .home-logo img { width: 92px; margin: 2px auto 10px; }
  .home-card { padding: 26px 30px 22px; }
  .home-card h1 { font-size: 23px; margin-bottom: 4px; }
  .home-sub { margin-bottom: 18px; }
  .choice-card { padding: 18px 16px 16px; }
  .cc-ic { width: 52px; height: 52px; font-size: 26px; border-radius: 16px; }
  .home-logout { margin-top: 18px; }
}

/* ═══ تعديلات مرحلة ١ على واجهة البنّاء ═══ */
/* تبويب المعاينة (خطة المعلم / بطاقة الأسرة) فوق المعاينة */
.preview-target {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.preview-target .ptv-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.preview-target .print-target-seg { margin: 0; flex: 1; min-width: 200px; }

/* تلميح أسفل أزرار الحفظ/التنزيل */
.cp-hint {
  margin-top: 8px; font-size: 11.5px; line-height: 1.65;
  color: var(--ink-2); text-align: center;
  background: var(--l2-tint); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px;
}
.cp-hint b { color: var(--ink); font-weight: 700; }

/* ═══ شاشة «خططي المحفوظة» (بطاقات المواد → الخطط) ═══ */
.sp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sp-head b { font-family: 'Cairo', sans-serif; font-size: 17px; color: var(--ink); }
.sp-head span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }

.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.subj-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 16px;
  padding: 18px 12px; cursor: pointer; font-family: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.subj-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--l2-soft); }
.subj-ic {
  width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-family: 'Amiri', serif; font-weight: 700; color: var(--l2-deep);
  background: linear-gradient(135deg, var(--l2-tint), var(--l1-tint));
}
.subj-nm { font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.3; }
.subj-ct { font-size: 12px; font-weight: 700; color: var(--ink-2); }

.sp-back { background: none; border: none; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--l2-deep); margin-bottom: 10px; padding: 4px 0; }
.sp-back:hover { color: var(--brand); }
.sp-list { display: flex; flex-direction: column; gap: 10px; }
.sp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; }
.sp-row .ti b { display: block; font-family: 'Cairo', sans-serif; font-size: 14.5px; color: var(--ink); margin-bottom: 2px; }
.sp-row .ti span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.sp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-open { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: box-shadow .15s; }
.sp-open:hover { box-shadow: var(--sh-sm); }
.sp-del { background: #fff; color: var(--l1-deep); border: 1.5px solid var(--l1-soft); border-radius: 10px; padding: 8px 12px; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.sp-del:hover, .sp-del.confirming { background: var(--l1-tint); border-color: var(--l1); }
.sp-eval { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.sp-eval.green { background: #dcfce7; color: #15803d; }
.sp-eval.orange { background: #ffedd5; color: #c2410c; }
.sp-eval.red { background: #fee2e2; color: #b91c1c; }
.sp-eval.none { background: var(--cream-2); color: var(--ink-3); }

/* قفل بطاقة المعلم لغير المدير (التعريف التلقائي من الحساب) */
.teacher-card.locked { pointer-events: none; cursor: default; }
.teacher-card.locked .tc-arrow { display: none; }

/* بطاقة «تقييم الطلاب» الثالثة في الرئيسية */
.choice-card.eval::before { background: linear-gradient(135deg, var(--l1-tint), transparent 70%); }
.choice-card.eval:hover { border-color: var(--l1-soft); }
.choice-card.eval .cc-ic { background: linear-gradient(135deg, var(--l1-tint), var(--l2-tint)); }
.choice-card.eval .cc-go { color: var(--l1-deep); }

/* ═══ نافذة التقييم السريع ═══ */
.modal-eval { max-width: 680px; }
.ev-intro { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; line-height: 1.6; }
.ev-pick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ev-result-seg { margin-bottom: 14px; }
.ev-segs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ev-rbtn { padding: 11px 8px; border-radius: 12px; border: 2px solid var(--line-2); background: #fff; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.ev-rbtn.green.active { border-color: #15803d; background: #dcfce7; color: #15803d; }
.ev-rbtn.orange.active { border-color: #c2410c; background: #ffedd5; color: #c2410c; }
.ev-rbtn.red.active { border-color: #b91c1c; background: #fee2e2; color: #b91c1c; }
.ev-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.ev-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: #fff; font-family: inherit; cursor: pointer; text-align: right; transition: all .12s; }
.ev-chip:hover { border-color: var(--l2-soft); transform: translateY(-2px); }
.ev-chip .evc-name { font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); }
.ev-chip .evc-tag { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.ev-chip.green { border-color: #15803d; background: #dcfce7; }
.ev-chip.green .evc-tag { color: #15803d; }
.ev-chip.orange { border-color: #c2410c; background: #ffedd5; }
.ev-chip.orange .evc-tag { color: #c2410c; }
.ev-chip.red { border-color: #b91c1c; background: #fee2e2; }
.ev-chip.red .evc-tag { color: #b91c1c; }
.ev-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.ev-count { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ev-foot .btn-primary { width: auto; margin-top: 0; padding: 12px 26px; }
@media (max-width: 560px) { .ev-pick { grid-template-columns: 1fr; } }

/* بطاقات دروس التقييم (مواد → دروس محضّرة بحالتها) */
.ev-lessons { display: flex; flex-direction: column; gap: 10px; }
.ev-lesson-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 14px 16px; cursor: pointer; font-family: inherit; text-align: right; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ev-lesson-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--l2-soft); }
.evl-title { font-family: 'Cairo', sans-serif; font-size: 14.5px; font-weight: 700; color: var(--ink); flex: 1; min-width: 140px; }
.evl-meta { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ev-lstat { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ev-lstat.done { background: #dcfce7; color: #15803d; }
.ev-lstat.partial { background: #ffedd5; color: #c2410c; }
.ev-lstat.todo { background: var(--cream-2); color: var(--ink-3); }

/* بطاقة «إدارة الرموز» (للمدير) + اللوحة */
.choice-card.codes::before { background: linear-gradient(135deg, #fde7c7, transparent 70%); }
.choice-card.codes:hover { border-color: var(--gold); }
.choice-card.codes .cc-ic { background: linear-gradient(135deg, #fde7c7, var(--l2-tint)); }
.choice-card.codes .cc-go { color: #b8860b; }

.modal-codes { max-width: 640px; }
.codes-intro { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; line-height: 1.6; }
.codes-list { display: flex; flex-direction: column; gap: 10px; }
.code-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1.5px solid var(--line-2); border-radius: 16px; padding: 12px 14px; }
.cdc-av { width: 42px; height: 42px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: 'Amiri', serif; font-size: 20px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.cdc-meta { flex: 1; min-width: 120px; }
.cdc-nm { font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); }
.cdc-role { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.cdc-code { font-family: 'Courier New', monospace; font-size: 17px; font-weight: 700; letter-spacing: 1px; color: var(--brand); background: var(--l2-tint); border: 1.5px dashed var(--l2-soft); border-radius: 10px; padding: 7px 14px; cursor: pointer; transition: all .15s; }
.cdc-code:hover { background: #fff; border-style: solid; }
.cdc-code.copied { background: #dcfce7; color: #15803d; border-color: #15803d; }
.cdc-actions { display: flex; gap: 6px; }
.cdc-gen, .cdc-edit { border: 1.5px solid var(--line-2); background: #fff; border-radius: 10px; padding: 7px 11px; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.cdc-gen:hover { background: var(--l2-tint); border-color: var(--l2-soft); color: var(--l2-deep); }
.cdc-edit:hover { background: var(--cream-2); }
@media (max-width: 560px) { .cdc-code { font-size: 15px; padding: 6px 10px; } .cdc-meta { min-width: 100%; order: -1; } }

/* ═══════════════════════════════════════════════════════════════
   شاشات مستقلة موحّدة الهوية (المحفوظة · التقييم · الرموز · الإدارة)
   صفحة كاملة بترويسة شعار الوزارة — لا تطفو على الخلفية، ولا تُغلق
   بالضغط خارجها. تُغطّي القائمة والزر العائم، بنفس هوية صفحة الترحيب.
   ═══════════════════════════════════════════════════════════════ */
.screen {
  display: none; position: fixed; inset: 0; z-index: 280;
  flex-direction: column; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 12% 8%,  rgba(231,111,81,0.10), transparent 60%),
    radial-gradient(ellipse 60% 50% at 92% 14%, rgba(42,157,143,0.12), transparent 58%),
    radial-gradient(ellipse 60% 55% at 82% 96%, rgba(69,123,157,0.10), transparent 60%),
    linear-gradient(165deg, #fdfaf4 0%, #f7f0e6 100%);
}
.screen.show { display: flex; animation: screenIn .34s cubic-bezier(.16,1,.3,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.screen-head {
  position: relative; z-index: 2; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 28px 16px;
  background: rgba(255,255,255,0.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 22px rgba(8,79,73,0.06);
}
.screen-head::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--l1), var(--l2), var(--l3));
}
.screen-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.screen-brand img { width: 50px; height: auto; display: block; flex-shrink: 0; }
.screen-brand-t { min-width: 0; }
.screen-brand-t h2 {
  font-family: 'Cairo', sans-serif; font-size: 19px; font-weight: 800;
  color: var(--ink); letter-spacing: -0.3px; line-height: 1.2;
  display: flex; align-items: center; gap: 9px;
}
.screen-ic { font-size: 20px; line-height: 1; }
.screen-brand-t span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 3px; }
.screen-back {
  font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 12px; border: 1.5px solid var(--line-2);
  background: #fff; color: var(--ink-2); transition: all .15s ease;
}
.screen-back:hover {
  border-color: var(--brand); color: var(--brand);
  transform: translateY(-1px); box-shadow: 0 6px 16px rgba(8,79,73,0.14);
}
.screen-back .sb-ic { font-size: 16px; line-height: 1; }

.screen-body {
  position: relative; z-index: 1; flex: 1; overflow-y: auto;
  width: 100%; max-width: 860px; margin: 0 auto;
  padding: 26px 28px 64px;
  animation: screenBodyIn .42s .04s both cubic-bezier(.16,1,.3,1);
}
@keyframes screenBodyIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen .adm-list { max-height: none; }

@media (max-width: 640px) {
  .screen-head { padding: 12px 16px 13px; gap: 10px; }
  .screen-brand img { width: 40px; }
  .screen-brand-t h2 { font-size: 16px; }
  .screen-brand-t span { font-size: 11px; }
  .screen-back { padding: 9px 13px; font-size: 13px; }
  .screen-body { padding: 18px 16px 52px; }
}
