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

/* توكنز الهوية (ألوان/ظلال/زوايا) انتقلت لملف assets/alwaleed-tokens.css —
   مصدر واحد بدل التكرار بين الملفات. القيم نفسها بلا أي تغيير. */

* { 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; }
.aurora-bg::after { /* طبقة نقاط خفيفة (texture) */
  content: ""; position: absolute; inset: 0; background-size: 22px 22px; }

/* تموّج لطيف للهالات */
@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-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(8,118,107,0.14);
}
.auth-err {
  color: var(--l1-deep); font-size: 13px; font-weight: 600;
  margin-top: 12px; text-align: center;
}
/* .btn-primary انتقل لملف assets/components.css */
.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; }

/* بطاقة المعلم */
/* .teacher-card وحالاتها انتقلت لملف assets/components.css */
.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;
}
.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-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 وكل عناصره الداخلية انتقلت لملف assets/components.css */
.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;
}

.crumb { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

/* مساحة المحتوى */
.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 {
  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 {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(8,118,107,0.12);
}
.field select:disabled { background: var(--cream-2); color: var(--ink-3); cursor: not-allowed; }

/* صفوف عناصر التحكم */
.ctl-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
/* .ctl-card انتقل لملف assets/components.css */
/* .ctl-h وكل عناصرها الداخلية انتقلت لملف assets/components.css */

/* ── أزرار المستويات (هوية لونية كاملة) ── */
.level-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* .lv-btn وكل حالاتها وعناصرها الداخلية انتقلت لملف assets/components.css */

/* ملخص الخطط */
.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; }

/* ── الطلاب ── */
.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 وكل حالاتها وعناصرها الداخلية انتقلت لملف assets/components.css */

/* ── أقسام الخطة ── */
.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 وكل حالاته وعناصره الداخلية انتقلت لملف assets/components.css */

.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 وكل عناصرها انتقلت لملف assets/components.css */

/* شريط معلومات المعاينة */
.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(90deg,#08766b,#61b7aa,#c79a45,#d97559) top left / 100% 4px no-repeat,
    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-info { 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;
}
.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(217,117,89,0.09); border-top: 2.5px solid var(--l1); }
.obj-col.ski { background: rgba(24,160,147,0.09); border-top: 2.5px solid var(--l2); }
.obj-col.emo { background: rgba(38,79,102,0.08); 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); }
.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;
}

/* ── المودالات ── */
.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);
}
/* مودال التأكيد الودّي */
.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); }


/* ── شاشة التحميل ── */
.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 و.step-card.filled (مع حركة pop) انتقلت لملف assets/components.css */

/* نقطة التفتيش */
.checkpoint-wrap { padding: 22px 30px 0; }
/* .checkpoint و.checkpoint.ready انتقلتا لملف assets/components.css */
/* .cp-left و.cp-ring انتقلتا لملف assets/components.css */
/* قواعد .checkpoint.ready .cp-ring انتقلت لملف assets/components.css */
/* .cp-text و.cp-print انتقلتا لملف assets/components.css */

/* ═══════════════════════════════════════════
   الطباعة
   ═══════════════════════════════════════════ */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .aurora-bg, .main-head, .panel-strip, .ctl-row,
  .preview-toolbar, .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, .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; }
  .main { height: auto; min-height: 100vh; }
  .panel-strip, .ctl-row, .preview-wrap { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 640px) {
  /* أقسام الخطة: عمودان متساويان على الجوال (٣ صفوف منتظمة) */
  .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 (الجوال) انتقل لملف assets/components.css */
  /* .cp-print (الجوال) انتقلت لملف assets/components.css */
  /* ملاحظة: لا نعيد تشكيل 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 انتقلت لملف assets/components.css */
.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); }

/* ── صور المستوى (تكدّس داخل زر المستوى) ── */
.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 .lv-ava انتقلت لملف assets/components.css */
@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-N .student-chk انتقلت لملف assets/components.css */

/* ── احتفال اكتمال البستان ── */
.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 (سطح المكتب) انتقلت لملف assets/components.css */

  .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(8,118,107,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(8,118,107,0.045) 1px, transparent 1px);
  opacity: .55;
}
.auth-card::before,
.side-logo::before,
.preview-toolbar .dot,
.wizard-progress .bar,
.btn-go {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
}
.side-title,
.auth-title,
.page-title,
.preview-toolbar .pt-info b {
  color: var(--brand) !important;
}
.sc-swatch.bloom {
  background: linear-gradient(135deg, #4f7d5a, #d9c6a3 58%, #e88d7a) !important;
}
.sc-swatch.royal {
  background: linear-gradient(135deg, #084f49, #08766b 58%, #c79a45) !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(8,118,107,.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(8,118,107,.08); }
.home-settings-card.home-active { border-color: rgba(8,118,107,.28); background: linear-gradient(180deg, rgba(8,118,107,.045), #fff 44%); }

.a4.home-card {
  height: 297mm;
  min-height: 297mm;
  overflow: hidden;
  padding: 0;
  background: #fffdfa;
  --hc: #08766b;
  --hc-deep: #084f49;
  --hc-soft: #dcefe8;
  --hc-tint: #f3faf7;
  --hc-warm: #c79a45;
  --hc-line: #e4d9c6;
  color: #26352f;
  border-radius: 8px;
  box-shadow: var(--sh-lg);
}
.a4.home-card.subj-islamic { --hc:#08766b; --hc-deep:#084f49; --hc-soft:#dcefe8; --hc-tint:#f3faf7; --hc-warm:#c79a45; }
.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:#1f8a5b; --hc-deep:#14613f; --hc-soft:#d7efe2; --hc-tint:#f1faf5; --hc-warm:#70a65a; }
.a4.home-card.subj-digital { --hc:#1f8fb0; --hc-deep:#155f76; --hc-soft:#d6ecf3; --hc-tint:#f0f9fc; --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:#08766b; --hc-deep:#084f49; --hc-soft:#dcefe8; --hc-tint:#f3faf7; --hc-warm:#c79a45; }

.hc-watermark {
  position: absolute;
  left: 15mm;
  bottom: 18mm;
  font-family: 'Amiri', serif;
  font-size: 92pt;
  line-height: 1;
  color: var(--hc);
  opacity: .06;
  z-index: 0;
  pointer-events: none;
}
.hc-watermark .subj-svg { display: block; width: 46mm; height: 46mm; }
.hc-subject-badge .hc-badge-ic { display: flex; align-items: center; justify-content: center; line-height: 0; }
.hc-subject-badge .hc-badge-ic .subj-svg { width: 13mm; height: 13mm; }
.hc-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14mm; 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; display: block; flex-shrink: 0; }
.hc-title { font-family: 'Cairo', sans-serif; font-weight: 900; line-height: 1.15; }
.hc-subtitle { font-weight: 600; opacity: .92; }
.hc-subject-badge { position: relative; z-index: 1; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px solid rgba(255,255,255,.45); 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-weight: 700; line-height: 1; }
.hc-subject-badge b { font-weight: 800; text-align: center; }
.hc-main { position: relative; z-index: 1; display: flex; flex-direction: column; }
.hc-hero { display: grid; grid-template-columns: .92fr 1.35fr; }
.hc-hero-card { border: 1.4px solid var(--hc-soft); background: #fff; box-shadow: 0 8px 24px rgba(46,30,10,.05); }
.hc-hero-card span { display: block; color: var(--hc-deep); font-weight: 800; }
.hc-hero-card b { display: block; color: #22332d; font-family: 'Cairo', sans-serif; font-weight: 900; }
.hc-hero-card.lesson { background: linear-gradient(135deg, var(--hc-tint), #fff); }
.hc-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.hc-info-item { border: 1px solid var(--hc-soft); background: #fff; }
.hc-info-item span { display: block; font-weight: 800; color: var(--hc); }
.hc-info-item b { display: block; font-weight: 800; color: #26352f; }
.hc-section { border: 1.2px solid var(--hc-soft); 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; 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; background: var(--hc); color: #fff; font-weight: 900; }
.hc-sec-title b { font-family: 'Cairo', sans-serif; font-weight: 900; color: var(--hc-deep); }
.hc-section p { margin: 0; color: #26352f; font-weight: 600; }
.hc-section ul { margin: 0; list-style: none; }
.hc-section li { position: relative; color: #26352f; font-weight: 600; }
.hc-section li::before { content: ""; position: absolute; right: 2px; 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; border: 1.2px solid var(--hc-soft); background: linear-gradient(135deg, var(--hc-tint), #fff); }
.hc-message b { flex-shrink: 0; color: var(--hc-deep); font-weight: 900; border-left: 1px solid var(--hc-soft); }
.hc-message span { color: #2d3b36; 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; background: var(--hc-tint); border-top: 1.5px solid var(--hc-soft); color: var(--hc-deep); 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(8,118,107,.18);
  background: rgba(8,118,107,.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-ct{ font-family:'Cairo',sans-serif; font-size:13px; font-weight:700; color:var(--ink-2); margin:0 2px 10px; }
/* .lvlhelp-card وكل عناصرها الداخلية انتقلت لملف assets/components.css */

/* تقليل الفراغ بين بطاقة المستويات وبطاقة الطلاب عند تكدّسهما (جوال/لوحي) */
@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; }
}
