/* ═══════════════════════════════════════════════════════════════
   DESIGN 3 — "بستان الخطط" / Aurora Bloom
   تصميم حيوي مبهج · هوية لونية لكل مستوى · A4 فني
   كل المعرّفات والوظائف متطابقة مع design-3-app.js (بدون أي تغيير)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* هوية برنامج العوق الفكري — دافئة ورسمية وهادئة */
  --cream:        #f7f3ea;
  --cream-2:      #efe6d8;
  --paper:        #fffdf8;
  --ink:          #1e3531;
  --ink-2:        #667b76;
  --ink-3:        #93a29e;
  --line:         #ded4c3;
  --line-2:       #d2c4ae;

  /* ألوان المستويات المعتمدة */
  --l1:           #e76f51;
  --l1-deep:      #b84a32;
  --l1-soft:      #f6c8ba;
  --l1-tint:      #fce4dc;

  --l2:           #2a9d8f;
  --l2-deep:      #0b6b63;
  --l2-soft:      #a9ded7;
  --l2-tint:      #ddf3ef;

  --l3:           #457b9d;
  --l3-deep:      #1d4e6f;
  --l3-soft:      #b8d5e4;
  --l3-tint:      #ddecf4;

  --brand:        #0b6b63;
  --brand-2:      #5aa299;
  --brand-3:      #c49a4a;
  --accent:       #0b6b63;

  --gold:         #c49a4a;

  --sh-sm:   0 2px 8px rgba(11,107,99,0.08);
  --sh-md:   0 8px 24px rgba(11,107,99,0.12);
  --sh-lg:   0 18px 50px -12px rgba(8,79,73,0.24);
  --sh-glow: 0 10px 40px rgba(90,162,153,0.22);

  --radius:   18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100vh; }

body {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── خلفية الأورورا المتدرّجة الحيّة ── */
.aurora-bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 70% 55% at 12% 8%,  rgba(249,115,22,0.18), transparent 60%),
    radial-gradient(ellipse 60% 50% at 92% 18%, rgba(123,92,255,0.20),  transparent 58%),
    radial-gradient(ellipse 65% 55% at 80% 92%, rgba(37,196,196,0.18),  transparent 60%),
    radial-gradient(ellipse 55% 45% at 18% 95%, rgba(242,183,5,0.12),   transparent 55%),
    linear-gradient(165deg, #fdfaf4 0%, #f7f0e6 100%);
}
.aurora-bg::after {
  /* طبقة نقاط خفيفة (texture) */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(123,92,255,0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.6;
}

/* تموّج لطيف للهالات */
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-2%, 2%) scale(1.04); }
}
.aurora-bg { animation: drift 22s ease-in-out infinite; }

/* ═══════════════════════════════════════════
   شاشة تسجيل الدخول
   ═══════════════════════════════════════════ */
.auth-screen {
  display: none; position: fixed; inset: 0; z-index: 300;
  align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 28px;
  padding: 46px 40px 40px;
  width: 100%; max-width: 420px;
  text-align: center;
  box-shadow: var(--sh-lg);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.6s cubic-bezier(0.16,1,0.3,1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--l1), var(--l2), var(--l3));
}
.auth-cube {
  width: 76px; height: 76px; margin: 0 auto 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 55%, var(--brand-3) 110%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif; font-size: 38px; font-weight: 700; color: #fff;
  box-shadow: var(--sh-glow);
  transform: rotate(-6deg);
  position: relative;
}
.auth-cube::after {
  content: ""; position: absolute; inset: -6px;
  border: 2px dashed rgba(123,92,255,0.3); border-radius: 26px;
}
.auth-card h1 {
  font-family: 'Cairo', sans-serif; font-size: 24px; font-weight: 800;
  color: var(--ink); margin-bottom: 6px; letter-spacing: -0.3px;
}
.auth-logo { margin: 4px auto 18px; }
.auth-logo img {
  width: 152px; height: auto; display: block; margin: 0 auto;
}
.auth-card .sub {
  font-size: 12.5px; font-weight: 700; letter-spacing: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 26px;
}
.auth-card .sub2 {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: 0.3px; margin-bottom: 4px;
}
.auth-form { text-align: right; }
.auth-form label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.auth-form input {
  width: 100%; padding: 15px 18px;
  border: 2px solid var(--line-2); border-radius: 14px;
  font-family: inherit; font-size: 17px; font-weight: 600;
  text-align: center; letter-spacing: 8px;
  background: #fff; color: var(--ink);
  transition: all 0.2s;
}
.auth-form input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(123,92,255,0.14);
}
.auth-err {
  color: var(--l1-deep); font-size: 13px; font-weight: 600;
  margin-top: 12px; text-align: center;
}
.btn-primary {
  width: 100%; margin-top: 22px; padding: 15px;
  border: none; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: var(--sh-md);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--sh-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-link {
  display: block; margin-top: 18px; text-align: center;
  color: var(--ink-2); font-size: 13px; text-decoration: none; font-weight: 600;
  transition: color 0.15s;
}
.btn-link:hover { color: var(--brand); }

/* ═══════════════════════════════════════════
   الإطار العام للتطبيق
   ═══════════════════════════════════════════ */
.app { display: none; min-height: 100vh; }
.app.show { display: flex; }

/* ── الشريط الجانبي ── */
.sidebar {
  flex: 0 0 290px; width: 290px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.sb-head { padding: 22px 20px 16px; }
.sb-brand { display: flex; align-items: center; gap: 12px; }
/* وضع الشعار: عمودي ومتمركز */
.sb-brand.sb-brand-logo { flex-direction: column; align-items: center; text-align: center; gap: 9px; }
.sb-brand.sb-brand-logo img { width: 118px; height: auto; display: block; }
.sb-brand.sb-brand-logo h1 { font-size: 16px; }
.sb-brand.sb-brand-logo .sub { letter-spacing: 0.3px; }
.sb-brand.sb-brand-logo .sb-school { font-size: 11px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.sb-mark {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--brand-3) 120%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif; font-size: 24px; font-weight: 700; color: #fff;
  box-shadow: var(--sh-md);
  flex-shrink: 0;
}
.sb-brand h1 {
  font-family: 'Cairo', sans-serif; font-size: 18px; font-weight: 800;
  color: var(--ink); line-height: 1.2;
}
.sb-brand .sub {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--brand); margin-top: 2px;
}

.nav-section { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--ink-3); text-transform: uppercase;
  padding: 12px 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: all 0.18s; margin-bottom: 3px;
  position: relative;
}
.nav-item .ic {
  width: 22px; text-align: center; font-size: 16px;
  color: var(--ink-3); transition: color 0.18s;
}
.nav-item:hover { background: var(--l2-tint); color: var(--ink); }
.nav-item:hover .ic { color: var(--brand); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(123,92,255,0.12), rgba(249,115,22,0.10));
  color: var(--brand); font-weight: 700;
}
.nav-item.active .ic { color: var(--brand); }
.nav-item.active::before {
  content: ""; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; border-radius: 4px;
  background: linear-gradient(var(--brand), var(--brand-2));
}
.nav-item .badge {
  margin-right: auto;
  background: var(--l2-soft); color: var(--l2-deep);
  font-size: 11px; font-weight: 700;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}

.sb-foot {
  padding: 14px; border-top: 1px solid var(--line);
  position: relative;
}

/* بطاقة المعلم */
.teacher-card {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 14px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line-2);
  transition: all 0.18s;
}
.teacher-card:hover { border-color: var(--brand); box-shadow: var(--sh-sm); }
.teacher-card.empty {
  border-style: dashed; border-color: var(--l1);
  background: var(--l1-tint);
}
.teacher-card.open { border-color: var(--brand); box-shadow: var(--sh-md); }
.tc-av {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.teacher-card.empty .tc-av {
  background: linear-gradient(135deg, var(--l1), var(--l1-deep));
}
.tc-info { flex: 1; min-width: 0; text-align: right; }
.tc-name {
  font-size: 14px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-role {
  font-size: 11px; color: var(--ink-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-arrow { color: var(--ink-3); font-size: 13px; transition: transform 0.2s; }
.teacher-card.open .tc-arrow { transform: rotate(180deg); }

.teacher-dropdown {
  display: none; position: relative;
  margin-top: 8px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--line-2);
  border-radius: 16px; box-shadow: var(--sh-md);
  max-height: 300px; overflow-y: auto; z-index: 60;
  padding: 7px;
}
.teacher-dropdown.show { display: block; animation: ddIn 0.2s ease; }
@keyframes ddIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.td-option {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 11px; cursor: pointer;
  transition: background 0.14s;
}
.td-option:hover { background: var(--l2-tint); }
.td-option.selected { background: var(--l2-soft); }
.td-option .av {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.td-option .info { flex: 1; min-width: 0; }
.td-option .nm {
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-option .rl {
  font-size: 11px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-empty { padding: 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ═══════════════════════════════════════════
   المحتوى الرئيسي
   ═══════════════════════════════════════════ */
.main {
  flex: 1; min-width: 0;
  height: 100vh; overflow-y: auto;
  padding: 0 0 120px;
}

.main-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 30px;
  background: rgba(251,247,240,0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.main-head h2 {
  font-family: 'Cairo', sans-serif; font-size: 22px; font-weight: 800;
  color: var(--ink); letter-spacing: -0.4px; line-height: 1.25;
}
.crumb { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.head-actions { display: flex; gap: 10px; flex-shrink: 0; }
.h-btn {
  padding: 11px 18px; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2);
  transition: all 0.16s; white-space: nowrap;
}
.h-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.h-btn.primary {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: var(--sh-md);
}
.h-btn.primary:hover:not(:disabled) { box-shadow: var(--sh-glow); transform: translateY(-2px); }
.h-btn.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* مساحة المحتوى */
.panel-strip, .ctl-row { padding: 0 30px; margin-top: 18px; }

/* شريط الفلاتر */
.panel-strip {
  margin-top: 20px;
}
.strip-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--sh-sm);
}
.field label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--ink-2); margin-bottom: 7px; padding-right: 2px;
}
.field select, .search-wrap input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line-2); border-radius: 12px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink); background: #fff;
  transition: all 0.16s; cursor: pointer;
}
.field select:focus, .search-wrap input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(123,92,255,0.12);
}
.field select:disabled { background: var(--cream-2); color: var(--ink-3); cursor: not-allowed; }
.search-wrap { position: relative; }
.search-wrap input { cursor: text; }
.search-wrap input::placeholder { color: var(--ink-3); font-weight: 500; }

/* صفوف عناصر التحكم */
.ctl-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.ctl-card {
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--sh-sm);
}
.ctl-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ctl-h .ic {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--l2-soft), var(--l1-soft));
  color: var(--brand); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.ctl-h .t { font-family: 'Cairo', sans-serif; font-size: 15.5px; font-weight: 700; color: var(--ink); }
.ctl-h .ct {
  margin-right: auto; font-size: 12px; font-weight: 700;
  color: var(--ink-2); background: var(--cream-2);
  padding: 4px 11px; border-radius: 20px;
}

/* ── أزرار المستويات (هوية لونية كاملة) ── */
.level-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lv-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px; border-radius: 15px; cursor: pointer;
  border: 2px solid var(--line-2); background: #fff;
  font-family: inherit; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.lv-btn .name {
  font-size: 13.5px; font-weight: 800; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.lv-btn .desc { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.lv-btn .lv-count {
  /* مخفية: العدد يظهر في ملخص «خطط جاهزة للطباعة» بالأسفل حتى لا يتكرر */
  display: none;
}
.lv-btn::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  opacity: 0; transition: opacity 0.2s;
}
/* ألوان كل مستوى */
.lv-btn[data-level="1"]:hover { border-color: var(--l1); background: var(--l1-tint); }
.lv-btn[data-level="2"]:hover { border-color: var(--l2); background: var(--l2-tint); }
.lv-btn[data-level="3"]:hover { border-color: var(--l3); background: var(--l3-tint); }

.lv-btn[data-level="1"].active {
  border-color: var(--l1); background: var(--l1-tint);
  box-shadow: 0 8px 22px rgba(249,115,22,0.28);
}
.lv-btn[data-level="2"].active {
  border-color: var(--l2); background: var(--l2-tint);
  box-shadow: 0 8px 22px rgba(123,92,255,0.26);
}
.lv-btn[data-level="3"].active {
  border-color: var(--l3); background: var(--l3-tint);
  box-shadow: 0 8px 22px rgba(37,196,196,0.24);
}
.lv-btn[data-level="1"].active::before { opacity: 1; background: linear-gradient(90deg, var(--l1), var(--l1-deep)); }
.lv-btn[data-level="2"].active::before { opacity: 1; background: linear-gradient(90deg, var(--l2), var(--l2-deep)); }
.lv-btn[data-level="3"].active::before { opacity: 1; background: linear-gradient(90deg, var(--l3), var(--l3-deep)); }

.lv-btn[data-level="1"].active .lv-count,
.lv-btn[data-level="1"].has-students .lv-count { background: var(--l1); color: #fff; }
.lv-btn[data-level="2"].active .lv-count,
.lv-btn[data-level="2"].has-students .lv-count { background: var(--l2); color: #fff; }
.lv-btn[data-level="3"].active .lv-count,
.lv-btn[data-level="3"].has-students .lv-count { background: var(--l3); color: #fff; }

.lv-btn.has-students[data-level="1"] { border-color: var(--l1-soft); }
.lv-btn.has-students[data-level="2"] { border-color: var(--l2-soft); }
.lv-btn.has-students[data-level="3"] { border-color: var(--l3-soft); }

/* ملخص الخطط */
.plans-summary {
  margin-top: 14px; padding: 13px 15px;
  background: linear-gradient(135deg, var(--l2-tint), var(--l1-tint));
  border: 1px solid var(--line); border-radius: 14px;
}
.plans-summary .top {
  font-size: 13px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
}
.plans-summary .count {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 14px;
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.plans-summary .breakdown { display: flex; gap: 8px; margin-top: 11px; }
.b-item {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 10px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: rgba(255,255,255,0.7); border: 1px solid var(--line);
}
.b-item .b-lvl { font-size: 11px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.b-item .b-cnt { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.b-item .b-num { font-size: 15px; color: var(--brand); font-weight: 800; }
.b-item.empty { opacity: 0.5; }

/* ── ودجة التقدّم ── */
.progress-widget {
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--sh-sm);
}
.pw-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pw-h .t { font-family: 'Cairo', sans-serif; font-size: 15px; font-weight: 700; color: var(--ink); }
.pw-h .pct {
  font-size: 16px; font-weight: 800;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pw-track {
  height: 9px; border-radius: 6px; background: var(--cream-2);
  overflow: hidden; margin-bottom: 16px;
}
.pw-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--l1), var(--l2), var(--l3));
  transition: width 0.5s cubic-bezier(0.16,1,0.3,1);
}
.pw-steps { display: flex; justify-content: space-between; gap: 6px; }
.pw-step { flex: 1; text-align: center; }
.pw-step .num {
  width: 34px; height: 34px; margin: 0 auto 6px; border-radius: 11px;
  background: var(--cream-2); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  transition: all 0.25s; border: 2px solid transparent;
}
.pw-step .lab { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.pw-step.active .num {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; transform: scale(1.08); box-shadow: var(--sh-md);
}
.pw-step.active .lab { color: var(--brand); font-weight: 700; }
.pw-step.done .num {
  background: var(--l3-soft); color: var(--l3-deep); border-color: var(--l3);
}
.pw-step.done .num::after { content: "✓"; }
.pw-step.done .lab { color: var(--l3-deep); }

/* ── الطلاب ── */
.student-list-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.student-list-title .lvl-badge {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; padding: 3px 11px; border-radius: 20px; font-size: 12px;
}
/* لون الشارة يتغيّر مع كل مستوى دعم (مطابق لأزرار المستوى) */
.student-list-title .lvl-badge.lv-1 { background: linear-gradient(135deg, var(--l1), var(--l1-deep)); }
.student-list-title .lvl-badge.lv-2 { background: linear-gradient(135deg, var(--l2), var(--l2-deep)); }
.student-list-title .lvl-badge.lv-3 { background: linear-gradient(135deg, var(--l3), var(--l3-deep)); }
.student-list-title .hint { color: var(--ink-3); font-weight: 600; margin-right: auto; }
.students-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.chip-btn {
  padding: 8px 14px; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2);
  transition: all 0.15s;
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.students-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  max-height: 240px; overflow-y: auto; padding: 2px;
}
.student-chk {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line-2);
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  transition: all 0.15s; user-select: none;
}
.student-chk:hover { border-color: var(--brand); background: var(--l2-tint); }
.student-chk input { display: none; }
.student-chk .box {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  border: 2px solid var(--line-2); transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.student-chk input:checked ~ .box {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
}
.student-chk input:checked ~ .box::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; }
.student-chk input:checked ~ .name { color: var(--brand); font-weight: 700; }
.student-chk .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-chk.empty {
  grid-column: 1 / -1; justify-content: center; cursor: default;
  border-style: dashed; color: var(--ink-3); background: transparent;
  padding: 22px;
}
.student-chk.empty:hover { border-color: var(--line-2); background: transparent; }
.student-chk.locked { opacity: 0.85; cursor: pointer; background: var(--cream-2); border-style: dashed; }
.student-chk.locked .lock-ico {
  color: var(--ink-3); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: color 0.15s;
}
.student-chk.locked .lock-ico svg { width: 16px; height: 16px; display: block; }
.student-chk.locked:hover .lock-ico { color: var(--brand); }
.student-chk.locked .lock-badge {
  margin-right: auto; font-size: 10.5px; font-weight: 700;
  color: var(--ink-2); background: #fff; padding: 3px 9px; border-radius: 12px;
  border: 1px solid var(--line-2);
}

/* ── أقسام الخطة ── */
.sec-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sec-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line-2);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: all 0.15s; user-select: none;
}
.sec-chip::before {
  content: ""; width: 16px; height: 16px; border-radius: 5px;
  border: 2px solid var(--line-2); transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
}
.sec-chip input { display: none; }
.sec-chip:has(input:checked) {
  background: var(--l2-tint); border-color: var(--l2); color: var(--brand); font-weight: 700;
}
.sec-chip:has(input:checked)::before {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; content: "✓";
}

/* ── التقويم / التواريخ ── */
.dates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.date-block-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px;
}
.date-block-label .ic { color: var(--brand); }
.date-input {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line-2);
  transition: all 0.15s;
}
.date-input:hover { border-color: var(--brand); }
.date-input.active { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(123,92,255,0.12); }
.date-input.empty .di-val { color: var(--ink-3); font-weight: 500; }
.date-input.has-value .di-val { color: var(--ink); font-weight: 700; }
.date-input .di-ic { font-size: 15px; }
.date-input .di-val { flex: 1; font-size: 13.5px; }
.date-input .di-arrow { color: var(--ink-3); font-size: 12px; }

.end-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.end-chip {
  padding: 11px 10px; border-radius: 12px; cursor: pointer; text-align: center;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2);
  transition: all 0.15s;
}
.end-chip:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.end-chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent;
}
.end-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.end-chip-note {
  display: none; grid-column: 1 / -1; font-size: 11.5px; font-weight: 600;
  color: var(--l1-deep); margin-top: 2px;
}
.end-chip-note.show { display: block; }

.date-summary {
  display: none; margin-top: 14px; padding: 13px 16px;
  background: linear-gradient(135deg, var(--l3-tint), var(--l2-tint));
  border: 1px solid var(--line); border-radius: 14px;
}
.date-summary.show { display: block; }
.date-summary .row {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; margin-bottom: 6px;
}
.date-summary .lbl { color: var(--ink-2); font-weight: 600; min-width: 46px; flex-shrink: 0; }
.date-summary .val { color: var(--ink); font-weight: 700; white-space: nowrap; }
.date-summary .duration {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2);
  font-size: 12.5px; font-weight: 700; color: var(--brand); text-align: center;
}

/* تقويم منبثق */
.cal {
  display: none; margin-top: 10px; padding: 14px;
  background: #fff; border: 1px solid var(--line-2);
  border-radius: 16px; box-shadow: var(--sh-md);
}
.cal.show { display: block; animation: ddIn 0.2s ease; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav {
  width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: var(--brand);
  font-size: 18px; font-weight: 700; transition: all 0.15s;
}
.cal-nav:hover { background: var(--l2-tint); }
.cal-title { font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--ink-3); padding: 5px 0; }
.cal-dow.sunday { color: var(--l1-deep); }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: all 0.12s;
}
.cal-cell:hover:not(.empty):not(.disabled) { background: var(--l2-tint); }
.cal-cell.empty { cursor: default; }
.cal-cell.sunday { color: var(--l1-deep); }
.cal-cell.thursday { color: var(--l3-deep); }
.cal-cell.today { border: 2px solid var(--brand); }
.cal-cell.selected {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  color: #fff; font-weight: 800;
}
.cal-cell.disabled { opacity: 0.3; cursor: not-allowed; }
.cal-foot { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.cal-today-btn {
  padding: 7px 14px; border-radius: 20px; cursor: pointer;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--brand);
  font-family: inherit; font-size: 12px; font-weight: 700; transition: all 0.15s;
}
.cal-today-btn:hover:not(:disabled) { background: var(--l2-tint); }
.cal-today-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cal-hint {
  display: flex; align-items: center; gap: 6px; margin-right: auto;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.cal-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--l1); }

/* ═══════════════════════════════════════════
   المعاينة + ورقة A4 الفنية
   ═══════════════════════════════════════════ */
.preview-wrap { padding: 22px 30px 0; }

.empty-state {
  text-align: center; padding: 70px 30px;
  background: rgba(255,255,255,0.6);
  border: 2px dashed var(--line-2); border-radius: 24px;
}
.empty-state .icon {
  font-size: 50px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2), var(--brand-3));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.empty-state h3 { font-family: 'Cairo', sans-serif; font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--ink-2); max-width: 440px; margin: 0 auto; line-height: 1.7; }

/* شريط معلومات المعاينة */
.preview-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 15px 20px; margin-bottom: 22px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--sh-sm);
}
.pt-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 20px;
  background: var(--l3-soft); color: var(--l3-deep);
  font-size: 12.5px; font-weight: 700;
}
.pt-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--l3-deep);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.pt-info { display: flex; flex-direction: column; }
.pt-info b { font-size: 14px; font-weight: 800; color: var(--ink); }
.pt-info span { font-size: 12px; color: var(--ink-2); }
.pt-meta { display: flex; gap: 18px; margin-right: auto; }
.pt-meta span { font-size: 12px; color: var(--ink-2); }
.pt-meta b { color: var(--brand); font-weight: 800; font-size: 14px; }

/* ════════ ورقة A4 ════════ */
.a4 {
  width: 210mm; min-height: 297mm; height: auto;
  background: var(--paper); color: var(--ink);
  margin: 0 auto 26px; padding: 0;
  box-shadow: var(--sh-lg);
  border-radius: 6px; overflow: visible;
  display: flex; flex-direction: column;
  position: relative;
  /* متغيّر اللون المحقون لكل مستوى عبر JS عبر class على .a4؟ لا — نلوّن حسب نص المستوى */
}
/* لون افتراضي (المستوى ٢/البرنامج) */
.a4 { --pc: var(--l2); --pc-deep: var(--l2-deep); --pc-soft: var(--l2-soft); --pc-tint: var(--l2-tint); }
.a4.lvl-1 { --pc: var(--l1); --pc-deep: var(--l1-deep); --pc-soft: var(--l1-soft); --pc-tint: var(--l1-tint); }
.a4.lvl-2 { --pc: var(--l2); --pc-deep: var(--l2-deep); --pc-soft: var(--l2-soft); --pc-tint: var(--l2-tint); }
.a4.lvl-3 { --pc: var(--l3); --pc-deep: var(--l3-deep); --pc-soft: var(--l3-soft); --pc-tint: var(--l3-tint); }

/* ترويسة A4 الفنية */
.a4-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9mm 7mm 7mm;
  background: linear-gradient(120deg, var(--pc-deep) 0%, var(--pc) 100%);
  color: #fff; position: relative; overflow: hidden;
}
.a4-head::after {
  content: ""; position: absolute; left: -30px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.10);
}
.a4-head::before {
  content: ""; position: absolute; left: 40px; bottom: -60px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.a4-h-l { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.a4-h-mark {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
  background: rgba(255,255,255,0.2); border: 1.5px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif; font-size: 26px; font-weight: 700; color: #fff;
}
/* شعار الوزارة (نسخة بيضاء) داخل ترويسة الورقة الداكنة — بلا علبة، مباشرة على الخلفية */
#preview .a4-h-mark:has(img) {
  width: auto; height: auto; padding: 0; border-radius: 0;
  background: transparent !important; border: 0 !important; box-shadow: none !important;
}
#preview .a4-h-mark img { height: 40px; width: auto; display: block; }
.a4-h-t .name { font-family: 'Cairo', sans-serif; font-size: 17pt; font-weight: 800; line-height: 1.2; }
.a4-h-t .tag { font-size: 8.5pt; font-weight: 600; opacity: 0.9; margin-top: 2px; }
.a4-h-r { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 5px; }
.a4-h-r .row { display: flex; align-items: center; gap: 8px; font-size: 8pt; font-weight: 700; }
.a4-h-r .row .fl {
  width: 38px; height: 16px; border-radius: 5px;
  background: rgba(255,255,255,0.22); border-bottom: 1.5px solid rgba(255,255,255,0.5);
}

/* معلومات الدرس + الطالب */
.a4-info {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 7mm 7mm 5mm;
  border-bottom: 2px solid var(--pc-soft);
}
.a4-info h1 { font-family: 'Cairo', sans-serif; font-size: 16pt; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.a4-info .meta { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.a4-info .meta span { font-size: 8.5pt; color: var(--ink-2); }
.a4-info .meta b { color: var(--ink); font-weight: 700; }
.a4-info .meta .lvl {
  background: var(--pc); color: #fff;
  padding: 3px 12px; border-radius: 20px; font-weight: 700; font-size: 8pt;
}
.student-box {
  text-align: center; padding: 9px 18px; border-radius: 14px;
  background: var(--pc-tint); border: 1.5px solid var(--pc-soft);
  min-width: 42mm;
}
.student-box .lab { font-size: 7.5pt; font-weight: 700; color: var(--pc-deep); margin-bottom: 3px; }
.student-box .nm { font-family: 'Cairo', sans-serif; font-size: 12.5pt; font-weight: 800; color: var(--ink); }

.dates-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin-top: 8px; font-size: 8pt; color: var(--ink-2);
}
.dates-line b { color: var(--ink); font-weight: 700; }
.dates-line .dt-val {
  font-weight: 700; color: var(--pc-deep);
  border-bottom: 1px dashed var(--pc); padding: 0 8px 1px; min-width: 60px; text-align: center;
}
.dates-line .dt-val.empty { min-width: 70px; }
.dates-line .arr { color: var(--pc); }
.dates-line .dur { color: var(--ink-2); font-style: italic; }

.a4-goal {
  margin: 0 7mm; padding: 8px 14px; border-radius: 10px;
  background: var(--pc-tint); font-size: 9pt; line-height: 1.6; color: var(--ink);
  border-right: 3px solid var(--pc);
}
.a4-goal b { color: var(--pc-deep); }

/* جسم A4 */
.a4-body {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  padding: 7px 7mm 5mm; min-height: 0;
}
/* توزيع الأقسام لملء ارتفاع الصفحة بأناقة (النموذجان الكلاسيكيان) */
.a4-body > .bodyrow { display: flex; flex-direction: column; min-height: 0; }
.a4-body > .bodyrow > .card,
.a4-body > .bodyrow > .a4-row { flex: 1 1 auto; min-height: 0; }
.a4-row { display: flex; gap: 8px; }
.a4-row.equal > * { flex: 1 1 0; min-width: 0; }

/* بطاقة قسم */
.card {
  border: 1px solid var(--pc-soft); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column; min-height: 0;
  background: #fff;
}
.card-h {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px;
  background: linear-gradient(100deg, var(--pc-tint), #fff);
  border-bottom: 1px solid var(--pc-soft);
}
.card-h .num {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  background: var(--pc); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 9pt; font-weight: 800;
}
.card-h .t { font-family: 'Cairo', sans-serif; font-size: 10pt; font-weight: 800; color: var(--ink); }
.card-h .ct {
  margin-right: auto; font-size: 7.5pt; font-weight: 700; color: var(--pc-deep);
  background: var(--pc-soft); padding: 2px 9px; border-radius: 12px;
}
.card-body { padding: 8px 12px; flex: 1; min-height: 0; }

/* الأهداف السلوكية (٣ أعمدة) */
.obj-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; height: 100%; }
.obj-col { border-radius: 9px; padding: 7px 9px; }
.obj-col.cog { background: rgba(249,115,22,0.08); border-top: 2.5px solid var(--l1); }
.obj-col.ski { background: rgba(123,92,255,0.08); border-top: 2.5px solid var(--l2); }
.obj-col.emo { background: rgba(37,196,196,0.09); border-top: 2.5px solid var(--l3); }
.obj-col-h { font-size: 8.5pt; font-weight: 800; margin-bottom: 6px; color: var(--ink); }
.obj-col.cog .obj-col-h { color: var(--l1-deep); }
.obj-col.ski .obj-col-h { color: var(--l2-deep); }
.obj-col.emo .obj-col-h { color: var(--l3-deep); }
.obj { display: flex; gap: 5px; font-size: 8pt; line-height: 1.5; margin-bottom: 5px; color: var(--ink); }
.obj-num {
  flex-shrink: 0; font-weight: 800; font-size: 7pt;
  background: #fff; border-radius: 5px; padding: 1px 5px; height: fit-content;
}
.obj-col.cog .obj-num { color: var(--l1-deep); }
.obj-col.ski .obj-num { color: var(--l2-deep); }
.obj-col.emo .obj-num { color: var(--l3-deep); }

/* عناصر القوائم */
.item {
  font-size: 8.5pt; line-height: 1.55; color: var(--ink);
  padding: 4px 0 4px 0; padding-right: 16px; position: relative;
}
.item::before {
  content: ""; position: absolute; right: 4px; top: 9px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--pc);
}
.item + .item { border-top: 1px dashed var(--pc-soft); }

/* البدائل */
.alts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.alt {
  border: 1px solid var(--pc-soft); border-radius: 9px; padding: 7px 9px;
  background: #fff;
}
.alt h4 {
  display: flex; align-items: center; gap: 6px;
  font-size: 8.5pt; font-weight: 800; color: var(--pc-deep); margin-bottom: 4px;
}
.alt .stp {
  width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0;
  background: var(--pc-soft); color: var(--pc-deep);
  display: flex; align-items: center; justify-content: center; font-size: 8pt; font-weight: 800;
}
.alt p { font-size: 8pt; line-height: 1.5; color: var(--ink-2); }
.alt.warmup { background: var(--pc-tint); }
.alt.closing { background: var(--pc-tint); }

/* التقويم */
.eval-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.eval-cell {
  border: 1px solid var(--pc-soft); border-radius: 9px; padding: 8px 10px;
  border-top: 2.5px solid var(--pc);
}
.eval-cell .lab { font-size: 8.5pt; font-weight: 800; color: var(--pc-deep); margin-bottom: 4px; }
.eval-cell p { font-size: 8pt; line-height: 1.5; color: var(--ink-2); }

/* الواجبات */
.sup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sup {
  border-radius: 9px; padding: 8px 11px; font-size: 8.5pt; line-height: 1.55; color: var(--ink);
}
.sup b { display: block; font-weight: 800; margin-bottom: 3px; }
.sup.enrich { background: rgba(37,196,196,0.10); border-right: 3px solid var(--l3); }
.sup.enrich b { color: var(--l3-deep); }
.sup.treat { background: rgba(242,183,5,0.12); border-right: 3px solid var(--gold); }
.sup.treat b { color: #9a7400; }

/* تذييل A4 */
.a4-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6mm 7mm; margin-top: auto;
  border-top: 2px solid var(--pc-soft);
  background: var(--pc-tint);
}
.a4-foot .sig { font-size: 8.5pt; color: var(--ink-2); text-align: center; }
.a4-foot .sig b { display: block; color: var(--ink); font-weight: 700; margin-bottom: 14px; }
.a4-foot .sig .nm {
  display: block; min-width: 42mm; border-top: 1px solid var(--ink-3);
  padding-top: 3px; font-weight: 700; color: var(--ink);
}
.a4-foot .stamp {
  font-family: 'Amiri', serif; font-size: 9pt; font-weight: 700; color: var(--pc-deep);
  text-align: center; padding: 8px 14px; border: 1.5px dashed var(--pc);
  border-radius: 10px;
}

/* ── الزر العائم للجوال ── */
.mobile-toggle {
  display: none; position: fixed; bottom: 22px; left: 22px;
  width: 60px; height: 60px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none; cursor: pointer; color: #fff; font-size: 24px; z-index: 80;
  box-shadow: var(--sh-glow);
  align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.mobile-toggle:active { transform: scale(0.92); }

/* ── المودالات ── */
.modal-bg {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(42,36,64,0.45); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 24px; width: 100%; max-width: 560px;
  max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: var(--sh-lg); overflow: hidden;
  animation: cardIn 0.32s cubic-bezier(0.16,1,0.3,1);
}
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-h h3 { font-family: 'Cairo', sans-serif; font-size: 17px; font-weight: 800; color: var(--ink); }
.modal-h .close {
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-size: 15px; transition: all 0.15s;
}
.modal-h .close:hover { background: var(--l1-tint); color: var(--l1-deep); border-color: var(--l1); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 22px; }

/* مودال التأكيد الودّي */
.confirm-modal .modal { max-width: 440px; text-align: center; }
.confirm-msg { padding: 30px 28px 8px; }
.confirm-msg .icon {
  font-size: 44px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.confirm-msg h4 { font-family: 'Cairo', sans-serif; font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.confirm-msg p { font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.confirm-actions { display: flex; gap: 10px; padding: 18px 28px 26px; }
.confirm-actions button {
  flex: 1; padding: 13px; border-radius: 13px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; transition: all 0.15s;
}
.btn-fill { border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2); }
.btn-fill:hover { border-color: var(--brand); color: var(--brand); }
.btn-go {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: var(--sh-md);
}
.btn-go:hover { box-shadow: var(--sh-glow); transform: translateY(-1px); }

/* صفوف السجل */
.rec-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px; margin-bottom: 8px;
  background: var(--cream); border: 1px solid var(--line);
}
.rec-row .av {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-family: 'Amiri', serif; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rec-row .ti { flex: 1; min-width: 0; }
.rec-row .ti b { display: block; font-size: 14px; font-weight: 700; color: var(--ink); }
.rec-row .ti span { font-size: 12px; color: var(--ink-2); }
.rec-row time { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.empty-state .icon { }

/* ── شاشة التحميل ── */
.global-loader {
  position: fixed; inset: 0; z-index: 400;
  background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity 0.4s; 
}
.global-loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid var(--l2-soft); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.global-loader p { font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* شريط تمرير مخصص */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ═══════════════════════════════════════════
   المؤشرات الحيّة (علامة لكل خطوة) + نقطة التفتيش
   ═══════════════════════════════════════════ */
/* الدائرة الصغيرة جنب كل عنوان خطوة */
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  background: var(--cream-2); color: var(--ink-3);
  border: 2px solid var(--line-2);
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}
/* بطاقة الخطوة عند اكتمالها */
.step-card.filled {
  border-color: var(--l3-soft);
  box-shadow: 0 6px 20px rgba(37,196,196,0.12);
}
.step-card.filled .step-dot {
  background: linear-gradient(135deg, var(--l3), var(--l3-deep));
  color: #fff; border-color: transparent;
  transform: scale(1.05);
}
/* إخفاء الرقم وإظهار ✓ عند الاكتمال */
.step-card.filled .step-dot { font-size: 0; }
.step-card.filled .step-dot::after {
  content: "✓"; font-size: 15px; color: #fff;
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* نقطة التفتيش */
.checkpoint-wrap { padding: 22px 30px 0; }
.checkpoint {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-radius: var(--radius);
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line); box-shadow: var(--sh-sm);
  transition: all 0.3s;
}
.checkpoint.ready {
  background: linear-gradient(120deg, var(--l3-tint), var(--l2-tint));
  border-color: var(--l3-soft);
  box-shadow: 0 10px 30px rgba(37,196,196,0.16);
}
.cp-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cp-ring {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--brand);
  background: conic-gradient(var(--brand) 0deg, var(--cream-2) 0deg);
  position: relative;
  transition: all 0.4s;
}
.cp-ring::before {
  content: ""; position: absolute; inset: 4px;
  background: #fff; border-radius: 50%;
}
.cp-ring span { position: relative; z-index: 1; }
.checkpoint.ready .cp-ring {
  background: linear-gradient(135deg, var(--l3), var(--l3-deep));
}
.checkpoint.ready .cp-ring::before { background: transparent; }
.checkpoint.ready .cp-ring span { color: #fff; font-size: 0; }
.checkpoint.ready .cp-ring span::after {
  content: "✓"; font-size: 22px; color: #fff;
}
.cp-text { min-width: 0; }
.cp-text b {
  display: block; font-family: 'Cairo', sans-serif;
  font-size: 15px; font-weight: 800; color: var(--ink);
}
.cp-text span {
  display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px;
}
.cp-print {
  flex-shrink: 0; padding: 14px 26px; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 800; color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: var(--sh-md);
  transition: all 0.18s;
}
.cp-print:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--sh-glow); }
.cp-print:active:not(:disabled) { transform: translateY(0); }
.cp-print:disabled {
  opacity: 0.4; cursor: not-allowed; box-shadow: none;
  background: var(--ink-3);
}

/* ═══════════════════════════════════════════
   الطباعة
   ═══════════════════════════════════════════ */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .aurora-bg, .sidebar, .main-head, .panel-strip, .ctl-row,
  .preview-toolbar, .mobile-toggle, .modal-bg, .global-loader,
  .checkpoint-wrap, .steps-col, .style-chooser, .bloom-toast { display: none !important; }
  .app { display: block !important; }
  .workspace, .preview-col { display: block !important; padding: 0 !important; max-height: none !important; overflow: visible !important; position: static !important; }
  .main { height: auto; overflow: visible; padding: 0; }
  .preview-wrap { padding: 0; }
  .a4 {
    width: 210mm; min-height: 297mm; height: auto; margin: 0; border-radius: 0;
    box-shadow: none; page-break-after: always; break-after: page;
  }
  .a4:last-child { page-break-after: auto; break-after: auto; }
  /* منع تقطيع الوحدات الصغيرة بين الصفحات (انسياب نظيف بلا قصّ) */
  .a4-head, .a4-info, .a4-goal, .a4-foot,
  .card, .obj-col, .obj, .alt, .eval-cell, .sup, .item {
    break-inside: avoid; page-break-inside: avoid;
  }
  /* القسم الضخم (البدائل) مسموح ينساب بين الصفحات بين مراحله */
  .card--flow { break-inside: auto; page-break-inside: auto; }
  /* ضمان طباعة الألوان */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ═══════════════════════════════════════════
   الاستجابة (جوال + لوحي)
   ═══════════════════════════════════════════ */
@media (max-width: 1100px) {
  .ctl-row { grid-template-columns: 1fr; }
  .strip-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app.show { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: -100vh; left: 0; right: 0; top: auto;
    width: 100%; height: 86vh; border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 26px 26px 0 0;
    transition: bottom 0.34s cubic-bezier(0.4,0,0.2,1);
    z-index: 70; box-shadow: 0 -12px 44px rgba(110,60,224,0.18);
  }
  .sidebar::before {
    content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    width: 46px; height: 5px; border-radius: 5px; background: var(--line-2);
  }
  .sidebar.show { bottom: 0; }
  .sb-head { padding-top: 26px; }
  /* الزر العائم يظهر فقط بعد تسجيل الدخول (عند ظهور التطبيق) —
     ولا يظهر على شاشة الدخول حتى لا يربك المستخدم */
  .mobile-toggle { display: none; }
  .app.show ~ .mobile-toggle { display: flex; }
  .main { height: auto; min-height: 100vh; }
  .main-head { padding: 16px 18px; }
  .panel-strip, .ctl-row, .preview-wrap { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 640px) {
  .main-head { flex-wrap: wrap; }
  .main-head h2 { font-size: 18px; }
  /* أقسام الخطة: عمودان متساويان على الجوال (٣ صفوف منتظمة) */
  .sec-chips { grid-template-columns: repeat(2, 1fr); }
  /* العنوان يبقى في سطر واحد على الجوال — يتكيّف حجمه مع عرض الشاشة */
  .auth-card h1 { white-space: nowrap; font-size: clamp(18px, 5.4vw, 24px); letter-spacing: -0.5px; }
  .strip-row { grid-template-columns: 1fr; }
  .students-list { grid-template-columns: 1fr; }
  .dates-grid { grid-template-columns: 1fr; }
  .pt-meta { gap: 12px; }
  .checkpoint-wrap { padding-left: 18px; padding-right: 18px; }
  .checkpoint { flex-direction: column; align-items: stretch; gap: 14px; }
  .cp-print { width: 100%; padding: 15px; }
  /* ملاحظة: لا نعيد تشكيل A4 على الجوال — تُعرض بمقاسها الحقيقي
     مصغّرة بـ zoom (انظر قاعدة @media screen أعلاه) للحفاظ على
     تطابق المعاينة مع الطباعة تماماً. */
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات النسخة الموحّدة
   ١) تخطيط عمودين (خطوات + معاينة حيّة) للديسكتوب
   ٢) توزيع بلمسة: صور المستوى + حركة الطيران + نبضة العدّاد
   ٣) خيارات ستايل الطباعة
   ٤) شريط طباعة ثابت للجوال + احتفال اكتمال البستان
   ═══════════════════════════════════════════════════════════════ */

/* ── المعاينة بمقاس الورقة الحقيقي مصغّرة بصرياً (مطابقة ١٠٠٪ للطباعة) ──
   نستخدم zoom عبر متغيّر يضبطه app.js حسب عرض العمود.
   مهم: zoom داخل @media screen فقط → الطباعة تتجاهله وتطبع بالمقاس الكامل. */
@media screen {
  .preview-wrap .a4 {
    width: 210mm; height: auto; min-height: 297mm;
    zoom: var(--pv-zoom, 1);
    margin: 0 auto 18px;
  }
}

/* ── خيارات ستايل الطباعة ── */
.style-chooser {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: 22px 30px 0;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--sh-sm);
}
.style-chooser .sc-label {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.sc-options { display: flex; gap: 8px; margin-right: auto; flex-wrap: wrap; }
.sc-opt {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 12px; cursor: pointer;
  /* أزرار ستايل الطباعة — موحّدة مع بقية الأدوات */
  font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2);
  transition: all 0.16s;
}
.sc-opt:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.sc-opt.active { border-color: var(--brand); color: var(--brand); background: var(--l2-tint); }
.sc-swatch { width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); }
.sc-swatch.bloom  { background: linear-gradient(135deg, var(--l1), var(--l2), var(--l3)); }
.sc-swatch.royal  { background: linear-gradient(135deg, #1B365D 40%, #c8a97e 40%); }
.sc-swatch.modern { background: linear-gradient(135deg, #5a7367 50%, #b89b6a 50%); }

/* ── صور المستوى (تكدّس داخل زر المستوى) ── */
.lv-ava { display: flex; gap: -4px; margin-top: 6px; min-height: 0; }
.lv-ava:empty { display: none; }
.lv-ava .av {
  width: 22px; height: 22px; border-radius: 50%; margin-inline-start: -6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 800; color: #fff;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  animation: avaPop 0.32s cubic-bezier(0.34,1.56,0.64,1);
}
.lv-ava .av:first-child { margin-inline-start: 0; }
.lv-ava .more {
  width: 22px; height: 22px; border-radius: 50%; margin-inline-start: -6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: var(--ink-2);
  background: var(--cream-2); border: 2px solid #fff;
}
.lv-btn[data-level="1"] .lv-ava .av { background: linear-gradient(135deg, var(--l1), var(--l1-deep)); }
.lv-btn[data-level="2"] .lv-ava .av { background: linear-gradient(135deg, var(--l2), var(--l2-deep)); }
.lv-btn[data-level="3"] .lv-ava .av { background: linear-gradient(135deg, var(--l3), var(--l3-deep)); }
@keyframes avaPop { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }

/* نبضة العدّاد عند الإضافة */
@keyframes countPop {
  0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); }
}
.lv-count.pop { animation: countPop 0.4s cubic-bezier(0.34,1.56,0.64,1); }

/* ── شريحة الطالب الطائرة ── */
.fly-chip {
  position: fixed; z-index: 250; pointer-events: none;
  padding: 7px 13px; border-radius: 14px;
  font-family: 'Tajawal', sans-serif; font-size: 13px; font-weight: 700; color: #fff;
  box-shadow: var(--sh-md); white-space: nowrap;
  transition: transform 0.55s cubic-bezier(0.5,0,0.2,1), opacity 0.55s ease;
}
.fly-chip.l1 { background: linear-gradient(135deg, var(--l1), var(--l1-deep)); }
.fly-chip.l2 { background: linear-gradient(135deg, var(--l2), var(--l2-deep)); }
.fly-chip.l3 { background: linear-gradient(135deg, var(--l3), var(--l3-deep)); }

/* تلميح المستوى النشط فوق قائمة الطلاب */
.students-list.wash { animation: washIn 0.4s ease; }
@keyframes washIn { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── لمسة لون المستوى الباهتة على صندوق توزيع الطلاب ── */
.students-list.lv-1, .students-list.lv-2, .students-list.lv-3 {
  padding: 11px; border-radius: 14px; transition: background 0.25s ease;
}
.students-list.lv-1 { background: var(--l1-tint); }
.students-list.lv-2 { background: var(--l2-tint); }
.students-list.lv-3 { background: var(--l3-tint); }
/* التحويم وحالة الاختيار تأخذ لون المستوى نفسه */
.students-list.lv-1 .student-chk:hover { border-color: var(--l1); background: #fff; }
.students-list.lv-2 .student-chk:hover { border-color: var(--l2); background: #fff; }
.students-list.lv-3 .student-chk:hover { border-color: var(--l3); background: #fff; }
.students-list.lv-1 .student-chk input:checked ~ .box { background: linear-gradient(135deg, var(--l1), var(--l1-deep)); }
.students-list.lv-2 .student-chk input:checked ~ .box { background: linear-gradient(135deg, var(--l2), var(--l2-deep)); }
.students-list.lv-3 .student-chk input:checked ~ .box { background: linear-gradient(135deg, var(--l3), var(--l3-deep)); }
.students-list.lv-1 .student-chk input:checked ~ .name { color: var(--l1-deep); }
.students-list.lv-2 .student-chk input:checked ~ .name { color: var(--l2-deep); }
.students-list.lv-3 .student-chk input:checked ~ .name { color: var(--l3-deep); }

/* ── احتفال اكتمال البستان ── */
.bloom-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(140%);
  z-index: 260; display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-radius: 18px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--sh-lg);
  opacity: 0; transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), opacity 0.4s ease;
  max-width: 90vw;
}
.bloom-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.bloom-toast .bt-icon { font-size: 24px; font-weight: 800; color: var(--l2-deep); animation: avaPop 0.5s ease; }
.bloom-toast .bt-text { display: flex; flex-direction: column; }
.bloom-toast .bt-text b { font-family: 'Cairo', sans-serif; font-size: 14.5px; font-weight: 800; color: var(--ink); }
.bloom-toast .bt-text span { font-size: 12px; color: var(--ink-2); }

/* ═══ تخطيط العمودين (ديسكتوب فقط) ═══ */
@media (min-width: 1024px) {
  .workspace {
    display: flex; gap: 26px; align-items: flex-start; padding: 0 30px;
  }
  .workspace .ctl-row,
  .workspace .panel-strip,
  .workspace .checkpoint-wrap { padding-left: 0; padding-right: 0; }
  .workspace .ctl-row { grid-template-columns: 1fr; }
  .style-chooser { margin: 0 0 16px; }

  .steps-col { flex: 1 1 460px; min-width: 0; max-width: 560px; }
  .preview-col {
    flex: 1 1 0; min-width: 0;
    position: sticky; top: 90px;
    max-height: calc(100vh - 110px); overflow-y: auto;
    padding-bottom: 24px;
  }
  .preview-col .preview-wrap { padding: 0; }
  .main { padding-bottom: 40px; }
}

/* ═══ جوال: شريط الطباعة يلتصق أسفل الشاشة ═══ */
@media (max-width: 1023px) {
  .checkpoint-wrap {
    position: sticky; bottom: 0; z-index: 50;
    margin-top: 22px; padding: 12px 18px 16px;
    background: linear-gradient(to top, var(--cream) 70%, transparent);
  }
}

/* ═══════════════════════════════════════════════════════════════
   تحسين الرأس والتذييل (طولي) — اقتراح المستخدم:
   • اسم الطالب بطاقة بارزة في زاوية الرأس (بدل الرقم/الفصل/الحصة)
   • إزالته من المنتصف + تذييل نحيف بسطر واحد
   الهدف: كسب مساحة عمودية وتخفيف الانضغاط مع الإبقاء على الطولي
   ═══════════════════════════════════════════════════════════════ */

/* بطاقة اسم الطالب على ترويسة A4 الملوّنة */
.a4-head .student-tag {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 9px 18px; border-radius: 14px; flex-shrink: 0;
  background: rgba(255,255,255,0.16);
  border: 1.5px solid rgba(255,255,255,0.42);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  backdrop-filter: blur(3px);
  max-width: 48%;
}
.a4-head .student-tag .st-lab {
  font-size: 9pt; font-weight: 700; color: #fff; opacity: 0.88; letter-spacing: 0.5px;
}
.a4-head .student-tag .st-name {
  font-family: 'Cairo', sans-serif; font-size: 17pt; font-weight: 800; color: #fff;
  line-height: 1.15;
}

/* منتصف الورقة: عمود واحد (أُزيل صندوق الطالب) */
.a4-info { display: block; }
.a4-info .meta { margin-top: 6px; }

/* تذييل نحيف بسطر واحد */
.a4-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 7mm; margin-top: auto;
  border-top: 2px solid var(--pc-soft); background: var(--pc-tint);
}
.a4-foot .foot-card {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px; border-radius: 12px;
  background: #fff; border: 1.5px solid var(--pc-soft);
}
.a4-foot .foot-card .fc-lab { font-size: 9pt; font-weight: 700; color: var(--pc-deep); }
.a4-foot .foot-card .fc-name {
  font-family: 'Cairo', sans-serif; font-size: 12pt; font-weight: 800; color: var(--ink);
}
.a4-foot .foot-prog {
  margin: 0 auto; font-family: 'Amiri', serif; font-size: 11pt; font-weight: 700;
  color: var(--pc-deep); letter-spacing: 0.3px;
}
.a4-foot .foot-sign {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 9.5pt; font-weight: 700; color: var(--ink-2);
}
.a4-foot .foot-sign .sign-line {
  display: inline-block; width: 42mm; height: 1px;
  border-bottom: 1.5px dotted var(--ink-3);
}



/* FULL_THEME_SITE_PATCH */
.aurora-bg {
  background:
    radial-gradient(ellipse 70% 55% at 10% 8%, rgba(196,154,74,0.13), transparent 60%),
    radial-gradient(ellipse 58% 48% at 92% 18%, rgba(11,107,99,0.15), transparent 58%),
    radial-gradient(ellipse 62% 52% at 82% 92%, rgba(90,162,153,0.14), transparent 60%),
    radial-gradient(ellipse 50% 42% at 18% 94%, rgba(69,123,157,0.10), transparent 55%),
    linear-gradient(165deg, #fbf8f0 0%, #f7f3ea 100%);
}
.aurora-bg::after {
  background-image: radial-gradient(rgba(11,107,99,0.045) 1px, transparent 1px);
  opacity: .55;
}
.auth-card::before,
.side-logo::before,
.preview-toolbar .dot,
.wizard-progress .bar,
.btn-primary,
.btn-go {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
}
.auth-cube,
.side-logo .mark {
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 58%, var(--gold)) !important;
}
.side-title,
.auth-title,
.page-title,
.ctl-card h3,
.preview-toolbar .pt-info b {
  color: var(--brand) !important;
}
.nav-item.active,
.nav-item:hover {
  border-color: rgba(11,107,99,.22) !important;
  background: rgba(11,107,99,.08) !important;
}
.sc-swatch.bloom {
  background: linear-gradient(135deg, #4f7d5a, #d9c6a3 58%, #e88d7a) !important;
}
.sc-swatch.royal {
  background: linear-gradient(135deg, #084f49, #0b6b63 58%, #c49a4a) !important;
}
.sc-swatch.modern {
  background: linear-gradient(135deg, #1e3a5f, #2563a8 58%, #2dd4bf) !important;
}

/* ═════════════ بطاقة المتابعة المنزلية ═════════════ */
.print-target-seg {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
  margin-top: 10px;
}
.ptarget {
  border: 1.5px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  border-radius: 13px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.ptarget:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); }
.ptarget.active { background: var(--l2-tint); border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 1px rgba(11,107,99,.08); }
.home-card-fields { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
.home-card-fields textarea,
.home-card-fields select {
  width: 100%;
  border: 1.5px solid var(--line-2);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 12px;
  outline: none;
  transition: all .16s ease;
}
.home-card-fields textarea { resize: vertical; line-height: 1.7; min-height: 86px; }
.home-card-fields textarea:focus,
.home-card-fields select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,107,99,.08); }
.home-settings-card.home-active { border-color: rgba(11,107,99,.28); background: linear-gradient(180deg, rgba(11,107,99,.045), #fff 44%); }

.a4.home-card {
  height: 297mm;
  min-height: 297mm;
  overflow: hidden;
  padding: 0;
  background: #fffdfa;
  --hc: #0b6b63;
  --hc-deep: #084f49;
  --hc-soft: #dcefe8;
  --hc-tint: #f3faf7;
  --hc-warm: #c49a4a;
  --hc-line: #e4d9c6;
  color: #26352f;
  border-radius: 8px;
  box-shadow: var(--sh-lg);
}
.a4.home-card.subj-islamic { --hc:#0b6b63; --hc-deep:#084f49; --hc-soft:#dcefe8; --hc-tint:#f3faf7; --hc-warm:#c49a4a; }
.a4.home-card.subj-lughati { --hc:#b65f3a; --hc-deep:#884225; --hc-soft:#f4dfd4; --hc-tint:#fff7f2; --hc-warm:#d49a57; }
.a4.home-card.subj-math { --hc:#4555a3; --hc-deep:#303a78; --hc-soft:#dfe4ff; --hc-tint:#f5f7ff; --hc-warm:#8a78d6; }
.a4.home-card.subj-science { --hc:#16807a; --hc-deep:#0f5d59; --hc-soft:#d6f0ee; --hc-tint:#f1fbfa; --hc-warm:#70a65a; }
.a4.home-card.subj-digital { --hc:#2563a8; --hc-deep:#1e3f73; --hc-soft:#dceaff; --hc-tint:#f3f8ff; --hc-warm:#2dd4bf; }
.a4.home-card.subj-english { --hc:#6d5bb5; --hc-deep:#473982; --hc-soft:#e7e1ff; --hc-tint:#f8f6ff; --hc-warm:#68a7d8; }
.a4.home-card.subj-social { --hc:#7b6a3a; --hc-deep:#5a4b26; --hc-soft:#eee7d2; --hc-tint:#fbf8ef; --hc-warm:#9f7d41; }
.a4.home-card.subj-life { --hc:#8f5f62; --hc-deep:#6d4648; --hc-soft:#f3dedc; --hc-tint:#fff7f6; --hc-warm:#78a36f; }
.a4.home-card.subj-default { --hc:#0b6b63; --hc-deep:#084f49; --hc-soft:#dcefe8; --hc-tint:#f3faf7; --hc-warm:#c49a4a; }

.hc-watermark {
  position: absolute;
  left: 15mm;
  bottom: 18mm;
  font-family: 'Amiri', serif;
  font-size: 92pt;
  line-height: 1;
  color: var(--hc);
  opacity: .045;
  z-index: 0;
  pointer-events: none;
}
.hc-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14mm;
  padding: 10mm 11mm 9mm;
  color: #fff;
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.20), transparent 28%),
    linear-gradient(125deg, var(--hc-deep), var(--hc));
  border-bottom: 4px solid var(--hc-warm);
}
.hc-head::after {
  content: "";
  position: absolute;
  inset-inline-end: -30mm;
  top: -34mm;
  width: 82mm;
  height: 82mm;
  border-radius: 50%;
  border: 18mm solid rgba(255,255,255,.08);
}
.hc-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.hc-brand img { width: auto; height: 39px; display: block; flex-shrink: 0; }
.hc-title { font-family: 'Cairo', sans-serif; font-size: 23pt; font-weight: 900; line-height: 1.15; }
.hc-subtitle { font-size: 9.5pt; font-weight: 600; opacity: .92; margin-top: 4px; }
.hc-subject-badge {
  position: relative; z-index: 1;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 34mm; min-height: 30mm;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 18px;
  background: rgba(255,255,255,.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
  backdrop-filter: blur(3px);
}
.hc-subject-badge span { font-family: 'Amiri', serif; font-size: 24pt; font-weight: 700; line-height: 1; }
.hc-subject-badge b { font-size: 7.5pt; font-weight: 800; margin-top: 5px; text-align: center; }
.hc-main { position: relative; z-index: 1; padding: 8mm 11mm 6mm; display: flex; flex-direction: column; gap: 4.8mm; }
.hc-hero { display: grid; grid-template-columns: .92fr 1.35fr; gap: 5mm; }
.hc-hero-card {
  border: 1.4px solid var(--hc-soft);
  border-radius: 18px;
  background: #fff;
  padding: 12px 15px;
  min-height: 24mm;
  box-shadow: 0 8px 24px rgba(46,30,10,.05);
}
.hc-hero-card span { display: block; color: var(--hc-deep); font-size: 9pt; font-weight: 800; margin-bottom: 5px; }
.hc-hero-card b { display: block; color: #22332d; font-family: 'Cairo', sans-serif; font-size: 16pt; font-weight: 900; line-height: 1.35; }
.hc-hero-card.lesson { background: linear-gradient(135deg, var(--hc-tint), #fff); }
.hc-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3.2mm; }
.hc-info-item {
  border: 1px solid var(--hc-soft);
  border-radius: 13px;
  background: #fff;
  padding: 8px 10px;
  min-height: 15mm;
}
.hc-info-item span { display: block; font-size: 7.5pt; font-weight: 800; color: var(--hc); margin-bottom: 2px; }
.hc-info-item b { display: block; font-size: 9.2pt; font-weight: 800; color: #26352f; line-height: 1.35; }
.hc-section {
  border: 1.2px solid var(--hc-soft);
  border-radius: 17px;
  overflow: hidden;
  background: rgba(255,255,255,.94);
  box-shadow: 0 7px 20px rgba(46,30,10,.045);
}
.hc-sec-title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px 8px;
  background: linear-gradient(90deg, var(--hc-tint), #fff);
  border-bottom: 1px solid var(--hc-soft);
}
.hc-sec-title span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 8px;
  background: var(--hc);
  color: #fff;
  font-size: 9pt;
  font-weight: 900;
}
.hc-sec-title b { font-family: 'Cairo', sans-serif; font-size: 11.5pt; font-weight: 900; color: var(--hc-deep); }
.hc-section p { margin: 0; padding: 11px 15px 13px; font-size: 10.5pt; line-height: 1.85; color: #26352f; font-weight: 600; }
.hc-section ul { margin: 0; padding: 10px 18px 12px 13px; list-style: none; }
.hc-section li {
  position: relative;
  padding: 4px 17px 4px 0;
  font-size: 10.3pt;
  line-height: 1.72;
  color: #26352f;
  font-weight: 600;
}
.hc-section li::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hc);
}
.hc-goal { border-right: 5px solid var(--hc); }
.hc-activity { border-right: 5px solid var(--hc-warm); }
.hc-family { border-right: 5px solid var(--hc); }
.hc-note.muted p { color: #7a817d; font-weight: 500; }
.hc-empty { color: #7a817d !important; }
.hc-message {
  display: flex; align-items: center; gap: 10px;
  border-radius: 16px;
  border: 1.2px solid var(--hc-soft);
  background: linear-gradient(135deg, var(--hc-tint), #fff);
  padding: 11px 14px;
}
.hc-message b {
  flex-shrink: 0;
  color: var(--hc-deep);
  font-size: 9.5pt;
  font-weight: 900;
  border-left: 1px solid var(--hc-soft);
  padding-left: 10px;
}
.hc-message span { color: #2d3b36; font-size: 10pt; line-height: 1.65; font-weight: 700; }
.hc-foot {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6mm 11mm;
  background: var(--hc-tint);
  border-top: 1.5px solid var(--hc-soft);
  color: var(--hc-deep);
  font-size: 9pt;
  font-weight: 800;
}
.hc-foot b { color: #22332d; font-weight: 900; }

@media print {
  .a4.home-card { box-shadow: none !important; border-radius: 0 !important; }
}

@media (max-width: 700px) {
  .print-target-seg { grid-template-columns: 1fr; }
}

/* تحسينات بطاقة الأسرة v2: ملاحظات خاصة + احتواء كامل داخل صفحة A4 */
.field-hint {
  margin: 6px 2px 0;
  color: #6b756f;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 600;
}
.home-note-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.home-note-list .empty {
  color: #87908a;
  font-size: 12px;
  font-weight: 700;
}
.home-note-list button {
  border: 1px solid rgba(11,107,99,.18);
  background: rgba(11,107,99,.07);
  color: var(--brand);
  border-radius: 999px;
  padding: 5px 9px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.home-card-fields select + textarea { margin-top: 8px; }

.a4.home-card { position: relative; display: flex; flex-direction: column; }
.hc-head { padding: 7mm 10mm 6.5mm; }
.hc-brand img { height: 32px; }
.hc-title { font-size: 19.5pt; }
.hc-subtitle { font-size: 8.5pt; margin-top: 2px; }
.hc-subject-badge { width: 28mm; min-height: 24mm; border-radius: 15px; }
.hc-subject-badge span { font-size: 20pt; }
.hc-subject-badge b { font-size: 7pt; margin-top: 3px; }
.hc-main { flex: 1; padding: 5mm 9.5mm 18mm; gap: 3mm; }
.hc-hero { gap: 3.3mm; }
.hc-hero-card { min-height: 18mm; padding: 8px 12px; border-radius: 15px; }
.hc-hero-card span { font-size: 8pt; margin-bottom: 2px; }
.hc-hero-card b { font-size: 13.2pt; line-height: 1.25; }
.hc-info-grid { gap: 2.1mm; }
.hc-info-item { min-height: 11.5mm; padding: 5px 8px; border-radius: 11px; }
.hc-info-item span { font-size: 6.8pt; margin-bottom: 1px; }
.hc-info-item b { font-size: 8.2pt; line-height: 1.25; }
.hc-section { border-radius: 14px; }
.hc-sec-title { padding: 6px 10px 5px; gap: 6px; }
.hc-sec-title span { width: 20px; height: 20px; border-radius: 7px; font-size: 8pt; }
.hc-sec-title b { font-size: 10pt; }
.hc-section p { padding: 7px 11px 8px; font-size: 9.3pt; line-height: 1.55; }
.hc-section ul { padding: 7px 15px 8px 10px; }
.hc-section li { padding: 2px 14px 2px 0; font-size: 9.1pt; line-height: 1.45; }
.hc-section li::before { top: 9px; width: 5px; height: 5px; }
.hc-goal, .hc-activity, .hc-family { border-right-width: 4px; }
.hc-message { border-radius: 13px; padding: 7px 10px; gap: 8px; }
.hc-message b { font-size: 8.4pt; padding-left: 8px; }
.hc-message span { font-size: 9pt; line-height: 1.45; }
.hc-foot { padding: 4mm 9.5mm; font-size: 8.2pt; }

/* ════════════════════════════════════════════════════════
   ✦ مساعدة اختيار المستوى (زر «كيف أختار؟» + النافذة)
   إضافة مستقلة — لا تؤثر على بقية التنسيقات
   ════════════════════════════════════════════════════════ */
.lvlhelp-bar{
  width:100%; margin:0 0 12px; display:flex; align-items:center; justify-content:center;
  gap:9px; font-family:inherit; cursor:pointer; border:1.5px dashed var(--line-2);
  border-radius:13px; background:linear-gradient(100deg,var(--l1-tint),var(--l2-tint),var(--l3-tint));
  padding:11px 12px; font-size:13px; font-weight:700; color:var(--ink); transition:all .2s;
}
.lvlhelp-bar:hover{ border-style:solid; transform:translateY(-1px); box-shadow:0 8px 20px rgba(30,53,49,.10); }
.lvlhelp-bar .q{
  width:20px; height:20px; border-radius:50%; background:var(--ink); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:800; flex-shrink:0;
}

.lvlhelp-backdrop{ position:fixed; inset:0; background:rgba(20,30,28,.42); opacity:0; pointer-events:none; transition:opacity .25s; z-index:900; }
.lvlhelp-backdrop.show{ opacity:1; pointer-events:auto; }

.lvlhelp-sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:1000; background:var(--cream);
  border-radius:24px 24px 0 0; box-shadow:0 -16px 50px rgba(20,30,28,.30);
  transform:translateY(100%); transition:transform .32s cubic-bezier(.22,1,.36,1);
  max-height:90vh; display:flex; flex-direction:column;
  pointer-events:none;
}
.lvlhelp-sheet.show{ transform:translateY(0); pointer-events:auto; }
.lvlhelp-grip{ width:42px; height:5px; border-radius:5px; background:var(--line-2); margin:10px auto 0; }
.lvlhelp-head{ display:flex; align-items:center; justify-content:space-between; padding:10px 20px 14px; border-bottom:1px solid var(--cream-2); }
.lvlhelp-head h3{ font-family:'Cairo',sans-serif; font-size:17px; color:var(--ink); margin:0; }
.lvlhelp-close{ background:var(--cream-2); border:none; width:30px; height:30px; border-radius:50%; cursor:pointer; font-size:16px; color:var(--ink-2); }
.lvlhelp-body{ overflow-y:auto; padding:18px 20px 26px; }

.lvlhelp-router{ background:var(--paper); border-radius:16px; border:1px solid var(--line-2); padding:6px 16px 14px; margin-bottom:18px; }
.lvlhelp-router .rt{ font-family:'Cairo',sans-serif; font-size:13px; font-weight:700; color:var(--ink); padding:12px 0 6px; display:flex; align-items:center; gap:7px; }
.lvlhelp-router .rt .q{ width:20px; height:20px; border-radius:50%; background:linear-gradient(135deg,var(--l3),var(--l2)); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; }
.lvlhelp-step{ display:flex; gap:11px; padding:11px 2px; border-bottom:1px solid var(--cream-2); }
.lvlhelp-step:last-of-type{ border-bottom:none; }
.lvlhelp-step .num{ flex-shrink:0; width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:12px; color:#fff; }
.lvlhelp-step .num.c1{ background:var(--l1); }
.lvlhelp-step .num.c2{ background:var(--l2); }
.lvlhelp-step .num.c3{ background:var(--l3); }
.lvlhelp-step .q-txt{ font-size:12.5px; line-height:1.6; color:var(--ink); }
.lvlhelp-step .arrow{ font-weight:800; }
.lvlhelp-step .arrow.a1{ color:var(--l1-deep); }
.lvlhelp-step .arrow.a2{ color:var(--l2-deep); }
.lvlhelp-step .arrow.a3{ color:var(--l3-deep); }
.lvlhelp-foot{ font-size:11.5px; color:var(--ink-3); text-align:center; padding-top:11px; line-height:1.6; }

.lvlhelp-ct{ font-family:'Cairo',sans-serif; font-size:13px; font-weight:700; color:var(--ink-2); margin:0 2px 10px; }
.lvlhelp-card{ background:var(--paper); border-radius:15px; border:1px solid var(--line-2); overflow:hidden; margin-bottom:12px; }
.lvlhelp-card .ch{ display:flex; align-items:center; gap:9px; padding:11px 14px; color:#fff; }
.lvlhelp-card[data-l="1"] .ch{ background:linear-gradient(135deg,var(--l1),var(--l1-deep)); }
.lvlhelp-card[data-l="2"] .ch{ background:linear-gradient(135deg,var(--l2),var(--l2-deep)); }
.lvlhelp-card[data-l="3"] .ch{ background:linear-gradient(135deg,var(--l3),var(--l3-deep)); }
.lvlhelp-card .ch .n{ font-family:'Cairo',sans-serif; font-weight:700; font-size:14px; }
.lvlhelp-card .ch .d{ font-size:11px; opacity:.85; }
.lvlhelp-card .cb{ padding:12px 14px 14px; }
.lvlhelp-card .id{ font-size:12.5px; line-height:1.65; color:var(--ink-2); margin-bottom:10px; }
.lvlhelp-card .diff{ font-size:11.5px; line-height:1.55; color:var(--ink-2); background:var(--cream); border-radius:10px; padding:9px 11px; border:1px dashed var(--line-2); }
.lvlhelp-card .diff b{ color:var(--ink); }
.lvlhelp-card .note{ font-size:11.5px; line-height:1.55; color:var(--l3-deep); background:var(--l3-tint); border:1px solid var(--l3-soft); border-radius:10px; padding:9px 11px; margin-top:9px; display:flex; gap:7px; }
.lvlhelp-card .note .ic{ flex-shrink:0; font-size:13px; }

/* تقليل الفراغ بين بطاقة المستويات وبطاقة الطلاب عند تكدّسهما (جوال/لوحي) */
@media (max-width:1100px){ .lvl-students-row{ gap:10px; } }

/* على الشاشات الكبيرة: النافذة في المنتصف بدل أسفل الشاشة */
@media (min-width:620px){
  .lvlhelp-sheet{ left:50%; right:auto; bottom:auto; top:50%; transform:translate(-50%,-44%) scale(.97); width:440px; border-radius:24px; opacity:0; pointer-events:none; }
  .lvlhelp-sheet.show{ transform:translate(-50%,-50%) scale(1); opacity:1; pointer-events:auto; }
  .lvlhelp-grip{ display:none; }
}
