/* ============================================================
   تابعلي — Design System
   ============================================================ */

:root {
  /* تدرّج ذهبي معدني: غامق ← لامع ← غامق مرتين، فالحافة تبان مصقولة مش لون واحد. */
  --gold-sheen: linear-gradient(115deg,
    #8a6712 0%, #d9ae45 11%, #fff6d2 21%, #d9ae45 31%,
    #7d5c0e 45%, #d9ae45 59%, #fffbe8 69%, #d9ae45 81%, #8a6712 100%);
  /* لوحة الألوان: تشبّع أعلى وتباين أقوى.
     القاعدة اللي كل لون هنا ماشي عليها — الألوان الدلالية (نجاح/تحذير/خطر)
     بتتعرض كنص فوق خلفية soft خفيفة، فلازم تفضل غامقة كفاية في الوضع الفاتح
     وفاتحة كفاية في الليلي. عشان كده كل واحد فيهم له قيمة مستقلة في
     body.dark-mode بدل ما نستخدم نفس الهيكس في الاتنين ويطلع باهت في واحد منهم. */
  --page: #e7ebf5;
  --panel: #ffffff;
  --panel-2: #eef1f9;
  --ink: #0f1428;
  --muted: #59617c;
  --line: #d7dcea;

  /* إنديغو حيوي لكن متزن: اللون المصمت للإجراء الأهم فقط، والباقي درجات باستيل. */
  --accent: #3a4fd8;
  --accent-soft: rgba(58, 79, 216, 0.14);
  --accent-light: #7488ff;
  --action-bg: #2f43cf;
  --action-bg-end: #5566ee;
  --theme-gradient-angle: 135deg;
  --action-ink: #ffffff;
  --teal-vivid: #0a9686;
  --teal-soft: rgba(10, 150, 134, 0.15);
  --violet-vivid: #7343e6;
  --violet-soft: rgba(115, 67, 230, 0.15);
  --search-gold-deep: #7d5910;
  --search-gold: #c39227;
  --search-gold-light: #eccb76;
  --search-gold-glow: rgba(195, 146, 39, 0.28);
  /* زرار البحث المسطّح: درجة أفتح من اللون الأساسي، وظل بنفس اللون. */
  --search-fab: #6172e0;
  --search-fab-strong: #3447c2;
  --search-fab-glow: rgba(58, 79, 216, 0.26);
  --lime: #d9f24d;
  --lime-ink: #24280a;

  --success: #04713d;
  --success-soft: rgba(4, 113, 61, 0.10);
  --warning: #985200;
  --warning-soft: rgba(152, 82, 0, 0.12);
  --danger: #c8111f;
  --danger-soft: rgba(200, 17, 31, 0.10);

  --purple: #7c4dff;
  --cyan: #06b0c4;
  --amber: #f59000;
  --gold: #bd8a00;
  --gold-soft: #fff0bd;
  --mint: #0fbf83;
  --rose: #f0357f;

  /* كروت الإحصائيات الباستيل (ستايل Analytics) */
  --stat-primary: #1636e0;
  --stat-primary-2: #12299f;
  --stat-sky: #d2e6ff;  --stat-sky-ink: #0a55b0;
  --stat-mint: #c9f4dc; --stat-mint-ink: #07854b;
  --stat-lav: #dcdfff;  --stat-lav-ink: #3f45d0;
  --stat-pink: #ffd7e5; --stat-pink-ink: #cc2c63;

  --sidebar-bg: #12162e;
  --sidebar-ink: #aab2d0;

  /* هوية تابعلي: ثابتة مش جزء من الثيم. اللوجو وصفحة الدخول لازم يفضلوا نفس
     الكحلي والتركواز مهما المدرّس اختار — لو اتحسبوا من `--accent` كان اللوجو
     هيتغيّر لونه مع كل ثيم. الكحلي هو كحلي اللوجو (#183866). التركواز بتاع
     اللوجو (#20B5A6) فاتح على نص أو زرار بكتابة بيضا، فالأزرار والكلام بياخدوا
     درجة أغمق منه بتعدّي تباين ٤.٥:١ على الأبيض. */
  --brand-navy: #183866;
  --brand-navy-lift: #25508c;
  --brand-navy-deep: #0d2142;
  --brand-teal: #20B5A6;
  --brand-accent: #0b7d72;
  --brand-accent-deep: #09665d;
  --brand-tile: linear-gradient(145deg, var(--brand-navy-lift), var(--brand-navy) 55%, var(--brand-navy-deep));

  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 8px 24px rgba(20, 32, 78, 0.10);
  --shadow-lg: 0 20px 50px rgba(20, 32, 78, 0.20);
  --speed: 0.22s;

  /* أقل ارتفاع لأي زر أو حقل يتلمس بالصباع على الموبايل. */
  --tap: 44px;

  /* أرضية حجم الخط. القياس لقى خط بينزل لـ٩px وبين ٤٧ و١١٣ عنصر تحت ١٢px في
     كل تبويب — والتباين على نفس النصوص دي ٦٫٨:١، يعني المشكلة مش لون. العربي
     بيتأذى أكتر من اللاتيني في الأحجام الصغيرة لأن النقط والتشكيل بيختفوا.
     كل حاجة كانت ١٢px أو أقل بقت بتقرا من هنا، فالتعديل في مكان واحد. */
  --fs-min: 12px;
}

/* ============================================================
   سلّم نقاط الكسر — خمس درجات بس، والكل بيلتزم بيها
   ------------------------------------------------------------
   1150px  شاشة عريضة  → لابتوب:  تقليل أعمدة الشبكات
    900px  لابتوب      → تابلت:   القائمة الجانبية تبقى درج
    760px  تابلت       → موبايل:  عمود واحد + الجداول تبقى كروت
    620px  موبايل      → موبايل صغير: الشبكات الثنائية تتفرد
    430px  موبايل صغير جداً: كل حاجة عمود واحد

   الميديا كويري ما بتقراش الـ custom properties، فالأرقام مكتوبة
   صريحة — لكن أي قاعدة جديدة لازم تستخدم رقم من الخمسة دول بالظبط،
   ومايتخترعش مقاس جديد، عشان الصفحات كلها تتحوّل مع بعض مش كل
   واحدة لوحدها.
   ============================================================ */

/* نظام باركود الطلاب والحضور */
.qr-action.active { color: #0f766e; background: rgba(20, 184, 166, .12); }
/* جنب أيقونة الباركود على طول — الاتنين بيشتغلوا على نفس الحاجة: الأولى
   بتوري الكارت، والتانية بتفتح الصفحة اللي الكارت بيوديها. */
.parent-report-action { color: var(--accent); }
.parent-report-action:hover { color: var(--action-ink); background: var(--accent); border-color: var(--accent); }
.student-card-qr-preview { display: grid; place-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.student-card-qr-preview img { display: block; width: 54px; height: 54px; image-rendering: pixelated; }

.student-qr-dialog {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .68);
  backdrop-filter: blur(5px);
}

.student-qr-sheet {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 24px;
  padding: 24px;
  background: var(--surface, #fff);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .32);
}

.student-qr-head,
.student-qr-actions,
.attendance-qr-input-row,
.attendance-qr-result {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.student-qr-head { justify-content: space-between; margin-bottom: 18px; }
.student-qr-head h2 { margin: 4px 0; }
.student-qr-head p { margin: 0; color: var(--muted, #64748b); }

.student-qr-print-card {
  width: min(420px, 100%);
  margin: 0 auto 18px;
  padding: 22px;
  border: 2px solid #0f766e;
  border-radius: 20px;
  background: #fff;
  color: #0f172a;
  text-align: center;
}

.student-qr-print-card img { display: block; width: min(330px, 100%); margin: auto; image-rendering: pixelated; }
.student-qr-print-card strong,
.student-qr-print-card span,
.student-qr-print-card small { display: block; }
.student-qr-print-card strong { margin-top: 10px; font-size: 1.35rem; }
.student-qr-print-card span { margin-top: 4px; font-weight: 800; color: #0f766e; }
.student-qr-print-card small { margin-top: 5px; color: #475569; }

.student-qr-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.student-qr-meta > div { padding: 12px; border: 1px solid var(--border, #e2e8f0); border-radius: 14px; }
.student-qr-meta span,
.student-qr-meta strong { display: block; }
.student-qr-meta span { color: var(--muted, #64748b); font-size: .78rem; }
.student-qr-meta strong { margin-top: 4px; }
.student-qr-actions { justify-content: center; }

.student-qr-empty { padding: 46px 20px; text-align: center; }
.student-qr-empty > .icon { width: 74px; height: 74px; color: #0f766e; }
.student-qr-empty h3 { margin: 14px 0 6px; }
.student-qr-empty p { margin: 0 auto 20px; color: var(--muted, #64748b); }

.attendance-qr-scanner {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, .35);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(20, 184, 166, .10), rgba(59, 130, 246, .06));
}

.attendance-qr-copy { margin-bottom: 12px; }
.attendance-qr-copy strong { display: flex; align-items: center; gap: 7px; }
.attendance-qr-copy span { display: block; margin-top: 4px; color: var(--muted, #64748b); font-size: .86rem; }
.attendance-qr-input-row input { flex: 1 1 260px; min-width: 0; }
.attendance-qr-result { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(34, 197, 94, .11); }
.attendance-qr-result span:last-child { color: var(--muted, #64748b); font-size: .82rem; }
/* كاميرا المسح: طبقة عائمة ثابتة تبقى شغّالة أثناء تسجيل الطلاب المتتابع */
/* شاشة مقسومة: النصف السفلي مرسى ثابت للكاميرا والنصف العلوي للكشف — بلا تشتيت.
   المقاسات مكرّرة inline في app.js كخط دفاع لو نسخة الـ CSS في الكاش قديمة. */
.attendance-camera-overlay {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 2147483000;
  width: 100%; height: 46vh; background: #020617; border-top: 3px solid #0f766e;
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 34px rgba(2, 6, 23, .45); overflow: hidden;
}
.attendance-camera-overlay[hidden] { display: none; }
.attendance-camera-frame { position: relative; }
.attendance-camera-overlay video { display: block; width: 100%; height: calc(46vh - 34px); object-fit: cover; background: #020617; }
/* الكارت المسجَّل بيتزحلق لأعلى النصف العلوي فيظهر كامل بأزرار التسميع */
.att-row { scroll-margin-top: 88px; scroll-margin-bottom: 48vh; }
/* حجز النصف السفلي: الكشف بيقف فوق الكاميرا وآخر طالب يفضل قابل للوصول */
body.camera-open .att-roster { padding-bottom: 48vh; }
.attendance-camera-target { position: absolute; inset: 15%; pointer-events: none; }
.attendance-camera-target span { position: absolute; width: 24px; height: 24px; border: 3px solid #34d399; }
.attendance-camera-target span:nth-child(1) { inset-block-start: 0; inset-inline-start: 0; border-inline-end: 0; border-block-end: 0; }
.attendance-camera-target span:nth-child(2) { inset-block-start: 0; inset-inline-end: 0; border-inline-start: 0; border-block-end: 0; }
.attendance-camera-target span:nth-child(3) { inset-block-end: 0; inset-inline-start: 0; border-inline-end: 0; border-block-start: 0; }
.attendance-camera-target span:nth-child(4) { inset-block-end: 0; inset-inline-end: 0; border-inline-start: 0; border-block-start: 0; }
.attendance-camera-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; color: #e2e8f0; font-size: var(--fs-min); font-weight: 700; }
.attendance-camera-bar button { display: inline-flex; align-items: center; gap: 6px; background: #0f766e; color: #fff; border: 0; border-radius: 10px; padding: 7px 12px; font-weight: 800; cursor: pointer; }
.attendance-camera-bar button .icon { width: 15px; height: 15px; }
.att-row.qr-verified { outline: 2px solid #22c55e; outline-offset: -2px; background: rgba(34, 197, 94, .08); }

@media (max-width: 620px) {
  .student-qr-dialog { padding: 10px; }
  .student-qr-sheet { padding: 16px; border-radius: 18px; }
  .student-qr-meta { grid-template-columns: 1fr; }
  .student-qr-actions > button,
  .attendance-qr-input-row > button { flex: 1 1 130px; }
}

@media print {
  body.printing-student-qr > *:not(.student-qr-dialog) { display: none !important; }
  body.printing-student-qr .student-qr-dialog { position: static; display: block; padding: 0; background: #fff; }
  body.printing-student-qr .student-qr-sheet { width: 100%; max-height: none; overflow: visible; padding: 0; box-shadow: none; }
  body.printing-student-qr .qr-no-print { display: none !important; }
  body.printing-student-qr .student-qr-print-card { width: 85mm; margin: 0 auto; break-inside: avoid; }
}

.legacy-barcode-warning { padding: 12px 14px; border: 1px solid #f3c47b; border-radius: 13px; color: #8a4b0f; background: #fff7e7; font-weight: 800; }
/* لوحة فلاتر الباركود بتستعمل نفس مجموعات تبويب الغياب عشان الشكل واحد. */
.barcode-filters-panel { display: grid; gap: 14px; }
.barcode-filters-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.barcode-filters-head .searchbox { flex: 1 1 260px; }
.barcode-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.barcode-head-actions .submit-btn.ghost { color: var(--accent); background: var(--accent-soft); }
.absence-filter-group.group-print { flex: 1 1 100%; }
.absence-filter-group.group-status { flex: 1 1 220px; min-width: 200px; }

/* الموبايل: البحث سطر كامل والأزرار عمودين، عشان «طباعة» و«PDF» ما يفضلوش
   يتزنقوا في آخر السطر ويخرجوا برّه الشاشة. */
@media (max-width: 760px) {
  .barcode-filters-head .searchbox { flex: 1 1 100%; min-width: 0; }
  .barcode-head-actions { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .barcode-head-actions > * { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; font-size: var(--fs-min); }
  .barcode-head-actions > *:first-child { grid-column: 1 / -1; }
}

/* لافتة الطلاب اللي من غير باركود — الإنشاء بقى بضغطة، مش تلقائي مع كل فتحة. */
.legacy-barcode-notice {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--warning-soft); border-inline-start: 5px solid var(--warning);
  border-radius: var(--radius-sm); background: var(--panel);
  font-weight: 700;
}
.legacy-barcode-notice .icon { width: 18px; height: 18px; color: var(--warning); }
.legacy-barcode-notice > span { margin-inline-end: auto; }

.legacy-barcode-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 13px; }
.legacy-barcode-gallery-card { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); transition: border-color var(--speed), box-shadow var(--speed); }
.legacy-barcode-gallery-card.selected { border-color: #0f766e; box-shadow: 0 0 0 2px rgba(15,118,110,.12); }
/* شريط جانبي بلون الحالة: تعرف المطبوع من الجديد من الناقص من غير ما تقرا. */
.legacy-barcode-gallery-card.state-printed { border-inline-start: 4px solid var(--success); }
.legacy-barcode-gallery-card.state-unprinted { border-inline-start: 4px solid var(--warning); }
.legacy-barcode-gallery-card.state-fresh { border-inline-start: 4px solid var(--accent); }
.legacy-barcode-gallery-card.state-missing { border-inline-start: 4px solid var(--danger); }
.legacy-barcode-gallery-card > button { position: relative; flex: none; padding: 0; border: 0; background: transparent; cursor: pointer; }
.legacy-barcode-gallery-card img { display: block; width: 104px; height: 104px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; image-rendering: pixelated; }
/* الصورة لسه ما وصلتش: مربع رمادي بدل أيقونة صورة مكسورة. */
.legacy-barcode-gallery-card img[data-qr] { background: var(--panel-2); border-style: dashed; }
.legacy-barcode-meta { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.legacy-barcode-meta span, .legacy-barcode-meta small { color: var(--muted); }
.legacy-barcode-meta .pill { color: inherit; }
.legacy-barcode-meta .pill.accent { background: var(--accent-soft); color: var(--accent); }
.legacy-barcode-check { position: absolute; z-index: 1; inset: 4px 4px auto auto; width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid #0f766e; border-radius: 6px; color: #fff !important; background: #0f766e; font-weight: 900; }
.legacy-barcode-missing { width: 104px; height: 104px; flex: none; display: grid; place-items: center; gap: 4px; padding: 6px; border: 1px dashed var(--danger-soft); border-radius: 9px; color: var(--muted); text-align: center; font-size: var(--fs-min); }
.legacy-barcode-missing .icon { width: 17px; height: 17px; color: var(--danger); }
.legacy-barcode-missing .table-action { font-size: var(--fs-min); }
/* زر معاينة صفحة ولي الأمر: بيفتح نفس الرابط اللي جوه الـ QR في تبويب جديد،
   فمكانه آخر بيانات الكارت بنبرة هادية عشان ما يزاحمش زر التحديد للطباعة. */
.barcode-preview-btn { margin-top: 3px; color: var(--accent); font-size: var(--fs-min); }
.barcode-preview-btn:hover { color: var(--action-ink); background: var(--accent); border-color: var(--accent); }
.barcode-preview-btn .icon { width: 14px; height: 14px; }

.risk-chip.print-printed.active { color: #fff; background: var(--success); border-color: var(--success); }
.risk-chip.print-unprinted.active { color: #fff; background: var(--warning); border-color: var(--warning); }
.risk-chip.print-missing.active { color: #fff; background: var(--danger); border-color: var(--danger); }
.risk-chip.print-fresh.active { color: var(--action-ink); background: var(--accent); border-color: var(--accent); }
.legacy-barcode-print-root { display: none; }
.legacy-barcode-print-mount { display: contents; }
.barcode-pdf-action { display: flex; justify-content: flex-start; margin: 0 0 10px; }
.finance-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.finance-kpi { display: grid; gap: 6px; padding: 16px; border-top: 4px solid var(--accent); }
.finance-kpi span, .finance-kpi small { color: var(--muted); font-weight: 700; }
.finance-kpi strong { font-size: 24px; }
.finance-kpi.highlight { border-top-color: var(--success); background: var(--success-soft); }
.finance-kpi.warning { border-top-color: var(--warning); background: var(--warning-soft); }
.finance-entry-form { align-items: end; }
/* السجل كارت واحد: الشهر فوق، وتحته زرارين «التحصيل» و«المصروفات» وزرار
   الإضافة على نفس الخط، وبعدين الفورم (لو اتفتح) والجدول. كانوا أربع كروت
   منفصلة وأزرار شهور متلخبطة في أربع اتجاهات. */
.finance-book { display: grid; gap: 14px; min-width: 0; }
.finance-book-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.finance-book-title h2 { font-size: 19px; }
.finance-book-title p { margin-top: 3px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.finance-month-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.finance-month-nav .ghost-btn { min-height: 40px; padding-inline: 13px; }
.finance-month-pick input { min-height: 40px; width: 164px; }
.finance-book-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.finance-kind-switch { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); }
.finance-kind-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 18px; border-radius: 10px; color: var(--muted); font-weight: 800; transition: background var(--speed), color var(--speed), box-shadow var(--speed); }
.finance-kind-switch button em { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--panel); color: var(--muted); font-size: var(--fs-min); font-style: normal; font-weight: 800; text-align: center; }
.finance-kind-switch button:hover { color: var(--ink); }
.finance-kind-switch button.active { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(15, 23, 42, .08); }
.finance-kind-switch button.active em { background: var(--accent-soft); color: var(--accent); }
.finance-kind-switch button[data-kind="handover"].active .icon { color: var(--success); }
.finance-kind-switch button[data-kind="expense"].active .icon { color: var(--danger); }
/* الفورم بخط جانبي بلون نوعه: أخضر للي داخل، أحمر للي خارج. */
.finance-entry-panel { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-inline-start: 4px solid var(--success); border-radius: 14px; background: var(--panel-2); }
.finance-entry-panel.is-expense { border-inline-start-color: var(--danger); }
.finance-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.finance-entry-head strong { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; }
.finance-entry-head span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.finance-entry-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.finance-empty { display: grid; justify-items: center; gap: 10px; padding: 28px 12px; }
.finance-entry-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 210px; }
.finance-manage-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-size: var(--fs-min); font-weight: 850; }
.finance-manage-btn:hover { border-color: var(--accent); color: var(--accent); }
.finance-manage-btn .icon { width: 15px; height: 15px; }
.finance-correction-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--line)); border-radius: 12px; background: var(--warning-soft); }
.finance-correction-note > div { display: grid; gap: 2px; }
.finance-correction-note strong { font-size: 12.5px; }
.finance-correction-note span { color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.finance-correction-note .ghost-btn { flex: none; min-height: 38px; background: var(--panel); }
.finance-delete-action { justify-self: start; }
.finance-table { min-width: 930px; }
.finance-separate-table { min-width: 690px; }
.finance-table td small { display: block; color: var(--muted); margin-top: 3px; }
.finance-amount { font-weight: 900; white-space: nowrap; }
.finance-amount.negative { color: var(--danger); }
.finance-reversal { opacity: .78; background: var(--panel-2); }
.stage-create-form { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); align-items: end; }
.stage-create-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }

/* زرار «إضافة مرحلة»: منقّط عشان يقرا كمكان فاضي مستني، مش كإجراء على مرحلة قايمة. */
.stage-card-add {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
}
.stage-card-add:hover { border-color: var(--accent); background: var(--accent-soft); }
.stage-card-add.is-open { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.dashboard-finance-strip { margin-top: 14px; }
.finance-strip-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.finance-strip-grid > div { display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--panel-2); }
.finance-strip-grid span { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.finance-strip-grid strong { font-size: 20px; }
/* ---------------- كارت الباركود ----------------
   تصميم واحد بيخدم الطباعة المباشرة والـ PDF. الجذر مخفي افتراضيًا
   (.legacy-barcode-print-root) فالستايلات دي ما بتأثرش على الواجهة العادية. */

.legacy-barcode-print-card {
  min-width: 0;
  display: grid;
  /* رأس · جسم مرن · شريط المدرس (الصف التالت بيختفي لوحده لو الشريط مقفول). */
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: .3mm solid #c8dcd8;
  border-radius: 2.6mm;
  background: #fff;
  break-inside: avoid;
}

.bc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2mm;
  padding: 1.5mm 3mm;
  background: linear-gradient(100deg, #0d5c53, #17836f);
  color: #fff;
  font-size: 7.5pt;
  font-weight: 900;
}

.bc-head b { font-family: Arial, Helvetica, sans-serif; font-size: 7pt; font-weight: 800; letter-spacing: .05em; color: #cdece4; }

.bc-body { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 44mm; align-items: center; gap: 3mm; padding: 2.4mm 3mm; }
/* بيانات الطالب متسندة لفوق بدل ما تتوسّط، عشان الفراغ يتجمّع تحت في مكان
   واحد يشيله شريط المدرس بدل ما يتوزّع حوالين السطور. */
.bc-info { min-width: 0; display: grid; gap: 1.2mm; align-content: start; }
.bc-name { font-size: 12pt; font-weight: 800; line-height: 1.25; color: #101828; }
.bc-meta { font-size: 8pt; font-weight: 700; color: #4a5568; }
.bc-place { font-size: 7.5pt; font-weight: 600; color: #7c8698; }
.bc-dot { align-self: center; width: .55mm; height: .55mm; border-radius: 50%; background: currentColor; opacity: .55; }

/* شريط المدرس: خط فاصل رفيع وخلفية باهتة بلون الرأس نفسه، فيقرأ كتذييل
   للكارت مش كسطر تالت من بيانات الطالب. */
.bc-teacher {
  display: grid;
  justify-items: center;
  /* الشريط بقى ٣ سطور (الاسم/التخصص/التواصل) وارتفاع الكارت ثابت بالورقة،
     فالمسافات هنا مضبوطة على أقل قيمة تفضل مقروءة من غير ما تاكل من الـ QR. */
  gap: .4mm;
  padding: 1.2mm 3mm 1.4mm;
  border-top: .25mm solid #d8e8e4;
  background: #f4faf8;
  text-align: center;
}
.bc-teacher-name { font-size: 8.5pt; font-weight: 800; line-height: 1.2; color: #0d5c53; }
.bc-teacher-title { font-size: 7pt; font-weight: 600; line-height: 1.2; color: #5c7a74; }
/* سطر التواصل أصغر وأغمق شوية من التخصص — بيقرأ كمعلومة ثانوية، والرقم بيفضل
   واضح للقراءة من الكارت المطبوع. */
/* بدون letter-spacing: html2canvas بيرسم النص المتباعد حرفًا حرفًا، والحروف
   العربية بتفقد اتصالها وتطلع مكسّرة في الـ PDF. */
.bc-teacher-contact { font-size: 7pt; font-weight: 800; line-height: 1.2; color: #0d5c53; }
.bc-teacher .bc-words { justify-content: center; }

/* الفراغ تحت الصورة جزء من «الهامش الصامت» للـ QR: الصورة نفسها بتتولّد بهامش
   وحدة واحدة بس (server.cjs)، فبياض الكارت حواليها هو اللي بيكمّل الأربع وحدات
   اللي القارئ محتاجها — عشان كده الـ 44مم كلها بتروح للوحدات نفسها. */
.bc-qr { display: grid; justify-items: center; gap: 2.6mm; }
.bc-qr img { width: 44mm; height: 44mm; }
.bc-qr b { font-family: Arial, Helvetica, sans-serif; font-size: 7pt; font-weight: 800; letter-spacing: .09em; color: #8a6d2f; }

/* المسافة بين الكلمات بتيجي من gap حقيقي في التخطيط مش من حرف المسافة (شوف wordSpans في utils.js).
   معاينة الإعدادات لازم تدخل في نفس القاعدة، وإلا الكلمات بتطلع ملزوقة فيها. */
.legacy-barcode-print-card .bc-words,
.barcode-teacher-preview .bc-words { display: flex; flex-wrap: wrap; align-items: baseline; gap: .18em .28em; }

/* الطباعة المباشرة بيرسمها المتصفح نفسه فـ .28em كفاية. لكن html2canvas (اللي بيعمل الـ PDF)
   بيرسم كل كلمة عربية أعرض من صندوقها في الـ DOM بـ ٠.٧–١.٦مم، فبتاكل المسافة اللي جنبها
   والكلام يطلع ملزوق. المقاس اتظبط بالقياس: .3em و.45em لسه بيلزقوا، .6em بتدي مسافة
   واضحة من غير ما تبقى واسعة. */
.legacy-barcode-pdf-root .bc-words { column-gap: .6em; }

/* معاينة الشريط داخل الإعدادات — نفس ستايل الطباعة بالظبط، متحطوط جوه إطار
   بعرض الكارت الحقيقي عشان المدير يشوف الناتج قبل ما يطبع. */
.barcode-teacher-preview-wrap { display: grid; gap: 8px; }
.barcode-teacher-preview {
  max-width: 96mm; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.barcode-teacher-preview .bc-teacher { border-top: 0; }
.barcode-teacher-preview em { display: block; padding: 12px; }

.legacy-barcode-pdf-root { position: fixed; left: -10000px; top: 0; z-index: -1; width: 210mm; background: #fff; }
.legacy-barcode-pdf-root .legacy-barcode-print-root { display: block !important; }
.legacy-barcode-pdf-root .legacy-barcode-print-page { width: 210mm; height: 297mm; padding: 9mm; box-sizing: border-box; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); gap: 4mm; background: #fff; }

@media print {
  @page { size: A4 portrait; margin: 9mm; }
  body.printing-barcode-batch * { visibility: hidden !important; }
  body.printing-barcode-batch .legacy-barcode-print-root, body.printing-barcode-batch .legacy-barcode-print-root * { visibility: visible !important; }
  body.printing-barcode-batch .legacy-barcode-print-root { display: block !important; position: absolute; inset: 0; }
  .legacy-barcode-print-page { width: 192mm; height: 279mm; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); gap: 4mm; break-after: page; page-break-after: always; }
  .legacy-barcode-print-page:last-child { break-after: auto; page-break-after: auto; }
  .legacy-barcode-print-card, .bc-head, .bc-teacher { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@media (max-width: 1150px) {
  .finance-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .finance-kpis { grid-template-columns: 1fr 1fr; }
  .finance-kpi strong { font-size: 19px; }
  .finance-strip-grid { grid-template-columns: 1fr 1fr; }
  /* الموبايل: الشهر سطر لوحده (السابق · الشهر · التالي)، والزرارين بعرض
     الشاشة، و«إضافة جديدة» تحتهم بعرض كامل تحت الصباع. */
  .finance-month-nav { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .finance-month-nav [data-action="finance-current-month"] { grid-column: 1 / -1; }
  .finance-month-pick input { width: 100%; }
  .finance-kind-switch { width: 100%; }
  .finance-add-btn { width: 100%; justify-content: center; }
  .finance-entry-foot > * { flex: 1 1 0; justify-content: center; }
}

body.dark-mode {
  /* احتياطي بس لحد ما theme.js يكتب ألوان الثيم على الجسم — لازم يفضل قريب منها. */
  --page: #0a0c1a;
  --panel: #1f2338;
  --panel-2: #292d44;
  --ink: #f4f6fc;
  --muted: #c2c8df;
  --line: #4a5069;
  --accent: #8ea2ff;
  --accent-soft: rgba(142, 162, 255, 0.14);
  --accent-light: #c2cbff;
  --action-bg: #4d61e8;
  --action-bg-end: #7a8bff;
  --action-ink: #ffffff;
  --teal-vivid: #33d6bf;
  --teal-soft: rgba(51, 214, 191, 0.18);
  --violet-vivid: #bda3ff;
  --violet-soft: rgba(189, 163, 255, 0.19);
  --search-gold-deep: #7f5d18;
  --search-gold: #d5a338;
  --search-gold-light: #f0d488;
  --search-gold-glow: rgba(229, 184, 81, 0.26);
  --search-fab: #6375e0;
  --search-fab-strong: #5768d1;
  --search-fab-glow: rgba(93, 111, 223, 0.34);
  /* الدلالية بتتقلب بالكامل في الليلي: الغامق مايتقراش فوق خلفية غامقة. */
  --success: #2fdd8e;
  --success-soft: rgba(47, 221, 142, 0.20);
  --warning: #fba947;
  --warning-soft: rgba(251, 169, 71, 0.12);
  --danger: #fd939c;
  --danger-soft: rgba(253, 147, 156, 0.10);
  --purple: #a98bff;
  --cyan: #2ad3e6;
  --amber: #ffab33;
  --mint: #34e0a4;
  --rose: #ff5f9c;
  --gold: #f5cc5c;
  --gold-soft: rgba(245, 204, 92, 0.16);
  --stat-primary: #3a5cff; --stat-primary-2: #1f36c4;
  --stat-sky: #14324f;  --stat-sky-ink: #8ccaff;
  --stat-mint: #10402e; --stat-mint-ink: #56e6a8;
  --stat-lav: #262a52;  --stat-lav-ink: #b3b9ff;
  --stat-pink: #47202f; --stat-pink-ink: #ff9dbe;
  --sidebar-bg: #10142a;
  --sidebar-ink: #b2bade;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
}

/* ------------------------------ الأساسيات ------------------------------ */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* تسميات لقارئ الشاشة بس. من غير القاعدة دي كانت بتتعرض كنص عادي جوه الصفوف
   وتاكل عرض اسم الطالب لحد ما يتقص لـ «اد...». */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Cairo', Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  /* clip مش hidden: hidden بتخلي الـ body عنصر تمرير فتبطّل كل position: sticky في الصفحة. */
  overflow-x: clip;
  transition: background var(--speed), color var(--speed);
}

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; background: none; }
svg { display: block; max-width: 100%; }
code { background: var(--panel-2); padding: 2px 7px; border-radius: 6px; font-size: var(--fs-min); }

.icon {
  width: 18px;
  height: 18px;
  /* zoom مش transform: المقاس لازم يكبّر الصندوق نفسه عشان الأزرار والصفوف
     تتوسع معاه، وكمان بيضرب في أي width/height خاص متكتوب تحت — لو ظبطنا
     المقاس هنا بـ calc كانت كل أيقونة ليها مقاس خاص هتفضل ثابتة. */
  zoom: var(--icon-scale, 1);
  fill: none;
  /* الصبغة بتتحط على color مش stroke: كده أي قاعدة أخص بتلوّن الأيقونة
     (تحذير/خطأ/كارت) تفضل هي اللي تكسب من غير ما نلغيها واحدة واحدة. */
  color: var(--icon-tint, currentColor);
  stroke: currentColor;
  stroke-width: var(--icon-stroke-width, 2);
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* الأسطح اللي بتفرض لون نص خاص بيها (سايدبار غامق، زرار مليان، شارة ملوّنة):
   الأيقونة جوّاها لازم تفضل بلون النص وإلا تختفي أو يقل تباينها. currentColor
   هنا معناها «ورّث لون العنصر اللي فوقيك» فبتلغي الصبغة العامة موضعيًا. */
:is(
  .sidebar, .brand, .nav-item, .primary-action, .submit-btn, .primary-mini, .action-btn,
  .student-search-fab, .toast, .pill, .metric-icon, .theme-preset-card, .icon-preset-card,
  .att-btn.active, .rec-btn.active, .auth-tab.active, .period-chip.active, .risk-chip.active,
  .absence-section-tab.active, .table-action:hover, .table-action.wa,
  .inline-edit-fee:hover, .parent-report-action:hover, .barcode-preview-btn:hover,
  .ghost-btn.primary-ghost:hover, .view-switch button.active,
  .roster-source-tabs button.active, .recognition-tabs button.active, .certificate-mode-tabs button.active,
  .zoom-preset.active, .duplicate-filter.active, .exemption-toggle.active, .payment-filter-row button.active,
  .attendance-camera-bar button, .legacy-barcode-check, .executive-card, .certificate-sheet,
  .month-chip, .year-chip-group .year-remove:hover, .report-workflow li > span,
  .settings-card-icon, .settings-detail-icon, .appearance-tab.selected, .settings-jump-chip.active,
  .card-type-remove, .card-type-switch, .card-type-icon-btn, .card-cond-remove, .empty-action,
  .search-jump-icon
) { --icon-tint: currentColor; }

/* الليلي: --accent بقى درجة فاتحة عشان يتقرا كنص فوق الكارت الغامق، فأي حاجة
   مليانة بيه ومكتوب عليها أبيض بقت أبيض على فاتح. «على الأساسي» في الليلي
   كحلي غامق — نفس منطق الزراير في أي واجهة ليلية. */
body.dark-mode :is(
  .parent-report-action:hover, .barcode-preview-btn:hover, .risk-chip.print-fresh.active, .risk-chip.active,
  .primary-mini:hover, .due-now-row .primary-mini:hover, .subs-student-row .primary-mini:hover, tbody .primary-mini:not(.ghost):hover,
  .inline-edit-fee:hover, .rec-btn.active.good, .view-switch button.active,
  .roster-source-tabs button.active, .area-badge, .theme-selected-mark, .empty-action:hover, .zoom-step:hover,
  .zoom-preset.active, .absence-filters-toggle b, .absence-tile-pick, .ghost-btn.primary-ghost:hover, .row-btn.pay
) { color: #0b1020; }
body.dark-mode .qr-action.active { color: var(--success); }
body.dark-mode .certificate-live-badge { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
body.dark-mode .conflict-value.mine .conflict-value-tag { color: var(--accent); }
body.dark-mode .conflict-error { color: var(--danger); }

/* أسطح التصدير (PDF/PNG): html2canvas مش بيفهم zoom، فلو الأيقونة اتكبّرت على
   الشاشة كانت هتطلع بمقاسها الأصلي في الملف — نثبّتها هنا عشان الاتنين يتطابقوا. */
:is(.certificate-export-root, .legacy-barcode-pdf-root, .doc) .icon {
  zoom: 1;
  --icon-tint: currentColor;
}

body:not(.logged-in) .app-shell { display: none; }
body:not(.logged-in) .student-search-fab { display: none; }
body.logged-in .auth-screen { display: none; }
.member-permissions-row { align-items: flex-start; flex-wrap: wrap; }
.permission-form { width: 100%; display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
/* شبكة بدل flex-wrap: مربعات التبويبات ١٤ مربع بأطوال نصوص مختلفة، فالـ wrap
   كان بيرصّها بأعمدة متعرجة تختلف مع كل عرض شاشة. */
.permission-form fieldset {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px 12px;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px;
}
.permission-form legend { padding: 0 8px; font-weight: 700; }
.permission-form label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.permission-form label input { flex: 0 0 auto; }
.absence-alert-panel { border-color: #fda29b !important; background: color-mix(in srgb, #d92d20 5%, var(--surface, #fff)); display: flex; flex-direction: column; }
.absence-alert-panel h2 { color: #b42318; }
.absence-count { flex-shrink: 0; align-self: flex-start; }

/* القائمة بتفضل بارتفاع ثابت مهما زاد عدد الطلاب، والباقي بيتسكرول جواها */
.absence-alert-list {
  gap: 6px;
  max-height: 244px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-start: 4px;
  scrollbar-width: thin;
  scrollbar-color: #fda29b transparent;
}
.absence-alert-list::-webkit-scrollbar { width: 6px; }
.absence-alert-list::-webkit-scrollbar-track { background: transparent; }
.absence-alert-list::-webkit-scrollbar-thumb { background: #fda29b; border-radius: 999px; }

.absence-alert-row { display: flex; align-items: center; gap: 6px; border: 1px solid #fecdca; border-radius: 10px; background: #fff6f5; padding-inline-end: 6px; }
.absence-alert-list .absence-alert-row > button { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 0 !important; background: transparent !important; color: #7a271a; }
.absence-alert-list .absence-alert-row > button:hover { transform: none; }
.absence-streak {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fee4e2;
  color: #b42318;
  font-size: var(--fs-min);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.absence-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.absence-alert-list .absence-info strong, .absence-alert-list .absence-info small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.absence-alert-list .absence-info strong { font-size: max(var(--fs-min), 12.5px); }
.absence-alert-list .absence-info small { font-size: var(--fs-min); font-weight: 600; color: #b42318; opacity: 0.85; }
.absence-alert-row .table-action { flex-shrink: 0; }

.dark-mode .absence-alert-row { background: color-mix(in srgb, #d92d20 13%, #171717); }
/* الألوان الوردي الفاتحة فوق مكتوبة للنهاري؛ في الليلي الكارت كان بيطلع
   بقعة فاتحة والعنوان أحمر غامق فوق كحلي (٢:١). */
.dark-mode .absence-alert-panel { border-color: color-mix(in srgb, var(--danger) 45%, var(--panel)) !important; background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.dark-mode .absence-alert-panel h2 { color: var(--danger); }
.dark-mode .absence-alert-row { border-color: color-mix(in srgb, var(--danger) 30%, var(--panel)); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.dark-mode .absence-alert-list { scrollbar-color: color-mix(in srgb, var(--danger) 55%, var(--panel)) transparent; }
.dark-mode .absence-alert-list .absence-alert-row > button { color: #fecdca; }
.dark-mode .absence-streak { background: color-mix(in srgb, #d92d20 28%, #171717); color: #fecdca; }
.dark-mode .absence-alert-list .absence-info small { color: #fda29b; }
.absence-alert-panel .section-head { margin-bottom: 12px; }
@media (max-width: 760px) { .absence-alert-list { max-height: 208px; } }
/* مؤشر المزامنة: شريحة سطر واحد ارتفاعها زي أزرار الشريط العلوي. من غير
   `white-space: nowrap` كان النص الطويل («متصل ومتزامن · آخر مزامنة ١٢:٣٣ م»)
   بيلف على أربع سطور على الموبايل ويحوّل الشريحة لبيضة واقفة جنب باقي الأزرار. */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--fs-min);
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted);
  background: var(--surface, #fff);
  cursor: pointer;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; flex: none; }
.sync-status.offline .sync-dot { background: #f79009; }
.sync-status.syncing .sync-dot { background: #2e90fa; animation: pulse 1s infinite; }
.sync-status.conflict .sync-dot { background: #d92d20; }
.sync-status:focus-visible { outline: 2px solid var(--brand, #2e90fa); outline-offset: 2px; }
/* على الشاشات الضيقة الشريحة بتكتفي بكلمة الحالة، والتفصيل يفضل في الـ title. */
@media (max-width: 900px) {
  .sync-status { height: 34px; padding: 0 11px; font-size: var(--fs-min); }
  .sync-detail { display: none; }
}
.offline-disabled { opacity: .48 !important; cursor: not-allowed !important; }
.is-offline .online-only-note { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------ شاشة الدخول ------------------------------ */

/* الشاشة دي لابسة ألوان هوية تابعلي مهما كان ثيم المدرّس.

   الثيم بيتكتب على الجسم بعد الدخول، وقبله الشاشة بتاخد ألوان الملف — يعني
   المدرّس اللي اختار أخضر وخرج كان بيلاقي صفحة الدخول خضرا، والزائر اللي
   بيشوف المنتج لأول مرة بيشوف إنديغو. التوكنز هنا على الشاشة نفسها فبتغلب
   اللي نازل من الجسم، والصفحة العامة بقت شكل واحد للكل: شكل المنتج. */
.auth-screen {
  --page: #f2f5fc;
  --panel: #ffffff;
  --panel-2: #f4f7fd;
  --line: #e0e6f3;
  --ink: #0b1433;
  --muted: #5a6585;
  --accent: var(--brand-accent);
  --accent-soft: rgba(37, 99, 235, 0.1);
  --action-bg: var(--brand-accent);
  --action-bg-end: var(--brand-accent-deep);
  --theme-gradient-angle: 180deg;
  --action-ink: #ffffff;
  --shadow: 0 10px 28px -14px rgba(15, 35, 95, 0.28);
  --shadow-lg: 0 30px 70px -30px rgba(12, 26, 79, 0.4);
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(760px 420px at 88% -8%, rgba(37, 99, 235, 0.12), transparent 70%),
    radial-gradient(640px 400px at 4% 104%, rgba(34, 195, 238, 0.12), transparent 70%),
    var(--page);
}

.auth-card {
  width: min(440px, 100%);
  padding: 30px 26px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 18px;
  animation: rise 0.5s ease both;
}

.auth-mark { margin-bottom: 14px; }
.auth-card h1, .auth-card h2 { font-size: 23px; font-weight: 900; line-height: 1.45; color: var(--ink); }

.auth-card p, .auth-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: max(var(--fs-min), 13.5px);
  font-weight: 600;
  line-height: 1.75;
}

.auth-plans-error a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-plans-error {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--ink);
}
.auth-plans-error .ghost-btn { width: 100%; }

/* الزرار الأساسي هنا بظل أزرق خفيف زي لوحة الهوية. `:not` عشان زرار كروت
   الباقات ليه قاعدته هو تحت، وأغلبه شبح من غير ظل. */
.auth-screen .submit-btn:not(.plan-pick) { border-radius: 12px; box-shadow: 0 12px 24px -14px rgba(37, 99, 235, 0.8); }
.auth-screen .field input, .auth-screen .field select { height: 48px; border-radius: 12px; background: #f7f9fe; }

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel-2);
}

.auth-tab {
  height: 38px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  transition: all var(--speed);
}

/* نفس تدرّج الزرار الأساسي بالظبط، مش `--accent` المسطّح: الشريحة المختارة
   وزرار «دخول السيستم» تحتيها وزرار البدء اللي على كروت الباقات لازم يبانوا
   من طقم واحد — لونين مختلفين على نفس الكارت بيتقروا كأنهم حاجتين. */
.auth-tab.active {
  background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end));
  color: var(--action-ink);
  box-shadow: var(--shadow);
}

.auth-form { display: grid; gap: 13px; }

/* مدخل هادي قبل الخانات: يعرّف الزائر هو داخل على إيه من غير ما يكرر عنوان
   الكارت، ويحوّل أول كتلة في الفورم من فراغ بصري لطمأنة مفيدة. */
.login-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block-end: 2px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, #fff), #fff 72%);
}
.login-intro > span:last-child { display: grid; gap: 1px; min-width: 0; }
.login-intro b { color: var(--ink); font-size: max(var(--fs-min), 12.5px); line-height: 1.5; }
.login-intro small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.55; }
.login-intro-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
}
.login-intro-icon svg,
.login-control-icon,
.login-recovery-icon svg,
.login-recovery-arrow,
.login-help-head svg,
.login-safety svg,
.auth-forgot svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-field { gap: 7px; }
.login-control { position: relative; display: block; }
.login-control-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  inset-inline-start: 14px;
  transform: translateY(-50%);
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  pointer-events: none;
  transition: color var(--speed), transform var(--speed);
}
.auth-screen .login-control > input {
  width: 100%;
  padding-inline-start: 44px;
  border-color: color-mix(in srgb, var(--line) 88%, var(--accent));
  background: linear-gradient(180deg, #fbfcff, #f6f8fd);
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
.auth-screen .login-control > input::placeholder { color: #a4abc0; font-size: max(var(--fs-min), 12.5px); }
.auth-screen .login-control:focus-within > input {
  border-color: color-mix(in srgb, var(--accent) 76%, #fff);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent), 0 10px 20px -18px var(--accent);
}
.login-control:focus-within .login-control-icon { color: var(--accent); transform: translateY(-50%) scale(1.08); }

/* رسالة غلط الدخول: صندوق واقف فوق الزرار، مش توست في ركن الشاشة. التوست
   بيروح لوحده بعد ثواني — واللي بيقرا بالراحة، أو رجع للتاب بعد ما ضغط،
   أو بيستخدم قارئ شاشة، بيلاقي الشاشة زي ما هي من غير ما يعرف حصل إيه.
   وهنا الرسالة بتفضل لحد ما حد يغيّر حاجة في الفورم. */
.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 800;
  line-height: 1.65;
}

/* «نسيت كلمة المرور؟» زرار بشكل لينك. مش `.submit-btn` تاني تحت الزرار
   الأساسي: زرارين متشابهين تحت بعض بيخلّوا اللي مستعجل يضغط الغلط. */
.auth-forgot {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  margin-top: -2px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 750;
  cursor: pointer;
  transition: color var(--speed), background var(--speed), border-color var(--speed);
}
.auth-forgot:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line); }
.auth-forgot svg { width: 15px; height: 15px; transition: transform var(--speed); }
.auth-forgot.is-open svg { transform: rotate(180deg); }

.login-help {
  display: grid;
  gap: 11px;
  margin: -2px 0 1px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 3.5%, #fff);
  animation: loginHelpReveal 240ms ease both;
}
.login-help[hidden] { display: none; }
.login-help-head { display: flex; align-items: center; gap: 9px; }
.login-help-head > span {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
}
.login-help-head > div { display: grid; gap: 1px; }
.login-help-head b { color: var(--ink); font-size: max(var(--fs-min), 12.5px); }
.login-help-head small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.login-recovery-paths { display: grid; gap: 7px; }
.login-recovery-path {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  background: #fff;
  text-decoration: none;
}
.login-recovery-path > div { display: grid; gap: 1px; }
.login-recovery-path b { color: var(--ink); font-size: max(var(--fs-min), 12px); line-height: 1.5; }
.login-recovery-path small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.55; }
.login-recovery-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-2);
}
.login-recovery-path.is-action {
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.login-recovery-path.is-action .login-recovery-icon,
.login-recovery-path.is-action .login-recovery-arrow { color: var(--accent); }
.login-recovery-path.is-action:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  box-shadow: 0 10px 24px -20px var(--accent);
}
.login-safety {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: -3px 0 0 !important;
  color: var(--muted) !important;
  font-size: var(--fs-min) !important;
  font-weight: 650 !important;
  line-height: 1.55 !important;
  text-align: center;
}
.login-safety svg { flex: none; width: 14px; height: 14px; color: #07956f; }
.login-submit { position: relative; overflow: hidden; min-height: 48px; font-weight: 850; }
.login-submit::after {
  content: '←';
  position: absolute;
  inset-inline-end: 18px;
  font-size: 18px;
  transition: transform var(--speed);
}
.login-submit:hover::after { transform: translateX(-3px); }
@keyframes loginHelpReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* «مش عندك حساب؟» تحت الفورم — نفس مكانه في لوحة الهوية. `.auth-card` قدّام
   الاسم عشان `.auth-card p` فوق بيحدّد الهامش والحجم بقوة أكبر. */
.auth-card .auth-switch {
  justify-self: center;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: max(var(--fs-min), 13px);
  font-weight: 700;
}

/* تحذير Caps Lock بياخد مكان تلميح الخانة تحت خانة الباسورد. `.field-note`
   جوّه `.field` بتاخد مكانها من الشبكة لوحدها، فالتحذير بيدخل ويطلع من غير
   ما يزحلق الزرار اللي تحته أكتر من سطره. */
#loginCaps { margin-top: 2px; }

/* ---------------------- صفحة الاشتراك العامة ----------------------

   الشاشة دي ليها شكلين على نفس المبنى: من غير تسجيل مفتوح هي كارت دخول
   متوسّط الصفحة زي ما كانت، ومع التسجيل بتبقى صفحة عرض كاملة. الفرق كله
   في `.has-landing` على الـbody — من غيرها كل اللي تحت ده ما بيتحطّش على
   حاجة، لأن العناصر نفسها مخفية من الـHTML.

   ترتيب الأعمدة على الشاشة الكبيرة: العرض في العمود العريض، وكارت الدخول
   ملزوق فوق في عمود ضيق جنبه. في نص الصفحة الكارت قبل العرض عشان الموبايل
   يبدأ بيه، والشبكة هنا بترجّعه مكانه من غير ما تلمس الترتيب المنطقي. */

.auth-stage { width: min(440px, 100%); display: grid; gap: 18px; }

/* بوابة الدخول: عمود واحد متوسّط من فوق لتحت.

   كانت عمودين — الوعد على حرف وكارت الدخول على الحرف التاني — وكل قسم تحتهم
   بيبدأ من مكان تاني: العنوان متوسّط على الصفحة، والأسئلة على حرف عمود الوعد،
   والباقات متوسّطة على عمودها هي. تلات محاور في صفحة واحدة، والعين بتدوّر على
   أول الكلام من جديد كل قسم. عمود واحد معناه محور واحد: كل حاجة بتبدأ وتنتهي
   على نفس الخطين، والوحيد اللي بيكسر التوسيط هو اللي بيتقري كقايمة. */
body.has-landing .auth-screen { place-items: start center; padding-block: 0 clamp(24px, 5vw, 60px); }
body.has-landing .auth-stage {
  width: min(1120px, 100%);
  justify-items: center;
  gap: clamp(30px, 4.4vw, 52px);
}
/* الأقسام بتاخد عرض المسرح وبتوسّط اللي جوّاها بنفسها — من غير الرقم ده
   `justify-items: center` بتلمّ كل قسم على عرض محتواه، فالشبكات اللي جوّاه
   (الباقات والمميزات) بتتلمّ معاه وبتفقد أعمدتها. */
body.has-landing .auth-stage > * { width: 100%; }
/* الكارت هو الاستثناء: عرضه ثابت وبيتوسّط جوّه المسرح العريض. */
body.has-landing .auth-card { justify-self: center; width: min(420px, 100%); }
.auth-card-rail { display: contents; }

/* ------------------------------ الشريط العلوي ------------------------------ */

/* شريط زجاجي عايم يفضل ظاهر مع التمرير: اللوك-أب على حرف، والتنقّل جوّه
   كبسولة هادية في النص، والدخول فعل واضح على الحرف التاني. */
.auth-nav {
  position: relative;
  z-index: 30;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  gap: 12px 20px;
  margin-block-start: clamp(10px, 2vw, 18px);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 15%, var(--line));
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 18px 48px -30px rgba(15, 35, 95, .58), 0 2px 10px rgba(15, 35, 95, .05), inset 0 1px rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  overflow: hidden;
  animation: auth-nav-reveal 680ms cubic-bezier(.2, .8, .2, 1) both;
}
/* طبقة ضوء بطيئة جوّه المستطيل: بتدي السطح عمق من غير ما تغيّر مكان العناصر. */
.auth-nav::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 50%, color-mix(in srgb, var(--brand-accent) 9%, transparent), transparent 25%),
    radial-gradient(circle at 92% 50%, color-mix(in srgb, var(--brand-teal) 10%, transparent), transparent 27%),
    linear-gradient(110deg, transparent 28%, rgba(255, 255, 255, .46) 46%, transparent 64%);
  background-size: 100% 100%, 100% 100%, 210% 100%;
  animation: auth-nav-surface 7.5s ease-in-out infinite;
}
/* شعاع هوية على الحافة العليا يحدد مركز الشريط هندسيًا. */
.auth-nav::after {
  content: "";
  position: absolute;
  inset-block-start: -1px;
  inset-inline-start: 50%;
  width: clamp(92px, 15vw, 170px);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand-teal), var(--brand-accent), transparent);
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--brand-teal) 58%, transparent));
  transform: translateX(50%) scaleX(.58);
  opacity: .7;
  pointer-events: none;
  animation: auth-nav-beam 4.8s ease-in-out infinite;
}
@keyframes auth-nav-reveal {
  from { opacity: 0; transform: translateY(-16px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes auth-nav-surface {
  0%, 100% { background-position: 0 0, 0 0, 115% 0; }
  50% { background-position: 0 0, 0 0, -115% 0; }
}
@keyframes auth-nav-beam {
  0%, 100% { opacity: .38; transform: translateX(50%) scaleX(.58); }
  50% { opacity: .92; transform: translateX(50%) scaleX(1); }
}
/* اللوك-أب: بلاطة الأيقونة وجنبها Tabe3ly فوق تابعلي. `flex: none` لأن الشريط
   بيلفّ — من غيرها اللوك-أب بيتزنق قدام الروابط والاسم بينزل تحت البلاطة. */
.auth-wordmark {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 154px;
  min-height: 48px;
  padding-inline: 4px 12px;
  flex: none;
}
.auth-wordmark .auth-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin-bottom: 0;
  background: var(--brand-tile);
  color: #fff;
  box-shadow: 0 10px 22px -13px color-mix(in srgb, var(--brand-navy) 75%, transparent);
  transition: transform 420ms cubic-bezier(.2, .8, .2, 1), box-shadow 420ms ease;
  animation: auth-mark-breathe 5.2s ease-in-out infinite;
}
.auth-wordmark:hover .auth-mark { transform: translateY(-2px) rotate(-3deg) scale(1.035); box-shadow: 0 16px 28px -14px color-mix(in srgb, var(--brand-navy) 85%, transparent); }
@keyframes auth-mark-breathe {
  0%, 100% { box-shadow: 0 10px 22px -13px color-mix(in srgb, var(--brand-navy) 75%, transparent); }
  50% { box-shadow: 0 12px 28px -11px color-mix(in srgb, var(--brand-teal) 55%, transparent); }
}
.auth-wordmark .brand-logo { width: 30px; height: 30px; }
.auth-wordmark-text { display: grid; gap: 2px; line-height: 1; }
.auth-wordmark-latin {
  font-family: Montserrat, Cairo, system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand-navy);
}
.auth-wordmark-name {
  color: color-mix(in srgb, var(--brand-navy) 82%, var(--muted));
  font-weight: 800;
  font-size: max(var(--fs-min), 13px);
  line-height: 1.15;
  white-space: nowrap;
}

.auth-nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-self: center;
  gap: 3px;
  margin: 0;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 11%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--page) 60%, transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, .72);
  list-style: none;
}
.auth-nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 15px;
  border-radius: 11px;
  color: var(--muted);
  font-size: max(var(--fs-min), 13.5px);
  font-weight: 700;
  text-decoration: none !important;
  text-underline-offset: 0;
  transition: color var(--speed), background var(--speed), box-shadow var(--speed), transform var(--speed);
}
.auth-nav-links a:visited { color: var(--muted); }
/* نقطة صغيرة بدل خط كامل: الكبسولة نفسها بتوضح العنصر النشط، والنقطة تضيف
   علامة هوية من غير ما تزاحم الكلمات. */
.auth-nav-links a::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-accent);
  transform: translateX(50%) scale(0);
  transition: transform var(--speed);
}
.auth-nav-links a:hover,
.auth-nav-links a:focus-visible,
.auth-nav-links a[aria-expanded="true"] {
  color: var(--brand-accent);
  background: color-mix(in srgb, var(--panel) 94%, var(--brand-accent) 6%);
  box-shadow: 0 8px 18px -15px rgba(15, 35, 95, 0.5);
  transform: translateY(-1px);
}
.auth-nav-links a:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand-accent) 65%, transparent); outline-offset: 2px; }
.auth-nav-links a:hover::after,
.auth-nav-links a:focus-visible::after,
.auth-nav-links a[aria-expanded="true"]::after { transform: translateX(50%) scale(1); }

/* زرار الدخول مختلف بصريًا عن زر التجربة في الهيرو: أصغر، ومعاه أيقونة حساب،
   لكنه ممتلئ عشان مستخدم السيستم الحالي يلاقي طريقه فورًا. */
.auth-nav-login {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 8px;
  min-width: 110px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 80%, #fff);
  background: linear-gradient(135deg, var(--brand-accent), color-mix(in srgb, var(--brand-accent) 82%, var(--brand-navy)));
  color: #fff;
  font: inherit;
  font-size: max(var(--fs-min), 13.5px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px -15px color-mix(in srgb, var(--brand-accent) 80%, transparent);
  transition: transform var(--speed), box-shadow var(--speed), filter var(--speed);
}
.auth-nav-login::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2px;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, .34) 46%, transparent 67%);
  transform: translateX(135%);
  transition: transform 720ms cubic-bezier(.2, .8, .2, 1);
}
.auth-nav-login svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 360ms cubic-bezier(.2, .8, .2, 1);
}
.auth-nav-login:hover { transform: translateY(-1px); filter: saturate(1.08); box-shadow: 0 16px 28px -15px color-mix(in srgb, var(--brand-accent) 88%, transparent); }
.auth-nav-login:hover::before { transform: translateX(-135%); }
.auth-nav-login:hover svg { transform: translateX(-2px) scale(1.06); }
.auth-nav-login:active { transform: translateY(0); }
.auth-nav-login:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

/* الروابط بتختفي على الضيّق: تلاتة بيلفّوا لسطر تاني تحت اللوك-أب فيعملوا
   شريط بارتفاع سطرين قبل ما الصفحة تبدأ أصلاً. الأقسام نفسها تحت بالترتيب. */
@media (max-width: 620px) {
  .auth-nav { grid-template-columns: minmax(0, 1fr) auto; }
  .auth-nav-links { display: none; }
  .auth-nav::after { width: 82px; }
  .auth-wordmark { min-width: 0; min-height: 48px; padding-inline-end: 6px; }
  .auth-wordmark .auth-mark { width: 42px; height: 42px; }
  .auth-nav-login { min-height: 48px; }
}

/* على التابلت بنحافظ على التوسيط الحقيقي، بس بنقلّل الجناحين وحشو الروابط
   بدل ما الشريط يلفّ أو عنصر يزق التاني. */
@media (max-width: 900px) {
  .auth-nav { grid-template-columns: minmax(132px, 1fr) auto minmax(132px, 1fr); gap: 8px 12px; }
  .auth-nav-links a { padding-inline: 11px; }
}
@media (max-width: 620px) {
  .auth-nav { grid-template-columns: minmax(0, 1fr) auto; }
}

/* -------------------------------- أول سطح -------------------------------- */

/* «صفحة البداية» في لوحة الهوية. على الموبايل الكلام ييجي الأول وبعده
   معاينة المنتج، ومن التابلت وطالع الكلام والمعاينة جنب بعض. */
.auth-hero { display: grid; justify-items: center; gap: clamp(14px, 3vw, 34px); text-align: center; }
.auth-hero-copy { display: grid; justify-items: center; gap: 16px; }
.auth-hero-art {
  position: relative;
  isolation: isolate;
  width: min(500px, 100%);
  min-width: 0;
  padding: 28px 16px 38px;
  direction: rtl;
}
.auth-hero-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 5% 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, .2), rgba(32, 181, 166, .1) 44%, transparent 72%);
  filter: blur(14px);
}

/* واجهة مصغرة حقيقية الملامح بدل Illustration عامة: نفس شكل لوحة اليوم،
   وكروت الحضور والتحصيل والمتابعة طافية حواليها كنتاج مباشر للمهمة. */
.auth-product-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(176, 190, 222, .8);
  border-radius: 22px;
  background: #f6f8fd;
  color: #101a3d;
  box-shadow: 0 30px 70px -36px rgba(15, 35, 95, .6), 0 12px 28px -20px rgba(15, 35, 95, .45);
  transform: rotate(-1deg);
  transform-origin: center;
  animation: product-preview-enter .7s cubic-bezier(.2, .8, .2, 1) both;
}
.product-preview-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 45px;
  padding: 7px 12px;
  border-bottom: 1px solid #e2e8f5;
  background: rgba(255, 255, 255, .94);
}
.product-preview-brand { display: inline-flex; align-items: center; gap: 6px; justify-self: start; color: #14275f; font-size: 11px; font-weight: 900; }
.product-preview-brand svg { width: 23px; height: 23px; padding: 4px; border-radius: 7px; background: #14275f; color: #fff; }
.product-preview-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 8.5px;
  font-weight: 900;
}
.product-preview-live i { width: 6px; height: 6px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .4); animation: product-live-pulse 1.8s ease-out infinite; }
.product-preview-dots { display: flex; gap: 4px; justify-self: end; direction: ltr; }
.product-preview-dots i { width: 6px; height: 6px; border-radius: 50%; background: #d5ddef; }
.product-preview-dots i:first-child { background: #20b5a6; }

.product-preview-shell { display: grid; grid-template-columns: 46px minmax(0, 1fr); min-height: 278px; }
.product-preview-nav {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 9px;
  padding: 13px 7px;
  background: linear-gradient(180deg, #162d68, #0d1c49);
}
.product-preview-nav span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #9fb1dc; }
.product-preview-nav span.active { background: rgba(32, 181, 166, .2); color: #55e1d2; }
.product-preview-nav svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.product-preview-main { min-width: 0; padding: 14px; }
.product-preview-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 12px; text-align: start; }
.product-preview-heading > div { display: grid; gap: 2px; }
.product-preview-heading small { color: #8390ad; font-size: 8px; font-weight: 700; }
.product-preview-heading strong { color: #101a3d; font-size: 14px; font-weight: 900; }
.product-preview-heading > span { padding: 4px 7px; border-radius: 7px; background: #ecfdf5; color: #047857; font-size: 7px; font-weight: 900; }
.product-preview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.product-preview-metrics > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1px 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e4e9f5;
  border-radius: 10px;
  background: #fff;
  text-align: start;
  box-shadow: 0 8px 18px -18px rgba(15, 35, 95, .7);
}
.product-preview-metrics small { align-self: end; overflow: hidden; color: #7b88a6; font-size: 6.8px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.product-preview-metrics b { align-self: start; color: #101a3d; font-size: 13px; font-weight: 900; }
.metric-glyph { grid-row: 1 / span 2; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; }
.metric-glyph.teal { background: #e7faf7; color: #078579; }
.metric-glyph.blue { background: #eaf1ff; color: #2563eb; }
.metric-glyph.violet { background: #f1edff; color: #7457d6; }
.metric-glyph svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

.product-preview-panels { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 7px; margin-top: 7px; }
.product-attendance-card,
.product-performance-card { min-width: 0; padding: 9px; border: 1px solid #e4e9f5; border-radius: 10px; background: #fff; }
.product-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 7px; text-align: start; }
.product-panel-title b { color: #101a3d; font-size: 8.5px; font-weight: 900; }
.product-panel-title span { color: #078579; font-size: 6.5px; font-weight: 900; }
.product-student-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 5px; padding: 5px 0; border-top: 1px solid #eef1f7; text-align: start; }
.product-avatar { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: #e9f8f6; color: #078579; font-size: 7px; font-style: normal; font-weight: 900; }
.product-avatar.alt { background: #eaf1ff; color: #2563eb; }
.product-avatar.warm { background: #fff5e6; color: #c16a05; }
.product-student-row b { overflow: hidden; color: #384563; font-size: 7px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.product-student-row em { padding: 2px 5px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 5.8px; font-style: normal; font-weight: 900; }
.product-student-row em.late { background: #fff7e8; color: #b45309; }
.product-performance-card { display: grid; align-content: start; }
.product-performance-card > small { margin-top: 7px; color: #7b88a6; font-size: 6px; font-weight: 700; line-height: 1.5; text-align: start; }
.product-bars { display: flex; align-items: end; gap: 5px; height: 72px; padding: 8px 4px 0; border-bottom: 1px solid #e7ebf5; }
.product-bars i { flex: 1; height: var(--bar); min-height: 8px; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #35cfc1, #2563eb); transform-origin: bottom; animation: product-bar-grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.product-bars i:nth-child(2) { animation-delay: .06s; }
.product-bars i:nth-child(3) { animation-delay: .12s; }
.product-bars i:nth-child(4) { animation-delay: .18s; }
.product-bars i:nth-child(5) { animation-delay: .24s; }
.product-bars i:nth-child(6) { animation-delay: .3s; }

.product-float {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 148px;
  padding: 9px 10px;
  border: 1px solid rgba(185, 198, 227, .85);
  border-radius: 13px;
  background: rgba(255, 255, 255, .96);
  color: #101a3d;
  box-shadow: 0 18px 38px -22px rgba(15, 35, 95, .65);
  backdrop-filter: blur(8px);
  text-align: start;
  animation: product-float 4.2s ease-in-out infinite;
}
.product-float > span { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; background: #e8f9f6; color: #078579; }
.product-float svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.product-float div { display: grid; gap: 1px; }
.product-float b { font-size: 8.5px; font-weight: 900; white-space: nowrap; }
.product-float small { color: #7b88a6; font-size: 6.5px; font-weight: 700; white-space: nowrap; }
.product-float-scan { top: 78px; left: -10px; }
.product-float-paid { right: -7px; bottom: 43px; animation-delay: -1.4s; }
.product-float-paid > span { background: #eaf1ff; color: #2563eb; }
.product-float-parent { left: 34px; bottom: 0; animation-delay: -2.8s; }
.product-float-parent > span { background: #f1edff; color: #7457d6; }

@keyframes product-preview-enter {
  from { opacity: 0; transform: translateY(18px) rotate(-1deg) scale(.98); }
  to { opacity: 1; transform: translateY(0) rotate(-1deg) scale(1); }
}
@keyframes product-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
@keyframes product-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes product-bar-grow { from { transform: scaleY(.08); opacity: .4; } to { transform: scaleY(1); opacity: 1; } }

/* شارة قصيرة فوق العنوان؛ اسم البراند موجود بالفعل في شريط التنقل. */
.auth-hero-top { display: flex; justify-content: center; }

/* الشارة: وعد التجربة، وزرار بيفتح التسجيل. أزرق وبنفسجي من الهوية مش
   ذهبي. الحركة تلاتة وبس: موجة نبض حواليها، لمعة بتعدّي عليها، ونجمة بتلمع
   — كفاية تشدّ العين من غير ما تنافس زرار «ابدأ الآن» الأساسي. */
.auth-badge {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 18px 9px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(37, 99, 235, 0.38);
  background: linear-gradient(120deg, #eaf1ff 0%, #f1ecff 100%);
  color: var(--brand-accent-deep);
  font: inherit;
  font-size: max(var(--fs-min), 15px);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  animation: brand-badge-pulse 2.4s ease-out infinite;
  transition: background var(--speed), color var(--speed), border-color var(--speed), transform var(--speed);
}
/* اللمعة تحت الكلام وفوق الخلفية: `isolation` بيخلّي الـz-index السالب
   يترسم جوّه الشارة نفسها مش ورا الصفحة. */
.auth-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.9) 50%, transparent 70%);
  transform: translateX(120%);
  animation: brand-badge-shine 3.6s ease-in-out infinite;
}
.auth-badge-spark { flex: none; width: 18px; height: 18px; fill: var(--brand-teal); animation: brand-badge-twinkle 1.8s ease-in-out infinite; }
.auth-badge-go {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: brand-badge-nudge 1.8s ease-in-out infinite;
}
.auth-badge:hover { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; transform: translateY(-1px); }
.auth-badge:hover .auth-badge-spark { fill: #fff; }
.auth-badge:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 3px; }
/* على الموبايل الجملة بتنزل سطرين: `balance` بيقسمها نصّين متساويين بدل
   كلمة «دفع.» لوحدها في السطر التاني. */
.auth-badge > span { text-wrap: balance; }

@keyframes brand-badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.38); }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
/* اللمعة بتعدّي من اليمين للشمال — نفس اتجاه القراية — وتستنّى شوية. */
@keyframes brand-badge-shine { 0%, 45% { transform: translateX(120%); } 100% { transform: translateX(-120%); } }
@keyframes brand-badge-twinkle { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(0.78) rotate(40deg); } }
@keyframes brand-badge-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }

/* العنوان أكبر حاجة على الشاشة وبفرق واضح — ده الوعد، وكل اللي تحته تفاصيله.
   مسافة السطر ١٫١٥ لأن أي مسافة أوسع في الحجم ده بتفصل السطرين عن بعض. */
.auth-hero h1 {
  /* الحد بالـch مربوط بحجم الخط، فبيدّي سطرين متوازنين على كل عرض، و`100%`
     عشان على الموبايل الرقم ده أوسع من الشاشة نفسها. */
  max-width: min(23ch, 100%);
  font-size: clamp(28px, 4.6vw, 50px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--ink);
}
/* الحاجات في سطر والخلاصة («في مكان واحد») في سطر لوحدها بلون الهوية. */
.auth-hero h1 .auth-hero-lead,
.auth-hero h1 .auth-hero-tail { display: block; text-wrap: balance; }
.auth-hero h1 .auth-hero-tail { color: var(--brand-accent); }

.auth-hero-sub {
  max-width: 40ch;
  color: var(--muted);
  font-size: max(var(--fs-min), 15.5px);
  font-weight: 600;
  line-height: 1.8;
  text-wrap: balance;
}

.auth-hero-actions { display: grid; justify-items: center; gap: 10px; margin-block-start: 6px; }
.auth-hero-cta { min-width: min(280px, 100%); height: 52px; font-size: max(var(--fs-min), 16px); }
.auth-hero-assurance {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.auth-hero-assurance svg { width: 15px; height: 15px; fill: none; stroke: var(--success); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
/* «اشترك دلوقتي» رابط جوّه جملة في كارت الدخول، مش زرار أساسي تاني. */
.auth-switch button {
  padding: 2px 3px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--brand-accent);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* سطر الطمأنة نزل للشريط السفلي: فوق كان جنب وعد التجربة والاتنين بيتقروا
   كجملة واحدة مكرّرة. تحت السعر بيبقى إجابة على السؤال اللي بيتسأل هناك. */
.auth-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 16px;
  /* الشريط <ul>، والمتصفّح بيديله ٤٠px إزاحة قايمة من نفسه — والصفر العام
     بيغطّي h1/h2/h3/p بس. */
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-trust li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.auth-trust svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--success);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------- مميزات السيستم: قسم بيتفتح ------------------------- */

/* القسم مقفول لحد ما حد يفتحه من الشريط، فبيتحسب في التخطيط بس وهو مفتوح.
   `[hidden]` لوحدها كفاية هنا لأن القاعدة مافيهاش `display` مفروض. */
.auth-features {
  display: grid;
  gap: 24px;
  width: 100%;
  scroll-margin-top: 18px;
  animation: feat-section-in 460ms cubic-bezier(.2, .8, .2, 1) both;
}
.auth-features[hidden] { display: none; }

@keyframes feat-section-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* الترويسة صفّ بطرفين زي ترويسة الأسعار بالظبط: العنوان على حرف وزرار
   الإخفاء على الحرف التاني. القسم طويل، فالخروج منه لازم يكون في أوله مش
   في آخره — اللي فتحه وعرف اللي عايزه مش هيسحب لآخر تلاتاشر كارت. */
.feat-head {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px 18px;
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-teal) 38%, transparent);
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--brand-teal) 34%, transparent), transparent 34%),
    linear-gradient(135deg, var(--brand-navy), color-mix(in srgb, var(--brand-navy) 82%, var(--brand-teal)));
  color: #fff;
  box-shadow: 0 24px 56px rgba(9, 34, 77, 0.18);
  text-align: start;
}
.feat-head::before,
.feat-head::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}
.feat-head::before { width: 260px; height: 260px; inset: -150px -60px auto auto; }
.feat-head::after { width: 180px; height: 180px; inset: auto auto -120px 18%; }
.feat-head-copy { display: grid; justify-items: start; gap: 10px; max-width: 680px; }
.feat-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #bdf7e8;
  font-size: max(var(--fs-min), 12px);
  font-weight: 850;
}
.feat-eyebrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.feat-head h2 { max-width: 18ch; font-size: clamp(28px, 4.2vw, 44px); font-weight: 950; line-height: 1.22; letter-spacing: -0.6px; }
.feat-head p { max-width: 62ch; color: rgba(255, 255, 255, 0.76); font-size: max(var(--fs-min), 15px); font-weight: 650; line-height: 1.85; }
.feat-close {
  position: relative;
  z-index: 1;
  align-self: start;
  flex: none;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.feat-close:hover { border-color: rgba(255, 255, 255, 0.44); background: rgba(255, 255, 255, 0.14); }
.feat-scoreboard {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}
.feat-scoreboard > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 14px 18px;
  background: rgba(8, 29, 67, 0.58);
}
.feat-scoreboard strong { color: #6ee7c8; font-size: clamp(25px, 3vw, 34px); font-weight: 950; line-height: 1; }
.feat-scoreboard span { color: rgba(255, 255, 255, 0.8); font-size: max(var(--fs-min), 12px); font-weight: 750; line-height: 1.45; }

/* قبل كتالوج المميزات فيه ثلاث رحلات فعلية: الزائر بيفهم «هعمل إيه» قبل
   ما يقرأ أسماء الخصائص. الأرقام مرسومة بقائمة مرتبة عشان الترتيب يفضل
   مفهوم حتى لو التنسيق أو الألوان ما اتحمّلوش. */
.feature-journeys { display: grid; gap: 16px; }
.feature-journeys-head { display: grid; justify-items: start; gap: 4px; text-align: start; }
.feature-journeys-head > span,
.feat-explorer-head > div > span {
  color: var(--accent);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 900;
}
.feature-journeys-head h3 { font-size: clamp(20px, 3vw, 27px); font-weight: 950; line-height: 1.35; }
.feature-journeys-head p { color: var(--muted); font-size: max(var(--fs-min), 13.5px); font-weight: 650; }
.feature-journeys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 14px;
}
.feature-journey {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 100%;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(150deg, var(--panel) 40%, color-mix(in srgb, var(--accent-soft) 38%, var(--panel)));
  box-shadow: 0 10px 28px rgba(10, 36, 74, 0.06);
  text-align: start;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.feature-journey::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 92px;
  height: 92px;
  inset: -46px auto auto -34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-soft) 68%, transparent);
}
.feature-journey:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); box-shadow: 0 18px 34px rgba(10, 36, 74, 0.1); }
.feature-journey-head { display: flex; align-items: center; justify-content: space-between; }
.feature-journey-number { color: color-mix(in srgb, var(--accent) 42%, var(--muted)); font-size: max(var(--fs-min), 12px); font-weight: 900; letter-spacing: 1px; }
.feature-journey h4 { font-size: max(var(--fs-min), 17px); font-weight: 950; line-height: 1.35; }
.feature-journey ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.feature-journey li { position: relative; display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: start; gap: 9px; min-height: 38px; }
.feature-journey li:not(:last-child)::after { content: ""; position: absolute; inset: 24px 12px 0 auto; width: 1px; background: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.feature-journey li b { position: relative; z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 950; }
.feature-journey li span { padding-top: 3px; line-height: 1.55; }

.feat-explorer {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent-soft));
  box-shadow: 0 14px 38px rgba(10, 36, 74, 0.07);
}
.feat-explorer-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; text-align: start; }
.feat-explorer-head > div { display: grid; gap: 4px; }
.feat-explorer-head h3 { font-size: clamp(20px, 3vw, 27px); font-weight: 950; line-height: 1.35; }
.feat-explorer-head > p { max-width: 38ch; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 650; line-height: 1.65; }
.feat-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 8px;
}
.feat-tab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 60px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.feat-tab:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
.feat-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); outline-offset: 2px; }
.feat-tab.is-active { border-color: var(--accent); background: linear-gradient(145deg, var(--accent-soft), var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent), 0 8px 20px rgba(10, 36, 74, 0.07); }
.feat-tab-number { color: color-mix(in srgb, var(--accent) 52%, var(--muted)); font-size: 10px; font-weight: 900; letter-spacing: 0.7px; }
.feat-tab-copy { display: grid; gap: 2px; min-width: 0; }
.feat-tab-copy b { overflow: hidden; font-size: max(var(--fs-min), 12.5px); font-weight: 900; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.feat-tab-copy small { color: var(--muted); font-size: 10px; font-weight: 700; }
.feat-tab > svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform 180ms ease, stroke 180ms ease; }
.feat-tab.is-active > svg { stroke: var(--accent); transform: translateX(-2px); }
.feat-panels { min-height: 0; }
.feat-group { display: grid; gap: 12px; text-align: start; animation: feat-panel-in 320ms ease both; }
.feat-group[hidden] { display: none; }
@keyframes feat-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* `auto-fit` هنا مش رقم ثابت زي شبكة الباقات: عدد الكروت في المجموعة بيتغيّر
   من تلاتة لستة، فالعمود بيتحدد بأقل عرض مقروء للكارت مش بعدد الكروت. */
.feat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  align-items: stretch;
}

.feat-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 7px 20px rgba(10, 36, 74, 0.045);
  text-align: start;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.feat-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: 0 15px 28px rgba(10, 36, 74, 0.08); }
.feat-card-head { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 11px; }

.feat-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feat-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.feat-card h3 { font-size: max(var(--fs-min), 15px); font-weight: 950; line-height: 1.4; }
/* السطر الأول أغمق من البنود تحته: هو اللي بيقول الخاصية دي إيه، والبنود
   تفاصيلها. لو الاتنين بنفس اللون الكارت بيتقري أربع سطور متساوية. */
.feat-card > p { color: var(--ink); font-size: max(var(--fs-min), 13px); font-weight: 650; line-height: 1.75; }

.feat-card ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.feat-card li { display: flex; align-items: flex-start; gap: 7px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; line-height: 1.65; }
.feat-card li svg {
  flex: none;
  width: 15px;
  height: 15px;
  /* العلامة بتنزل شعرة عشان تقع في نص أول سطر مش فوقه — البند سطرين على
     الموبايل، والتوسيط الرأسي كان بيحطها في نص السطرين. */
  margin-top: 3px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent-soft), var(--panel));
  text-align: start;
}
.feat-foot > div { display: grid; gap: 3px; }
.feat-foot strong { color: var(--ink); font-size: max(var(--fs-min), 14px); font-weight: 950; }
.feat-foot span { color: var(--muted); font-size: max(var(--fs-min), 12px); font-weight: 650; line-height: 1.55; }
.feat-foot .primary-btn { flex: none; min-width: 210px; }
.feat-foot .primary-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; }

/* زرار إظهار كلمة المرور جوّه الخانة نفسها. الخانة عندها padding ثابت من
   `.field input`، فبنزوّد الجهة اللي فيها الزرار بس عشان النص ما يدخلش تحته. */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-inline-end: 44px; }
/* خانة الباسورد في الدخول `dir="ltr"` لأن اللي جوّاها إنجليزي، بس زرار
   العين متعلّق في حرف الصفحة الشمال (`inset-inline-end` في صفحة RTL).
   يعني منطق الخانة اتقلب والزرار مكانه ما اتقلبش — والإزاحة المنطقية فوق
   بقت بتبعّد النص عن الجهة الغلط، فالنجوم بتمشي تحت الزرار. الجهة هنا
   بتتحدد بالحقيقي مش بالمنطقي. */
.pass-wrap input[dir="ltr"] { padding-inline-end: 14px; padding-left: 44px; }
/* أيقونة القفل على اليمين والعين على الشمال حتى لو اتجاه النص جوّه الخانة
   إنجليزي. الاتجاه المنطقي للخانة لوحده كان بيحط الحشو تحت الأيقونة. */
.auth-screen .login-control > input[dir="ltr"] { padding-right: 44px; }
.auth-screen .pass-wrap.login-control > input[dir="ltr"] { padding-right: 44px; padding-left: 44px; }
.pass-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pass-toggle:hover { background: var(--panel-2); color: var(--ink); }
.pass-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* الحالة المضغوطة = كلمة المرور ظاهرة دلوقتي. اللون بيقول كده من غير أيقونة
   تانية — مفيش أيقونة «عين مشطوبة» في الطقم. */
.pass-toggle[aria-pressed="true"] { color: var(--accent); }

/* شعرة تحت رأس الكارت: نفس الفاصل اللي بيقسم كارت الباقة بين القرار
   والتفاصيل. من غيرها العنوان والوصف والتبويبات والفورم كانوا أربع كتل
   بنفس البُعد من بعض، فالكارت بيتقري طابور عناصر مش رأس وجسم. */
.auth-card-head { display: grid; padding-block-end: 16px; border-block-end: 1px solid var(--line); }
.auth-card-head .brand-mark[hidden] { display: none; }

/* ------------------------- نص الهوية جنب كارت الدخول ------------------------- */

/* «صفحة الدخول» في لوحة الهوية: لوح كحلي فيه بلاطة الأيقونة واللوك-أب
   والشعار، وتحتهم تلات وعود قصيرة.

   الصورة اللي في اللوحة اتبدّلت بمدارات مرسومة: صورة فصل حقيقية بتتحمّل
   تقيلة على نت الموبايل قبل ما الفورم نفسه يبان، والمدارات زينة هادية ورا الهوية.
   مخفي تحت ٧٦٠ — الشريط فوق فيه اللوجو، واللوح كان هيزقّ الفورم لتحت شاشة. */
.auth-brand {
  display: none;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  align-content: space-between;
  gap: 30px;
  padding: clamp(28px, 4vw, 44px) clamp(20px, 3.2vw, 38px);
  color: #dbe5ff;
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(59, 130, 246, 0.42), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(34, 195, 238, 0.2), transparent 65%),
    linear-gradient(160deg, var(--brand-navy-lift), var(--brand-navy) 52%, var(--brand-navy-deep));
}
.auth-brand-orbits { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }

.auth-brand-body { display: grid; justify-items: center; align-self: center; gap: 2px; text-align: center; }
.auth-brand-tile {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin-block-end: 16px;
  border-radius: 28px;
  color: #fff;
  background: var(--brand-tile);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(140, 180, 255, 0.2),
    0 24px 50px -18px rgba(0, 0, 0, 0.6),
    0 0 70px -12px rgba(32, 181, 166, 0.45);
}
.auth-brand-tile .brand-logo { width: 76px; height: 76px; }
.auth-brand-latin {
  font-family: Montserrat, Cairo, system-ui, sans-serif;
  font-size: clamp(30px, 3.6vw, 40px);
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.05;
  color: #fff;
}
.auth-brand-name { font-size: clamp(24px, 2.8vw, 32px); font-weight: 900; line-height: 1.3; color: #fff; }
.auth-brand-slogan { margin-block-start: 8px; color: #a8e3db; font-size: max(var(--fs-min), 15px); font-weight: 700; }

.auth-brand-points { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.auth-brand-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(160, 190, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}
.auth-brand-points svg {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 11px;
  background: rgba(59, 130, 246, 0.22);
  fill: none;
  stroke: #8fd8ff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-brand-points span { display: grid; gap: 1px; }
.auth-brand-points b { color: #fff; font-size: max(var(--fs-min), 14px); font-weight: 800; }
.auth-brand-points small { color: #a9bff5; font-size: max(var(--fs-min), 12px); font-weight: 600; }

/* ----- كروت الباقات ----- */

.auth-offer { display: grid; gap: 20px; }
/* مقدمة الأسعار وحدة واحدة بدل أربع مجموعات عائمة: رسالة القرار على اليمين،
   المدة والسعر على اليسار، وشريط الطمأنة رابط بينهم. الخلفية الهادية بتفصل
   الاختيار عن كروت الباقات من غير ما تزود عنوان أو كلام جديد. */
.offer-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(230px, .82fr) minmax(500px, 1.45fr);
  align-items: center;
  gap: 22px 30px;
  padding: 26px 28px 0;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 28px;
  background:
    radial-gradient(circle at 94% 2%, color-mix(in srgb, var(--brand-accent) 14%, transparent) 0, transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 94%, var(--accent-soft)), var(--panel));
  box-shadow: 0 24px 60px -44px rgba(15, 35, 95, .58);
}
.offer-head::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 18px auto auto 42%;
  width: 150px;
  height: 150px;
  border: 1px dashed color-mix(in srgb, var(--brand-accent) 19%, transparent);
  border-radius: 50%;
  opacity: .7;
}
.offer-head-text { display: grid; justify-items: start; gap: 10px; text-align: start; }
.offer-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 22%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-accent) 8%, var(--panel));
  color: var(--brand-accent-deep);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 800;
}
.offer-eyebrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.3; }
.offer-head-switch {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 91%, transparent);
  box-shadow: 0 14px 34px -28px rgba(15, 35, 95, .65);
  backdrop-filter: blur(10px);
}
.offer-switch-title {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  text-align: start;
}
.offer-switch-title > span { color: var(--muted); font-size: max(var(--fs-min), 11px); font-weight: 800; }
.offer-switch-title > strong { grid-column: 1; color: var(--ink); font-size: max(var(--fs-min), 13px); font-weight: 900; }

/* الملاحظات التلاتة: أيقونة وكلمتين، جنب بعض. دي الاعتراضات اللي بتيجي قبل
   السعر — «هجرّب الأول؟»، «هدفع دلوقتي؟»، «هعيد إدخال كل طلابي؟» — ومكانها
   جنب السعر مش في قسم لوحده تحته. */
.offer-notes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  grid-column: 1 / -1;
  gap: 8px 26px;
  margin: 0 -28px;
  padding: 12px 28px;
  list-style: none;
  border-top: 1px solid color-mix(in srgb, var(--accent) 11%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
.offer-notes li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.offer-notes svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.offer-head h2 { max-width: 12ch; font-size: clamp(27px, 3.2vw, 38px); line-height: 1.24; font-weight: 900; color: var(--ink); }
/* «تابعلي» في العنوان بلون الهوية. المتصفّح بيحط أصفر فاقع على `mark` من
   نفسه، فالخلفية لازم تتصفّر صراحةً. */
.offer-head h2 mark { background: none; color: var(--brand-accent); }
.offer-head-text > p { max-width: 37ch; color: var(--muted); font-size: max(var(--fs-min), 14px); line-height: 1.8; font-weight: 600; }

/* أكبر توفير على الشريط في شارة خضرا جنبه: الأرقام مكتوبة على الشرايح
   أصلاً، بس اللي نازل من العنوان مابيقفش يقارن أربع شرايح. */
.offer-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: max(var(--fs-min), 12px);
  font-weight: 800;
}
.offer-hint svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* المبدّل كبسولة بيضا بظل خفيف والمختار أزرق مليان — زي «شهري / سنوي» في
   لوحة الهوية، بس بالمدد الأربعة الحقيقية. */
.duration-switch {
  display: flex;
  flex-wrap: wrap;
  /* المدد الأربعة بتلف على سطرين على الموبايل — من غير التوسيط السطر التاني
     بيتزنق على جنب وشكله زي حاجة ناقصة مش زي بقية الصف. */
  justify-content: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px -18px rgba(15, 35, 95, 0.5);
}

/* جوّه مقدمة الأسعار المدة اختيار قرار، مش مجرد فلاتر صغيرة. الأربع خانات
   المتساوية تخلي الاسم والتوفير يتقارنوا رأسيًا في لمحة واحدة. */
.offer-head-switch .duration-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 17px;
  box-shadow: none;
}
.offer-head-switch .duration-chip {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 58px;
  padding: 7px 8px;
  border-radius: 13px;
}
.offer-head-switch .duration-chip > span { font-size: max(var(--fs-min), 13px); }
.offer-head-switch .duration-chip em { padding: 0; background: transparent; color: var(--success); font-size: max(var(--fs-min), 10.5px); }
.offer-head-switch .duration-chip.active em { background: transparent; color: rgba(255, 255, 255, .84); }

.duration-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  font-size: max(var(--fs-min), 13px);
  transition: all var(--speed);
}
.duration-chip em {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: max(var(--fs-min), 11px);
  font-style: normal;
  font-weight: 800;
}
/* الأزرق الغامق مش `--accent`: في الوضع الليلي `--accent` بيبقى إنديغو فاتح،
   وأبيض فوقه تباينه ٢٫٣:١ — يعني المدة المختارة، وهي أهم حاجة على الشريط،
   بتبقى أصعب حاجة تتقري. `--action-bg` هو نفس اللي الزرار الأساسي بيستخدمه. */
.duration-chip.active { background: var(--action-bg); color: var(--action-ink); box-shadow: var(--shadow); }
.duration-chip.active em { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* التلات باقات إما تلاتة في صف أو واحدة تحت التانية — مافيش «اتنين والتالت
   لوحده» أبداً.

   `auto-fit` مع حد أدنى كان بيدّي التلات حالات حسب العرض المتاح، والحالة
   الوسطانية دي هي أوحش واحدة: المقارنة بتحصل بين اتنين، والتالتة بتقع تحت
   لوحدها فبتبان زي إضافة مش زي اختيار. فالعدد مكتوب صراحةً بدل ما يتحسب. */
.plan-grid {
  display: grid;
  /* تحت الحد ده عمود واحد بعرض كارت الدخول نفسه — الكارت بعرض ٧٠٠px
     مايتقريش، والعمود المحدود بيخلّي الصفحة كلها على خط واحد. */
  grid-template-columns: minmax(0, 440px);
  justify-content: center;
  gap: 16px;
  /* مش `start`: الكروت بتتمدّ لنفس الطول عشان زرار الاستفسار في قاع كل واحد
     يقف على خط واحد. المحتوى اللي جوّاهم مختلف الطول (سطر توفير، سطر كود،
     شهر هدية) فمن غير التمدّد التلات زراير بتبقى على تلات ارتفاعات. */
  align-items: stretch;
}

/* الكارت أبيض ببرواز شعرة وظل خفيف، والتلاتة شكل واحد — زي لوحة الهوية.

   كانوا تلات ألوان (هادي، ذهبي، ماسي)، والهوية الجديدة كحلي وأزرق بس، فالدهب
   والتلج بقوا ألوان من برّه العيلة. الفرق بين الباقات بقى في الاسم والرقم،
   والمميّزة بتتعلّم ببرواز أزرق وشارة راكبة على حرفها. */
.plan-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 30px 20px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 36px -28px rgba(15, 35, 95, 0.5);
  transition: transform 360ms cubic-bezier(.2, .8, .2, 1), box-shadow 360ms ease, border-color 360ms ease;
}
.plan-card::before {
  content: '';
  position: absolute;
  inset: 0 18px auto;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand-teal) 55%, var(--line)), transparent);
  opacity: .55;
  transition: opacity 360ms ease, transform 360ms ease;
}
.plan-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); box-shadow: 0 30px 58px -34px rgba(15, 35, 95, 0.62); }
.plan-card:hover::before { opacity: 1; transform: scaleX(1.08); }

/* البرواز ٢px من غير ما يزحزح المحتوى: الحد نفسه ١px زي أخواته، والتاني
   حلقة ظل — فالكلام جوّه المميّزة واقف على نفس خطوط الكروت اللي جنبها. */
.plan-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 28px 56px -30px rgba(11, 125, 114, 0.55);
}
.plan-card.featured::before { height: 4px; background: linear-gradient(90deg, transparent, var(--brand-teal), var(--brand-accent), transparent); opacity: 1; }

/* شارة «الأكثر طلباً» راكبة على الحرف العلوي في النص زي لوحة الهوية.
   بالحروف الفيزيائية (`left` و`translate`) مش المنطقية: التوسيط مالوش
   علاقة باتجاه الكتابة، والمنطقي في صفحة عربية بيقلب الإزاحة. */
.plan-flag {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-accent), var(--brand-accent-deep));
  color: #fff;
  font-size: max(var(--fs-min), 12px);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 16px -8px rgba(37, 99, 235, 0.75);
}

/* الاسم على حرف الكارت، وشارة العرض على حرفه التاني. */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-chips { display: flex; align-items: center; gap: 6px; flex: none; }
.plan-head h3 { font-size: 20px; font-weight: 900; color: var(--ink); }
.plan-fit {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-block-start: -5px;
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.plan-fit span { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--brand-teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-teal) 12%, transparent); }
/* حد الطلاب سطر الوصف تحت الاسم («لحد ١٠٠ طالب») — نفس مكان «للمراكز
   الصغيرة» في لوحة الهوية. هو الرقم الوحيد اللي بيفرّق بين الباقات فعلاً،
   فبيتقري مع الاسم قبل السعر. */
.plan-quota { margin-block-start: -5px; color: var(--muted); font-size: max(var(--fs-min), 13px); font-weight: 800; }

.plan-ribbon {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 800;
  white-space: nowrap;
}
.plan-ribbon small { font-size: max(var(--fs-min), 10.5px); font-weight: 700; opacity: 0.75; }

.plan-price-box {
  display: grid;
  gap: 5px;
  margin-block-start: 3px;
  padding: 14px 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--line));
  border-radius: 17px;
  background:
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--brand-teal) 9%, transparent), transparent 34%),
    var(--panel-2);
  transition: transform 360ms cubic-bezier(.2, .8, .2, 1), border-color 360ms ease;
}
.plan-card:hover .plan-price-box { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.plan-card.featured .plan-price-box { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 64%, var(--panel)), var(--panel-2)); }
.plan-price-label { color: var(--muted); font-size: max(var(--fs-min), 10.5px); font-weight: 800; }
.plan-was { margin: 0; }
.plan-was del {
  color: var(--muted);
  font-size: max(var(--fs-min), 14px);
  font-weight: 700;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.plan-price strong {
  font-size: clamp(30px, 3.6vw, 40px);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.plan-price span { color: var(--muted); font-size: max(var(--fs-min), 13px); font-weight: 700; }

.plan-rate { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.plan-saving { color: var(--success); font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.plan-scarce { color: var(--warning); font-size: max(var(--fs-min), 12px); font-weight: 800; }

.plan-features {
  display: grid;
  gap: 9px;
  margin-block: 3px 14px;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--line);
}
.plan-includes { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.plan-includes em { padding: 3px 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: max(var(--fs-min), 10.5px); font-style: normal; font-weight: 800; }
/* الريسِت العام في أول الملف فيه h1 و h2 و h3 و p بس — أي h4 أو ul جديد
   بيجيب هوامش المتصفّح معاه. */
.plan-features h4 { margin: 0; font-size: max(var(--fs-min), 13.5px); font-weight: 800; color: var(--ink); }

.plan-points { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.plan-points li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--ink);
  font-size: max(var(--fs-min), 13px);
  font-weight: 600;
  line-height: 1.65;
}
/* علامة صح خضرا جوّه دايرة فاتحة زي لوحة الهوية. الحشو جوّه الـsvg هو اللي
   بيعمل الدايرة حوالين العلامة من غير عنصر زيادة. */
.plan-points li svg {
  width: 18px;
  height: 18px;
  margin-block-start: 2px;
  padding: 3px;
  border-radius: 50%;
  background: var(--success-soft);
  fill: none;
  stroke: var(--success);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plan-points li.plan-bonus { font-weight: 800; color: var(--success); }

/* الزرار في قاع الكارت زي لوحة الهوية، و`auto` فوقه هو اللي بيلزقه هناك —
   الكروت متمدّة لنفس الطول فالتلات زراير بيقفوا على خط واحد.

   `.plan-card` قدّام الاسم مش زيادة: `.submit-btn` معرّف بعد كده في الملف
   وبنفس قوة المُحدِّد، فالزرار كان بيرجع مليان مهما كتبنا هنا. */
.plan-card .plan-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-block-start: auto;
  width: 100%;
  border: 1.5px solid var(--accent);
  background: var(--panel);
  color: var(--accent);
  box-shadow: none;
}
.plan-pick svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.3; transition: transform var(--speed); }
.plan-card .plan-pick:hover svg { transform: translateX(-2px); }
.plan-card .plan-pick:hover { background: var(--accent-soft); }
.plan-card.featured .plan-pick {
  border-color: transparent;
  background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end));
  color: var(--action-ink);
  box-shadow: 0 12px 24px -12px rgba(37, 99, 235, 0.75);
}

/* الاستفسار لينك هادي تحت الزرار مش زرار تاني: زرارين بحدود تحت بعض كانوا
   بيقسموا النداء نصّين. الرسالة لسه فيها اسم الباقة. */
.plan-ask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  margin-block-end: -8px;
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
  text-decoration: none;
  transition: color var(--speed), transform var(--speed);
}
.plan-ask svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.plan-ask:hover { color: var(--accent); transform: translateY(-1px); }

/* «كل المميزات بالتفصيل» تحت الكروت: مكان «مقارنة تفصيلية» في لوحة الهوية،
   وبيفتح نفس قسم المميزات اللي في الشريط. */
.offer-more { display: flex; justify-content: center; }
.offer-more a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 10px;
  color: var(--accent);
  font-size: max(var(--fs-min), 13.5px);
  font-weight: 800;
}
.offer-more a:hover { text-decoration: underline; text-underline-offset: 4px; }
.offer-more svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }


/* ----- خطوات الاشتراك ----- */

.signup-flow { display: grid; gap: 16px; }

/* شريط الخطوات: دواير مترقّمة على خط واحد. الخط مرسوم كخلفية على القايمة
   كلها مش قطعة بين كل خطوتين — على الموبايل الخطوة الحالية بتاخد عرض أكبر
   من أخواتها، والقطع كانت هتبقى بأطوال مختلفة ومش واصلة للدواير. */
.signup-rail {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  background: linear-gradient(var(--line), var(--line)) no-repeat center 13px / calc(100% - 56px) 2px;
}
.signup-rail li {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 700;
  text-align: center;
}
.signup-rail li i { font-style: normal; }
.signup-rail li span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  font-size: max(var(--fs-min), 12px);
  font-weight: 800;
  transition: border-color var(--speed), background var(--speed), color var(--speed), box-shadow var(--speed), transform var(--speed);
}
.signup-rail li.current { color: var(--accent); font-weight: 900; }
.signup-rail li.current span { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); transform: scale(1.04); }
.signup-rail li.done { color: var(--ink); }
.signup-rail li.done span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.signup-step { display: grid; gap: 14px; }
.signup-step-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: 17px;
  background:
    radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--brand-teal) 9%, transparent), transparent 30%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 54%, var(--panel)), var(--panel));
}
.signup-step-head > div { display: grid; gap: 1px; min-width: 0; }
.signup-step-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--brand-accent), var(--brand-teal));
  color: #fff;
  box-shadow: 0 13px 24px -17px rgba(11, 125, 114, .8);
}
.signup-step-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-card .signup-step-count {
  margin: 0;
  color: var(--accent);
  font-size: max(var(--fs-min), 10.5px);
  font-weight: 900;
  line-height: 1.4;
}
.signup-step-title {
  margin: 0;
  color: var(--ink);
  font-size: max(var(--fs-min), 18px);
  font-weight: 900;
  line-height: 1.35;
  outline: none;
}
.signup-step-title:focus-visible { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; }
.auth-card .signup-step-description {
  margin: 0;
  color: var(--muted);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 600;
  line-height: 1.65;
}
.signup-step-body { display: grid; gap: 12px; animation: signup-step-in 280ms cubic-bezier(.2, .8, .2, 1) both; }
.signup-step-body .field > span:first-child { transition: color var(--speed); }
.signup-step-body .field:focus-within > span:first-child { color: var(--accent); }
.auth-card .signup-context-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--success-soft) 54%, var(--panel));
  color: var(--muted);
  font-size: max(var(--fs-min), 11.5px);
  line-height: 1.7;
}
.signup-context-note svg { width: 16px; height: 16px; flex: none; margin-top: 3px; fill: none; stroke: var(--success); stroke-width: 2; }
.signup-actions { display: flex; gap: 9px; padding-top: 14px; border-top: 1px solid var(--line); }
.signup-actions button { min-height: 48px; }
.signup-actions .submit-btn { flex: 1; }
.signup-actions .ghost-btn { flex: 0 0 auto; min-width: 92px; }
.signup-next,
.signup-back { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.signup-next::after,
.signup-back::before { font-size: 22px; font-weight: 800; line-height: .7; transition: transform var(--speed); }
.signup-next::after { content: '‹'; }
.signup-next.final::after { content: '✓'; font-size: 16px; }
.signup-back::before { content: '‹'; transform: rotate(180deg); }
.signup-next:hover::after { transform: translateX(-2px); }
.signup-back:hover::before { transform: translateX(2px) rotate(180deg); }
@keyframes signup-step-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pick-block { display: grid; gap: 7px; }
.pick-label { color: var(--muted); font-size: max(var(--fs-min), 12px); font-weight: 800; }
.duration-switch.inline { background: transparent; border: 0; padding: 0; }
.duration-switch.inline .duration-chip { border: 1px solid var(--line); background: var(--panel-2); }
.duration-switch.inline .duration-chip.active { border-color: var(--action-bg); background: var(--action-bg); }

.pick-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-align: start;
  transition: all var(--speed);
}
.pick-row b { font-size: max(var(--fs-min), 13.5px); font-weight: 800; color: var(--ink); }
.pick-row small { grid-column: 1; color: var(--muted); font-size: max(var(--fs-min), 12px); font-weight: 700; }
.pick-row span {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: max(var(--fs-min), 15px);
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pick-row.active { border-color: var(--accent); background: var(--accent-soft); }
/* السعر القديم أصغر وباهت جنب الجديد — زي كروت الباقات، عشان الرقمين
   مايتقروش على إنهم رقمين لباقتين. */
.pick-row span del { font-size: 0.78em; font-weight: 700; color: var(--muted); margin-inline-end: 5px; }

.promo-row { display: flex; align-items: flex-end; gap: 8px; }
.promo-row .field { flex: 1; min-width: 0; }
.promo-row .ghost-btn { flex: 0 0 auto; height: var(--tap); }

.promo-note { font-size: max(var(--fs-min), 12.5px); font-weight: 800; line-height: 1.7; }
.promo-note.good { color: var(--success); }
.promo-note.bad { color: var(--danger); }

.signup-summary {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: max(var(--fs-min), 13px);
  font-weight: 700;
  line-height: 1.8;
}
.signup-summary strong { color: var(--accent); font-weight: 800; }

.pay-modes { display: grid; gap: 8px; }
.pay-mode {
  display: grid;
  gap: 3px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-align: start;
  transition: all var(--speed);
}
.pay-mode b { font-size: max(var(--fs-min), 14px); font-weight: 800; color: var(--ink); }
.pay-mode small { color: var(--muted); font-size: max(var(--fs-min), 12px); font-weight: 600; line-height: 1.7; }
.pay-mode.active { border-color: var(--accent); background: var(--accent-soft); }

.method-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.method-pick {
  flex: 1 1 140px;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: max(var(--fs-min), 13px);
  font-weight: 800;
  transition: all var(--speed);
}
.method-pick.active { border-color: var(--action-bg); background: var(--action-bg); color: var(--action-ink); }

.pay-target {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--ink);
  font-size: max(var(--fs-min), 13px);
  font-weight: 700;
  line-height: 1.8;
}
.pay-target b { letter-spacing: 0.05em; }

.signup-review-note {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}
.signup-review-note strong { color: var(--ink); font-size: max(var(--fs-min), 13.5px); font-weight: 900; }
.auth-card .signup-review-note p { margin: 0; font-size: max(var(--fs-min), 13px); }
.signup-review-note a {
  justify-self: start;
  color: var(--accent);
  font-size: max(var(--fs-min), 13px);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.signup-submit-error { margin: 0; }

.receipt-ok { display: grid; justify-items: start; gap: 7px; }
.receipt-ok img {
  max-height: 190px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.signup-done { display: grid; gap: 15px; justify-items: stretch; text-align: start; animation: signup-step-in 360ms cubic-bezier(.2, .8, .2, 1) both; }
.auth-card.signup-complete { padding-block: 38px; }
.auth-card.signup-complete .auth-card-head,
.auth-card.signup-complete .auth-tabs,
.auth-card.signup-complete .auth-switch { display: none; }
.signup-done-visual { display: grid; place-items: center; padding-top: 2px; }
.signup-done-visual > span {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 23px;
  background: linear-gradient(145deg, var(--brand-accent), var(--brand-teal));
  color: #fff;
  box-shadow: 0 17px 36px -22px rgba(11, 125, 114, .9), 0 0 0 9px color-mix(in srgb, var(--success-soft) 64%, transparent);
  transform: rotate(4deg);
}
.signup-done-visual > span::after {
  content: '';
  position: absolute;
  inset: -15px;
  border: 1px dashed color-mix(in srgb, var(--success) 28%, transparent);
  border-radius: 29px;
  transform: rotate(-8deg);
}
.signup-done-visual svg { width: 31px; height: 31px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.signup-done-head { display: grid; justify-items: center; gap: 3px; text-align: center; }
.auth-card .signup-done-eyebrow { margin: 0; color: var(--success); font-size: max(var(--fs-min), 11.5px); font-weight: 900; }
.signup-done h3 { color: var(--ink); font-size: 24px; font-weight: 900; line-height: 1.4; }
.auth-card .signup-done-head > p:last-child { max-width: 34ch; margin: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; line-height: 1.75; }
.signup-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, var(--panel)));
}
.signup-code-card > span { display: grid; gap: 2px; }
.signup-code-card small { color: var(--muted); font-size: max(var(--fs-min), 10.5px); font-weight: 800; }
.signup-code-card b { color: var(--accent); font-size: max(var(--fs-min), 18px); font-weight: 900; letter-spacing: .08em; }
.signup-code-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 11px;
  background: var(--panel);
  color: var(--accent);
  font: inherit;
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 800;
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed), transform var(--speed);
}
.signup-code-card button:hover { transform: translateY(-1px); border-color: var(--accent); }
.signup-code-card button.copied { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.signup-code-card button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.signup-done-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.signup-done-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 64px;
  padding-bottom: 10px;
}
.signup-done-timeline li:last-child { min-height: 34px; padding-bottom: 0; }
.signup-done-timeline li::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset-inline-start: 16px;
  inset-block-start: 34px;
  width: 2px;
  height: calc(100% - 24px);
  background: var(--line);
}
.signup-done-timeline li:last-child::after { display: none; }
.signup-done-timeline li > span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 900;
}
.signup-done-timeline li.done > span { border-color: color-mix(in srgb, var(--success) 28%, var(--line)); background: var(--success-soft); color: var(--success); }
.signup-done-timeline li.current > span { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.signup-done-timeline svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.signup-done-timeline li > div { display: grid; gap: 2px; padding-top: 2px; }
.signup-done-timeline b { color: var(--ink); font-size: max(var(--fs-min), 13px); font-weight: 900; }
.signup-done-timeline small { color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 600; line-height: 1.55; }
.signup-done-help {
  display: grid;
  gap: 8px;
  padding: 12px 13px;
  border-radius: 14px;
  background: var(--panel-2);
}
.auth-card .signup-done-help p { margin: 0; color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 600; line-height: 1.7; }
.signup-done-help a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  color: var(--success);
  font-size: max(var(--fs-min), 12px);
  font-weight: 900;
  text-decoration: none;
}
.signup-done-help a:hover { text-decoration: underline; text-underline-offset: 3px; }
.signup-done-help svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.signup-done .signup-done-login { width: 100%; min-height: 50px; margin-top: 1px; }

/* ----- الأسئلة الشائعة والفوتر ----- */

/* شريط الترحيب بعد الدخول. */
.welcome-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: opacity var(--speed) ease, transform var(--speed) ease;
}

/* الترحيب بيروح لوحده بعد تمن ثواني. الاختفاء المفاجئ في نص الشاشة بيتقرا
   زي غلطة رسم — والطلوع لفوق بيقول إنه راح مش إنه اتشال. */
.welcome-note.leaving { opacity: 0; transform: translateY(-6px); }
.welcome-text { display: grid; gap: 3px; min-width: 0; }
.welcome-hello { font-size: max(var(--fs-min), 15px); font-weight: 800; color: var(--ink); }
.welcome-line { font-size: max(var(--fs-min), 12.5px); font-weight: 600; color: var(--muted); }
.welcome-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
}
.welcome-close:hover { background: var(--panel-2); color: var(--ink); }

/* `details/summary` مش مكوّن متعمّل بإيدينا بقصد: بيفتح ويقفل من غير جافاسكربت،
   وبيشتغل مع البحث في الصفحة وقارئ الشاشة صح، ولو الجافاسكربت وقع بيفضل شغّال. */
/* عرض مقيّد عشان سطر الإجابة مايتمدّش على عرض الشاشة كله ويبقى صعب القراية. */
/* قسم التواصل: نفس عرض الأسئلة بالظبط (760px) عشان الحرف الشمال يفضل
   واحد من فوق لتحت — القسمين ورا بعض، وعرضين مختلفين بيتقروا زحزقة. */
.auth-contact {
  display: grid;
  gap: 18px;
  width: min(980px, 100%);
  margin-inline: auto;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 0, color-mix(in srgb, var(--accent-soft) 78%, transparent), transparent 35%),
    var(--panel);
  box-shadow: 0 22px 54px rgba(10, 36, 74, 0.1);
  scroll-margin-top: 18px;
  animation: contact-section-in 420ms cubic-bezier(.2, .8, .2, 1) both;
}
.auth-contact[hidden] { display: none; }
@keyframes contact-section-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* بقى قسم بيتفتح من الشريط زي المميزات، فترويسته بقت زيها: العنوان على حرف
   وزرار الإخفاء على الحرف التاني — الخروج من القسمين في نفس المكان. */
.contact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  text-align: start;
}
.contact-head-copy { display: grid; justify-items: start; gap: 8px; max-width: 660px; }
.contact-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: max(var(--fs-min), 12px);
  font-weight: 900;
}
.contact-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 13%, transparent); animation: contact-live 1.8s ease-in-out infinite; }
@keyframes contact-live { 50% { box-shadow: 0 0 0 9px transparent; } }
.contact-close { flex: none; }
.contact-head h2 {
  max-width: 18ch;
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 950;
  line-height: 1.25;
  color: var(--ink);
}
.contact-head p { max-width: 62ch; color: var(--muted); font-size: max(var(--fs-min), 14px); font-weight: 650; line-height: 1.8; }

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  gap: 14px;
}
.contact-primary-wrap {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--brand-navy), color-mix(in srgb, var(--brand-navy) 80%, var(--brand-teal)));
  color: #fff;
  box-shadow: 0 16px 34px rgba(9, 34, 77, 0.16);
}
.contact-primary-kicker { color: #91efd8; font-size: max(var(--fs-min), 11.5px); font-weight: 900; }
.contact-primary-wrap > p { display: flex; align-items: flex-start; gap: 7px; color: rgba(255, 255, 255, 0.66); font-size: max(var(--fs-min), 10.5px); font-weight: 650; line-height: 1.55; }
.contact-primary-wrap > p svg { flex: none; width: 14px; height: 14px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; }
.contact-guide {
  display: grid;
  align-content: start;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel-2) 76%, var(--panel));
}
.contact-guide-head { display: grid; gap: 3px; text-align: start; }
.contact-guide-head > span { color: var(--accent); font-size: max(var(--fs-min), 11px); font-weight: 900; }
.contact-guide-head h3 { color: var(--ink); font-size: max(var(--fs-min), 17px); font-weight: 950; }
.contact-guide ol { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.contact-guide li { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 9px; color: var(--ink); font-size: max(var(--fs-min), 12.5px); font-weight: 750; }
.contact-guide li b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 950; }

.contact-more { display: grid; gap: 11px; padding-top: 2px; text-align: start; }
.contact-more > div:first-child { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.contact-more h3 { color: var(--ink); font-size: max(var(--fs-min), 15px); font-weight: 950; }
.contact-more p { max-width: 48ch; color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 650; line-height: 1.55; }

/* 220px مش 260px زي كروت المميزات: الكارت هنا سطرين قصيرين مش فقرة، فـ260
   كانت بتسيب فراغ في نص كل كارت وتنزل الصفّ لاتنين بدل تلاتة. */
.contact-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.contact-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 74px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  text-align: start;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
/* اللي ليه لينك بيتحرّك تحت الماوس، والنص الساكت لأ — الفرق ده هو اللي
   بيقول للزائر إن ده بيتضغط وده بيتقرا، من غير ما نكتبله. */
.contact-card:not(.is-static):hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(10, 36, 74, 0.08); }
.contact-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent); outline-offset: 2px; }
.contact-card.is-primary {
  min-height: 118px;
  padding: 17px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.contact-card.is-primary:not(.is-static):hover { border-color: rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.13); box-shadow: none; }
.contact-card.is-primary:focus-visible { outline-color: rgba(255, 255, 255, 0.55); }

.contact-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.contact-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-card.is-primary .contact-icon { width: 48px; height: 48px; border-radius: 15px; background: #fff; color: var(--brand-teal); }
.contact-card.is-primary .contact-icon svg { width: 23px; height: 23px; }

.contact-body { display: grid; gap: 2px; min-width: 0; }
.contact-label { color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 700; }
/* الرقم والإيميل بيتكتبوا لاتيني في صفحة عربية، فبيتقصّوا بنقط بدل ما
   يكسروا الكارت — والعنوان الكامل بيفضل في الـhref. */
.contact-value {
  color: var(--ink);
  font-size: max(var(--fs-min), 13.5px);
  font-weight: 800;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-note { color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 600; line-height: 1.5; }
.contact-card-action { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-size: max(var(--fs-min), 11px); font-weight: 900; white-space: nowrap; }
.contact-card-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform 180ms ease; }
.contact-card:not(.is-static):hover .contact-card-action svg { transform: translateX(-2px); }
.contact-card.is-primary .contact-label,
.contact-card.is-primary .contact-note { color: rgba(255, 255, 255, 0.68); }
.contact-card.is-primary .contact-value { color: #fff; font-size: max(var(--fs-min), 17px); font-weight: 950; }
.contact-card.is-primary .contact-card-action { align-self: end; padding: 8px 10px; border-radius: 10px; background: #fff; color: var(--brand-navy); }

/* العنوان والمواعيد ممكن يبقوا سطرين، فبيتلفّوا بدل ما يتقصّوا: دول كلام
   بيتقرا، مش رقم بيتضغط. */
.contact-card.is-static .contact-value { white-space: normal; }

.contact-more .contact-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.contact-more .contact-card { grid-column: span 2; }
.contact-more .contact-card.is-static { grid-column: span 3; }

@media (max-width: 760px) {
  .auth-contact { border-radius: 23px; }
  .contact-layout { grid-template-columns: minmax(0, 1fr); }
  .contact-more > div:first-child { align-items: start; flex-direction: column; gap: 4px; }
  .contact-more .contact-grid { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
  .contact-more .contact-card,
  .contact-more .contact-card.is-static { grid-column: auto; }
}

@media (max-width: 620px) {
  .auth-contact { gap: 16px; padding: 20px 16px; }
  .contact-head { gap: 10px; }
  .contact-head h2 { font-size: 28px; }
  .contact-head p { font-size: max(var(--fs-min), 13px); }
  .contact-close { min-height: 38px; padding-inline: 12px; }
  .contact-primary-wrap, .contact-guide { padding: 15px; border-radius: 18px; }
  .contact-card.is-primary { grid-template-columns: auto minmax(0, 1fr); min-height: 0; }
  .contact-card.is-primary .contact-card-action { grid-column: 1 / -1; justify-content: center; }
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------ التواصل والدعم ------------------------------ */
/* نفس كروت التواصل اللي على الصفحة العامة. */
.support-workspace { gap: 16px; }
.support-section { display: grid; gap: 12px; padding: 18px 20px; }
.support-section h3 { font-size: 16px; font-weight: 800; }
.support-section > .ghost-btn, .support-section > .primary-mini { justify-self: start; }
.support-empty p { color: var(--muted); font-size: max(var(--fs-min), 13px); line-height: 1.8; }
.support-tips { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.support-tips li { display: flex; align-items: flex-start; gap: 10px; font-size: max(var(--fs-min), 13px); line-height: 1.8; }
.support-tips li .icon { --icon-tint: var(--success); flex: none; width: 18px; height: 18px; margin-top: 4px; }
@media (max-width: 760px) {
  .support-section > .ghost-btn { width: 100%; justify-content: center; }
}

.auth-faq {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 18px;
  width: 100%;
  margin-inline: auto;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: 28px;
  background:
    radial-gradient(circle at 8% 0, color-mix(in srgb, var(--brand-teal) 10%, transparent), transparent 29%),
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 95%, var(--accent-soft)), var(--panel));
  box-shadow: 0 24px 60px -46px rgba(15, 35, 95, .58);
}
.auth-faq::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: auto -72px -92px auto;
  width: 210px;
  height: 210px;
  border: 1px dashed color-mix(in srgb, var(--brand-teal) 22%, transparent);
  border-radius: 50%;
}
.faq-head { display: grid; justify-items: center; gap: 9px; max-width: 620px; margin-inline: auto; text-align: center; }
.faq-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 20%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-accent) 7%, var(--panel));
  color: var(--brand-accent-deep);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 800;
}
.faq-eyebrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.auth-faq h2 { font-size: clamp(25px, 3vw, 36px); line-height: 1.3; font-weight: 900; color: var(--ink); }
.auth-faq h2 mark { background: none; color: var(--brand-accent); }
.faq-head > p { max-width: 52ch; color: var(--muted); font-size: max(var(--fs-min), 13.5px); font-weight: 600; line-height: 1.8; }
.faq-grid { display: grid; gap: 12px; align-items: start; }
.auth-faq details {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 9%, var(--line));
  border-radius: 17px;
  overflow: hidden;
  box-shadow: 0 10px 24px -24px rgba(15, 35, 95, .7);
  transition: border-color var(--speed), box-shadow var(--speed), transform var(--speed);
}
.auth-faq details:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.auth-faq details[open] { border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); box-shadow: 0 18px 36px -30px rgba(11, 125, 114, .62); }
.auth-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: max(var(--fs-min), 14px);
  font-weight: 800;
  color: var(--ink);
  list-style: none;
}
.faq-question { display: flex; align-items: center; gap: 11px; min-width: 0; }
.faq-question b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: max(var(--fs-min), 11px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: background var(--speed), color var(--speed), transform var(--speed);
}
.auth-faq details[open] .faq-question b { background: var(--brand-accent); color: #fff; transform: rotate(-3deg); }
.auth-faq summary::-webkit-details-marker { display: none; }
.auth-faq summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-inline: 10px 5px;
  /* حدود فيزيائية مش منطقية بقصد: السهم ده بيشاور لتحت ولفوق، والاتجاهين
     دول مالهمش علاقة بيمين الصفحة وشمالها. `border-inline-end` في صفحة
     عربية بيبقى الحد الشمال، فالسهم كان بيشاور لجنب بدل ما ينزل. */
  border-right: 2.2px solid var(--muted);
  border-bottom: 2.2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease;
}
.auth-faq details[open] summary { color: var(--accent); }
.auth-faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); border-color: var(--accent); }
/* `pretty` بتمنع الكلمة اليتيمة في آخر الإجابة — سطر فيه كلمة واحدة بيخلّي
   الكارت شكله زي حاجة اتقصّت. المتصفح اللي مايعرفهاش بيتجاهلها وخلاص. */
.auth-faq details > p {
  padding: 0 59px 17px 18px;
  color: var(--muted);
  font-size: max(var(--fs-min), 13px);
  font-weight: 600;
  line-height: 1.95;
  text-wrap: pretty;
}
.auth-faq details[open] > p { animation: faq-answer-in 280ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes faq-answer-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.faq-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px calc(clamp(24px, 4vw, 42px) * -1) calc(clamp(24px, 4vw, 42px) * -1);
  padding: 15px clamp(24px, 4vw, 42px);
  border-top: 1px solid color-mix(in srgb, var(--accent) 11%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 42%, transparent);
}
.faq-support > span { display: grid; gap: 2px; text-align: start; }
.faq-support strong { color: var(--ink); font-size: max(var(--fs-min), 13.5px); font-weight: 900; }
.faq-support small { color: var(--muted); font-size: max(var(--fs-min), 11.5px); font-weight: 600; }
.faq-support a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--line));
  border-radius: 13px;
  background: var(--panel);
  color: var(--success);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 800;
  text-decoration: none;
  transition: transform var(--speed), box-shadow var(--speed), background var(--speed);
}
.faq-support a:hover { transform: translateY(-1px); background: var(--success-soft); box-shadow: 0 12px 24px -20px rgba(11, 125, 114, .72); }
.faq-support svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

.auth-foot {
  display: grid;
  width: 100%;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  border-radius: 30px;
  background: var(--panel);
  box-shadow: 0 28px 70px -48px rgba(9, 31, 76, .55);
}
.auth-final-cta {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .55fr);
  align-items: center;
  gap: 30px 48px;
  min-height: 275px;
  padding: clamp(34px, 5vw, 56px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 9% 18%, rgba(91, 219, 203, .24), transparent 24%),
    linear-gradient(125deg, #102f5e 0%, #174a75 55%, #087d72 145%);
}
.auth-final-cta::before,
.auth-final-cta::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
}
.auth-final-cta::before {
  inset-inline-end: -95px;
  inset-block-start: -135px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 0 0 42px rgba(255, 255, 255, .025), 0 0 0 88px rgba(255, 255, 255, .018);
}
.auth-final-cta::after {
  inset-inline-start: 43%;
  inset-block-end: -155px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(42, 207, 184, .2), transparent 68%);
}
.auth-final-copy,
.auth-final-action,
.auth-final-cta .auth-trust { position: relative; z-index: 1; }
.auth-final-copy { display: grid; justify-items: start; gap: 11px; text-align: start; }
.auth-final-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid rgba(120, 238, 221, .26);
  border-radius: 999px;
  background: rgba(3, 34, 66, .3);
  color: #baf7ec;
  font-size: max(var(--fs-min), 12px);
  font-weight: 800;
}
.auth-final-kicker svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.auth-final-copy h2 {
  max-width: 17ch;
  color: #fff;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 900;
  line-height: 1.32;
  text-wrap: balance;
}
.auth-final-copy h2 mark { background: none; color: #74ead9; }
.auth-final-copy p {
  max-width: 56ch;
  color: rgba(234, 244, 255, .78);
  font-size: max(var(--fs-min), 14px);
  font-weight: 600;
  line-height: 1.85;
}
.auth-final-action { display: grid; justify-items: stretch; gap: 11px; }
.auth-final-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 58px;
  padding: 11px 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 17px;
  background: #fff;
  color: #0a776d;
  box-shadow: 0 20px 34px -22px rgba(0, 0, 0, .72);
  font: inherit;
  font-size: max(var(--fs-min), 15px);
  font-weight: 900;
  cursor: pointer;
  transition: transform var(--speed), box-shadow var(--speed), background var(--speed);
}
.auth-final-button::before {
  content: '';
  position: absolute;
  inset-block: 0;
  width: 50%;
  background: linear-gradient(100deg, transparent, rgba(34, 192, 171, .15), transparent);
  transform: translateX(250%) skewX(-18deg);
  transition: transform 620ms cubic-bezier(.2, .8, .2, 1);
}
.auth-final-button span,
.auth-final-button svg { position: relative; z-index: 1; }
.auth-final-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; transition: transform var(--speed); }
.auth-final-button:hover { transform: translateY(-2px); background: #f5fffd; box-shadow: 0 25px 40px -22px rgba(0, 0, 0, .8); }
.auth-final-button:hover::before { transform: translateX(-250%) skewX(-18deg); }
.auth-final-button:hover svg { transform: translateX(-3px); }
.auth-final-action > p {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(232, 245, 255, .72);
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 700;
  text-align: center;
}
.auth-final-action > p svg { width: 14px; height: 14px; fill: none; stroke: #75e8d7; stroke-width: 2.3; }
.auth-final-cta .auth-trust {
  grid-column: 1 / -1;
  justify-content: flex-start;
  gap: 10px 24px;
  padding-top: 19px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.auth-final-cta .auth-trust li { color: rgba(233, 244, 255, .77); font-size: max(var(--fs-min), 12px); }
.auth-final-cta .auth-trust svg { stroke: #75e8d7; }
.auth-foot-base {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 17px clamp(20px, 3.2vw, 34px);
}
.auth-foot-base:has(.auth-foot-help > :not([hidden])) { justify-content: space-between; }
.auth-foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.auth-foot-mark {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 12px;
  background: var(--brand-tile);
  box-shadow: 0 9px 18px -13px rgba(16, 47, 94, .8);
}
.auth-foot-mark svg { width: 26px; height: 26px; color: #fff; }
.auth-foot-brand > span:last-child { display: grid; gap: 0; text-align: start; line-height: 1.05; }
.auth-foot-brand b { font-family: 'Montserrat', 'Cairo', sans-serif; font-size: max(var(--fs-min), 13px); letter-spacing: -.02em; }
.auth-foot-brand small { color: var(--muted); font-size: max(var(--fs-min), 10px); font-weight: 800; }
.auth-foot-help { display: flex; align-items: center; justify-content: flex-end; gap: 11px; }
.auth-foot-help p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.auth-foot-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: max(var(--fs-min), 13px);
  font-weight: 800;
  text-decoration: none;
  transition: border-color var(--speed), color var(--speed), transform var(--speed);
}
.auth-foot-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
/* رموز الأيقونات هنا كلها خطوط مش مساحات: `fill` بيحوّل أيقونة واتساب لبقعة سودا. */
.auth-foot-link svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .auth-badge, .auth-badge::after, .auth-badge-spark, .auth-badge-go { animation: none; }
  .auth-product-preview, .product-preview-live i, .product-float, .product-bars i { animation: none; }
  .signup-step-body { animation: none; }
  .signup-done { animation: none; }
  .auth-faq summary::after { transition: none; }
  .auth-final-button, .auth-final-button::before, .auth-final-button svg { transition: none; }
  .auth-features, .feat-group { animation: none; }
  .feature-journey, .feat-card, .feat-tab, .feat-tab > svg { transition: none; }
  .auth-contact, .contact-eyebrow i { animation: none; }
  .contact-card, .contact-card-action svg { transition: none; }
}

/* ----- المقاسات -----

   الصفحة بتتفرّج على أربع هيئات:

   • من ١١٥١: عمودين على طول الصفحة — الوعد والباقات في العمود العريض،
     وكارت الدخول ملزوق جنبهم. الأسئلة والفوتر على العرض كله تحتيهم.
   • ٩٠١ لـ١١٥٠: الوعد والكارت جنب بعض في أول سطح بس، وباقي الصفحة على
     العرض كله — الباقات التلاتة محتاجين العرض ده عشان المقارنة.
   • ٧٦٠ لـ٩٠٠: عمود واحد، والباقات التلاتة لسه جنب بعض.
   • تحت ٧٦٠: كل حاجة تحت بعضها، والباقات واحدة واحدة.

   الأرقام دي من سلّم نقاط الكسر بتاع الملف كله (٤٣٠ / ٦٢٠ / ٧٦٠ / ٩٠٠ /
   ١١٥٠)، مش مقاسات اتفصّلت للصفحة دي لوحدها — `test/ui-structure.test.mjs`
   بيرفض أي رقم بره السلّم عشان الصفحات كلها تتحوّل مع بعض.

   والمهم إن الهيئة تفضل صح عند حافة كل درجة، وده اتقاس: عند ١١٥١ العمود
   العريض بياخد ٧٢٤px بعد كارت الدخول (٣٤٠) والفاصل (٢٤) والحواف (٤٨) وشريط
   السكرول، يعني كل باقة ٢٣١ — أوسع من ٢٢٣ اللي بتبقى عندها عند ٧٦٠، فالمقارنة
   اللي شغّالة على التابلت شغّالة هنا. تحت ١١٥١ الباقات بترجع تاخد العرض كله
   عشان عمودين هناك كانوا بيكسروهم لصفّين، والمقارنة — اللي هي كل الغرض من
   الكروت — بتضيع عشان نكسب عمود. */

@media (min-width: 760px) {
  /* التلاتة جنب بعض. الفاصل والحشو بينقصوا شوية هنا عشان العرض المتاح
     على التابلت أضيق — الكارت بيفضل مقروء، والمقارنة بتفضل في نظرة. */
  .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; gap: 12px; }
  /* الكارت المميّز بيطلع فوق وينزل تحت إخواته بـ١٢px، والحشو ده بيفضّي له
     المكان — من غيره كان بياكل من المسافة اللي بين القسمين. مافيش تكبير:
     الكروت لازم تفضل على نفس العرض عشان العين تقارن الأسعار جنب بعض. */
  .plan-grid { padding-block: 12px; }
  .plan-card { padding: 28px 16px 16px; }
  .plan-card.featured { margin-block: -12px; }

  /* أول سطح: الكلام على حرف والرسمة على الحرف التاني، زي «صفحة البداية» على
     التابلت واللابتوب في لوحة الهوية. الكلام أول عنصر فبيقع على اليمين. */
  .auth-hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: center;
    justify-items: stretch;
    text-align: start;
  }
  .auth-hero-copy, .auth-hero-actions { justify-items: start; }
  .auth-hero-top { justify-self: start; }
  .auth-hero .auth-badge { text-align: start; }
  .auth-hero-art { order: 0; width: 100%; }

  /* صفحة الدخول: الكارت ونص الهوية لوح واحد بحرف واحد وظل واحد. السكة
     اللي كانت `display: contents` بقت هي اللوح، والكارت جوّاها فقد بروازه
     وظله عشان مايبقاش كارت جوّه كارت. مفيش لزق هنا — اللوح صفّ عادي في
     المسرح، فمش بيعدّي على الأسئلة اللي تحته. */
  .auth-stage { width: min(980px, 100%); }
  .auth-card-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.94fr);
    width: min(980px, 100%);
    justify-self: center;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
  body.has-landing .auth-stage > .auth-card-rail { width: min(980px, 100%); }
  .auth-card-rail > .auth-card {
    align-self: center;
    padding: clamp(28px, 4vw, 48px) clamp(20px, 3.4vw, 40px);
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  /* بلاطة الأيقونة في راس الكارت بتتكرّر مع اللي في اللوح الكحلي جنبها. */
  .auth-card-rail .auth-card-head .brand-mark { display: none; }
  .auth-brand { display: grid; }
}

@media (min-width: 901px) {
  .plan-grid { gap: 16px; }
  .plan-card { padding: 28px 18px 16px; }

  /* الأسئلة على عمودين بتاخد عرض الصفحة كله زي كل قسم قبلها. عمود واحد
     محبوس على ٧٦٠px كان بيخلّي القسم ده أضيق من اللي فوقه واللي تحته
     بـ٣٠٠px — فالصفحة كانت بتضيّق فجأة عند الأسئلة وترجع تتوسّع بعدها.
     `start` عشان فتح سؤال مايمدّش السؤال اللي جنبه معاه. */
  .faq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1151px) {
  /* الوصف بيكبر مع العنوان: ١٥٫٥px تحت عنوان ٥٤px بيبان زي حاشية. العنوان
     نفسه مالوش قاعدة هنا — حجمه وعرضه الاتنين في القاعدة الأساسية. */
  .auth-hero-sub { max-width: 56ch; font-size: max(var(--fs-min), 16.5px); }
}

@media (max-width: 760px) {
  .feat-head { grid-template-columns: minmax(0, 1fr) auto; border-radius: 23px; }
  .feat-head h2 { font-size: 31px; }
  .feat-scoreboard > div { grid-template-columns: 1fr; justify-items: center; gap: 5px; padding: 13px 8px; text-align: center; }
  .feat-scoreboard span { max-width: 14ch; }
  .feat-explorer-head { align-items: start; flex-direction: column; }
  .feat-foot { align-items: stretch; flex-direction: column; }
  .feat-foot .primary-btn { width: 100%; min-width: 0; }
  .auth-final-cta { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .auth-final-copy { justify-items: center; text-align: center; }
  .auth-final-copy h2 { max-width: 19ch; }
  .auth-final-action { width: min(360px, 100%); }
  .auth-final-cta .auth-trust { justify-content: center; }
}

@media (max-width: 620px) {
  /* الشريحة بتضيق عشان الأربعة يقربوا من سطر واحد، والحشو بيقلّ عشان الرقم
     اللي جنب الاسم («−٣٠٪») مايتزنقش. */
  .duration-chip { min-height: 34px; padding: 0 11px; }
  .plan-card { padding: 26px 16px 16px; }
  /* الشريط والكارت بيضيقوا شوية: ١٨px حشو على ٣٧٥px بياكلوا من الخانات. */
  .auth-nav { padding: 8px 10px; border-radius: 16px; }
  .auth-nav-login { min-height: 38px; padding: 0 16px; }
  .auth-card { padding: 26px 20px; border-radius: 22px; }
  .auth-features { gap: 20px; }
  .feat-head { gap: 22px 10px; padding: 22px 18px; }
  .feat-head h2 { max-width: 14ch; font-size: 28px; line-height: 1.3; }
  .feat-head p { font-size: max(var(--fs-min), 13.5px); line-height: 1.75; }
  .feat-close { min-height: 38px; padding-inline: 12px; }
  .feat-scoreboard { border-radius: 15px; }
  .feat-scoreboard > div { min-height: 83px; }
  .feat-scoreboard strong { font-size: 25px; }
  .feat-scoreboard span { font-size: 10.5px; }
  .feature-journeys-grid { grid-template-columns: minmax(0, 1fr); }
  .feature-journey { padding: 16px; border-radius: 18px; }
  .feat-explorer { padding: 16px; border-radius: 22px; }
  .feat-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feat-tab { min-height: 58px; padding: 9px; }
  .feat-tab-number { display: none; }
  .feat-card { padding: 16px; }
  .feat-foot { padding: 16px; border-radius: 18px; }
  .signup-step-head { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 11px; border-radius: 15px; }
  .signup-step-icon { width: 42px; height: 42px; border-radius: 13px; }
  .auth-hero-art { padding-inline: 4px; }
  .auth-product-preview { animation: none; transform: none; border-radius: 18px; }
  .product-preview-shell { grid-template-columns: 38px minmax(0, 1fr); min-height: 248px; }
  .product-preview-nav { padding-inline: 5px; }
  .product-preview-nav span { width: 25px; height: 25px; }
  .product-preview-main { padding: 11px; }
  .product-preview-metrics > div { padding: 7px; }
  .product-performance-card { display: none; }
  .product-preview-panels { grid-template-columns: minmax(0, 1fr); }
  .product-float-scan { top: 72px; left: -3px; }
  .product-float-paid { right: -3px; bottom: 8px; }
  .product-float-parent { display: none; }
  .duration-switch { border-radius: 22px; }
  .offer-head { grid-template-columns: 1fr; gap: 18px; padding: 22px 18px 0; border-radius: 23px; }
  .offer-head::before { inset: 30px auto auto -54px; }
  .offer-head-text { justify-items: center; text-align: center; }
  .offer-head h2 { max-width: 15ch; font-size: 28px; }
  .offer-head-text > p { max-width: 34ch; text-align: center; }
  .offer-head-switch { width: 100%; padding: 12px; }
  .offer-notes { margin-inline: -18px; padding-inline: 18px; }
  .offer-head-switch .duration-chip { min-height: 54px; padding: 6px 4px; }

  /* العنوان على ٣٧٥ بكسل كان ٢٨ بكسل بمسافة سطر ١٫١٥ — أربع كلمات تقيلة لازقة
     في بعض من غير نفَس. أصغر سنة ومسافة أوسع بتخلّي كل سطر يتقري لوحده. */
  .auth-hero h1 { font-size: 25px; line-height: 1.4; letter-spacing: 0; }

  .offer-notes { justify-content: center; }
  .auth-faq { padding: 22px 16px; border-radius: 23px; }
  .auth-faq h2 { font-size: 26px; }
  .auth-faq summary { min-height: 56px; padding-inline: 10px; }
  .faq-question { gap: 9px; }
  .faq-question b { width: 31px; height: 31px; border-radius: 10px; }
  .auth-faq details > p { padding-inline: 50px 14px; }
  .faq-support { display: grid; margin-inline: -16px; margin-bottom: -22px; padding: 14px 16px; }
  .faq-support a { width: 100%; }
  .auth-foot { border-radius: 23px; }
  .auth-final-cta { min-height: 0; gap: 24px; padding: 30px 20px 24px; }
  .auth-final-copy h2 { font-size: 28px; }
  .auth-final-copy p { font-size: max(var(--fs-min), 13px); }
  .auth-final-button { min-height: 54px; border-radius: 15px; }
  .auth-final-cta .auth-trust { gap: 8px 16px; padding-top: 17px; }
  .auth-foot-base { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 13px; padding: 16px; }
  .auth-foot-brand, .auth-foot-help { justify-self: center; }
  .auth-foot-help { justify-content: center; flex-wrap: wrap; }
}

@media (max-width: 430px) {
  /* بند لوحده تحت بندين بيبان زي حاجة اتنست، مش زي بند تالت في قايمة.
     تحت بعض بيبقوا قايمة تعداد، وده اللي هُمّا أصلاً. */
  .auth-trust { flex-direction: column; align-items: center; gap: 8px; }
  .offer-notes { display: grid; grid-template-columns: 1fr; justify-items: start; gap: 8px; }
  .offer-switch-title { grid-template-columns: 1fr; }
  .offer-hint { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
  .offer-head-switch .duration-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 17px; }

  /* شريط الخطوات بقى أرقام + اسم الخطوة اللي إحنا فيها. الأربع أسامي مع بعض
     في العرض ده بتاخد تلات سطور لكل واحدة، وشريط تقدّم بارتفاع تلات سطور
     مابيقولش تقدّم. الاسم الوحيد اللي بيفرق دلوقتي هو بتاع الخطوة المفتوحة. */
  .signup-rail li i { display: none; }
  .signup-rail li.current { flex: 3 1 auto; }
  .signup-rail li.current i { display: block; white-space: nowrap; }

  /* المعاينة تفضل مقروءة على ٣٧٥px من غير ما كروت الإشعار تخرج بره الشاشة. */
  .auth-hero-art { padding-block: 16px 32px; }
  .product-preview-bar { min-height: 40px; padding-inline: 9px; }
  .product-preview-live { font-size: 7.5px; }
  .product-preview-main { padding: 9px; }
  .product-preview-heading > span { display: none; }
  .product-preview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-preview-metrics > div:last-child { display: none; }
  .product-float { min-width: 132px; padding: 7px 8px; }
  .product-float > span { width: 26px; height: 26px; }
  .product-float b { font-size: 7.5px; }
  .product-float small { font-size: 6px; }
}

/* ------------------------------ الهيكل العام ------------------------------ */

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  gap: 18px;
}

.sidebar {
  width: 240px;
  min-height: calc(100vh - 36px);
  padding: 18px 14px;
  border-radius: var(--radius);
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
  position: sticky;
  top: 18px;
  align-self: flex-start;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; flex-shrink: 0; }

/* بلاطة الأيقونة نفسها: كحلي بلمعة، والعلامة ملوّنة من جوّاها. كانت مربّع
   بلون ثيم المدرّس وعلامة بيضا، فاللوجو كان بيتغيّر لونه مع كل ثيم — والهوية
   لازم تفضل هي هي في كل مكان بتظهر فيه. */
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 13px;
  background: var(--brand-tile);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(140, 180, 255, 0.16),
    0 8px 18px -8px rgba(6, 13, 46, 0.55);
}

/* القايمة الجانبية غامقة في كل الثيمات — تقريبًا نفس كحلي البلاطة — فالبلاطة
   كانت بتدوب فيها واللوجو مش باين. هنا بتلبس أيقونة التطبيق الفاتحة من لوحة
   الهوية: بلاطة بيضا وساق كحلي وضحكة تركواز، وده باين على أي لون قايمة. */
.sidebar .brand-mark {
  background: #fff;
  color: var(--brand-navy);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 8px 18px -8px rgba(0, 0, 0, 0.6);
}

/* الضحكة والنقطتين تركواز ثابت جوّه الرمز (#i-logo)، والساق بياخد لون النص
   (currentColor): أبيض على البلاطة الكحلي وكحلي على البلاطة البيضا. مش بياخد
   ستايل .icon الخطي. */
.brand-logo { width: 32px; height: 32px; fill: currentColor; stroke: none; }

.brand-title { color: #fff; font-weight: 800; font-size: 15px; }
.brand-subtitle { font-size: var(--fs-min); }

.nav-list {
  display: grid;
  gap: 4px;
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-end: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.nav-list::-webkit-scrollbar { width: 5px; }
.nav-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 999px; }

/* المجموعات: الفاصل بينها مسافة أوسع من المسافة بين أزرارها، عشان العين تشوف
   أربع كتل مش ستاشر سطر. العنوان خافت ومش قابل للضغط — لافتة مش زرار. */
.nav-group { display: grid; gap: 4px; }
.nav-group + .nav-group { margin-block-start: 13px; }
.nav-group-title {
  color: rgba(255, 255, 255, 0.42);
  font-size: var(--fs-min);
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 0 13px 3px;
}
.nav-group[hidden] { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-ink);
  font-weight: 700;
  font-size: 13.5px;
  text-align: right;
  border: 1px solid transparent;
  transition: all var(--speed);
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.nav-item.active {
  background: linear-gradient(100deg, rgba(128, 144, 237, 0.24), rgba(82, 103, 215, 0.10));
  color: #fff;
  border-color: rgba(147, 162, 255, 0.18);
  border-inline-start-color: var(--accent-light);
  box-shadow: 0 7px 18px rgba(5, 9, 25, 0.18);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-ink);
  font-weight: 700;
  transition: all var(--speed);
}

/* لازم يفضل مركّب: زرار الخروج بياخد .utility-btn كمان، و`color: var(--muted)`
   بتاعها متأخرة عن دي في الملف وبنفس الأولوية — فكانت بتكسبها وتحط لون النص
   الهادي (المظبوط للكارت الأبيض) فوق الشريط الجانبي الغامق. */
.utility-btn.logout-btn { color: var(--sidebar-ink); }
.logout-btn:hover, .utility-btn.logout-btn:hover { background: var(--danger-soft); color: #ff8b8f; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------ الشريط العلوي ------------------------------ */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-brand-mark { display: none; }
.topbar-brand-name { margin: 0; font-size: 19px; font-weight: 900; }
.page-subtitle { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }

/* اسم الشاشة مش سطر تايه جوّه أول كارت: عنوان موحّد بين الهيدر والمحتوى.
   اللون مركز في علامة واحدة وشريط رفيع، عشان الهوية تبان من غير زحمة ألوان. */
.page-heading {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
  padding: 17px 19px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--line));
  border-radius: 20px;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--panel) 94%, var(--accent)) 0%, var(--panel) 62%),
    var(--panel);
  box-shadow: 0 13px 34px -26px rgba(22, 37, 82, .48);
}
.page-heading::before {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 4px;
  background: linear-gradient(180deg, var(--brand-teal), var(--accent));
}
.page-heading::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: auto -55px -85px auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.page-heading-mark {
  --icon-tint: currentColor;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-navy), color-mix(in srgb, var(--brand-navy) 72%, var(--brand-accent)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 11px 24px -14px rgba(6, 13, 46, .75);
}
.page-heading-mark .icon { width: 23px; height: 23px; }
.page-heading-copy { min-width: 0; display: grid; gap: 2px; }
.page-heading-eyebrow { color: var(--accent); font-size: max(var(--fs-min), 11px); font-weight: 900; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: clamp(22px, 2.1vw, 29px); font-weight: 950; line-height: 1.35; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 650; line-height: 1.65; }

.top-actions { display: flex; align-items: center; gap: 10px; }

/* لوحة استيراد الطلاب من إكسيل */
.import-preview { display: grid; gap: 14px; margin-top: 6px; }
.import-summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.import-summary strong { font-size: 15px; color: var(--ink); }
.import-warnings { display: grid; gap: 6px; margin: 0; padding: 10px 12px; list-style: none; background: var(--warning-soft); border-radius: var(--radius-sm); }
.import-warnings li { display: flex; align-items: center; gap: 7px; font-size: max(var(--fs-min), 12.5px); font-weight: 600; color: var(--warning); }
.import-warnings .icon { width: 15px; height: 15px; }
.import-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.import-counts > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.import-counts span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.import-counts strong { font-size: 20px; }
.import-counts .new { background: var(--success-soft); color: var(--success); }
.import-counts .duplicate { background: var(--accent-soft); color: var(--accent); }
.import-counts .ambiguous { background: var(--warning-soft); color: var(--warning); }
.import-duplicate-review { display: grid; gap: 12px; padding: 14px; border: 1px solid rgba(44, 75, 224, .2); border-radius: var(--radius-sm); background: var(--accent-soft); }
.import-duplicate-review h3 { margin: 0 0 4px; font-size: 14px; }
.import-duplicate-review p { margin: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); line-height: 1.6; }
.import-duplicate-names { display: flex; flex-wrap: wrap; gap: 6px; }
.import-duplicate-names > span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: var(--fs-min); font-weight: 700; }
.import-duplicate-names small { color: var(--muted); }
.import-mode-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; }
.import-mode-option { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); transition: border-color var(--speed), box-shadow var(--speed); }
.import-mode-option.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(44, 75, 224, .12); }
.import-mode-option input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
.import-mode-option span { display: grid; gap: 3px; }
.import-mode-option strong { font-size: max(var(--fs-min), 12.5px); }
.import-mode-option small { color: var(--muted); font-size: var(--fs-min); line-height: 1.55; }
.import-ambiguous { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning); font-size: var(--fs-min); line-height: 1.7; }
.import-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.import-actions .submit-btn { flex: 1; min-width: 200px; }

/* مؤشر الحفظ التلقائي */
.save-status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  font-size: max(var(--fs-min), 12.5px); font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel);
  box-shadow: var(--shadow);
  transition: opacity var(--speed), background var(--speed), color var(--speed);
}
.save-status[hidden] { display: none; }
.save-status .save-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none;
}
.save-status.is-saving { color: var(--muted); }
.save-status.is-saving .save-dot { animation: savePulse 0.9s ease-in-out infinite; }
.save-status.is-saved { color: var(--success); background: var(--success-soft); border-color: transparent; }
/* انتظار مش فشل: أصفر ونبضة زي «جارٍ الحفظ» عشان يقرأ كحالة شغّالة لا حالة وقوف. */
.save-status.is-busy { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.save-status.is-busy .save-dot { animation: savePulse 0.9s ease-in-out infinite; }
.save-status.is-error { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
@keyframes savePulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (max-width: 900px) {
  /* مؤشر الحفظ كان بيتضاف داخل صف أدوات الرأس بعد التحميل، فيزق «إضافة طالب»
     لسطر جديد. على الموبايل يبقى إشعارًا عائمًا قصيرًا فوق شريط التنقل؛ واضح
     للمستخدم لكنه خارج حسابات عرض الهيدر، لذلك الصفحة لا تتحرك بعد الفتح. */
  .top-actions .save-status {
    position: fixed;
    z-index: 95;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 94px);
    min-height: 38px;
    padding: 7px 12px;
    transform: translateX(-50%);
    box-shadow: 0 10px 28px rgba(20, 32, 78, .18);
  }
  .top-actions .save-status .save-text { display: inline; }
}

.utility-pill {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  transition: all var(--speed);
  position: relative;
}

.utility-btn:hover { background: var(--panel-2); color: var(--ink); }
.utility-btn.active, .utility-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.notif-btn .badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-min);
  font-weight: 800;
}

.badge.hidden { display: none; }

.menu-btn { display: inline-flex; background: var(--panel); border: 1px solid var(--line); }

/* طي القائمة الجانبية على الشاشات الكبيرة عبر زر القائمة */
@media (min-width: 901px) {
  body.nav-collapsed .sidebar { display: none; }
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end));
  color: var(--action-ink);
  font-weight: 800;
  border: 1px solid color-mix(in srgb, var(--action-bg-end) 74%, #fff);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--action-bg) 24%, transparent);
  transition: transform var(--speed), box-shadow var(--speed);
}

.primary-action:hover { transform: translateY(-2px); box-shadow: 0 14px 30px color-mix(in srgb, var(--action-bg) 32%, transparent); }

/* ------------------------------ البحث والتنبيهات ------------------------------ */

.quick-search {
  position: fixed;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 68;
  width: min(460px, calc(100vw - 44px));
  max-height: min(680px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 17px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(16, 24, 40, .22), 0 4px 16px rgba(16, 24, 40, .12);
  animation: rise 0.3s ease both;
}
.quick-search[hidden] { display: none; }

/* زرار البحث: دايرة مسطّحة. لون واحد أزرق فاتح من عيلة اللون الأساسي، من غير
   ميلان ولا زجاج ولا بيفل — الوضوح كله جاي من الشكل نفسه، وظل واحد خفيف تحته
   بيرفعه عن الصفحة بس من غير ما يعمل حجم مزيّف. */
.student-search-fab {
  position: fixed;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 69;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--search-fab);
  box-shadow: 0 6px 16px var(--search-fab-glow);
  transition: transform var(--speed), background var(--speed), box-shadow var(--speed);
}

/* اللمسة: حلقة رفيعة بتتفرد من حوالين الدايرة زي نبضة رادار وقت ما تقرّب منها.
   الحركة كلها على ::after بـ transform وopacity — مافيش layout بيتحرك، ومافيش
   تدرّج ولا ظل مزيّف يرجّعنا للشكل المجسّم اللي شِلناه. الحلقة تحت الأيقونة
   بـ z-index عشان ما تعديش فوقها وهي بتكبر. */
.student-search-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  border: 2px solid var(--search-fab);
  opacity: 0;
  pointer-events: none;
}
.student-search-fab:hover::after,
.student-search-fab:focus-visible::after { animation: fabRadar 1.7s cubic-bezier(.22, .61, .36, 1) infinite; }

@keyframes fabRadar {
  0% { opacity: .5; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(1.6); }
}

.student-search-fab:hover {
  transform: translateY(-2px);
  background: var(--search-fab-strong);
  box-shadow: 0 10px 22px var(--search-fab-glow);
}
/* العدسة بتميل شوية وهي بتكبر — إحساس إنها بتدوّر مش مجرد أيقونة واقفة. */
.student-search-fab:hover .icon { transform: rotate(-14deg) scale(1.08); }
.student-search-fab:active {
  transform: translateY(1px) scale(.96);
  background: var(--search-fab-strong);
  box-shadow: 0 3px 8px var(--search-fab-glow);
}
/* وهي مفتوحة بتقف عن النبض وتقعد على اللون الغامق: الحالة نفسها بقت واضحة. */
.student-search-fab[aria-expanded="true"] { background: var(--search-fab-strong); }
.student-search-fab[aria-expanded="true"]::after { animation: none; opacity: 0; }
.student-search-fab .icon {
  width: 21px;
  height: 21px;
  stroke-width: calc(var(--icon-stroke-width, 2) * 1.1);
  transition: transform var(--speed);
}
.student-search-fab:focus-visible { outline: 3px solid var(--search-fab-strong); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .student-search-fab:hover::after, .student-search-fab:focus-visible::after { animation: none; }
  .student-search-fab:hover .icon { transform: none; }
}

/* ---------------------- زرار واحد: البحث والمساعد الذكي ---------------------- */
/* المساعد كان دايرة كحلي تانية جنب البحث بتاكل من الركن. دلوقتي هو جوّه زرار
   البحث: دوسة = بحث، ضغطة مطوّلة = الاختيارين يطلعوا فوق الزرار. النجمة
   الصغيرة على طرف الزرار هي اللي بتقول إن فيه حاجة تانية مستخبية جوّاه.

   الضغطة المطوّلة على الموبايل بتطلّع قايمة «نسخ/مشاركة» وبتحدد نص — بنقفلهم
   على الزرار ده بس. */
.student-search-fab {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.student-search-fab .fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--search-fab);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--search-fab);
  pointer-events: none;
  transition: transform var(--speed);
}
.student-search-fab .fab-badge .icon,
.student-search-fab:hover .fab-badge .icon {
  width: 11px;
  height: 11px;
  fill: currentColor;
  stroke: none;
  transform: none;
}
/* والقايمة مفتوحة الزرار بيقعد على اللون الغامق زي البحث المفتوح، والنجمة
   بتختفي: الاختيارات نفسها قدامك. */
.student-search-fab.is-dialing { background: var(--search-fab-strong); }
.student-search-fab.is-dialing::after { animation: none; opacity: 0; }
.student-search-fab.is-dialing .fab-badge { transform: scale(0); }

/* الاختيارين عمود فوق الزرار، كل دايرة متسنترة على دايرة البحث (٤٤ جوّه ٥٠)
   واسمها في كبسولة على يمينها ناحية الصفحة. نفس لون وظل زرار البحث بالظبط. */
.fab-dial {
  position: fixed;
  left: calc(max(22px, env(safe-area-inset-left)) + 3px);
  bottom: calc(max(22px, env(safe-area-inset-bottom)) + 62px);
  z-index: 71;
  display: grid;
  gap: 10px;
  justify-items: end;
}
.fab-dial-item {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
  padding: 0;
  animation: fabDialPop .22s cubic-bezier(.22, .61, .36, 1) backwards;
}
/* اللي أقرب للزرار يطلع الأول، واللي فوقه وراه بلحظة. */
.fab-dial-item:nth-last-child(2) { animation-delay: .05s; }
.fab-dial-icon {
  --icon-tint: currentColor;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--search-fab);
  box-shadow: 0 6px 16px var(--search-fab-glow);
  transition: transform var(--speed), background var(--speed), box-shadow var(--speed);
}
.fab-dial-icon .icon {
  width: 20px;
  height: 20px;
  stroke-width: calc(var(--icon-stroke-width, 2) * 1.1);
}
.fab-dial-label {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: max(var(--fs-min), 14px);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .12);
}
.fab-dial-item:hover .fab-dial-icon {
  transform: translateY(-2px);
  background: var(--search-fab-strong);
  box-shadow: 0 10px 22px var(--search-fab-glow);
}
.fab-dial-item:active .fab-dial-icon { transform: translateY(1px) scale(.96); background: var(--search-fab-strong); }
.fab-dial-item:focus-visible { outline: none; }
.fab-dial-item:focus-visible .fab-dial-icon { outline: 3px solid var(--search-fab-strong); outline-offset: 3px; }
.fab-dial-item[aria-expanded="true"] .fab-dial-icon { background: var(--search-fab-strong); }

@keyframes fabDialPop {
  from { opacity: 0; transform: translateY(10px) scale(.9); }
}
body:not(.logged-in) .fab-dial, body:not(.logged-in) .assistant-panel { display: none; }

/* ------------------------------ المساعد الذكي ------------------------------ */

.assistant-panel {
  position: fixed;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 70;
  width: min(420px, calc(100vw - 44px));
  height: min(580px, calc(100vh - 124px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow: 0 28px 70px rgba(16, 24, 40, .2), 0 6px 18px rgba(16, 24, 40, .1);
  animation: rise 0.3s ease both;
}
.assistant-panel[hidden] { display: none; }
.assistant-head {
  --icon-tint: currentColor;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  color: #ffffff;
  background:
    radial-gradient(circle at 12% 0%, rgba(63, 214, 189, .22), transparent 34%),
    linear-gradient(135deg, var(--brand-navy), var(--brand-accent));
}
.assistant-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.assistant-avatar .icon { width: 20px; height: 20px; fill: var(--brand-teal); stroke: var(--brand-teal); }
.assistant-head-copy { flex: 1; min-width: 0; }
.assistant-head h2 { margin: 0; font-size: 16px; font-weight: 900; color: #ffffff; }
.assistant-head p { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: max(var(--fs-min), 12px); color: #c9f3ec; }
.assistant-status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #5ee6bf; box-shadow: 0 0 0 4px rgba(94, 230, 191, .13); }
.assistant-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, .1);
}
.assistant-close:hover { background: rgba(255, 255, 255, .2); }
.assistant-close:focus-visible { outline: 2px solid var(--brand-teal); outline-offset: 2px; }
.assistant-close .icon { width: 18px; height: 18px; }
.assistant-resume {
  display: none;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  font-size: 13px;
  font-weight: 850;
  text-align: start;
}
.assistant-resume:hover, .assistant-resume:focus-visible { background: rgba(255, 255, 255, .2); }
.assistant-resume .icon { width: 16px; height: 16px; transform: rotate(90deg); }

/* بعد فتح التبويب المطلوب يفضل شريط رجوع صغير بدل اختفاء المساعد. الجسم
   والفورم فقط هما اللي بيتطووا، والمستخدم يقدر ينفّذ الخطوة من غير حجب الشاشة. */
.assistant-panel.is-minimized {
  width: min(330px, calc(100vw - 44px));
  height: auto;
  border-radius: 16px;
  animation: none;
}
.assistant-panel.is-minimized .assistant-head { padding: 9px 10px; }
.assistant-panel.is-minimized .assistant-head-copy,
.assistant-panel.is-minimized .assistant-log,
.assistant-panel.is-minimized .assistant-form { display: none; }
.assistant-panel.is-minimized .assistant-resume { display: flex; }
.assistant-panel.is-minimized .assistant-avatar { width: 34px; height: 34px; border-radius: 10px; }
.assistant-panel.is-minimized .assistant-close { width: 32px; height: 32px; }

.assistant-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 36%, var(--panel)) 0, var(--panel-2) 120px);
}
.assistant-msg {
  max-width: 92%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: max(var(--fs-min), 13.5px);
  line-height: 1.7;
}
.assistant-msg p { margin: 0; }
.assistant-msg.is-bot {
  align-self: flex-start;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-start-start-radius: 4px;
  box-shadow: 0 5px 14px rgba(16, 24, 40, .045);
}
.assistant-msg.is-welcome { max-width: 100%; padding: 13px; border-start-start-radius: 16px; }
.assistant-msg.is-welcome > p { color: var(--ink-soft, var(--ink)); font-weight: 700; }
.assistant-msg.is-user {
  align-self: flex-end;
  color: #ffffff;
  background: var(--brand-accent);
  border-start-end-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-steps { display: grid; gap: 4px; margin: 8px 0 0; padding-inline-start: 20px; }
.assistant-steps li::marker { color: var(--brand-accent); font-weight: 800; }
.assistant-tip {
  margin-top: 8px !important;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: max(var(--fs-min), 12.5px);
}
.assistant-go {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 10px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  color: var(--action-ink);
  background: linear-gradient(135deg, var(--action-bg), var(--action-bg-end));
}
.assistant-go:focus-visible, .assistant-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.assistant-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 11px; }
.assistant-chip {
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel-2);
  font-size: max(var(--fs-min), 12.5px);
  line-height: 1.45;
  text-align: start;
  transition: border-color var(--speed), color var(--speed), background var(--speed), transform var(--speed);
}
.assistant-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--panel); transform: translateY(-1px); }
.assistant-msg.is-typing { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.assistant-msg.is-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: assistantDot 1s ease-in-out infinite;
}
.assistant-msg.is-typing span:nth-child(2) { animation-delay: .15s; }
.assistant-msg.is-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes assistantDot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.assistant-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.assistant-input-wrap {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-2);
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
.assistant-input-wrap > .icon { width: 17px; height: 17px; flex: none; color: var(--muted); }
.assistant-form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 15px;
}
.assistant-form input:focus { outline: none; }
.assistant-input-wrap:focus-within { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.assistant-form button {
  --icon-tint: currentColor;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-accent), var(--brand-teal));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand-accent) 30%, transparent);
  transition: transform var(--speed), box-shadow var(--speed);
}
.assistant-form button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--brand-accent) 38%, transparent); }
.assistant-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* السهم مرسوم رايح يمين، والكلام العربي بيمشي شمال. */
.assistant-form button .icon { width: 19px; height: 19px; transform: scaleX(-1); }

@media (prefers-reduced-motion: reduce) {
  .assistant-panel { animation: none; }
  .assistant-msg.is-typing span { animation: none; }
  .fab-dial-item { animation: none; }
  .fab-dial-item:hover .fab-dial-icon, .student-search-fab .fab-badge { transform: none; }
}
@media (max-width: 900px) {
  /* زرار البحث مرفوع فوق شريط التنقل (+80px)، والقايمة فوقه بنفس المسافة. */
  body.logged-in .fab-dial { bottom: calc(env(safe-area-inset-bottom, 0px) + 142px); }
  body.logged-in .assistant-panel {
    z-index: 92;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
    height: min(68dvh, 620px);
    max-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 112px);
    border-radius: 26px;
  }
  body.logged-in .assistant-panel.is-minimized {
    right: auto;
    width: min(340px, calc(100vw - 24px));
    height: auto;
  }
}
@media (max-width: 620px) {
  /* زرار البحث هنا ٤٦px وعلى بعد ١٤px من الطرف. */
  .fab-dial { left: calc(max(14px, env(safe-area-inset-left)) + 1px); }
  body.logged-in .fab-dial { bottom: calc(env(safe-area-inset-bottom, 0px) + 138px); }
  /* أقل من 16px وسفاري الآيفون بيعمل تكبير للصفحة كلها أول ما تدوس الخانة. */
  .assistant-form input { font-size: 16px; }
  body.logged-in .assistant-panel { height: min(66dvh, 560px); }
  .assistant-head { padding: 12px; }
  .assistant-log { padding: 11px; }
  .assistant-msg { max-width: 96%; }
  .assistant-msg.is-welcome { max-width: 100%; }
  .assistant-chip { min-height: 46px; }
}

/* شريط التحميل: بيقعد فوق خالص، ورفيع عشان ما ياخدش مساحة، وبيتملي بالتحويل
   مش بالعرض عشان الحركة تفضل على كارت الشاشة مش على الـ layout. */
.app-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 96;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}
.app-progress[hidden] { display: none; }
/* كان ٣ بكسل — خيط رفيع في أعلى الشاشة بيعدّي من غير ما حد ياخد باله، وخصوصًا
   على الموبايل تحت شريط المتصفح. أربعة مع أرضية أوضح بيخلّيه يتقري كمؤشر. */
.app-progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: var(--accent-soft);
  box-shadow: inset 0 -1px 0 rgba(16, 24, 40, .06);
}
.app-progress-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: right center;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--accent), var(--search-gold-light), var(--accent-2));
  box-shadow: 0 0 12px var(--search-gold-glow);
  transition: transform .18s cubic-bezier(.25, .8, .35, 1), opacity .3s;
}
.app-progress.is-done .app-progress-fill { transition: transform .2s ease-out, opacity .3s .12s; opacity: 0; }
/* المتغيّر الصح اسمه --sidebar-bg. الاسم الغلط (--sidebar) مش معرّف في أي مكان،
   يعني الخلفية كانت بتطلع شفافة والنص أبيض — أبيض على أبيض، مش باين خالص.
   القيمة الاحتياطية موجودة عشان أي متغيّر ناقص ما يرجّعش نفس العطل. */
.app-progress-label {
  display: none;
  padding: 6px 16px;
  border-radius: 0 0 14px 14px;
  color: #ffffff;
  background: var(--sidebar-bg, #12162e);
  box-shadow: 0 8px 20px rgba(16, 24, 40, .22);
  font-size: var(--fs-min);
  font-weight: 800;
  letter-spacing: .1px;
}
.app-progress.has-label .app-progress-label { display: block; }
html[dir="rtl"] .app-progress-fill { transform-origin: right center; }

.quick-search-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.quick-search-head h2 { font-size: 17px; font-weight: 900; }
.quick-search-head p { max-width: 340px; margin-top: 3px; color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.65; }
.quick-search-close { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; color: var(--muted); background: var(--panel-2); }
.quick-search-close:hover { color: var(--ink); background: var(--line); }
.quick-search-close .icon { width: 16px; height: 16px; }

.quick-search-bar { display: flex; gap: 8px; align-items: center; }
.quick-search label { min-width: 0; min-height: 46px; flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--panel-2); transition: border-color var(--speed), box-shadow var(--speed); }
.quick-search label:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.quick-search label .icon { width: 19px; height: 19px; flex: 0 0 auto; color: var(--accent); }
.quick-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: none; color: var(--ink); font-weight: 700; }
.quick-search button { padding: 8px 16px; border-radius: 999px; background: var(--panel-2); font-weight: 700; color: var(--muted); }
.quick-search button:hover { color: var(--ink); }

/* زرار الكاميرا: على الشاشة الواسعة مربّع بنفس ارتفاع خانة الكتابة عشان الصف
   يفضل خط واحد، وبالأيقونة لوحدها — الصف ضيق أصلاً والكلام هيقصّر خانة البحث.
   الاسم موجود في aria-label وtitle، وبيظهر مكتوب على الموبايل تحت. */
.quick-search .quick-search-scan {
  flex: 0 0 auto;
  display: grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 8px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--accent);
  background: var(--panel-2);
  transition: background var(--speed), border-color var(--speed), transform var(--speed);
}
.quick-search .quick-search-scan:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quick-search .quick-search-scan:active { transform: scale(.95); }
.quick-search .quick-search-scan .icon { width: 21px; height: 21px; }
.quick-search .quick-search-scan span { display: none; }

.search-results { display: grid; gap: 12px; min-height: 0; overflow-y: auto; padding-top: 10px; border-top: 1px solid var(--line); overscroll-behavior: contain; }
.search-empty { color: var(--muted); font-weight: 700; padding: 18px 8px; line-height: 1.7; text-align: center; }
.search-group { display: grid; gap: 7px; }
.search-group-title { font-size: var(--fs-min); font-weight: 900; color: var(--muted); padding: 2px 4px 5px; }
.search-item {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; width: 100%;
  padding: 11px; border: 1px solid transparent; border-radius: 15px; background: var(--panel-2);
  text-align: start; transition: background var(--speed), border-color var(--speed), transform var(--speed);
}
.search-item:hover, .search-item:focus-visible { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--panel); outline: none; }
.search-student-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--accent); background: var(--accent-soft); font-size: 17px; font-weight: 900; }
.search-item-copy { display: grid; gap: 3px; min-width: 0; }
.search-item-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.search-item-title .pill { flex: 0 0 auto; padding: 3px 7px; font-size: var(--fs-min); }
.search-item strong { font-size: 13.5px; font-weight: 700; }
.search-item small { font-size: var(--fs-min); color: var(--muted); font-weight: 600; }
.search-item-phones { display: flex; gap: 10px; flex-wrap: wrap; }
.search-item-open { align-self: center; color: var(--accent); font-size: var(--fs-min); font-weight: 900; white-space: nowrap; }

/* نتيجة «روح لمكان» أو «نفّذ أمر»: نفس صف الطالب بالظبط عشان القايمة تفضل
   قايمة واحدة، بس المربّع الأول أيقونة بدل أول حرف من الاسم، والسهم في آخر
   السطر بيقول إنها بتوديك مش بتفتح ملف. */
.search-jump-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); }
.search-jump-icon .icon { width: 18px; height: 18px; }
.search-jump:hover .search-jump-icon, .search-jump:focus-visible .search-jump-icon { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.search-item-go { width: 16px; height: 16px; color: var(--muted); }
.quick-search-head kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-block-end-width: 2px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-min);
  font-weight: 800;
}

@media (max-width: 620px) {
  .student-search-fab { left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: 46px; height: 46px; }
  .quick-search { left: max(10px, env(safe-area-inset-left)); bottom: max(80px, calc(env(safe-area-inset-bottom) + 72px)); width: calc(100vw - 20px); max-height: calc(100dvh - 96px); padding: 14px; border-radius: 19px; }
  .quick-search-head p { max-width: 270px; }
  /* على الموبايل الصف الواحد كان بيسيب لخانة الكتابة ٢٠٠px بس، وزرار التفريغ
     بيقع تحت حد اللمس. فبنكسر الصف: الكتابة سطر كامل، والزرارين تحتها. والمساحة
     الزيادة بتدي زرار الباركود اسمه مكتوب بدل أيقونة لوحدها — «قراءة الباركود»
     مش هتتلخبط مع «مسح» اللي جنبها. */
  .quick-search-bar { flex-wrap: wrap; }
  .quick-search label { flex: 1 1 100%; }
  .quick-search .quick-search-scan { flex: 1 1 0; width: auto; padding: 0 14px; font-size: 13px; font-weight: 800; }
  .quick-search .quick-search-scan span { display: block; }
  .quick-search-bar > button:not(.quick-search-scan) { flex: 0 0 auto; min-height: 46px; padding-inline: 20px; border-radius: 14px; }
  .search-item { grid-template-columns: 38px minmax(0, 1fr); }
  .search-student-avatar { width: 38px; height: 38px; border-radius: 12px; }
  .search-item-open { grid-column: 2; justify-self: start; }
}

.notifications-panel {
  position: fixed;
  top: 84px;
  inset-inline-end: 26px;
  z-index: 60;
  width: min(360px, calc(100vw - 40px));
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: rise 0.25s ease both;
}

/* ------------------------------ شريط الاشتراك ------------------------------ */
/* نفس مقاسات شريط تخصيص الواجهة بالظبط: الاتنين بيقعوا في نفس المكان تحت
   الترويسة، وأي فرق في الحشو أو الهامش بيبان قفزة لما واحد يظهر مكان التاني.
   الفرق الوحيد هو اللون — تحذير أصفر وهو بينبّه، وأحمر لما يكون قافل. */
.sub-bar {
  margin: 10px 22px 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--ink);
}
.sub-bar[hidden] { display: none; }
.sub-bar .icon { width: 20px; height: 20px; flex: none; color: var(--warning); }
.sub-bar-text { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.sub-bar strong { font-size: 13px; font-weight: 900; }
.sub-bar span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.sub-bar .primary-mini { flex: 0 0 auto; min-height: 34px; padding-block: 7px; }
/* القافل أحمر: «فاضل يومين» و«واقف» مش نفس الخبر، ولو الاتنين بنفس اللون
   المدرس اللي اتعوّد على الأصفر بيعدّي على الأحمر من غير ما يقراه. */
.sub-bar.blocked { border-color: var(--danger); background: var(--danger-soft); }
.sub-bar.blocked .icon { color: var(--danger); }

/* على الموبايل الزرار بينزل سطر لوحده بعرض الشريط: جنب سطرين كلام في ٣٧٥px
   بيتحشر في ٧٠px وبيتقسّم كلمته على سطرين. */
@media (max-width: 620px) {
  .sub-bar { flex-wrap: wrap; }
  .sub-bar .primary-mini { width: 100%; }
}

/* ------------------------------ تخصيص الواجهة ------------------------------ */
.layout-editor-bar {
  margin: 10px 22px 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink);
}
.layout-editor-bar[hidden] { display: none; }
.layout-editor-copy { display: grid; gap: 2px; min-width: 0; }
.layout-editor-copy strong { font-size: 13px; font-weight: 900; }
.layout-editor-copy span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; line-height: 1.6; }
.layout-editor-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 1 auto; }
.layout-editor-actions .ghost-btn, .layout-editor-actions .primary-mini { min-height: 34px; padding-block: 7px; white-space: nowrap; }

/* الأدوات شريط فوق الجزء، والجزء بياخد مسافة من فوق على قد ارتفاع الشريط
   (بيتقاس في layout.js) — الشريط القديم كان عايم فوق الكارت وبيغطي عنوانه اللي
   المفروض يقولك إنت بترتّب إيه. الـpadding مابيكسرش شبكة الكارت من جوّه زي ما
   عنصر زيادة كان هيعمل. المخفي بيبان باهت في وضع الترتيب عشان تقدر ترجّعه. */
.layout-customizable-item { position: relative; max-width: 100%; }
.layout-customizable-item[data-layout-span] { grid-column: 1 / -1; }
body:not(.layout-edit-mode) .layout-customizable-item[data-layout-hidden] { display: none !important; }
.layout-edit-mode .layout-customizable-item {
  outline: 2px dashed color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 3px;
  padding-top: calc(var(--layout-tools-h, 34px) + 16px) !important;
  user-select: none;
}
.layout-edit-mode .layout-customizable-item[data-layout-hidden] { outline-color: var(--line); }
.layout-edit-mode .layout-customizable-item[data-layout-hidden] > :not(.layout-card-tools) { opacity: .38; filter: grayscale(1); }
.layout-edit-mode .nav-item {
  cursor: grab;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}
.layout-edit-mode .nav-item:active, .layout-edit-mode .layout-drag-handle:active { cursor: grabbing; }
.layout-dragging { opacity: .48 !important; box-shadow: 0 18px 50px rgba(0, 0, 0, .18) !important; }

.layout-card-tools {
  position: absolute;
  z-index: 12;
  top: 8px;
  inset-inline: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.layout-card-tools button {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
}
.layout-card-tools .layout-tool-word { padding: 0 9px; font-size: 12px; font-weight: 800; }
.layout-card-tools button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.layout-card-tools button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.layout-card-tools button:disabled { opacity: .3; cursor: default; }
.layout-card-tools [data-layout-command="hide"][aria-pressed="true"] { background: var(--accent); color: #fff; }
.layout-drag-handle { cursor: grab; color: var(--muted) !important; font-size: 18px !important; }

/* نقطة على زرار الطبقات لما التبويب اللي قدامك فيه أجزاء مخفية — من غيرها اللي
   خبّى كارت الأسبوع اللي فات هيفتكر إنه اتمسح. */
.utility-btn.has-hidden::after {
  content: '';
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--panel);
}

/* السحب في المتصفح مابيشتغلش باللمس أصلاً، فالمقبض على الموبايل بيبقى زرار
   مالوش لازمة. الكلاس محدد بأبوه عشان يغلب `.layout-card-tools button`. */
@media (pointer: coarse) {
  .layout-card-tools .layout-drag-handle { display: none; }
  .layout-card-tools button { min-width: 34px; height: 34px; }
}
@media (max-width: 760px) {
  .layout-editor-bar { margin-inline: 12px; align-items: stretch; flex-direction: column; }
  .layout-editor-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .layout-editor-actions .primary-mini { grid-column: 1 / -1; }
}

.panel-head.compact { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head.compact h2 { font-size: 15px; font-weight: 800; }
.panel-head.compact button { color: var(--muted); padding: 6px; border-radius: 8px; }
.panel-head.compact button:hover { background: var(--panel-2); color: var(--ink); }

.notice-list { display: grid; gap: 8px; max-height: 55vh; overflow-y: auto; }

.notice-item {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border-inline-start: 4px solid var(--line);
  text-align: right;
  transition: transform var(--speed);
}

.notice-item:hover { transform: translateX(-3px); }
.notice-item strong { font-size: 13.5px; }
.notice-item span { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }
.notice-item.danger { border-color: var(--danger); background: var(--danger-soft); }
.notice-item.warning { border-color: var(--warning); background: var(--warning-soft); }
.notice-item.info { border-color: var(--accent); background: var(--accent-soft); }
.notice-group { display: grid; gap: 8px; }
.notice-group + .notice-group { margin-block-start: 12px; }
.notice-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-min);
  font-weight: 800;
}
.notice-group-title span {
  background: var(--panel-2);
  border-radius: 999px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.notice-empty { color: var(--muted); font-weight: 600; text-align: center; padding: 14px 0; }

/* ------------------------------ المحتوى واللوحات ------------------------------ */

.tab-content { display: block; }
/* `both` كان بيُبقي transform بعد انتهاء الحركة، فيحوّل محتوى التبويب إلى
   stacking context دائم. أي نافذة داخله وقتها تفضل تحت شريط الموبايل مهما
   كان z-index بتاعها. الحركة تنتهي لنفس الموضع، فلا نحتاج تثبيت الإطار. */
.tab-content.tab-enter { animation: tabIn 0.35s ease; }

.content-column { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

.panel {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-head h2, .panel > h2 { font-size: 16px; font-weight: 800; }
.section-head p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; margin-top: 2px; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.section-head-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.month-picker { min-width: 160px; }
.month-picker select { min-width: 160px; }

.dashboard-toolbar { display: flex; justify-content: flex-start; margin-bottom: 4px; }
.dashboard-toolbar .month-picker { min-width: 200px; }

.primary-mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  font-weight: 700;
  font-size: max(var(--fs-min), 12.5px);
  transition: transform var(--speed), opacity var(--speed);
}

.primary-mini:hover { transform: translateY(-1px); opacity: 1; background: var(--accent); color: #fff; }
.primary-mini.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }

/* كل لوحة لها لمسة واحدة مرتبطة بمعناها، من غير ما تتحول الصفحة لمجموعة أزرار مصمتة. */
.dashboard-finance-strip .primary-mini {
  background: var(--teal-soft);
  color: var(--teal-vivid);
  border-color: color-mix(in srgb, var(--teal-vivid) 22%, transparent);
}
.dashboard-finance-strip .primary-mini:hover { background: var(--teal-vivid); color: #fff; }
.attendance-trend-panel .primary-mini {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 22%, transparent);
}
.attendance-trend-panel .primary-mini:hover { background: var(--success); color: #fff; }

/* ---------- ترتيب أهمية الأزرار ----------
   اللون الكامل معناه «ده أهم زرار في الشاشة». لما ٤٧ زرار «تحصيل» في صف
   الجدول ياخدوا نفس اللون الكامل بتاع «إضافة طالب»، مفيش زرار بيكسب —
   العين ما بتعرفش تبدأ منين. الأزرار المتكررة جوه الصفوف والقوايم بتاخد
   نفس اللون بس بوزن أخف (خلفية فاتحة + نص بنفس اللون)، فتفضل واضحة إنها
   قابلة للضغط من غير ما تزاحم الزرار الأساسي. بيرجع لونه كامل عند المرور. */
.due-now-row .primary-mini,
.subs-student-row .primary-mini,
tbody .primary-mini:not(.ghost) {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.due-now-row .primary-mini:hover,
.subs-student-row .primary-mini:hover,
tbody .primary-mini:not(.ghost):hover {
  background: var(--accent);
  color: #fff;
  opacity: 1;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 700;
  transition: all var(--speed);
}

.ghost-btn:hover { border-color: var(--ink); }

/* ------------------------------ كروت المقاييس ------------------------------ */

.dashboard-pro { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

/* `auto-fit` بيحط أكتر عدد يساعه العرض: ستة كروت على شاشة كبيرة كانت بتبقى
   خمسة وكارت لوحده في صف تاني جنبه فراغ. الأعمدة بتتحسب من عدد الكروت
   الظاهرة (الكارت اللي اتخفى من «تخصيص الواجهة» مابيتعدّش): ستة = ٣×٢،
   سبعة أو تمانية = صفين من أربعة. المتصفح اللي مابيفهمش `of` بيفضل على `auto-fit`.
   كروت لوحة التحكم نفسها جوّه `.dashboard-metrics-section` وليها أعمدة بعرض
   السيكشن (تحت)، فالقواعد دي بقت لملف الطالب بس. */
@media (min-width: 1151px) {
  :not(.dashboard-metrics-section) > .dashboard-metrics:has(> :nth-child(6 of :not([data-layout-hidden]))) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :not(.dashboard-metrics-section) > .dashboard-metrics:has(> :nth-child(7 of :not([data-layout-hidden]))) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-width: 1150px) {
  :not(.dashboard-metrics-section) > .dashboard-metrics:has(> :nth-child(5 of :not([data-layout-hidden]))) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* عدد فردي على عمودين: الأخير بياخد الصف كله بدل ما يقف لوحده في نصه. */
  :not(.dashboard-metrics-section) > .dashboard-metrics:has(> :nth-child(5 of :not([data-layout-hidden]))) > :nth-last-child(1 of :not([data-layout-hidden])):nth-child(odd of :not([data-layout-hidden])) { grid-column: 1 / -1; }
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  /* كروت الصف الواحد طولها واحد، فالسطر الصغير بينزل تحت في كلهم على نفس الخط. */
  align-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--speed), box-shadow var(--speed);
}

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

.metric-card::before { content: none; }

/* كل البطاقات أبيض بتباين عالٍ ولمسة لون في الأيقونة فقط */

.metric-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-head p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.metric-head strong { font-size: 25px; font-weight: 900; display: block; margin-top: 3px; color: var(--ink); }
.metric-card small { color: var(--muted); font-weight: 600; font-size: var(--fs-min); }

.metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--panel-2);
  color: var(--muted);
}

/* لمسة لون واحدة هادئة داخل كل بطاقة (الأيقونة فقط) */
.metric-card.revenue .metric-icon { background: var(--teal-soft); color: var(--teal-vivid); }
.metric-card.students .metric-icon { background: var(--accent-soft); color: var(--accent); }
.metric-card.attendance .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-card.members .metric-icon { background: var(--violet-soft); color: var(--violet-vivid); }
.metric-card.today-summary .metric-icon { background: var(--violet-soft); color: var(--violet-vivid); }
/* كارتين التحذير: الأيقونة ملوّنة زي الباقي، بس دول كمان بياخدوا خط جانبي
   بلونهم. الصف فيه ستة كروت متشابهة، والأيقونة لوحدها بتتقري كزينة —
   والاتنين دول هما اللي المفروض العين تقع عليهم الأول لما يبقى فيهم رقم. */
.metric-card.streak-risk .metric-icon { background: var(--warning-soft); color: var(--warning); }
.metric-card.streak-withdrawal .metric-icon { background: var(--danger-soft); color: var(--danger); }
.metric-card.streak-risk { border-inline-start: 4px solid var(--warning); }
.metric-card.streak-withdrawal { border-inline-start: 4px solid var(--danger); }
/* الصفر مش تحذير: الكارت بيفضل مكانه بس بيرجع رمادي زي باقي الصف. */
.metric-card.streak-risk:not(.metric-link), .metric-card.streak-withdrawal:not(.metric-link) { border-inline-start-color: var(--line); }
.metric-card.streak-risk:not(.metric-link) .metric-icon,
.metric-card.streak-withdrawal:not(.metric-link) .metric-icon { background: var(--panel-2); color: var(--muted); }

/* كروت اللوحة جوّه سيكشن ليه عنوان («ملخص الشهر») زي «تصنيف الطلاب» اللي
   تحتها، فبقت أصغر: خلفية أهدى من غير ظل، ورقم وأيقونة أصغر.

   السيكشن مش `.panel` بالقصد: مدير الترتيب بيعتبر أي `.panel` جزء واحد بيتحرك
   كله، فكان هيبلع الكروت ويضيّع إخفاء وترتيب كل كارت لوحده.

   الأعمدة بتتحسب من عرض السيكشن نفسه مش الشاشة، لأن فتح وقفل السايدبار بيغيّر
   المساحة من غير ما الشاشة تتغيّر: عمودين، وبعدين ٣×٢، وبعدين الستة في صف. */
.dashboard-metrics-section {
  container: dashboard-metrics / inline-size;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dashboard-metrics-section > .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container dashboard-metrics (min-width: 560px) {
  .dashboard-metrics-section > .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.dashboard-metrics-section .metric-card { min-height: 142px; padding: 16px; gap: 12px; border-radius: var(--radius-sm); background: var(--panel-2); box-shadow: none; }
.dashboard-metrics-section .metric-card:hover { box-shadow: var(--shadow); }
.dashboard-metrics-section .metric-head { align-items: center; }
.dashboard-metrics-section .metric-head > div { display: grid; gap: 5px; min-width: 0; }
.dashboard-metrics-section .metric-head p { line-height: 1.35; color: var(--muted); }
.dashboard-metrics-section .metric-head strong { margin: 0; font-size: clamp(21px, 2.15vw, 28px); line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.dashboard-metrics-section .metric-card > small { display: block; min-height: 2.8em; padding-top: 9px; border-top: 1px solid var(--line); line-height: 1.55; }
.dashboard-metrics-section .metric-icon { width: 40px; height: 40px; border-radius: 12px; }
.dashboard-metrics-section .metric-icon .icon { width: 18px; height: 18px; }
/* رقم كارت «ملخص اليوم» تاريخ بالحروف، فمسموحله ينزل سطر من غير ما يزحم الكارت. */
.dashboard-metrics-section .metric-card.today-summary .metric-head strong { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
/* أيقونة الكارت اللي رقمه صفر رمادي على نفس لون الكارت الجديد، فكانت هتختفي. */
.dashboard-metrics-section .metric-card.streak-risk:not(.metric-link) .metric-icon,
.dashboard-metrics-section .metric-card.streak-withdrawal:not(.metric-link) .metric-icon { background: var(--panel); }
@media (max-width: 620px) {
  .dashboard-metrics-section { padding: 14px; }
  .dashboard-metrics-section > .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-metrics-section .metric-card { min-height: 0; padding: 14px; }
  .dashboard-metrics-section .metric-head strong { font-size: 23px; }
  .dashboard-metrics-section .metric-card > small { min-height: 0; }
}

.count-up { animation: countIn 0.5s ease both; }

.dashboard-main {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 14px;
}

.charts-pair { grid-template-columns: 1fr 1fr; }
.attendance-trend-panel { grid-column: span 2; overflow-x: auto; }
.dash-exams { grid-column: span 2; }

/* ------------------------------ قائمة المتابعة ------------------------------ */

.focus-list { display: grid; gap: 8px; }

.focus-list button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: 'swatch title arrow' 'swatch meta arrow';
  align-items: center;
  column-gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: right;
  transition: all var(--speed);
}

.focus-list button:hover { border-color: var(--line); transform: translateX(-3px); }
.focus-list .swatch { grid-area: swatch; }
.focus-list strong { grid-area: title; font-size: 13.5px; }
.focus-list small { grid-area: meta; color: var(--muted); font-weight: 600; }
.focus-arrow { grid-area: arrow; color: var(--muted); }

.swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.swatch.lime { background: #b5cf1f; }
.swatch.purple { background: var(--purple); }
.swatch.cyan { background: var(--cyan); }
.swatch.amber { background: var(--amber); }
.swatch.mint { background: var(--mint); }
.swatch.rose { background: var(--rose); }

/* ------------------------------ الجداول ------------------------------ */

/* min-width: 0 مهم: من غيره الجدول العريض (min-width: 1050px مثلاً) بيسرّب
   مقاسه لكل الآباء عبر min-content، فاللوحة كلها تخرج بره الشاشة بدل ما
   الجدول يتمرّر جوه صندوقه. الـ overflow لوحده ما بيمنعش التسريب ده. */
.table-wrap { min-width: 0; overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; min-width: 720px; }

thead th {
  padding: 11px 14px;
  text-align: right;
  font-size: var(--fs-min);
  font-weight: 800;
  color: var(--muted);
  background: var(--panel-2);
  white-space: nowrap;
}

tbody td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background var(--speed); }
tbody tr:hover { background: var(--panel-2); }

.student-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }

.student-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.student-phone { color: var(--muted); font-size: var(--fs-min); font-weight: 600; direction: ltr; text-align: right; }
.student-name.link {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--ink); cursor: pointer; text-align: inherit;
  font: inherit; font-weight: 700; font-size: 13.5px;
}
.student-name.link:hover { color: var(--accent); text-decoration: underline; }
.student-code { font-family: ui-monospace, "Cascadia Code", monospace; color: var(--accent); font-weight: 700; }
.level-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ------------------------------ كروت الطلاب ------------------------------ */

/* ---------------------- كشف الطلاب: مربعات بتوهّج ---------------------- */

/* مربع لكل طالب، والشبكة بتحشر أكبر عدد يدخل في العرض المتاح. `auto-fill` مع
   حد أدنى صغير معناه إن نفس الكود بيطلع تلات مربعات على موبايل وعشرة على لاب
   من غير أي media query. */
/* ألوان المربعات لوحة ثابتة مش تابعة للثيم: دي إشارة مرور، ومعنى اللون لازم
   يفضل هو هو مهما المستخدم غيّر مظهر السيستم — أخضر ملتزم ودافع في كل الثيمات.
   اللوحة: #001524 / #15616d / #ffecd1 / #ff7d00 / #78290f. */
/* كل لون هنا بيقبل تجاوز من الإعدادات (--tile-pulse-*) والقيمة المكتوبة هي
   الافتراضي: لوحة «إشارة مرور» بتسيب المتغيرات دي فاضية فتفضل الألوان الثابتة
   شغّالة بنسختها الليلية كمان من غير ما نكرّرها في JS. */
.student-tiles {
  display: grid;
  --tile-min: var(--tile-min-setting, 96px);
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));
  gap: 10px;
  margin-top: 4px;
}

/* ألوان التصنيفات. معرّفة على الشبكة وعلى كل حاجة بتعرض نفس التصنيفات — شيبس
   الفلتر في المراحل ولوحة التصنيف في لوحة التحكم — عشان اللون اللي في القايمة
   يبقى هو نفسه اللي في المربع. كتابتها تاني في كل مكان كانت معناها إن تغيير
   لون من الإعدادات يمشي في حتة ويقف في التانية. */
.student-tiles, .card-type-filter-row, .card-type-rows {
  --pulse-name: var(--tile-pulse-name, #001524);
  /* اللوحة مفيهاش أخضر، والأخضر مالوش بديل هنا: من غيره «ملتزم ودافع» هياخد
     نفس تركواز «ملتزم مدفعش» والتفرقة اللي المربعات موجودة عشانها تضيع. */
  --pulse-good: var(--tile-pulse-good, #0f6f3e);
  --pulse-good-bg: var(--tile-pulse-good-bg, rgba(15, 111, 62, .10));
  --pulse-info: var(--tile-pulse-info, #15616d);
  --pulse-info-bg: var(--tile-pulse-info-bg, rgba(21, 97, 109, .11));
  /* البرتقالي الصريح للإطار والتوهّج — أشكال، مالهاش شرط قراءة. نفس اللون في
     خط ٩٫٥ بكسل تباينه ٢٫٦ فوق الأبيض، فالكلمة بس هي اللي بتاخد نسخة أغمق. */
  --pulse-warn: var(--tile-pulse-warn, #ff7d00);
  --pulse-warn-ink: var(--tile-pulse-warn-ink, #9a4b00);
  --pulse-warn-bg: var(--tile-pulse-warn-bg, rgba(255, 125, 0, .13));
  --pulse-danger: var(--tile-pulse-danger, #78290f);
  --pulse-danger-bg: var(--tile-pulse-danger-bg, rgba(120, 41, 15, .10));
  /* الخانتين الحرتين: بنفسجي وتركوازي بعيدين كفاية عن الأربعة اللي فوق عشان
     نوع زي «غياب متكرر — دافع» ما يتلخبطش مع البرتقالي في نص الكشف. */
  --pulse-violet: var(--tile-pulse-violet, #6b2c9e);
  --pulse-violet-bg: var(--tile-pulse-violet-bg, rgba(107, 44, 158, .10));
  --pulse-teal: var(--tile-pulse-teal, #0d6a67);
  --pulse-teal-bg: var(--tile-pulse-teal-bg, rgba(13, 106, 103, .11));
  --pulse-idle: var(--tile-pulse-idle, #ffecd1);
  --pulse-idle-line: var(--tile-pulse-idle-line, #e6cba6);
  --pulse-idle-ink: var(--tile-pulse-idle-ink, #6b5a45);
}

/* الليلي: نفس الصبغات مرفوعة عشان تبان فوق الكارت الغامق. الأحمر بيتسحب ناحية
   الأحمر الصافي والبرتقالي ناحية الكهرماني، لأن رفع الاتنين على طول بيقرّبهم من
   بعض والمفروض يفضلوا مقروءين كإشارتين مختلفتين. */
body.dark-mode .student-tiles,
body.dark-mode .card-type-filter-row,
body.dark-mode .card-type-rows {
  --pulse-name: var(--tile-pulse-name, #eef2f8);
  --pulse-good: var(--tile-pulse-good, #46e694);
  --pulse-good-bg: var(--tile-pulse-good-bg, rgba(70, 230, 148, .12));
  --pulse-info: var(--tile-pulse-info, #58cfe0);
  --pulse-info-bg: var(--tile-pulse-info-bg, rgba(88, 207, 224, .12));
  --pulse-warn: var(--tile-pulse-warn, #ffa233);
  --pulse-warn-ink: var(--tile-pulse-warn-ink, #ffa233);
  --pulse-warn-bg: var(--tile-pulse-warn-bg, rgba(255, 162, 51, .14));
  --pulse-danger: var(--tile-pulse-danger, #ff9a80);
  --pulse-danger-bg: var(--tile-pulse-danger-bg, rgba(255, 154, 128, .14));
  --pulse-violet: var(--tile-pulse-violet, #cba0ff);
  --pulse-violet-bg: var(--tile-pulse-violet-bg, rgba(203, 160, 255, .14));
  --pulse-teal: var(--tile-pulse-teal, #3fdcc9);
  --pulse-teal-bg: var(--tile-pulse-teal-bg, rgba(63, 220, 201, .14));
  --pulse-idle: var(--tile-pulse-idle, rgba(255, 236, 209, .07));
  --pulse-idle-line: var(--tile-pulse-idle-line, rgba(255, 236, 209, .22));
  --pulse-idle-ink: var(--tile-pulse-idle-ink, #c3b49c);
}
/* الحد الأدنى بيصغّر على الموبايل عشان تلات مربعات يدخلوا في الصف بدل اتنين —
   البانل جوّاه ٣١٠ بكسل بس، و٣ × ١١٦ مايدخلوش. */
@media (max-width: 620px) {
  .student-tiles { --tile-min: calc(var(--tile-min-setting, 96px) * .77); gap: 7px; }
}

.student-tile {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 7px 6px;
  border: 1.5px solid var(--tile-line);
  border-radius: 13px;
  background: var(--tile-bg);
  color: var(--pulse-name);
  text-align: center;
  cursor: pointer;
  /* التوهّج نفسه: هالة ملوّنة تحت المربع بلون حالته. */
  box-shadow: 0 0 0 3px var(--tile-halo), 0 6px 18px var(--tile-glow);
  transition: transform var(--speed), box-shadow var(--speed), border-color var(--speed);
}
/* الرفعة للماوس بس: على اللمس الهوفر بيعلق بعد الدوسة والمربع يفضل مرفوع.
   ومنطقة الضغط بتترفع مع المربع، فالماوس اللي على آخر ٣ بكسل تحت كان بيخرج
   منه، ينزل، يترفع تاني — والضغطة وقت الرعشة دي بتقع في الفراغ بين المربعات.
   الذيل الشفاف تحته بيسد الفراغ اللي الرفعة بتسيبه. */
.student-tile::after { content: ''; position: absolute; inset: auto 0 -5px; height: 5px; }
@media (hover: hover) {
  .student-tile:hover { transform: translateY(-3px); box-shadow: 0 0 0 4px var(--tile-halo), 0 12px 26px var(--tile-glow); }
}
.student-tile:active { transform: translateY(0) scale(.98); }
.student-tile:focus-visible { outline: 3px solid var(--tile-line); outline-offset: 3px; }

.tile-name {
  /* الخط بيكبر مع المربع بس ما ينزلش تحت مقاسه الأصلي: المربع الصغير بيقلّل
     الحروف الظاهرة (وفيه قص على تلات سطور أصلاً)، إنما خط ٨ بكسل ما يتقراش. */
  font-size: max(var(--fs-min), calc(11.5px * max(1, var(--tile-scale, 1))));
  font-weight: 800;
  line-height: 1.35;
  /* الأسماء الطويلة بتتقص على تلات سطور بدل ما تكبّر المربع وتكسر الصف. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.tile-state { font-size: max(var(--fs-min), calc(9.5px * max(1, var(--tile-scale, 1)))); font-weight: 700; color: var(--tile-ink); }

/* مربع طالب جروب التفوق: وسام فوق حالته مش بديل عنها. الإطار والهالة بيبقوا
   ذهبيين، والخمس نجوم تحت الاسم، ولون الحالة (الخلفية والكلمة) زي ما هو —
   عشان تعرف إنه متفوق ومنسحب في نفس اللحظة لو حصل. */
/* الوسام كان تلات حلقات مركّبة فوق بعض: إطار ذهبي فاتح، وحلقة ٢ بكسل غامقة،
   وهالة ٥ بكسل. في شبكة فراغها ١٠ بكسل الحلقات بتاكل المسافة، فالمربع المتفوق
   بيبان محشور في جيرانه، والشكل نفسه بيقرا كـ«هدف» مش كوسام.

   بقى أربع طبقات كل واحدة ليها شغلانة: شعرة ذهب غامق ملزوقة في الإطار هي
   اللي بتحمل التباين (الذهبي الفاتح لوحده بينزل تحت ٣:١)، هالة رفيعة حواليها،
   ضلّ دافي واسع تحت المربع بيرفعه عن الصفحة، ولمعة داخلية من فوق. الطبقات
   بتبني عمق بدل ما تبني حلقات، والمساحة اللي بتاخدها بره المربع بقت ٥ بكسل
   بدل ٧. */
.student-tile.is-excellence {
  border-color: var(--excellence-line, #d8a725);
  box-shadow:
    inset 0 1px 0 var(--excellence-sheen, rgba(255, 247, 219, .55)),
    0 0 0 1px var(--excellence-ring, #9b7100),
    0 0 0 4px var(--excellence-halo, rgba(216, 167, 37, .3)),
    0 8px 20px var(--excellence-glow, rgba(216, 167, 37, .3));
}
.student-tile.is-excellence:hover {
  box-shadow:
    inset 0 1px 0 var(--excellence-sheen, rgba(255, 247, 219, .55)),
    0 0 0 1px var(--excellence-ring, #9b7100),
    0 0 0 5px var(--excellence-halo, rgba(216, 167, 37, .3)),
    0 14px 30px var(--excellence-glow, rgba(216, 167, 37, .3));
}
/* سطر النجوم بياخد مكان من الاسم، فالاسم بينزل لسطرين بدل تلاتة عشان المربع
   يفضل مربع ومحصلش قص في النص. */
.student-tile.is-excellence .tile-name { -webkit-line-clamp: 2; line-clamp: 2; }

/* تاج ضوء ذهبي من فوق المربع، ومعاه الشعاع اللي بيعدّي. الاتنين طبقتين في
   خلفية واحدة عشان الوسام يسيب ::after فاضي لسهم المربع المفتوح — قبل كده
   اللمعة كانت بتاخده وبتقفل الـ overflow معاه، فالمتفوق لما يتفتح كان بيفقد
   السهم اللي بيقول الكارت اللي تحت بتاعه.

   والضوء من فوق مش من تحت بقصد: تحت في النجوم، وذهب فوق ذهب بيبلّع بعضه. */
.student-tile.is-excellence::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(102deg, transparent 41%, var(--excellence-flash, rgba(255, 250, 232, .7)) 50%, transparent 59%),
    radial-gradient(132% 72% at 50% -20%, var(--excellence-wash, rgba(255, 255, 255, .5)), transparent 70%);
  background-size: 260% 100%, auto;
  background-position: 135% 0, 0 0;
  background-repeat: no-repeat;
  pointer-events: none;
}
/* الطبقة المطلقة بترسم فوق خلفية المربع وتحت أي عنصر positioned جوّاه — من
   غير السطر ده الاسم والحالة كانوا هيتغطّوا. */
.student-tile.is-excellence > * { position: relative; z-index: 1; }

[data-tile-excellence="shine"] .student-tile.is-excellence::before {
  animation: tile-shine 4.5s ease-in-out infinite;
}
@keyframes tile-shine {
  0%, 64% { background-position: 135% 0, 0 0; }
  100% { background-position: -35% 0, 0 0; }
}

/* الخمس نجوم كانت سطر مصمت بلون واحد — بتقرا كنص صغير مركون تحت الاسم مش
   كوسام. دلوقتي بتاخد تدرّج ذهبي على طول السطر وشعاع بيمشي فيه، فبيبان
   المعدن. القص على النص مدعوم في كل المتصفحات الحديثة، وبرّاه بيفضل اللون
   المصمت شغّال زي ما كان. */
.tile-stars {
  display: block;
  color: var(--excellence-star, #b3820c);
  font-size: max(var(--fs-min), calc(9px * max(1, var(--tile-scale, 1))));
  letter-spacing: .1em;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 1px 0 var(--excellence-star-shade, rgba(94, 66, 0, .3)));
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .tile-stars {
    background: linear-gradient(100deg,
      var(--excellence-star, #b3820c) 0 36%,
      var(--excellence-star-hi, #ffeaa8) 48%,
      var(--excellence-star, #b3820c) 60%);
    background-size: 280% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: tile-stars-sheen 4.5s ease-in-out infinite;
  }
}
@keyframes tile-stars-sheen {
  0%, 58% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* «نجوم بس» بتشيل الذهبي وتسيب النجوم، و«من غير تمييز» بتشيل الاتنين. */
[data-tile-excellence="stars"] .student-tile.is-excellence,
[data-tile-excellence="off"] .student-tile.is-excellence {
  border-color: var(--tile-line);
  box-shadow: 0 0 0 3px var(--tile-halo), 0 6px 18px var(--tile-glow);
}
[data-tile-excellence="stars"] .student-tile.is-excellence::before,
[data-tile-excellence="off"] .student-tile.is-excellence::before { content: none; }
[data-tile-excellence="off"] .tile-stars { display: none; }
@media (prefers-reduced-motion: reduce) {
  /* الحركة بتقف، واللمعة بتترمي بره المربع بدل ما تفضل واقفة في نصه — لكن
     تدرّج النجوم بيتظبط على وضع فيه شعاع ثابت عشان ما يرجعش لون واحد مسطّح. */
  [data-tile-excellence="shine"] .student-tile.is-excellence::before { animation: none; }
  .tile-stars { animation: none; background-position: 46% 0; }
}

/* أربع معانٍ، أربع ألوان:
     أخضر    ملتزم ودافع الاشتراك
     أزرق    ملتزم بس لسه مدفعش
     برتقالي غاب أكتر من حصة في الشهر
     أحمر    منسحب
   والرملي الباهت للتوقف المؤقت لأنه مش انسحاب ومينفعش ياخد الأحمر. */
.student-tile.pulse-good { --tile-line: var(--pulse-good); --tile-ink: var(--tile-pulse-good-ink, var(--pulse-good)); --tile-bg: var(--pulse-good-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-good) 34%, transparent); }
.student-tile.pulse-info { --tile-line: var(--pulse-info); --tile-ink: var(--tile-pulse-info-ink, var(--pulse-info)); --tile-bg: var(--pulse-info-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-info) 32%, transparent); }
.student-tile.pulse-warning { --tile-line: var(--pulse-warn); --tile-ink: var(--pulse-warn-ink); --tile-bg: var(--pulse-warn-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-warn) 36%, transparent); }
.student-tile.pulse-danger { --tile-line: var(--pulse-danger); --tile-ink: var(--tile-pulse-danger-ink, var(--pulse-danger)); --tile-bg: var(--pulse-danger-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-danger) 38%, transparent); }
.student-tile.pulse-violet { --tile-line: var(--pulse-violet); --tile-ink: var(--tile-pulse-violet-ink, var(--pulse-violet)); --tile-bg: var(--pulse-violet-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-violet) 34%, transparent); }
.student-tile.pulse-teal { --tile-line: var(--pulse-teal); --tile-ink: var(--tile-pulse-teal-ink, var(--pulse-teal)); --tile-bg: var(--pulse-teal-bg); --tile-halo: transparent; --tile-glow: color-mix(in srgb, var(--pulse-teal) 34%, transparent); }
.student-tile.pulse-idle { --tile-line: var(--pulse-idle-line); --tile-ink: var(--pulse-idle-ink); --tile-bg: var(--pulse-idle); --tile-halo: transparent; --tile-glow: transparent; color: var(--pulse-idle-ink); }

/* التعبئة المصمتة بتاخد لون «الحبر» مش لون الإطار: البرتقالي الصريح تباينه مع
   الأبيض ٢٫٦ بس، والحبر هو النسخة اللي اتظبطت أصلاً عشان تتقرا. وفي الليلي
   الألوان مرفوعة وفاتحة فالنص بيتقلب غامق بدل الأبيض. */
[data-tile-fill="solid"] .student-tile {
  border-color: var(--tile-ink);
  background: var(--tile-ink);
  color: #fff;
}
[data-tile-fill="solid"] .student-tile .tile-state { color: rgba(255, 255, 255, .86); }
body.dark-mode[data-tile-fill="solid"] .student-tile,
body.dark-mode [data-tile-fill="solid"] .student-tile { color: #08131f; }
body.dark-mode[data-tile-fill="solid"] .student-tile .tile-state,
body.dark-mode [data-tile-fill="solid"] .student-tile .tile-state { color: rgba(8, 19, 31, .78); }

[data-tile-fill="outline"] .student-tile {
  background: var(--panel);
  color: var(--pulse-name);
  box-shadow: none;
}
[data-tile-fill="outline"] .student-tile:hover { box-shadow: 0 8px 18px var(--tile-glow); }

/* المربع المتفوق بياخد سطحه الذهبي الفاتح المصمت. مكانه هنا بعد أنماط التعبئة
   التلاتة مش فوق مع باقي قواعد الوسام، لأن «مصمتة» و«حدود فقط» بيحطّوا خلفية
   بمُحدِّد أقوى — لو الذهب اتكتب فوقهم كانوا هيدوسوا عليه.

   الوسام كان إطار وهالة حوالين خلفية لون الحالة، وده بيتشاف لما تبص على المربع
   نفسه. بقى السطح كله ذهب فيتشاف من آخر الشبكة. ولون الحالة مابيضيعش: كلمة
   الحالة تحت الاسم بتفضل بلونها (متغمّقة شوية عشان تقعد على الذهب)، فالمتفوق
   المنسحب لسه بيقول إنه منسحب.

   الوضعين اللي فيهم ذهب مكتوبين بالاسم — «نجوم بس» و«من غير تمييز» بيشيلوا
   الذهب، فسطحهم لازم يفضل لون الحالة زي أي مربع تاني من غير قواعد إلغاء. */
body[data-tile-excellence="shine"] .student-tile.is-excellence,
body[data-tile-excellence="gold"] .student-tile.is-excellence,
body.dark-mode[data-tile-excellence="shine"] .student-tile.is-excellence,
body.dark-mode[data-tile-excellence="gold"] .student-tile.is-excellence {
  background: var(--excellence-fill, #f0e5c7);
  border-color: var(--excellence-line, #d8a725);
  color: var(--excellence-ink, #483400);
  /* النجوم فوق الذهب: الأساس بيغمق، وقمة الشعاع بتاخد الذهب الخام بدل الفاتح
     اللي كان بيختفي فوق سطح فاتح. جراديان النجوم فوق بيقرا المتغيّرين دول. */
  --excellence-star: var(--excellence-star-deep, #6d4f00);
  --excellence-star-hi: var(--excellence-line, #d8a725);
}
body[data-tile-excellence="shine"] .student-tile.is-excellence .tile-state,
body[data-tile-excellence="gold"] .student-tile.is-excellence .tile-state,
body.dark-mode[data-tile-excellence="shine"] .student-tile.is-excellence .tile-state,
body.dark-mode[data-tile-excellence="gold"] .student-tile.is-excellence .tile-state {
  color: color-mix(in srgb, var(--tile-ink) 88%, #000);
}

/* المربع المفتوح (أو اللي تحت الضغطة): حلقة بلونه عشان تعرف الكارت الطاير
   فوقه بتاع مين. */
.student-tile.is-open,
.student-tile.is-peeking { --tile-halo: color-mix(in srgb, var(--tile-line) 26%, transparent); }
.student-tile.is-peeking { transform: scale(.96); }

/* المربعات بتتمسك بالصباع: تحديد النص كان بيلوّن الأسامي وانت بتلف، والضغطة
   المطوّلة على الموبايل كانت بتفتح قايمة النسخ بدل النظرة. */
.student-tile { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }

/* الطبقة الطايرة فوق الشبكة — الكارت التفصيلي والنظرة الخاطفة. مكانها بيتحسب
   بالجافاسكريبت (tile-layer.js) لأن مكان المربع في الشبكة مش معروف وقت الرسم.
   position: fixed عشان تفضل ثابتة على المربع وهي بره تدفّق الصفحة. */
.tile-layer {
  position: fixed;
  z-index: 120;
  width: min(330px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); /* بيتظبط بالجافاسكريبت على طول الشاشة الحقيقي */
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: scale(.86) translateY(4px);
  transition: opacity .14s ease-out, transform .24s cubic-bezier(.18, .89, .32, 1.16);
}
.tile-layer.is-in { opacity: 1; transform: none; }

/* الطبقة نفسها معتمة تحت الكارت: خلفية كارت التفوق تدرّج بينتهي بذهبي شفاف
   (rgba بـ 0.15). على الصفحة كان واقف على بانل معتم فمحدش واخد باله، وطاير فوق
   الشبكة المربعات بقت بتبان من وراه والكلام اللي عليه بقى مقروء على ضهر مزحوم. */
.tile-card-layer {
  background: var(--panel);
  border-radius: var(--radius-sm);
  /* ظل الكارت الطاير مكانه هنا مش على .student-card اللي جوّه: الطبقة
     overflow: auto والكارت بيملاها بالظبط، فأي ظل بيترسم بره حدود الكارت
     بيتقص عند حدود الطبقة ومحدش بيشوفه. تلات طبقات — لمسة قريبة بتحدّد
     الحافة، وسحابة واسعة بتعتّم الكشف اللي تحت — عشان الكارت يبان واقف فوق
     المربعات والكلام مش لازق فيهم. */
  box-shadow:
    0 2px 6px rgba(15, 23, 42, .18),
    0 14px 32px rgba(15, 23, 42, .3),
    0 38px 78px rgba(15, 23, 42, .42);
}

.tile-card-layer .student-card {
  /* حد أتقل وأغمق من كارت واقف في الكشف: الشعرة الفاتحة بتدوب وسط الزحمة. */
  border-width: 2px;
  border-color: color-mix(in srgb, var(--line) 40%, var(--ink) 60%);
  box-shadow: none;
}
/* كارت التفوق بيفضل ذهبه، بس أتقل وبحلقة جوّانية عشان يفضل أوضح كارت في
   الشاشة وهو طاير. */
.tile-card-layer .student-card-excellence {
  border-width: 3px;
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent);
}
.tile-card-layer .student-card:hover { transform: none; }
/* الكارت الطاير لازم يبان كامل: السكرول جوّاه بيخفي صف الأزرار اللي تحت، وده
   بالظبط اللي بتفتح الكارت عشانه. نفس المحتوى بمسافات أضيق شوية عشان يقع
   جوّه طول الشاشة العادي من غير ما يتقص. */
.tile-card-layer .student-card { padding: 12px; }
.tile-card-layer .student-card-meta { gap: 6px; margin: 10px 0; }
.tile-card-layer .student-card-meta > div { padding: 7px; }
.tile-card-layer .student-card-meta .progress { margin-top: 5px; }
.tile-card-layer .student-card-actions { padding-top: 8px; }
/* الشاشات القصيرة: نفس الكارت مضغوط أكتر بدل ما آخره يتقص. بيتحط من
   tile-layer.js وقت ما الطول الطبيعي يعدّي طول الشاشة. */
.tile-card-layer.is-dense .student-card { padding: 10px; }
.tile-card-layer.is-dense .student-card-meta { gap: 5px; margin: 8px 0; }
.tile-card-layer.is-dense .student-card-meta > div { padding: 5px 6px; }
.tile-card-layer.is-dense .student-card-meta > div > span:first-child { margin-bottom: 2px; font-size: 10px; }
.tile-card-layer.is-dense .student-card-meta strong { font-size: 11.5px; }
.tile-card-layer.is-dense .student-card-meta small { margin-top: 2px; font-size: 10px; }
.tile-card-layer.is-dense .student-card-meta .progress { margin-top: 4px; }
.tile-card-layer.is-dense .student-card-qr-preview img { width: 44px; height: 44px; }
.tile-card-layer.is-dense .student-card-actions { padding-top: 6px; gap: 5px; }
/* في الليلي الظل لوحده مابيفصلش (كله غامق فوق غامق)، فالحد بيتقلب لفاتح
   يرسم حافة الكارت بدل ما يدوب فيها. */
body.dark-mode .tile-card-layer {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, .5),
    0 14px 32px rgba(0, 0, 0, .56),
    0 38px 78px rgba(0, 0, 0, .62);
}
body.dark-mode .tile-card-layer .student-card { border-color: color-mix(in srgb, var(--line) 55%, #ffffff 45%); }
body.dark-mode .tile-card-layer .student-card-excellence { border-color: var(--gold); }
/* السحب للإغلاق: الكارت بيمشي مع الإيد، فحركة الـ CSS المحفوظة بتتشال وقت
   السحب عشان مايتأخّرش عن الإصبع. */
.tile-card-layer.is-dragging { transition: none; }

/* الموبايل والتابلت: نفس الكارت بس مايبلعش الشاشة. قواعد الشاشة الضيّقة
   بتخلي بيانات الكارت عمود واحد وترمي الباركود تحت الاسم — ده منطقي لكارت
   واقف في الكشف، لكن الكارت الطاير بكده بيبقى برج بيغطي الشاشة كلها وانت
   أصلاً فاتحه عشان تبص بصة. عمودين وصف واحد للاسم بيرجّعوه لنص الطول. */
@media (max-width: 620px) {
  .tile-card-layer .student-card-head { flex-direction: row; }
  .tile-card-layer .student-card-badges { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; }
  .tile-card-layer .student-card-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-card-layer .student-card-identity .student-name { font-size: 13.5px; }
  .tile-card-layer .student-card-qr-preview img { width: 46px; height: 46px; }
}

/* على اللمس مفيش مؤشر يقول إن الكارت بيتسحب، فالخط الصغير فوق بيقولها. */
@media (pointer: coarse) {
  .tile-card-layer::after {
    content: '';
    position: absolute;
    z-index: 1;
    top: 5px;
    inset-inline: 0;
    width: 34px;
    height: 4px;
    margin: 0 auto;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 45%, transparent);
    pointer-events: none;
  }
}

/* النظرة الخاطفة: بتظهر والصباع نازل وبتروح مع رفعه، فمالهاش أزرار ولا بتاكل
   دوسات — أي حاجة تتعمل عليها هتكون بالغلط. */
.tile-peek {
  z-index: 130;
  pointer-events: none;
  width: min(300px, calc(100vw - 24px));
  max-height: none;
  overflow: visible;
  padding: 12px 13px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: 0 20px 46px rgba(15, 23, 42, .28);
}
body.dark-mode .tile-peek { box-shadow: 0 20px 46px rgba(0, 0, 0, .6); }
.tile-peek-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tile-peek-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 900; }
/* الرقم هو بيت القصيد في النظرة، فبياخد أكبر خط والعنوان بيصغر تحته. */
.tile-peek-metric { flex: none; display: grid; justify-items: end; line-height: 1.15; }
.tile-peek-metric small { color: var(--muted); font-size: 10px; font-weight: 800; }
.tile-peek-metric b { font-size: 17px; font-weight: 900; }
.tile-peek-metric.tone-good b { color: var(--success); }
.tile-peek-metric.tone-mid b { color: var(--warning); }
.tile-peek-metric.tone-low b { color: var(--danger); }
.tile-peek-metric.tone-idle b { color: var(--muted); }
.tile-peek-hint { margin: 3px 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.tile-peek-chart { min-height: 76px; display: grid; align-content: center; }
.tile-peek-chart > svg { width: 100%; height: auto; }
.tile-peek-chart .peek-empty,
.tile-peek-chart .chart-empty { margin: 0; padding: 18px 4px; color: var(--muted); font-size: 11.5px; text-align: center; }
.tile-peek-foot { margin: 8px 0 0; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.tile-peek-foot svg { flex: none; width: 13px; height: 13px; }

@media (prefers-reduced-motion: reduce) {
  .student-tile { transition: none; }
  .student-tile:hover { transform: none; }
  .tile-layer { transition: opacity .1s linear; transform: none; }
}

.students-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 11px;
}

.student-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
}

.student-card:hover { transform: translateY(-2px); }
.student-card-excellence {
  border: 2px solid var(--gold);
  background: linear-gradient(145deg, var(--panel), var(--gold-soft));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--gold) 18%, transparent);
}

.student-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.student-card-identity { min-width: 0; }
.student-card-identity .student-name { white-space: normal; text-align: right; font-size: 14px; }
.student-card-badges { display: flex; align-items: flex-end; gap: 6px; flex-direction: column; flex: 0 0 auto; }
.excellence-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #6f4b00;
  background: #f7d76f;
  font-size: var(--fs-min);
  font-weight: 900;
  white-space: nowrap;
}
body.dark-mode .excellence-badge { color: #2d2100; }
.duplicate-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  font-size: var(--fs-min);
  font-weight: 900;
  white-space: nowrap;
}
/* الكارت نفسه بيتعلّم بخط جانبي بس — علامة كافية من غير ما تصرخ. */
.student-card-duplicate { border-inline-start: 3px solid var(--warning); }

.student-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}
.student-card-meta > div { min-width: 0; padding: 8px; border-radius: 10px; background: color-mix(in srgb, var(--panel-2) 78%, transparent); }
.student-card-meta > div > span:first-child { display: block; margin-bottom: 4px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.student-card-meta strong { display: block; font-size: max(var(--fs-min), 12.5px); overflow-wrap: anywhere; }
.student-card-meta small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-min); }
.student-card-meta .progress { display: block; width: 100%; margin: 7px 0 0; }
.student-fee-cell { position: relative; }
.inline-edit-fee { margin-top: 5px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); background: var(--panel); font-size: var(--fs-min); font-weight: 800; cursor: pointer; }
.inline-edit-fee:hover { color: #fff; background: var(--accent); }
.payment-filter-row .payment-unpaid { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.payment-filter-row .payment-unpaid.active { color: #fff; border-color: var(--danger); background: var(--danger); }
.payment-filter-row .payment-paid { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, var(--line)); }
.payment-filter-row .payment-paid.active { color: #fff; border-color: var(--success); background: var(--success); }
.payment-filter-row .payment-partial { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, var(--line)); }
.payment-filter-row .payment-partial.active { color: #fff; border-color: var(--warning); background: var(--warning); }
.payment-filter-row .payment-exempt { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 35%, var(--line)); }
.payment-filter-row .payment-exempt.active { color: #fff; border-color: var(--purple); background: var(--purple); }

/* فلتر الأسماء المكررة — نبرة تحذير هادية، مش خطر. */
.duplicate-filter-row { align-items: center; }
.duplicate-filter { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, var(--line)); }
.duplicate-filter.active { color: #fff; border-color: var(--warning); background: var(--warning); }
.filter-note { color: var(--muted); font-size: var(--fs-min); font-weight: 700; line-height: 1.7; }
.student-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); }
.excellence-toggle { color: var(--gold); font-size: 17px; }
.excellence-toggle.active { color: #6f4b00; background: #f7d76f; }
.excellence-toggle:disabled { opacity: .55; cursor: wait; }
.exemption-toggle { color: var(--purple); }
.exemption-toggle.active { color: #fff; background: var(--purple); }
.excellence-filter { color: var(--gold); }
.excellence-filter.active { color: #2d2100; background: #f7d76f; border-color: var(--gold); }

/* ------------------------------ ملف الطالب ------------------------------ */
.profile-head { display: flex; align-items: center; gap: 12px; }
.back-btn { flex: 0 0 auto; }
.profile-contacts { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.profile-contacts .icon { width: 15px; height: 15px; vertical-align: middle; margin-inline-end: 4px; }
.profile-contacts strong { color: var(--ink); }
.status-history { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--fs-min); color: var(--muted); }
.status-history strong { color: var(--ink); }
/* السبب بيلزق في الشارة اللي قبله عشان يبان إنه بتاعها هي، مش سطر سايب. */
.status-history .status-reason {
  display: inline-flex; align-items: center; gap: 5px;
  margin-inline-start: -3px; padding: 3px 9px;
  border-radius: 999px; background: var(--panel-2);
  color: var(--ink); font-weight: 700;
}
.status-history .status-reason .icon { width: 13px; height: 13px; color: var(--muted); }
/* الافتراضات: مصدر القرار جنب الحالة، وصندوق الاقتراح تحت السجل. */
.status-history .status-source { color: var(--muted); font-size: var(--fs-min); }
.status-history .status-lock-toggle { margin-inline-start: auto; }
.rule-chip { white-space: nowrap; }
.rule-proposal-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink); }
.rule-proposal-box p { margin: 0; flex: 1 1 16rem; min-width: 0; }
.rule-proposal-box small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-min); }
.rule-proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rule-warning-line { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: var(--fs-min); }
.rule-warning-line .icon { width: 13px; height: 13px; }
.status-audit-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.status-audit-filters .table-action[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
/* إعداد الافتراضات: كل قاعدة في مربع، والمربعات بتتصف جنب بعض على الشاشة
   الواسعة وتحت بعض على الموبايل. */
.rules-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 14px; }
.rules-block { display: grid; gap: 10px; align-content: start; min-width: 0; margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rules-block legend { padding-inline: 6px; color: var(--ink); font-weight: 700; }
.rules-block-wide, .rules-preview, .rules-actions { grid-column: 1 / -1; }
.rules-choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.rules-choices[hidden] { display: none; }
.rules-toggle { font-weight: 600; }
.rules-preview { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink); }
.rules-preview-title { font-size: var(--fs-min); }
.rules-impact { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rules-impact small { display: block; color: var(--muted); font-size: var(--fs-min); overflow-wrap: anywhere; }
.rules-conflict { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* شروط جروب التفوق والتنبيهات — نفس هيكل فورم الافتراضات. */
.excellence-rules-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 10px 14px; }
.excellence-criteria, .insight-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 10px; }
.excellence-criterion, .insight-rule { display: grid; gap: 8px; align-content: start; min-width: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); }
.excellence-rules-form [data-points-only][hidden] { display: none; }
.excellence-counter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; font-size: 15px; }
.excellence-counter .ghost-btn { min-height: var(--tap); }
.insight-rule-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rules-holidays { display: grid; gap: 8px; margin-bottom: 14px; }
.rules-holiday-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rules-holiday-row small { display: block; color: var(--muted); font-size: var(--fs-min); }
.field-hint { margin: -2px 0 0; color: var(--muted); font-size: var(--fs-min); line-height: 1.7; }
.session-list.mini { max-height: 320px; overflow-y: auto; }
.session-row.static { cursor: default; }

/* لوحة تحليل الحالة */
.insight-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-inline-start: 4px solid var(--line); }
.insight-panel.good { border-inline-start-color: var(--success); }
.insight-panel.mid { border-inline-start-color: var(--warning); }
.insight-panel.warning { border-inline-start-color: var(--warning); }
.insight-panel.danger { border-inline-start-color: var(--danger); }
.insight-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.insight-main p { color: var(--muted); font-size: 13.5px; font-weight: 600; margin: 0; }
.insight-label { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; }
.insight-label .icon { width: 16px; height: 16px; }
.goal-ring { display: flex; align-items: center; gap: 10px; }
.goal-text { display: flex; flex-direction: column; }
.goal-text strong { font-size: 14px; }
.goal-text small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }

/* الملاحظات ونقاط القوة والضعف */
.note-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.note-form select { flex: 0 0 auto; min-width: 130px; }
.note-form input { flex: 1 1 200px; }
.notes-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.note-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.note-body { flex: 1 1 auto; min-width: 0; }
.note-body p { margin: 0 0 4px; font-weight: 600; font-size: 13.5px; }
.note-body small { color: var(--muted); font-size: var(--fs-min); }
.session-row.static:hover { transform: none; }

.cell-money { font-weight: 800; white-space: nowrap; }
.cell-actions { white-space: nowrap; }

.progress {
  display: inline-block;
  width: 74px;
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  vertical-align: middle;
  margin-inline-end: 8px;
}

.progress span { display: block; height: 100%; border-radius: inherit; background: var(--cyan); transition: width 0.5s ease; }
.progress-num { color: var(--muted); font-weight: 700; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: var(--fs-min);
  font-weight: 800;
  white-space: nowrap;
}

.pill.good { background: var(--success-soft); color: var(--success); }
.pill.mid { background: var(--warning-soft); color: var(--warning); }
.pill.low { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: var(--panel-2); color: var(--muted); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.previous-grade { background: var(--accent-soft); color: var(--accent); }
.pill.exempt { background: color-mix(in srgb, var(--purple) 14%, transparent); color: var(--purple); }
.unit-tag { font-size: var(--fs-min); font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; margin-inline-start: 6px; }

.payment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--fs-min);
  font-weight: 800;
  transition: transform var(--speed);
}

.payment:hover { transform: scale(1.04); }
.payment .icon { width: 14px; height: 14px; }
.payment.paid { background: var(--success-soft); color: var(--success); }
.payment.partial { background: var(--accent-soft); color: var(--accent); }
.payment.unpaid { background: var(--warning-soft); color: var(--warning); }
.payment.exempt { background: color-mix(in srgb, var(--purple) 14%, transparent); color: var(--purple); }

.table-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-min);
  transition: all var(--speed);
}

.table-action:hover { color: var(--ink); background: var(--line); }
.table-action .icon { width: 15px; height: 15px; }
.table-action.danger:hover { background: var(--danger-soft); color: var(--danger); }
.table-action.approve { background: var(--success-soft); color: var(--success); }
.table-action.approve:hover { background: var(--success); color: #fff; }
/* «فك القفل» بيظهر جنب البادچ الأصفر اللي بيقول إن الحفظ مقفول، فبياخد لون
   التحذير نفسه: البادچ بيوصف الحالة والزرار بيحلّها، والاتنين قطعة واحدة. */
.table-action.unlock { background: var(--warning-soft); color: var(--warning); }
.table-action.unlock:hover { background: var(--warning); color: #fff; }
.table-action.wa { background: var(--success-soft); color: #128C7E; }
.table-action.wa:hover { background: #25D366; color: #fff; }
.table-action.wa.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.whatsapp-bulk-btn { background: #128c7e; box-shadow: 0 8px 18px rgba(18, 140, 126, .2); }
.whatsapp-bulk-btn:hover { background: #0f766e; }
.grade-wa { flex: 0 0 auto; }

/* ------------------------------ المراحل ------------------------------ */

/* اختيار المرحلة: قائمة منسدلة. الكروت القديمة كانت بتعرض خمس بيانات لكل مرحلة
   — العدد وشهر الخطة والأساسي والخصم والصافي — وكلها متكررة تحت في لوحة تفاصيل
   المرحلة المختارة، فعلى الموبايل كنت بتمرّر على ست كروت طول كل واحد ١٧٠ بكسل
   قبل ما توصل للي اخترته. القائمة بتاخد سطر واحد، والتفاصيل كلها بتظهر تحتها
   بناءً على الاختيار. */
.stage-picker {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.stage-picker-field { flex: 1 1 260px; min-width: 0; margin: 0; }
.stage-picker-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-picker-actions .ghost-btn { min-height: 42px; }
.stage-remove-btn { color: var(--danger); }
.stage-remove-btn:hover { background: var(--danger-soft); border-color: var(--danger); }

.stage-finance-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  margin-bottom: 16px;
}

.stage-finance-form .field { min-width: 160px; flex: 1; }

/* كارت تفاصيل المرحلة: رأس (عنوان + شهر + زرارين)، شريط الاشتراك، ومجموعتين
   أرقام. كل صف بعدد أعمدة ثابت عشان مفيش رقم يقعد لوحده في سطر. */
.stage-details-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-details-title { min-width: 0; }
.stage-details-title h2 { font-size: 17px; font-weight: 900; text-wrap: balance; }
.stage-details-title p { margin-top: 3px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }
.stage-details-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.stage-details-actions { display: flex; gap: 8px; }
.stage-details-actions > button { min-height: 42px; white-space: nowrap; }

.stage-fee-strip { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.stage-fee-values { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.stage-fee-values > div { min-width: 0; padding-inline: 12px; border-inline-start: 1px solid var(--line); }
.stage-fee-values > div:first-child { padding-inline-start: 0; border-inline-start: 0; }
.stage-fee-values dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.stage-fee-values dd { margin: 2px 0 0; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stage-fee-values .is-net dd { color: var(--accent); }
.stage-fee-edit { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-size: max(var(--fs-min), 12.5px); font-weight: 800; white-space: nowrap; }
.stage-fee-edit:hover { border-color: var(--accent); color: var(--accent); }

.stage-kpis { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; margin-bottom: 16px; }
.stage-kpi-group { min-width: 0; display: grid; align-content: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.stage-kpi-group h3 { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.stage-kpi-group h3 .icon { width: 16px; height: 16px; }
.stage-kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stage-kpi { min-width: 0; display: grid; align-content: start; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.stage-kpi span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; line-height: 1.35; }
.stage-kpi strong { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stage-kpi strong small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.stage-kpi > small { color: var(--purple); font-size: var(--fs-min); font-weight: 800; line-height: 1.35; }
.stage-kpi.is-alert strong { color: var(--danger); }
.stage-collect { display: grid; gap: 7px; }
.stage-collect-figures { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stage-collect-figures strong { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stage-collect-figures span { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.stage-collect-figures em { margin-inline-start: auto; color: var(--success); font-style: normal; font-weight: 900; font-variant-numeric: tabular-nums; }
.stage-collect-bar { height: 8px; overflow: hidden; border-radius: 99px; background: var(--panel-2); }
.stage-collect-bar i { display: block; height: 100%; border-radius: inherit; background: var(--success); }

/* ملخص الفلتر جزء من قرار البحث، مش كارت KPI ثالث دائم. خلفيته الخفيفة
   والعناوين الصغيرة يفرقوه عن ملخص المرحلة من غير ما يزاحموه بصريًا. */
.stage-filter-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent-soft) 44%, var(--panel));
}
.stage-filter-summary-head { flex: 0 1 210px; min-width: 150px; display: grid; gap: 2px; }
.stage-filter-summary-head span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: max(var(--fs-min), 12.5px); font-weight: 900; }
.stage-filter-summary-head .icon { width: 16px; height: 16px; color: var(--accent); }
.stage-filter-summary-head small { color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.stage-filter-summary-values { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.stage-filter-summary-values > div { min-width: 0; padding-inline: 12px; border-inline-start: 1px solid var(--line); }
.stage-filter-summary-values dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.stage-filter-summary-values dd { margin-top: 2px; color: var(--ink); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stage-filter-summary-values .is-collected dd { color: var(--success); }
.stage-filter-summary-values .is-due dd { color: var(--danger); }

@media (max-width: 1150px) { .stage-kpis { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) {
  .stage-details-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .stage-details-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stage-details-tools .month-picker, .stage-details-tools .month-picker select { width: 100%; min-width: 0; }
  .stage-details-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .stage-details-actions > button { justify-content: center; padding-inline: 8px; }
  .stage-fee-strip { flex-direction: column; align-items: stretch; padding: 12px; }
  .stage-fee-values > div { padding-inline: 8px; }
  .stage-fee-values dd { font-size: 15px; }
  .stage-fee-edit { justify-content: center; }
  .stage-kpi-group { padding: 10px; }
  .stage-kpi { padding: 9px 10px; }
  .stage-kpi strong { font-size: 15px; }
  .stage-filter-summary { align-items: stretch; flex-direction: column; gap: 9px; }
  .stage-filter-summary-head { flex-basis: auto; min-width: 0; }
  .stage-filter-summary-values { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 9px; }
  .stage-filter-summary-values > div:nth-child(odd) { border-inline-start: 0; }
}
/* الفلوس أطول من أعداد الطلاب: المتبقي بياخد السطر كله والاتنين التانيين جنب بعض. */
@media (max-width: 430px) {
  .is-money .stage-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-money .stage-kpi-row > .stage-kpi:first-child { grid-column: 1 / -1; }
}

/* نص الإعفاء داخل جداول اشتراك الطالب */
td .exempt { color: var(--purple); font-weight: 800; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: 42px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  flex: 1;
  min-width: 220px;
  transition: border-color var(--speed);
}

.searchbox:focus-within { border-color: var(--accent); }
.searchbox input { flex: 1; border: 0; outline: 0; background: none; color: var(--ink); font-weight: 600; }

/* ------------------------------ الحضور ------------------------------ */

.split-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
/* عنصر الـ grid افتراضيًا min-width:auto فبيرفض يصغّر تحت مقاس محتواه، واللوحة
   كانت بتخرج بره العمود بدل ما تتقلّص. */
.split-layout > *, .dashboard-main > * { min-width: 0; }

.att-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.att-controls .field { min-width: 170px; }
.session-pill { align-self: center; }
.lesson-controls { display: grid; gap: 10px; margin-bottom: 16px; }

/* --- جدول الحصص --- */
.attendance-smart-start {
  display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%;
  margin-bottom: 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 13px; background: color-mix(in srgb, var(--accent-soft) 42%, var(--panel));
}
.attendance-smart-start-icon { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--action-ink); }
.attendance-smart-start-icon .icon { width: 16px; height: 16px; }
.attendance-smart-start > span:nth-child(2) { min-width: 0; display: grid; gap: 1px; }
.attendance-smart-start small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.attendance-smart-start strong { color: var(--ink); font-size: max(var(--fs-min), 13px); font-weight: 900; text-wrap: balance; }
.attendance-smart-start > b { margin-inline-start: auto; color: var(--accent); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; direction: ltr; }
.today-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.today-schedule-label { display: inline-flex; align-items: center; gap: 6px; font-size: max(var(--fs-min), 12.5px); font-weight: 800; color: var(--muted); }
.today-schedule-label .icon { width: 15px; height: 15px; }
.schedule-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; transition: all var(--speed);
}
.schedule-chip strong { font-size: max(var(--fs-min), 12.5px); }
.schedule-chip small { font-size: var(--fs-min); color: var(--muted); font-weight: 700; }
.schedule-chip.pending { border-color: var(--warning); }
.schedule-chip.done { border-color: var(--success); }
.schedule-chip.active { background: var(--accent-soft); border-color: var(--accent); }
.schedule-chip:hover { transform: translateY(-2px); }

.schedule-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.schedule-form .field { min-width: 150px; }
.schedule-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.schedule-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.schedule-row strong { font-size: 13px; display: block; }
.schedule-row small { color: var(--muted); font-weight: 600; font-size: var(--fs-min); }

/* عمود grid افتراضيًا بيتمدّد لأعرض محتوى جوّاه (max-content)، فأي زرار زيادة
   في صف التسميع كان بيوسّع الكشف كله ويخرّجه برّه الشاشة على الموبايل.
   minmax(0,1fr) بيقفل ده: العرض بيتحدد من اللوحة والمحتوى بيلف جوّاه. */
.att-roster { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid transparent;
  transition: border-color var(--speed);
}

.att-row.alert { border-color: var(--danger); background: var(--danger-soft); }

/* اسم الطالب في كشف الحضور بيتعلّق فيه شارات (باركود موثّق، غياب تلقائي، لم
   يُختبر المستوى — تلقائي)، و.student-name أصلها white-space: nowrap عشان
   أعمدة الجداول. يعني السطر بيفضل سطر واحد مهما طال، وعلى الموبايل بيخرج برّه
   الشاشة — وفي RTL بيخرج من ناحية الشمال، فالمدرس ما بيقدرش يقرا الشارة ولا
   يوصلها بالسحب. هنا بس بنخلّي السطر يلف والشارات تنزل تحت الاسم. */
.att-row .student-cell > div { min-width: 0; flex: 1 1 auto; }
.att-row .student-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.att-row .student-phone { overflow-wrap: anywhere; }
.warn-text { color: var(--danger); }

.att-toggle { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.att-status {
  display: flex; gap: 5px; align-items: center;
  background: var(--panel); padding: 4px; border-radius: 999px; border: 1px solid var(--line);
}

/* خمس درجات مباشرة في صف واحد: المسار اليومي يبقى ضغطة واحدة، مع عنوان صغير
   يوضح إن الشريط للتسميع وحالة نصية لا تعتمد على اللون وحده. */
.att-recitation { flex: 1 1 420px; min-width: min(100%, 360px); display: grid; gap: 6px; align-content: start; }
.recitation-head { display: flex; align-items: center; padding-inline: 3px; }
.recitation-head span { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.rec-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.att-btn {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 800;
  color: var(--muted);
  transition: all var(--speed);
}

.att-btn.active.present { background: var(--success); color: #fff; }
.att-btn.active.late { background: var(--warning); color: #fff; }
.att-btn.active.absent { background: var(--danger); color: #fff; }

.rec-btn {
  width: 100%; min-width: 0; min-height: 38px; padding: 5px 3px;
  border-radius: 10px;
  font-size: max(10px, calc(var(--fs-min) - 1px));
  font-weight: 800;
  color: var(--muted);
  line-height: 1.25;
  transition: all var(--speed);
}
.rec-btn:hover { background: var(--panel-2); color: var(--ink); }
.rec-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent); outline-offset: 1px; }
.rec-btn.active.excellent { background: var(--success); color: #fff; }
.rec-btn.active.good { background: var(--accent); color: #fff; }
.rec-btn.active.average { background: var(--warning); color: #fff; }
.rec-btn.active.weak { background: var(--danger); color: #fff; }

.att-roster.is-cancelled { opacity: 0.55; }
.session-row.cancelled { opacity: 0.7; }
.session-row.cancelled strong { text-decoration: line-through; }

.att-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.att-bulk-actions { flex: 1 1 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.att-bulk-actions .ghost-btn { width: 100%; justify-content: center; white-space: nowrap; }
.att-all-present { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); color: var(--success); background: var(--success-soft); }
.att-all-present:hover { border-color: var(--success); background: color-mix(in srgb, var(--success-soft) 68%, var(--panel)); }
.att-all-excellent { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); color: var(--accent); background: var(--accent-soft); }
.att-all-excellent:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 68%, var(--panel)); }
.ghost-btn.danger-ghost { color: var(--danger); border-color: var(--danger); }
.ghost-btn.danger-ghost:hover { border-color: var(--danger); background: var(--danger-soft); }

/* --- تحسين شاشة الحضور على الموبايل: تكديس الصف وتوزيع الأزرار للمس مريح --- */
@media (max-width: 620px) {
  .att-controls .field { flex: 1 1 100%; min-width: 0; }
  .attendance-smart-start { width: 100%; }
  .att-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .att-toggle { width: 100%; justify-content: flex-start; gap: 8px; }
  .att-status {
    flex: 1 1 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    border-radius: 14px;
    padding: 6px;
  }
  .att-recitation { flex: 1 1 100%; min-width: 0; }
  .att-status .att-btn { flex: 1 1 0; text-align: center; padding-inline: 6px; min-height: 40px; }
  .rec-options .rec-btn { text-align: center; min-height: 42px; }
  .att-actions .submit-btn,
  .att-actions .ghost-btn { flex: 1 1 100%; }
  .att-bulk-actions { flex: 1 1 100%; gap: 8px; }
  .att-bulk-actions .ghost-btn { min-width: 0; padding-inline: 8px; font-size: max(11px, var(--fs-min)); }
  /* الصف بيبقى عمودي هنا، وفي الوضع العمودي flex-basis بيتقاس على الارتفاع مش
     العرض. يعني `flex: 1 1 100%` على خانة سبب الغياب كانت بتطلب ارتفاع الصف كله،
     فالـ wrap بيفتح عمود تاني ويرمي الخانة برّه الصف — وفي RTL العمود ده بيروح
     شمال الشاشة، يعني المدرس ما بيشوفش الخانة اللي بيكتب فيها أصلاً.
     الصف العمودي مالوش أي معنى إنه يلف، والخانة بتاخد عرضها من الامتداد. */
  .att-row { flex-wrap: nowrap; min-width: 0; }
  .att-reason,
  .att-untested-reason { flex: 0 0 auto; width: 100%; min-width: 0; }
}

/* ------------------------------ الاشتراكات والمواعيد ------------------------------ */
.subs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.subs-card { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.subs-card-body { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; }
.subs-card-toggle { width: 100%; border: 0; background: transparent; color: inherit; padding: 14px; text-align: start; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subs-card-toggle:hover { background: var(--accent-soft); }
.subs-card-chevron { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 900; flex: 0 0 auto; }
.subs-card.is-open { grid-column: 1 / -1; max-width: 980px; width: 100%; justify-self: center; }
.group-inline-form { display: flex; align-items: center; gap: 6px; }
.group-inline-form input { width: min(180px, 38vw); border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); border-radius: 9px; padding: 7px 9px; }
.payment-history-row td { background: var(--panel-2); padding-block: 8px; }
.payment-entry-list { display: flex; flex-wrap: wrap; gap: 8px; }
.payment-entry { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 7px 9px; font-size: var(--fs-min); }
.payment-entry span, .payment-entry small { color: var(--muted); }
.subs-card-head h3 { font-size: 16px; font-weight: 900; }
.subs-card-head small { color: var(--muted); font-weight: 700; font-size: var(--fs-min); }
.subs-section { display: flex; flex-direction: column; gap: 10px; }
.subs-section-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: max(var(--fs-min), 12.5px); color: var(--muted); }
.subs-plan-form, .subs-schedule-form, .subs-month-discount-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.subs-plan-form .field, .subs-schedule-form .field, .subs-month-discount-form .field { min-width: 120px; flex: 1; }
.subs-discount-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.subscriptions-toolbar { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.monthly-system-summary table { min-width: 980px; }
.monthly-system-summary td { vertical-align: middle; }

/* جدول تفاصيل المجموعات — مظهر احترافي */
.monthly-system-summary thead th {
  font-size: var(--fs-min);
  letter-spacing: 0.3px;
  text-transform: none;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
}
.monthly-system-summary tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
.monthly-system-summary tbody tr:hover { background: var(--accent-soft); }
.monthly-system-summary tbody td { padding: 13px 14px; }
.monthly-system-summary .col-stage strong { color: var(--ink); font-weight: 800; }
.monthly-system-summary .col-group { font-weight: 600; }

/* أعمدة الأرقام: محاذاة وأرقام متساوية العرض */
.monthly-system-summary .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
  font-weight: 600;
}
.monthly-system-summary .num.strong { font-weight: 800; color: var(--ink); }
.monthly-system-summary .num.pos { color: var(--success); font-weight: 800; }
.monthly-system-summary .num.neg { color: var(--danger); font-weight: 800; }
.monthly-system-summary .num.zero { color: var(--muted); }

/* شارات */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: max(var(--fs-min), 12.5px);
}
.tag-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: var(--fs-min); font-weight: 700; white-space: nowrap;
}
.tag-pill.discount-pill { background: var(--warning-soft); color: var(--warning); }
.tag-pill.muted-pill { background: var(--panel-2); color: var(--muted); }

/* صف الإجمالي */
.monthly-system-summary tfoot .totals-row td {
  border-top: 2px solid var(--line);
  background: var(--panel-2);
  font-weight: 800;
  color: var(--ink);
}
.monthly-system-summary tfoot .totals-row:hover td { background: var(--panel-2); }

/* مجموعة العام الدراسي: زر الاختيار + زر الإخفاء */
.year-chip-group { display: inline-flex; align-items: center; gap: 2px; }
.year-chip-group .year-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; color: var(--muted);
  border: 1px solid var(--line); transition: all var(--speed);
}
.year-chip-group .year-remove:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.year-chip-group .year-remove .icon { width: 13px; height: 13px; }
.period-chip.add-year { border-style: dashed; color: var(--accent); border-color: var(--accent); }
.period-chip.add-year:hover { background: var(--accent-soft); }
.table-action.active-discount { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.subs-hint { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.subs-plan-readonly { display: flex; gap: 20px; }
.subs-plan-readonly div { display: flex; flex-direction: column; gap: 2px; }
.subs-plan-readonly span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.subs-plan-readonly strong { font-size: 15px; font-weight: 900; }

/* مساحة التشغيل الجديدة للاشتراكات والمواعيد */
.subscriptions-workspace { gap: 16px; }

/* زرارين التحصيل: نفس الجسم ونفس المقاس ونفس خانة الأيقونة، والفرق في اللون بس.
   الباركود مليان بلون الأزرار الأساسي (زي «المجموعات» وهو شغّال)، والأسعار
   هادي على خلفية الكارت — فالعين تعرف الأساسي من غير ما التاني يبان ناشز. */
.toolbar-actions .subs-action {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 42px; padding: 5px 6px; padding-inline-end: 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-radius: 13px;
  color: var(--ink); background: var(--panel-2);
  font-weight: 800; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 35, 95, 0.06);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.subs-action-icon {
  --icon-tint: var(--accent);
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft);
}
.subs-action-icon .icon { width: 16px; height: 16px; }
.toolbar-actions .subs-action.is-primary {
  border-color: transparent; color: var(--action-ink);
  background: linear-gradient(var(--theme-gradient-angle, 135deg), var(--action-bg), var(--action-bg-end));
  box-shadow: 0 8px 20px -10px var(--action-bg);
}
.subs-action.is-primary .subs-action-icon { --icon-tint: currentColor; background: rgba(255, 255, 255, 0.18); }
.toolbar-actions .subs-action:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 10px 22px -14px rgba(15, 35, 95, 0.45); }
.toolbar-actions .subs-action.is-primary:hover { border-color: transparent; box-shadow: 0 12px 24px -10px var(--action-bg); }
.toolbar-actions .subs-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .toolbar-actions .subs-action, .toolbar-actions .subs-action:hover { transition: none; transform: none; } }
.subs-section-view { display: grid; gap: 16px; min-width: 0; }

.subscriptions-control-toolbar {
  /* جزء طبيعي من الصفحة: ما يفضلش معلّق فوق الكروت أثناء التمرير. */
  position: static;
  /* المسافة بين المجموعات (14px) أكبر من اللي جوه المجموعة الواحدة (8px)،
     فالعين تفصل «العام» عن «الشهر» عن الأزرار من غير ما الشريط يزحم. */
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  padding: 12px 16px; border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow: var(--shadow);
}
.subscriptions-control-toolbar .period-group { gap: 8px; }
.subscriptions-control-toolbar .period-label { min-width: 0; }
/* فاصل رفيع بدل مسافة واسعة — بيفصل المناطق وبياخد مكان أقل. */
.toolbar-divider { width: 1px; align-self: stretch; min-height: 26px; background: var(--line); }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }

/* زرار أيقونة فقط للإجراءات النادرة — بيوفّر عرض السطر من غير ما يخفي وظيفة. */
.toolbar-icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); background: var(--panel);
  cursor: pointer; transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.toolbar-icon-btn:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.toolbar-icon-btn .icon { width: 15px; height: 15px; }
/* auto-fit مش رقم ثابت: كارت «مبالغ الإعفاء» خلاهم ٦، والعدد ممكن يزيد تاني. */
.subs-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; }
.subs-summary-card { min-width: 0; display: flex; align-items: flex-start; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: var(--shadow); }
.subs-summary-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.subs-summary-card.success .subs-summary-icon { color: var(--success); background: var(--success-soft); }
.subs-summary-card.danger .subs-summary-icon { color: var(--danger); background: var(--danger-soft); }
.subs-summary-card.warning .subs-summary-icon { color: var(--warning); background: var(--warning-soft); }
.subs-summary-card.exempt .subs-summary-icon { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent); }
.subs-summary-card > div { min-width: 0; }
.subs-summary-card small, .subs-summary-card p { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.subs-summary-card strong { display: block; margin-block: 2px; overflow: hidden; font-size: 17px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
/* السطر التوضيحي بيلف على سطرين بدل ما يتقص عند حافة الكارت — «بعد استبعاد
   ٢٠٠ ج.م. إعفاءات» كان بيخرج بره الكارت وهو مقصوص. */
.subs-summary-card p { margin: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.55; }

.subs-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.subs-filters > label { display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.subs-filters select, .subs-search { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.subs-filters select { min-width: 160px; padding-inline: 11px; }
.subs-search { flex: 1 1 300px; display: flex !important; grid-template-columns: none !important; align-items: center; gap: 7px !important; padding-inline: 12px; }
.subs-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; }
.subs-search .icon { width: 16px; }
.subs-groups-table-panel { padding: 0; overflow: hidden; }
.subs-operations-table { min-width: 1180px; }
.subs-operations-table th { padding-block: 11px; font-size: var(--fs-min); white-space: nowrap; }
.subs-operations-table td { vertical-align: middle; padding-block: 12px; }
.subs-operations-table td > strong, .subs-operations-table td > small { display: block; }
.subs-operations-table td > small { margin-top: 3px; color: var(--muted); font-size: var(--fs-min); }
.subs-group-row { cursor: default; }
.subs-group-row.is-open td { background: var(--accent-soft); border-bottom-color: transparent; }
.subs-group-row .table-action .icon { transition: transform var(--speed); }
.subs-group-row.is-open .table-action .icon { transform: rotate(180deg); }
.subs-times { max-width: 190px; color: var(--muted); font-size: var(--fs-min); }
.collection-status { display: inline-flex; align-items: center; width: fit-content; padding: 3px 8px; border-radius: 999px; font-size: var(--fs-min); font-weight: 900; white-space: nowrap; }
.collection-status.paid { color: var(--success); background: var(--success-soft); }
.collection-status.partial { color: var(--warning); background: var(--warning-soft); }
.collection-status.unpaid { color: var(--danger); background: var(--danger-soft); }
.collection-status.neutral { color: var(--muted); background: var(--panel-2); }
.collection-status.exempt { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent); }
.collection-progress { width: 86px; height: 7px; overflow: hidden; border-radius: 999px; background: var(--panel-2); }
.collection-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--success)); }
.subs-expanded-row > td { padding: 0 !important; background: color-mix(in srgb, var(--accent-soft) 48%, var(--panel)); }
.subs-students-panel { padding: 15px 18px 18px; }
.subs-students-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.subs-students-head strong, .subs-students-head small { display: block; }
.subs-students-head small { color: var(--muted); }
.subs-student-list { display: grid; gap: 7px; }
.subs-student-row { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(90px, .65fr)) minmax(120px, auto); align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.subs-student-row > div:not(.subs-student-name) span, .subs-student-name small { display: block; color: var(--muted); font-size: var(--fs-min); }
.subs-student-row strong { font-size: max(var(--fs-min), 12.5px); }
.subs-student-row .pos { color: var(--success); }
.subs-student-row .neg { color: var(--danger); }
.subs-student-row .exempt { color: var(--purple); }
.subs-student-row.is-exempt { border-color: color-mix(in srgb, var(--purple) 40%, var(--line)); background: color-mix(in srgb, var(--purple) 6%, var(--panel)); }
.subs-row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.subs-table-slim .exempt-note { color: var(--purple); font-weight: 800; }

.subs-drawer-backdrop {
  position: fixed; z-index: 1500; inset: 0; display: flex; justify-content: flex-start; padding: 16px;
  background: rgba(8, 18, 36, .58); backdrop-filter: blur(7px) saturate(.85);
}
.subs-drawer {
  width: min(650px, calc(100vw - 32px)); height: calc(100dvh - 32px); overflow: hidden;
  display: flex; flex-direction: column; border: 1px solid rgba(255,255,255,.16); border-radius: 26px;
  background: var(--panel); box-shadow: 0 34px 90px -30px rgba(3, 13, 29, .82), 0 12px 28px -18px rgba(3, 13, 29, .46);
}
.subs-drawer.compact { width: min(470px, calc(100vw - 32px)); }
.subs-drawer.is-entering { animation: drawer-in .28s cubic-bezier(.2,.82,.2,1) both; }
@keyframes drawer-in { from { transform: translateX(-34px) scale(.985); opacity: .45; } }
.pricing-dialog-backdrop { align-items: center; justify-content: center; }
.pricing-dialog { width: min(720px, calc(100vw - 32px)); height: auto; max-height: calc(100dvh - 32px); }
.pricing-dialog.is-entering { animation-name: dialog-in; }
@keyframes dialog-in { from { transform: translateY(18px) scale(.975); opacity: .45; } }
.subs-drawer > header {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px 16px;
  padding: 22px 22px 17px; overflow: hidden; color: #fff; border-bottom: 0;
  background:
    radial-gradient(circle at 12% 28%, rgba(255,255,255,.12) 0 3px, transparent 4px),
    linear-gradient(125deg, color-mix(in srgb, var(--ink) 90%, var(--accent)), color-mix(in srgb, var(--accent) 82%, #12325b));
}
.subs-drawer > header::after {
  content: ''; position: absolute; width: 190px; height: 190px; inset-inline-start: -82px; top: -104px;
  border: 30px solid rgba(255,255,255,.055); border-radius: 50%; pointer-events: none;
}
.subs-drawer-title-row { display: flex; align-items: center; gap: 13px; min-width: 0; }
.subs-drawer-mark {
  display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.2);
  border-radius: 15px; background: rgba(255,255,255,.11); box-shadow: inset 0 1px 0 rgba(255,255,255,.16); backdrop-filter: blur(8px);
}
.subs-drawer-mark .icon { width: 22px; height: 22px; }
.subs-drawer > header small { color: rgba(255,255,255,.68); font-size: var(--fs-min); font-weight: 800; }
.subs-drawer > header h2 { margin: 2px 0; color: #fff; font-size: 20px; font-weight: 900; }
.subs-drawer > header p { color: rgba(255,255,255,.76); font-size: var(--fs-min); font-weight: 650; }
.subs-drawer-close {
  position: relative; z-index: 2; align-self: start; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px; background: rgba(255,255,255,.1); color: #fff;
}
.subs-drawer-close:hover { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.2); color: #fff; }
.subs-drawer-assurance { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; padding-inline-start: 61px; }
.subs-drawer-assurance span {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.82); font-size: var(--fs-min); font-weight: 750;
}
.subs-drawer-assurance .icon { width: 13px; height: 13px; color: #7ce7c9; }
.subs-drawer-body {
  flex: 1; min-height: 0; overflow: auto; display: grid; align-content: start; gap: 12px; padding: 18px 20px 28px;
  background: color-mix(in srgb, var(--panel-2) 42%, var(--panel)); scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  scrollbar-gutter: stable;
}
.pricing-stage-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 14px 34px -32px rgba(7, 28, 52, .75); }
.pricing-stage-head strong, .pricing-stage-head small { display: block; }
.pricing-stage-head { padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.pricing-stage-head strong { font-size: 14px; font-weight: 900; }
.pricing-stage-head small { margin-top: 2px; color: var(--success); font-weight: 750; }
.pricing-stage-card form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.pricing-stage-card form button { grid-column: 1 / -1; justify-self: start; }
.pricing-stage-card .month-discount-inline { padding-top: 10px; border-top: 1px dashed var(--line); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.subs-drawer-empty { min-height: 100%; display: grid; place-items: center; align-content: center; gap: 9px; padding: 42px 24px; text-align: center; }
.subs-drawer-empty > .icon { width: 46px; height: 46px; padding: 11px; border-radius: 15px; color: var(--accent); background: var(--accent-soft); }
.subs-drawer-empty h3 { margin: 3px 0 0; font-size: 18px; font-weight: 900; }
.subs-drawer-empty p { max-width: 38ch; margin: 0; color: var(--muted); font-size: 13px; font-weight: 650; line-height: 1.8; }
.subs-drawer-empty .submit-btn { margin-top: 6px; }
.table-action:disabled, button:disabled { cursor: not-allowed; opacity: .45; }

/* ------------------ مساحة المجموعات: بطاقات + لوحة تحكم ------------------ */

.view-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.view-switch button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 9px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; transition: background var(--speed), color var(--speed); }
.view-switch button.active { color: #fff; background: var(--accent); }
.view-switch .icon { width: 14px; height: 14px; }

.groups-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.groups-toolbar .subs-search { flex: 1 1 260px; }
.groups-toolbar label:not(.subs-search) { display: grid; gap: 4px; }
.groups-toolbar label span { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.groups-toolbar select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }

.group-create-panel { display: grid; gap: 12px; border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.group-create-form { display: grid; grid-template-columns: 170px minmax(200px, 1fr) 160px; gap: 10px; align-items: end; }
.group-create-form button { grid-column: 1 / -1; justify-self: start; }

.orphan-panel { display: grid; gap: 10px; border-color: color-mix(in srgb, var(--warning, var(--accent)) 34%, var(--line)); }
.orphan-stage-row { display: flex; flex-wrap: wrap; gap: 8px; }
.orphan-stage-chip { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-size: var(--fs-min); font-weight: 800; transition: border-color var(--speed), transform var(--speed); }
.orphan-stage-chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.orphan-stage-chip strong { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: var(--fs-min); }
.orphan-hint { color: var(--muted); font-size: var(--fs-min); }

.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.group-card { display: grid; align-content: start; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: var(--shadow); transition: transform var(--speed), border-color var(--speed); }
.group-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.group-card.is-over { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.group-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.group-card-head strong { display: block; font-size: 14px; }
.group-card-head small { display: block; color: var(--muted); font-size: var(--fs-min); }
.group-count { display: flex; align-items: baseline; gap: 1px; padding: 5px 10px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-size: 15px; font-weight: 900; }
.group-count em { font-size: var(--fs-min); font-style: normal; opacity: .75; }
.group-count.over { color: var(--danger); background: var(--danger-soft); }
.group-capacity-bar { height: 5px; overflow: hidden; border-radius: 99px; background: var(--panel-2); }
.group-capacity-bar > span { height: 100%; display: block; border-radius: 99px; background: var(--accent); }
.group-card.is-over .group-capacity-bar > span { background: var(--danger); }
.group-card-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.group-chip { padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: var(--fs-min); font-weight: 800; direction: rtl; }
.group-chip.muted { color: var(--muted); font-weight: 600; }
.group-chip.conflict { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); }
.group-card-note { color: var(--muted); font-size: var(--fs-min); }
.group-card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.group-card-actions .primary-mini, .group-card-actions .ghost-btn { flex: 1 1 auto; justify-content: center; font-size: var(--fs-min); }

.subs-drawer.group-panel { width: min(860px, 96vw); }
/* رأس لوحة المجموعة كان بياخد ارتفاع كبير فيدفع القوايم تحت الطية. */
.subs-drawer.group-panel > header { padding: 17px 20px 14px; }
.subs-drawer.group-panel > header h2 { font-size: 18px; }
.group-panel-tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--line); }
.subs-drawer.group-panel .group-panel-tabs { padding-top: 5px; }
.subs-drawer.group-panel .group-panel-tabs button { padding-block: 8px; }
.group-panel-tabs button { display: inline-flex; align-items: center; gap: 5px; padding: 10px 15px; border-bottom: 2px solid transparent; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.group-panel-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.group-panel-tabs .icon { width: 14px; height: 14px; }

.group-info-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); }
.group-info-form .wide { grid-column: 1 / -1; }
.group-info-form button { grid-column: 1 / -1; justify-self: start; }
.group-info-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.group-info-facts article { padding: 13px; border: 1px solid var(--line); border-radius: 14px; }
.group-info-facts small { display: block; color: var(--muted); font-size: var(--fs-min); }
.group-info-facts strong { display: block; margin: 2px 0 4px; font-size: 19px; }
.group-info-facts p { color: var(--muted); font-size: var(--fs-min); }

.panel-slot-list { display: grid; gap: 7px; }
.panel-slot-row { display: grid; grid-template-columns: minmax(92px, .75fr) minmax(92px, .75fr) minmax(105px, .8fr) minmax(135px, 1.2fr) auto auto; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.panel-slot-row select, .panel-slot-row input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.panel-schedule-empty {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: 13px;
  background: var(--accent-soft);
}
.panel-schedule-empty > .icon { width: 22px; height: 22px; flex: 0 0 auto; color: var(--accent); }
.panel-schedule-empty strong, .panel-schedule-empty span { display: block; }
.panel-schedule-empty strong { font-size: 13px; }
.panel-schedule-empty span { margin-top: 2px; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.panel-add-slots { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.panel-add-slots-head strong, .panel-add-slots-head span { display: block; }
.panel-add-slots-head strong { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.panel-add-slots-head strong .icon { width: 16px; height: 16px; color: var(--accent); }
.panel-add-slots-head span { margin-top: 3px; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.schedule-day-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.schedule-preset {
  min-height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800;
}
.schedule-preset:hover, .schedule-preset[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.schedule-preset.clear { margin-inline-start: auto; }
.panel-add-slots-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.panel-add-slots-actions small { color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.panel-add-slots-actions button { flex: 0 0 auto; }

.roster-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.roster-current, .roster-picker { display: grid; align-content: start; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); }
.roster-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.roster-head strong { display: block; font-size: max(var(--fs-min), 12.5px); }
.roster-head small { display: block; color: var(--muted); font-size: var(--fs-min); }
.roster-source-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.roster-source-tabs button { padding: 5px 9px; border-radius: 7px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.roster-source-tabs button.active { color: #fff; background: var(--accent); }
.roster-list { max-height: 330px; display: grid; align-content: start; gap: 6px; overflow-y: auto; }
.roster-row { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.roster-row > div { flex: 1; min-width: 0; }
.roster-row strong { display: block; overflow: hidden; font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
.roster-row small { display: block; color: var(--muted); font-size: var(--fs-min); }
.roster-row.pickable { cursor: pointer; transition: border-color var(--speed), background var(--speed); }
.roster-row.pickable:hover { border-color: var(--accent); }
.roster-row.picked { border-color: var(--accent); background: var(--accent-soft); }
.roster-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.roster-move select { max-width: 130px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); font-size: var(--fs-min); }
.roster-picker-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.roster-picker-tools .ghost-btn { padding: 6px 11px; font-size: var(--fs-min); }
.roster-apply-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 11px; border: 1px solid var(--accent); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); font-size: var(--fs-min); font-weight: 800; }

/* على الشاشات الواسعة تبويب الطلاب بيملأ ارتفاع اللوحة، والتمرير بيبقى جوه القوايم نفسها.
   قبل كده القوايم كانت مقفولة على 330px والباقي بيتمرّر باللوحة كلها، فتنزل تحت الطية
   ويضطر المستخدم يمرّر مرتين عشان يختار طالب أو ينقله. */
@media (min-width: 1151px) {
  .group-panel .subs-drawer-body:has(> .roster-layout) { align-content: stretch; padding-bottom: 16px; }
  .group-panel .subs-drawer-body > .roster-layout { min-height: 0; align-items: stretch; }
  .group-panel .roster-current, .group-panel .roster-picker { min-height: 0; display: flex; flex-direction: column; }
  /* حقل البحث معرّف بـ flex: 1 1 300px عشان يتمدّد أفقيًا في الأشرطة،
     ولو سبناه في عمود flex هيبلع ارتفاع القسم كله. القائمة بس هي اللي تتمدّد. */
  .group-panel .roster-current > *, .group-panel .roster-picker > * { flex: 0 0 auto; }
  .group-panel .roster-list { flex: 1 1 0; min-height: 140px; max-height: none; }
}

/* المناطق: بطاقات مرتّبة بالحجم بدل جدول — الشريط بيخلّي المقارنة بين المناطق
   بالعين من غير ما تقرا أرقام، والشرايح بتوري توزيع كل منطقة على المواعيد. */
.area-total { padding: 5px 11px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap; }
.area-rank { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 11px; }
.area-card { display: grid; align-content: start; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); }
/* عناصر الـ grid افتراضيًا min-width:auto فبترفض تصغّر تحت مقاس محتواها، وكانت
   بتخرج بره حدود الكارت لما المراحل تكتر أو اسم المجموعة يطول. */
.area-card > * { min-width: 0; }
.area-card.leading { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.area-card > header { display: flex; align-items: center; gap: 10px; }
.area-badge { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; font-size: var(--fs-min); font-weight: 800; }
.area-name { flex: 1; min-width: 0; }
.area-name strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.area-name small { display: block; overflow: hidden; color: var(--muted); font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
.area-count { flex: none; text-align: center; line-height: 1.15; }
.area-count strong { display: block; font-size: 21px; }
.area-count small { display: block; color: var(--muted); font-size: var(--fs-min); }
.area-share { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.area-share > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.area-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.area-meta .good { color: var(--success); }
.area-meta .mid { color: var(--warning); }
.area-meta .low { color: var(--danger); }
.area-groups { display: flex; flex-wrap: wrap; gap: 4px; }
/* inline-block مش inline-flex عشان الأسماء الطويلة تتقص بالنقط بدل ما تمدّ الكارت. */
.area-chip { max-width: 100%; display: inline-block; overflow: hidden; padding: 4px 9px; border-radius: 999px; background: var(--panel); color: var(--ink); font-size: var(--fs-min); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.area-chip b { margin-inline-end: 5px; color: var(--accent); font-size: var(--fs-min); }
.area-chip.none { color: var(--muted); }
.area-chip.none b { color: var(--muted); }

.schedule-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.schedule-section-head p { color: var(--muted); font-size: var(--fs-min); }
.schedule-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.schedule-summary-grid article { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.schedule-summary-grid article > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: var(--accent-soft); }
.schedule-summary-grid small { display: block; color: var(--muted); font-size: var(--fs-min); }
.schedule-summary-grid strong { font-size: 21px; }
.schedule-summary-grid .has-conflict { border-color: color-mix(in srgb, var(--danger) 42%, var(--line)); }
.schedule-summary-grid .has-conflict > span { color: var(--danger); background: var(--danger-soft); }
.quick-schedule-panel { display: grid; gap: 14px; border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.quick-schedule-panel form { display: grid; gap: 12px; }
.quick-schedule-group { max-width: 480px; }
.quick-schedule-meta { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) minmax(140px, .7fr); gap: 10px; align-items: end; }
.quick-schedule-meta.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.group-chip small { margin-inline-start: 2px; color: inherit; font-size: .9em; opacity: .72; }
.schedule-days-picker { display: grid; grid-template-columns: repeat(7, minmax(95px, 1fr)); gap: 7px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.schedule-days-picker legend { padding-inline: 7px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.schedule-day-choice { min-height: 46px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); font-size: var(--fs-min); font-weight: 800; cursor: pointer; }
.schedule-day-choice:has(> input[type="checkbox"]:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.schedule-day-choice input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.schedule-day-choice input[type="time"] { display: none; grid-column: 1 / -1; width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.schedule-day-choice:has(> input[type="checkbox"]:checked) input[type="time"] { display: block; }
.weekly-schedule-panel { padding: 12px; overflow: hidden; }
.weekly-desktop { display: grid; grid-template-columns: repeat(7, minmax(125px, 1fr)); gap: 7px; overflow-x: auto; }
.schedule-day-column { min-width: 0; min-height: 280px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.schedule-day-column > header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; padding: 2px 2px 7px; border-bottom: 1px solid var(--line); }
.schedule-day-column > header strong { font-size: var(--fs-min); }
.schedule-day-column > header span { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: var(--fs-min); font-weight: 900; }
.schedule-day-column > div { display: grid; gap: 7px; }
.schedule-session-card { width: 100%; display: grid; gap: 2px; padding: 9px; border: 1px solid var(--line); border-inline-start: 3px solid var(--accent); border-radius: 10px; text-align: start; background: var(--panel); transition: transform var(--speed), border-color var(--speed); }
.schedule-session-card:hover, .schedule-session-card:focus-visible { transform: translateY(-2px); border-color: var(--accent); outline: none; }
.schedule-session-card.conflict { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); border-inline-start-color: var(--danger); }
.schedule-time { color: var(--accent); font-size: var(--fs-min); font-weight: 900; direction: ltr; justify-self: start; }
.schedule-session-card strong { overflow: hidden; font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
.schedule-session-card small { color: var(--muted); font-size: var(--fs-min); }
.schedule-conflict { display: flex; align-items: center; gap: 3px; margin-top: 4px; color: var(--danger); font-size: var(--fs-min); font-weight: 900; }
.schedule-conflict .icon { width: 11px; height: 11px; }
.schedule-day-empty { padding: 20px 4px; color: var(--muted); font-size: var(--fs-min); text-align: center; }
.weekly-mobile { display: none; }
.schedule-empty-state { min-height: 360px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; background: radial-gradient(circle at center, var(--accent-soft), transparent 62%), var(--panel); }
.schedule-empty-state > .icon { width: 64px; height: 64px; padding: 14px; border-radius: 20px; color: var(--accent); background: var(--accent-soft); }
.schedule-empty-state p { max-width: 520px; color: var(--muted); }
.edit-schedule-form { display: grid; gap: 12px; }

@media (max-width: 1150px) {
  .subs-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .schedule-days-picker { grid-template-columns: repeat(4, minmax(95px, 1fr)); }
  .schedule-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .roster-layout { grid-template-columns: 1fr; }
  .group-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .schedule-section-head { align-items: stretch; flex-direction: column; }
  /* الشريط ده بيوصل 252px على الموبايل (تلت الشاشة) عشان بيلف على 4 صفوف،
     فتثبيته كان بياكل الشاشة بدل ما يساعد. الشبكة هنا بتدي كل مجموعة سطر
     كامل بترتيب ثابت — لابل ثم قائمة تمدّ على الفاضي ثم الأزرار الصغيرة —
     بدل ما flex-wrap يوزّعها بشكل مختلف كل مرة حسب طول اسم العام. */
  .subscriptions-control-toolbar {
    position: static; display: grid; grid-template-columns: minmax(0, 1fr);
    align-items: stretch; gap: 10px; padding: 12px 13px;
  }
  .subscriptions-control-toolbar .period-group { flex-wrap: nowrap; gap: 8px; }
  .subscriptions-control-toolbar .period-label { flex: 0 0 auto; min-width: 0; font-size: var(--fs-min); }
  .subscriptions-control-toolbar .compact-period-select { flex: 1 1 auto; min-width: 0; }
  .subscriptions-control-toolbar .compact-period-select select { width: 100%; min-width: 0; }
  .subscriptions-control-toolbar .period-chip.add-year { flex: 0 0 auto; padding-inline: 11px; font-size: var(--fs-min); white-space: nowrap; }
  /* الفاصل الرأسي مالوش معنى لما كل مجموعة تاخد سطر لوحدها. */
  .toolbar-divider { display: none; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
  .toolbar-actions > button { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; font-size: var(--fs-min); }
  /* نص كل زرار بياخد نص الشريط بس (~160px)، فالخانة بتصغر والنص يلف لو احتاج
     بدل ما يخرج بره الزرار. */
  .toolbar-actions .subs-action { gap: 7px; padding-inline: 5px 9px; white-space: normal; line-height: 1.25; text-align: start; }
  .toolbar-actions .subs-action .subs-action-icon { width: 26px; height: 26px; border-radius: 8px; }
  .subs-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subs-summary-card { padding: 11px; }
  .subs-summary-card:last-child { grid-column: 1 / -1; }
  .subs-filters > label, .subs-search { flex: 1 1 100%; }
  .subs-filters select { width: 100%; }
  .subs-student-row { grid-template-columns: repeat(3, 1fr); }
  .subs-student-name { grid-column: 1 / -1; }
  .subs-student-row > button, .subs-student-row > .collection-status { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .subs-drawer-backdrop { align-items: flex-end; padding: 8px 8px 0; }
  /* blur كامل للشاشة وراء النافذة من أثقل مؤثرات الرسم على موبايلات أندرويد.
     طبقة داكنة ثابتة تؤدي نفس وظيفة التركيز من غير تقطيع أثناء التمرير والكتابة. */
  .subs-drawer-backdrop { backdrop-filter: none; background: rgba(8, 18, 36, .72); }
  .subs-drawer, .subs-drawer.compact, .subs-drawer.group-panel { width: 100%; max-width: none; height: calc(100dvh - 8px); border-radius: 24px 24px 0 0; }
  .subs-drawer { contain: layout paint; box-shadow: 0 16px 38px -18px rgba(3, 13, 29, .72); }
  .subs-drawer > header { padding: 17px 15px 14px; }
  .subs-drawer-mark { width: 44px; height: 44px; border-radius: 14px; }
  .subs-drawer-assurance { padding-inline-start: 57px; }
  .subs-drawer-assurance span:nth-child(n+2) { display: none; }
  .subs-drawer-body { padding: 13px 12px max(20px, env(safe-area-inset-bottom)); }
  .pricing-stage-card form, .pricing-stage-card .month-discount-inline { grid-template-columns: 1fr; }
  .pricing-stage-card form button { grid-column: auto; width: 100%; }
  .group-create-form, .group-info-form { grid-template-columns: 1fr; }
  .group-create-form button, .group-info-form button { grid-column: auto; width: 100%; }
  .groups-grid { grid-template-columns: 1fr; }
  .group-panel-tabs { padding-inline: 12px; }
  .group-panel-tabs button { flex: 1; justify-content: center; padding-inline: 6px; font-size: var(--fs-min); }
  .panel-slot-row { grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto; }
  .panel-slot-row label:nth-of-type(3), .panel-slot-row label:nth-of-type(4) { grid-row: 2; }
  .quick-schedule-meta { grid-template-columns: 1fr 1fr; }
  .quick-schedule-meta.compact { grid-template-columns: 1fr 1fr; }
  .quick-schedule-meta.compact .schedule-shared-time { grid-column: 1 / -1; }
  .quick-schedule-meta .quick-schedule-group { grid-column: 1 / -1; max-width: none; }
  .roster-head { align-items: stretch; flex-direction: column; }
  .roster-source-tabs button { flex: 1; }
  .roster-move select { max-width: 104px; }
  .schedule-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-days-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-panel .schedule-day-choice:has(> input[type="checkbox"]:checked) { grid-column: 1 / -1; }
  .panel-add-slots { padding: 12px; }
  .panel-add-slots-actions { align-items: stretch; flex-direction: column; }
  .panel-add-slots-actions .submit-btn { width: 100%; justify-content: center; }
  .weekly-desktop { display: none; }
  .weekly-mobile { display: grid; gap: 12px; }
  .mobile-day-list { display: grid; gap: 8px; }
  .mobile-day-list .schedule-session-card { padding: 12px; }
  .mobile-day-list .schedule-session-card strong { font-size: 13px; }
  .schedule-empty-state { min-height: 330px; padding-inline: 18px; }
}

@media (max-width: 430px) {
  .subs-summary-grid, .schedule-summary-grid { grid-template-columns: 1fr; }
  .subs-summary-card:last-child { grid-column: auto; }
  .schedule-days-picker { grid-template-columns: 1fr; }
  .group-panel .schedule-days-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subs-students-head { align-items: flex-start; flex-direction: column; }
  /* الشاشات الضيقة جداً: «العام» و«الشهر» ياخدوا سطر لوحدهم فوق القائمة، عشان
     اسم العام الدراسي كامل ما يزاحمش زر «إضافة عام» ولا يتقص. */
  .subscriptions-control-toolbar .period-group {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  }
  .subscriptions-control-toolbar .period-label { grid-column: 1 / -1; }
}

.prev-year-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); margin-bottom: 14px;
}
.prev-year-label { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: max(var(--fs-min), 12.5px); }
.prev-year-summary strong { font-size: 18px; font-weight: 900; }
.prev-year-summary small { color: var(--muted); font-weight: 700; }

/* ------------------- الاشتراكات في ملف الطالب: ملخّص وشريط شهور ------------------- */

/* أربع أرقام بتجاوب على «هو دفع كام، وعليه إيه، والشهر ده عامل إيه، وآخر مرة
   دفع إمتى». دي كانت محتاجة تقرا ٣٦ صف عشان تطلعها بنفسك. */
.sub-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sub-summary-cell {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.sub-summary-cell > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.sub-summary-cell > span .icon { width: 14px; height: 14px; }
.sub-summary-cell strong { font-size: 18px; font-weight: 900; line-height: 1.3; }
.sub-summary-cell small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
/* المتأخرات هي الرقم اللي بيستدعي تصرّف، فلونها بيتغيّر مع الحالة. */
.sub-summary-cell.is-due { border-color: var(--danger); background: var(--danger-soft); }
.sub-summary-cell.is-due strong { color: var(--danger); }
.sub-summary-cell.is-clear { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); background: var(--success-soft); }
.sub-summary-cell.is-clear strong { color: var(--success); }

.sub-year-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  margin-bottom: 10px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700;
}
.sub-year-line strong { color: var(--ink); font-size: 13.5px; font-weight: 900; }

/* شريط الشهور: اثناشر زرار بدل اثناشر صف. اللون بيقول الحالة والضغط بيفتح
   التفاصيل، فالسنة كلها بقت بتتقرا في سطرين. */
/* ستة في الصف = صفّين نضاف للاثناشر شهر. `auto-fill` كان بيحط ١١ في صف وشهر
   يتيم لوحده تحتيهم. وتلاتة على الموبايل = أربع صفوف كاملة. */
.sub-months {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 620px) {
  .sub-months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sub-month {
  display: grid;
  gap: 2px;
  padding: 9px 8px;
  border: 1.5px solid var(--sub-line);
  border-radius: 12px;
  background: var(--sub-bg);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: transform var(--speed), box-shadow var(--speed), border-color var(--speed);
}
.sub-month:hover { transform: translateY(-2px); box-shadow: 0 6px 14px var(--sub-glow); }
.sub-month:focus-visible { outline: 3px solid var(--sub-line); outline-offset: 2px; }
.sub-month-name { font-size: var(--fs-min); font-weight: 800; }
.sub-month-state { font-size: var(--fs-min); font-weight: 700; color: var(--sub-ink); }

.sub-month.sub-paid { --sub-line: var(--success); --sub-ink: var(--success); --sub-bg: var(--success-soft); --sub-glow: color-mix(in srgb, var(--success) 30%, transparent); }
.sub-month.sub-partial { --sub-line: var(--warning); --sub-ink: var(--warning); --sub-bg: var(--warning-soft); --sub-glow: color-mix(in srgb, var(--warning) 30%, transparent); }
.sub-month.sub-unpaid { --sub-line: var(--danger); --sub-ink: var(--danger); --sub-bg: var(--danger-soft); --sub-glow: color-mix(in srgb, var(--danger) 30%, transparent); }
.sub-month.sub-exempt { --sub-line: var(--gold); --sub-ink: var(--gold); --sub-bg: var(--gold-soft); --sub-glow: color-mix(in srgb, var(--gold) 26%, transparent); }
/* القادم واللي مالوش اشتراك: بلا لون عشان ما يزاحموش الشهور اللي محتاجة قرار. */
.sub-month.sub-future,
.sub-month.sub-none { --sub-line: var(--line); --sub-ink: var(--muted); --sub-bg: var(--panel-2); --sub-glow: transparent; color: var(--muted); }
.sub-month.sub-none { border-style: dashed; }

/* الشهر الحالي معلّم دايمًا، والمفتوح متوصّل بجدول التفاصيل بسهم. */
.sub-month.is-now { box-shadow: inset 0 0 0 1.5px var(--sub-line); }
.sub-month.is-open { position: relative; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sub-line) 26%, transparent); }
.sub-month.is-open::after {
  content: '';
  position: absolute;
  bottom: -10px; left: 50%;
  width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg);
  border-inline-start: 1.5px solid var(--sub-line);
  border-block-start: 1.5px solid var(--sub-line);
  background: var(--panel);
}

.sub-month-detail { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .sub-month { transition: none; }
  .sub-month:hover { transform: none; }
}

.session-list { display: grid; gap: 8px; }

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: right;
  transition: all var(--speed);
}

/* صف بزرّين: الصف يبقى حاوية بدون padding، والفتح زر جوّه جنب زر الحذف
   (زر جوه زر مش HTML صالح، فالصف ما ينفعش يفضل <button>). */
.session-row.session-row-split { align-items: stretch; padding: 0; gap: 6px; }

.session-open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
}

.session-copy { min-width: 0; display: grid; gap: 6px; width: 100%; }
.session-heading,
.session-foot { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.session-heading strong { min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.session-stage {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: var(--fs-min);
  font-weight: 750;
}
.session-foot small { min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.session-attendance-badge { flex: 0 0 auto; white-space: nowrap; }

.session-delete {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--speed);
}

.session-delete:hover { background: var(--danger-soft); color: var(--danger); }
.session-delete .icon { width: 16px; height: 16px; }

.session-row:hover { border-color: var(--line); transform: translateX(-3px); }
.session-row strong { font-size: 13px; display: block; }
.session-row small { color: var(--muted); font-weight: 600; }

@media (max-width: 620px) {
  .session-row.session-row-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 0;
    overflow: hidden;
  }
  .session-open { padding: 13px 12px; }
  .session-heading { display: grid; justify-items: start; gap: 3px; }
  .session-heading strong { font-size: 14px; }
  .session-stage { padding: 0; background: transparent; }
  .session-foot { align-items: end; }
  .session-foot small { flex: 1 1 auto; }
  .session-delete {
    width: 42px;
    border-inline-start: 1px solid var(--line);
    border-radius: 0;
  }
}

/* ------------- الانتقال من ملف الطالب لمكان تعديل البيان ------------- */

/* الصف بيفضل شكله زي أي صف عرض، وبس بيقول إنه بيتضغط عند المرور أو التركيز —
   عشان القايمة ما تتحوّلش لحيطة أزرار ملوّنة. */
button.session-row.session-jump { width: 100%; font: inherit; color: inherit; cursor: pointer; }
.session-jump:hover { border-color: var(--accent); background: var(--accent-soft); }
.session-jump:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.session-jump .jump-side { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.session-jump .jump-icon { width: 14px; height: 14px; color: var(--muted); opacity: 0; transition: opacity var(--speed); }
.session-jump:hover .jump-icon,
.session-jump:focus-visible .jump-icon { opacity: 1; color: var(--accent); }

/* صف جدول بيتصرف كزرار — `button` جوّه `tr` مش HTML صالح. */
tr.row-jump { cursor: pointer; }
tr.row-jump:hover > td { background: var(--accent-soft); }
tr.row-jump:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.row-jump .jump-icon { width: 13px; height: 13px; margin-inline-start: 6px; vertical-align: -2px; color: var(--muted); opacity: 0; transition: opacity var(--speed); }
tr.row-jump:hover .jump-icon,
tr.row-jump:focus-visible .jump-icon { opacity: 1; color: var(--accent); }

/* بطاقة رقم بتودّي للمكان اللي الرقم بيتعدّل منه. */
button.metric-card.metric-link { width: 100%; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.metric-card.metric-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* الطالب اللي المدرس جه عشانه: علامة تخليه يبان فورًا في كشف فيه عشرات الأسماء. */
.att-row.is-focus-student,
.grade-row.is-focus-student { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.grade-row.is-focus-student { scroll-margin-top: 88px; scroll-margin-bottom: 24vh; }

@media (prefers-reduced-motion: reduce) {
  .session-jump .jump-icon,
  tr.row-jump .jump-icon { transition: none; }
}

/* ------------------------------ الامتحانات ------------------------------ */

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.report-card { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 16px 12px; }
.report-card strong { font-size: 21px; font-weight: 900; }
.report-card p { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.report-icon { color: var(--accent); width: 22px; height: 22px; }

.exams-layout { grid-template-columns: 1.5fr 1fr; }

.exam-list { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.exam-library-tools,
.exam-roster-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, .6fr);
  gap: 9px;
  align-items: end;
  margin-bottom: 11px;
}
.exam-library-tools .field,
.exam-roster-filters .field { margin: 0; }
.exam-library-tools .searchbox,
.exam-roster-filters .searchbox { min-height: 44px; }
.exam-roster-toolbar {
  display: grid;
  gap: 10px;
  margin: 2px 0 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--panel-2) 72%, var(--panel));
}
.exam-roster-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(74px, .35fr);
  align-items: center;
  gap: 10px;
}
.exam-progress-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.exam-progress-icon .icon { width: 18px; height: 18px; }
.exam-roster-progress strong { display: block; font-size: 13px; font-weight: 900; }
.exam-roster-progress small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.exam-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--line); }
.exam-progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width .24s ease; }
.exam-roster-filters { grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(130px, .6fr)); margin: 0; }
.exam-filter-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 14px; color: var(--muted); text-align: center; }
.exam-filter-empty > .icon { width: 28px; height: 28px; color: var(--accent); }
.exam-filter-empty strong { color: var(--ink); font-size: 14px; }
.exam-filter-empty span { font-size: 12.5px; }
.exam-filter-empty .ghost-btn { margin-top: 4px; }

@media (max-width: 760px) {
  .exam-library-tools { grid-template-columns: 1fr; }
  .exam-roster-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-roster-filters .searchbox { grid-column: 1 / -1; }
  .exam-roster-progress { grid-template-columns: auto minmax(0, 1fr); }
  .exam-progress-track { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .exam-roster-filters { grid-template-columns: 1fr; }
  .exam-roster-filters .searchbox { grid-column: auto; }
}

.exam-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 2px solid transparent;
  text-align: right;
  transition: all var(--speed);
}

.exam-card:hover { border-color: var(--line); }
.exam-card.active { border-color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.exam-card strong { font-size: 13.5px; display: block; }
.exam-card small { color: var(--muted); font-weight: 600; font-size: var(--fs-min); }

.exam-extremes { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.exam-extremes .pill { display: inline-flex; align-items: center; gap: 5px; }
.exam-extremes .icon { width: 13px; height: 13px; }

.grades-grid { display: grid; gap: 8px; min-width: 0; }

.grade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  cursor: pointer;
}

/* عنصر الـ flex افتراضيًا min-width:auto، فاسم الطالب (white-space: nowrap)
   كان بيفرض عرض الصف كله ويطلّع اللوحة بره الشاشة — والـ body عنده
   overflow-x: clip فالزيادة كانت بتتقص من غير تمرير، يعني خانة الدرجة
   نفسها تختفي على الشاشات الضيقة. */
.grade-row > .student-cell { min-width: 0; flex: 1 1 auto; }
.grade-row .student-cell > div { min-width: 0; }
.grade-row .student-name { overflow: hidden; text-overflow: ellipsis; }

.grade-row input {
  width: 110px;
  flex: 0 1 110px;
  min-width: 72px;
  height: 42px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 800;
  text-align: center;
  outline: 0;
  transition: border-color var(--speed);
}

.grade-row input:focus { border-color: var(--accent); }

.grade-state-field { flex: 0 0 auto; }
.grade-state-field select {
  min-width: 104px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: var(--fs-min);
  font-weight: 850;
  outline: 0;
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed), color var(--speed);
}
.grade-state-field select:focus { border-color: var(--accent); }
.grade-row.is-scored .grade-state-field select { background: var(--success-soft); color: var(--success); }
.grade-row.is-absent .grade-state-field select { background: var(--danger-soft); color: var(--danger); }
.grade-row.is-excused .grade-state-field select { background: var(--warning-soft); color: var(--warning); }
.grade-row input:disabled { opacity: .5; cursor: not-allowed; background: transparent; }

.grades-form .submit-btn { margin-top: 16px; }

/* ------------------------------ التقارير ------------------------------ */

.executive-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--sidebar-bg), #2a2b33);
  color: #eceef2;
  border: 0;
}

.executive-card h2 { color: #fff; font-size: 17px; }
.executive-card p { color: #b9bac4; max-width: 640px; margin-top: 6px; font-weight: 600; }
.executive-card .primary-mini { background: var(--lime); color: var(--lime-ink); }

.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }

.export-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px dashed var(--line);
  font-weight: 700;
  transition: all var(--speed);
}

.export-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ------------------------------ الرسوم البيانية ------------------------------ */

.chart { width: 100%; height: auto; }
.chart-empty { color: var(--muted); font-weight: 600; padding: 18px 0; text-align: center; }

/* أعمدة رأسية — العنصر الواحد بيدخل عمودين: خانة العمود ثم العنوان تحته مباشرة،
   عشان كل العناوين تقع على نفس السطر مهما اختلف طولها. */
.bar-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  /* صف العناوين بارتفاع ثابت: النص المايل مابياخدش مساحته من الـ layout (الـ
     transform مابيغيّرش صندوق العنصر)، فمن غير الارتفاع ده كان هينزل بره الكارت.
     والحشوة الشمال عشان عنوان آخر عمود (أقصى الشمال في RTL) ما يخرجش من البانل. */
  grid-template-rows: var(--plot-h, 130px) var(--label-h, 46px);
  align-items: end;
  gap: 9px 10px;
  padding-top: 20px;
  padding-left: 22px;
}

.bar-track { display: flex; align-items: flex-end; justify-content: center; height: 100%; border-bottom: 1.5px solid var(--line); }

.bar-fill {
  position: relative;
  width: 100%;
  max-width: 38px;
  min-height: 3px;
  border-radius: 8px 8px 0 0;
  animation: barIn 0.6s ease both;
  transform-origin: bottom;
}

.bar-value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  color: var(--ink);
  font-size: var(--fs-min);
  font-weight: 800;
  white-space: nowrap;
}

/* عناوين الأعمدة مايلة. الاسم الكامل («نوفمبر») عرضه ضعف عرض العمود على
   الموبايل، وأفقياً مافيش غير حلين — نكسر الكلمة أو نقصّها، والاتنين وحشين.
   الميل بيسيب الاسم كامل ومقروء ومصفوف على زاوية واحدة طول الرسم.
   النص متعلّق من طرفه اليمين (أول حرف في العربي) عند نص العمود، وبينزل ناحية
   الشمال، فمابيدخلش على منطقة الأعمدة خالص. */
.bar-label {
  color: var(--muted);
  font-size: var(--fs-min);
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  justify-self: center;
  align-self: start;
  transform: translateX(-50%) rotate(var(--label-tilt, -42deg));
  transform-origin: top right;
}

/* سجل اليوم باليوم في نمو الأعداد — رأسه شريط `.growth-strip` زي الخلاصة. */
.ledger-panel { display: grid; gap: 12px; }
.ledger-panel > .section-head { margin-bottom: 0; }

.ledger-weekdays, .ledger-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ledger-weekdays { margin-top: 4px; }
.ledger-weekdays span { color: var(--muted); font-size: var(--fs-min); font-weight: 800; text-align: center; }
.ledger-cell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 3px;
  min-height: 74px;
  padding: 6px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.ledger-cell.is-blank { border: 0; background: transparent; min-height: 0; }
.ledger-cell.is-quiet { opacity: .55; }
.ledger-date { color: var(--muted); font-size: var(--fs-min); font-weight: 800; text-align: center; }
.ledger-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; min-height: 26px; }
.ledger-bar { width: 8px; border-radius: 3px 3px 0 0; }
.ledger-bar.in { background: var(--success); }
.ledger-bar.out { background: var(--danger); }
.ledger-delta { font-size: var(--fs-min); font-weight: 800; text-align: center; color: var(--muted); }
.ledger-delta.up { color: var(--success); }
.ledger-delta.down { color: var(--danger); }

.ledger-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.ledger-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ledger-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ledger-key.in { background: var(--success); }
.ledger-key.out { background: var(--danger); }

.ledger-events { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ledger-event {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.ledger-event.is-undated { border-style: dashed; }
.ledger-when { display: grid; justify-items: center; }
.ledger-when strong { font-size: 19px; line-height: 1; }
.ledger-when small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.ledger-what { display: grid; gap: 6px; min-width: 0; }
.ledger-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ledger-name {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-min);
  font-weight: 700;
  cursor: pointer;
}
.ledger-name:hover { border-color: var(--accent); color: var(--accent); }
/* الشريحة بتفضل سطر واحد؛ السبب بيتحط بعد فاصل رفيع بلون أهدى من الاسم. */
.ledger-name:has(.ledger-reason) { display: inline-flex; align-items: center; gap: 7px; }
.ledger-reason { padding-inline-start: 7px; border-inline-start: 1px solid var(--line); color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.ledger-name:hover .ledger-reason { color: inherit; }
.ledger-more { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.ledger-running { display: grid; justify-items: center; }
.ledger-running span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.ledger-running strong { font-size: 17px; }

@media (max-width: 760px) {
  /* اليوم، الأسماء، والعدد في سطر واحد — العدد كان بينزل سطر لوحده ويطوّل كل يوم. */
  .ledger-event { grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 9px 10px; }
  .ledger-running { gap: 0; }
  .ledger-cell { min-height: 50px; gap: 2px; padding: 4px 3px; }
  .ledger-bars { min-height: 16px; }
  .ledger-bar { width: 6px; }
  .ledger-weekdays, .ledger-calendar { gap: 4px; }
  .ledger-panel .section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .ledger-panel .month-picker, .ledger-panel .month-picker select { width: 7.5rem; min-width: 0; }
}

/* حصص الشهر بالكامل — مصفوفة مجموعات × أيام */
.month-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.month-summary > div { display: grid; gap: 2px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.month-summary span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.month-summary strong { font-size: 21px; }
.month-summary small { color: var(--muted); font-size: var(--fs-min); }
.month-grid { min-width: 680px; }
.month-grid th, .month-grid td { padding: 6px 5px; text-align: center; }
.month-grid thead th { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.month-grid thead abbr { display: grid; gap: 1px; text-decoration: none; border: 0; }
.month-day { font-size: 13px; font-weight: 800; color: var(--ink); }
.month-weekday { font-size: var(--fs-min); color: var(--muted); }
.month-grid tbody th[scope="row"] { text-align: start; white-space: nowrap; position: sticky; inset-inline-start: 0; background: var(--panel); z-index: 1; }
.month-group { display: block; font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.month-grid tbody th small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.month-cell.empty { color: var(--muted); opacity: .45; }
.month-chip {
  display: inline-block;
  min-width: 46px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: var(--fs-min);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--speed), box-shadow var(--speed);
}
.month-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.month-chip.tone-high { background: var(--success); color: #fff; }
/* --success بيتقلب من أخضر غامق في الوضع الفاتح لأخضر فاقع في الغامق، فالنص
   الأبيض اللي بيقرا ٦:١ فوق الغامق بينزل ١.٦:١ فوق الفاقع ويختفي. */
body.dark-mode .month-chip.tone-high { color: #04331f; }
.month-chip.tone-good { background: var(--success-soft); color: var(--success); }
.month-chip.tone-mid { background: var(--warning-soft); color: var(--warning); }
.month-chip.tone-low { background: var(--danger-soft); color: var(--danger); }
.month-chip.tone-none { background: var(--panel-2); color: var(--muted); }
.month-chip.tone-cancelled { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
.month-grid tfoot td, .month-grid tfoot th { border-top: 1.5px solid var(--line); font-weight: 800; font-size: var(--fs-min); }
.month-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.month-legend span { display: inline-flex; align-items: center; gap: 5px; }
.month-key { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }
.month-key.tone-high { background: var(--success); }
.month-key.tone-good { background: var(--success-soft); }
.month-key.tone-mid { background: var(--warning-soft); }
.month-key.tone-low { background: var(--danger-soft); }
.month-key.tone-cancelled { background: var(--panel-2); }

/* نسختين لنفس البيانات: المصفوفة على الديسكتوب، وكروت المجموعات على الموبايل.
   نفس أسلوب الجدول الأسبوعي في الاشتراكات (.weekly-desktop / .weekly-mobile). */
.month-mobile { display: none; }
.month-mobile-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.month-mobile-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.month-mobile-identity { min-width: 0; display: grid; gap: 7px; }
.month-mobile-head strong { display: block; min-width: 0; font-size: 14px; font-weight: 850; line-height: 1.45; overflow-wrap: anywhere; }
.month-mobile-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.month-mobile-head small,
.month-mobile-count { color: var(--muted); font-size: var(--fs-min); font-weight: 700; line-height: 1.35; }
.month-mobile-count { padding-inline-start: 9px; border-inline-start: 1px solid var(--line); }
.month-mobile-average { min-width: 52px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
/* شبكة بأعمدة متساوية: الشيبس بتفضل مصفوفة تحت بعضها مهما اختلف طول النسبة،
   بدل ما flex-wrap يزحلق كل صف بمقدار مختلف. */
.month-mobile-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.month-mobile-day { display: grid; justify-items: center; gap: 2px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.month-mobile-day b { font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.month-mobile-daily .month-mobile-day b { color: var(--muted); }
.month-chip-block { display: block; width: 100%; min-width: 0; margin-top: 2px; text-align: center; }
/* الشيب ده هو زرار فتح الحصة على الموبايل — مقاسه لازم يبقى مقاس اللمسة زي
   أزرار الحضور بالظبط، مش ٣٣ بكسل. */
.month-chip-block { min-height: var(--tap); display: flex; align-items: center; justify-content: center; }

@media (max-width: 760px) {
  .month-desktop { display: none; }
  .month-mobile { display: grid; gap: 10px; }
  .month-summary { grid-template-columns: 1fr 1fr; }
  .month-summary strong { font-size: 18px; }
  .month-mobile-card { box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 5%, transparent); }
  .month-legend { gap: 8px 12px; font-size: var(--fs-min); }
}

/* إضافة دفعة طلاب — جدول إدخال داخل نافذة أعرض من المعتاد */
.bulk-shared { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.bulk-rows { max-height: 42vh; overflow: auto; }
.bulk-table { min-width: 640px; }
.bulk-table th, .bulk-table td { padding: 7px 9px; vertical-align: middle; }
.bulk-table td:first-child { color: var(--muted); font-weight: 800; width: 2.5em; text-align: center; }
.bulk-table input {
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.bulk-table input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bulk-row-error input[data-field="bulk-name"] { border-color: var(--danger); }
.bulk-error { display: block; margin-top: 4px; color: var(--danger); font-size: var(--fs-min); font-weight: 700; }

/* أعمدة حول خط الصفر — الزيادة فوق والنقص تحت */
.delta-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 20px 0 0 22px;
}
.delta-col { display: grid; grid-template-rows: calc(var(--plot-h, 130px) / 2) calc(var(--plot-h, 130px) / 2) var(--label-h, 46px); gap: 0 0; }
.delta-half { position: relative; display: flex; justify-content: center; }
.delta-half.top { align-items: flex-end; border-bottom: 1.5px solid var(--line); }
.delta-half.bottom { align-items: flex-start; }
.delta-fill {
  position: relative;
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  animation: barIn 0.6s ease both;
}
.delta-fill.up { border-radius: 8px 8px 0 0; background: var(--success); transform-origin: bottom; }
.delta-fill.down { border-radius: 0 0 8px 8px; background: var(--danger); transform-origin: top; }
.delta-value {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink);
  font-size: var(--fs-min);
  font-weight: 800;
  white-space: nowrap;
}
.delta-fill.up .delta-value { bottom: 100%; margin-bottom: 5px; }
.delta-fill.down .delta-value { top: 100%; margin-top: 5px; }
.delta-col .bar-label { margin-top: 6px; }
.delta-col .bar-label.up { color: var(--success); }
.delta-col .bar-label.down { color: var(--danger); }

/* الميل قرار مبني على المساحة مش على الجهاز. نفس رسم «اتجاه الحضور» بيقعد في
   تلت بانل على اللاب (العمود ٣٠ بكسل، والاسم ٤٤) وبيقعد في بانل كامل في تبويب
   تاني (العمود ٨٥). فبنسأل الغلاف عن عرضه: فوق ٦٤٠ بكسل فيه فسحة لاثناشر اسم
   واقفين، وتحتها بيميلوا. الشاشة الصغيرة بتقع تحت الحد ده تلقائياً. */
.chart-shell { container-type: inline-size; }

@container (min-width: 640px) {
  .bar-chart { grid-template-rows: var(--plot-h, 130px) auto; padding-left: 0; }
  .delta-chart { padding-left: 0; }
  .delta-col { grid-template-rows: calc(var(--plot-h, 130px) / 2) calc(var(--plot-h, 130px) / 2) auto; }
  .bar-label { transform: none; align-self: end; text-align: center; }
}

/* تبويب نمو الأعداد */
.muted-note { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.period-hint { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }

/* الخلاصة: الرقم الكبير، وتحته المعادلة في شريط واحد متقسّم بخطوط رفيعة. */
.growth-summary { display: grid; gap: 14px; }
.growth-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.growth-now h2 { margin: 0; font-size: 17px; font-weight: 900; }
.growth-now-change { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.growth-now-change .pill { font-size: 14px; padding: 3px 11px; }
.growth-now-change small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }

.growth-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  margin: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--line);
}
.growth-strip > div { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 11px 13px; background: var(--panel); }
.growth-strip dt { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.growth-strip dt b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: var(--panel-2); color: var(--ink); font-size: 13px; line-height: 1; }
.growth-strip dd { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.growth-strip small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.growth-strip .is-in dd, .growth-strip .is-in dt b { color: var(--success); }
.growth-strip .is-out dd, .growth-strip .is-out dt b { color: var(--danger); }
.growth-strip .is-total { background: var(--panel-2); }
.growth-equation .is-total dd { color: var(--accent); font-size: 26px; }
.growth-strip .is-total dt b { background: var(--panel); }

.growth-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.growth-fact {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
  color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700;
}
.growth-fact b { color: var(--ink); font-weight: 900; font-variant-numeric: tabular-nums; }
.growth-fact.tone-good b { color: var(--success); }
.growth-fact.tone-mid b { color: var(--warning); }
.growth-fact.tone-low b { color: var(--danger); }

/* سطور الشهور والتقسيم: اسم، عمود، عدد، حركة، صافي — نفس الأماكن في كل سطر. */
.growth-rows-head,
.growth-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) minmax(0, 1fr) 3rem minmax(7.5rem, auto) 3.6rem;
  align-items: center; gap: 12px;
}
.growth-rows-head { padding: 0 12px 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.growth-rows-head span:nth-child(3), .growth-rows-head span:nth-child(5) { text-align: center; }
.growth-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.growth-row { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.growth-row:last-child { border-bottom: 0; }
/* تظليل خفيف بس: الأحمر والأخضر اللي جوه السطر لازم يفضلوا مقروءين عليه في الليلي. */
.growth-row.is-current { border-radius: 12px; border-bottom-color: transparent; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.growth-row-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.growth-row-name strong { overflow: hidden; font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.growth-row-name small { flex: 0 0 auto; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.growth-row-name small.tone-mid { color: var(--warning); }
.growth-row-name small.tone-low { color: var(--danger); }
.growth-row-bar { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: var(--panel-2); }
.growth-row-bar i { display: block; height: 100%; border-radius: inherit; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.growth-row.is-current .growth-row-bar { background: var(--panel); }
.growth-row.is-current .growth-row-bar i { background: var(--accent); }
.growth-row-total { font-size: 17px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.growth-row-flow { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-min); font-weight: 800; }
.growth-row-flow .is-in { color: var(--success); }
.growth-row-flow .is-out { color: var(--danger); }
.growth-row-flow .is-quiet { color: var(--muted); font-weight: 600; }
.growth-row-net { justify-self: center; min-width: 3rem; text-align: center; }

.growth-table-toggle .icon { width: 15px; height: 15px; transition: transform var(--speed); }
.growth-table-toggle.is-open .icon { transform: rotate(180deg); }

.growth-dims {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); scrollbar-width: none;
}
.growth-dims::-webkit-scrollbar { display: none; }
.growth-dim {
  flex: 1 0 auto; min-height: 38px; padding: 0 14px; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; white-space: nowrap;
}
.growth-dim:hover { color: var(--ink); }
.growth-dim.active { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(15, 23, 42, .08); }

/* الجدول الكامل: تمرير أفقي وأول عمود ثابت، مش كروت (القاعدة العامة ماسكة .table-wrap بس). */
.growth-table-scroll { margin-top: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.growth-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.growth-table td, .growth-table th { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.growth-table tbody tr:last-child > * { border-bottom: 0; }
.growth-table thead th { background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.growth-table th[scope="row"], .growth-table thead th:first-child {
  position: sticky; inset-inline-start: 0; z-index: 1;
  background: var(--panel); text-align: start; box-shadow: inset 1px 0 0 var(--line);
}
.growth-table thead th:first-child { background: var(--panel-2); }
.growth-table .growth-in { color: var(--success); font-weight: 800; }
.growth-table .growth-out { color: var(--danger); font-weight: 800; }

@media (max-width: 620px) {
  .growth-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .growth-strip dd { font-size: 20px; }
  .growth-now-change { justify-items: start; }
  .growth-rows-head { display: none; }
  /* على الموبايل السطر بيبقى سطرين: الاسم والعمود والعدد فوق، والحركة والصافي تحت. */
  .growth-row {
    grid-template-columns: minmax(4.6rem, 6.5rem) minmax(0, 1fr) auto;
    grid-template-areas: "name bar total" "name flow net";
    gap: 3px 10px; padding: 8px;
  }
  .growth-row-name { grid-area: name; flex-direction: column; align-items: flex-start; gap: 0; align-self: center; }
  .growth-row-bar { grid-area: bar; }
  .growth-row-total { grid-area: total; min-width: 2.2rem; }
  .growth-row-flow { grid-area: flow; }
  .growth-row-net { grid-area: net; min-width: 2.6rem; padding-block: 1px; }
  .growth-months-panel .section-head, .growth-breakdown-panel .section-head { flex-wrap: wrap; }
  .growth-table-toggle { width: 100%; justify-content: center; }
}

/* أعمدة أفقية — للعناوين الطويلة */
.hbar-chart { display: grid; gap: 11px; padding: 6px 0 2px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.hbar-label { color: var(--muted); font-size: var(--fs-min); font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.hbar-track { display: block; height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; min-width: 4px; border-radius: 999px; animation: hbarIn 0.6s ease both; transform-origin: right; }
.hbar-value { color: var(--ink); font-size: var(--fs-min); font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: left; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut { width: 158px; flex-shrink: 0; }
.donut-seg { animation: fadeIn 0.7s ease both; }
.donut-center { fill: var(--ink); font-size: 26px; font-weight: 900; font-family: inherit; }
.donut-sub { fill: var(--muted); font-size: var(--fs-min); font-weight: 700; font-family: inherit; }
.donut-legend { display: grid; gap: 8px; }
.donut-key { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: max(var(--fs-min), 12.5px); }
.donut-key i { width: 11px; height: 11px; border-radius: 4px; }

.spark { width: 100%; height: 110px; }
.spark-line { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: dash 1.2s ease forwards; }

.ring { width: 54px; height: 54px; }
.ring.good { color: var(--success); }
.ring.mid { color: var(--warning); }
.ring.low { color: var(--danger); }
.ring-text { fill: var(--ink); font-size: 13px; font-weight: 800; font-family: inherit; }

/* ------------------------------ الأعضاء والسجل ------------------------------ */

.member-list { display: grid; gap: 8px; }

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.member-row span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; display: block; }
.member-row strong { font-size: 13.5px; }
.member-row .student-cell { flex: 1 1 200px; }
/* الأزرار كانت في .head-actions من غير wrap: أربع أزرار جنب بعض بتخرج برّه
   الكارت على أي شاشة أضيق من ٤٥٠px. */
.member-row .head-actions { flex-wrap: wrap; }

@media (max-width: 620px) {
  .member-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .member-row .student-cell { flex: 0 0 auto; }
  /* حالة العضو (مدير/عضو/معطّل) تفضل فوق كسطر بيانات، والأزرار تحتها عمودين
     متساويين بدل صف واحد بيتقص. */
  .member-row .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .member-row .head-actions > .pill { grid-column: 1 / -1; justify-self: start; }
  .member-row .head-actions > .table-action { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; font-size: var(--fs-min); }
  /* آخر زرار بيفرد على العرض كله لو قاعد لوحده في سطره. العدّ لازم يكون على
     الأزرار وحدها (`nth-of-type` على `button`) مش على كل الأولاد: البادچات
     `span` وبتاخد سطر كامل، فلما زاد بادچ «الحفظ مقفول عليه» اتقلبت فردية
     العدّ الكلية، والقاعدة فردت زرار وسط الصف وسابت خانة فاضية جنب اللي
     قبله. */
  .member-row .head-actions > .table-action:last-child:nth-of-type(odd) { grid-column: 1 / -1; }
  .permission-form fieldset { grid-template-columns: 1fr 1fr; }
  .permission-form button { width: 100%; }
}

.activity-list { display: grid; gap: 4px; max-height: 65vh; overflow-y: auto; }

.activity-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  transition: background var(--speed);
}

.activity-row:hover { background: var(--panel-2); }
.activity-time { color: var(--muted); font-size: var(--fs-min); font-weight: 700; direction: ltr; text-align: right; }
.activity-row strong { font-size: 13px; display: block; }
.activity-row p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }
.activity-row small { color: var(--muted); font-weight: 700; background: var(--panel-2); padding: 4px 10px; border-radius: 999px; }

.restricted { display: grid; justify-items: center; gap: 8px; padding: 50px 20px; text-align: center; }
.restricted p { color: var(--muted); font-weight: 600; }

/* ------------------------------ الإعدادات والمساعدة ------------------------------ */

.settings-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.action-panel { display: grid; gap: 10px; }
.hint-text { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }

/* مركز الإعدادات: شبكة كروت مجمّعة بالموضوع بدل أربعتاشر لوحة فوق بعض، وكل
   كارت بيفتح تفاصيله في شاشة مستقلة. الكارت بيعرض وضعه الحالي عشان الشبكة
   تجاوب على «هو ده مظبوط؟» من غير ما تفتحه.

   كل مجموعة ليها درجة لونها الخاصة (--group-ink) مشتقّة من ألوان الثيم نفسه —
   يعني بتتغيّر مع كل ثيم ومع الوضع الليلي من غير قيم مكتوبة بالإيد هنا. اللون
   وظيفته إنك تعرف مكانك بنظرة، فهو على الأيقونة والشارة بس مش على الكارت كله. */
.settings-hub, .settings-detail { display: grid; gap: 22px; align-items: start; }
/* --group-base هو اللون الخام، و--group-ink هو اللي بيتكتب بيه فعلاً. لازم
   الاتنين يتعرّفوا على نفس العنصر اللي شايل data-group: لو حطينا --group-ink
   على الأب وهو بيقرا var(--group-base)، القيمة بتتحسب عند الأب بلون الأب —
   فكل المجموعات كانت هتطلع بنفس اللون. */
.settings-group, .settings-detail {
  /* الصبغة بتاخد اللون الخام، والكتابة بتاخده مشدود ناحية لون النص. ثيمات زي
     «غروب» ألوانها فاتحة، فاللون الخام فوق صبغته كان بينزل تحت ٣:١ للأيقونة.
     والشد ناحية --ink بيصلّح الوضعين بقاعدة واحدة: بيغمّق في الفاتح لأن النص
     أسود، وبيفتّح في الليلي لأن النص أبيض. */
  --group-base: var(--accent);
  --group-ink: color-mix(in srgb, var(--group-base) 74%, var(--ink));
  --group-soft: color-mix(in srgb, var(--group-base) 14%, transparent);
}
/* الثيمات بتخلي «الثانوي» درجة أفتح من الأساسي، فلو خدناه زي ما هو تبقى
   مجموعتين ورا بعض بنفس اللون تقريبًا. شدّة بسيطة ناحية الأحمر بتحوّله لبنفسجي
   حقيقي متميّز — ولسه مشتق من الثيم فبيتغيّر معاه ومع الوضع الليلي. */
:is(.settings-group, .settings-detail)[data-group="appearance"] { --group-base: color-mix(in srgb, var(--violet-vivid) 70%, var(--danger)); }
:is(.settings-group, .settings-detail)[data-group="operations"] { --group-base: var(--warning); }
:is(.settings-group, .settings-detail)[data-group="data"] { --group-base: var(--teal-vivid); }
:is(.settings-group, .settings-detail)[data-group="account"] { --group-base: var(--danger); }

.settings-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); align-items: center; gap: 24px;
  padding: 24px 26px;
  background:
    radial-gradient(115% 150% at 100% 0%, var(--accent-soft) 0%, transparent 58%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel) 100%);
}
/* خط رفيع بلون الثيم على حرف اللوحة — لمسة هوية من غير خلفية ملوّنة تقيلة. */
.settings-hero::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.settings-hero-copy { min-width: 0; }
.settings-hero-copy h2 { margin: 3px 0 5px; font-size: 20px; letter-spacing: -.2px; }
.settings-hero-copy p { margin: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; line-height: 1.75; max-width: 60ch; }
.settings-hero-meta { display: inline-block; margin-top: 9px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800; font-variant-numeric: tabular-nums; }
.settings-search { width: 100%; }

.settings-group { display: grid; gap: 4px; }
.settings-group-head { display: flex; align-items: center; gap: 9px; }
.settings-group-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--group-ink); box-shadow: 0 0 0 4px var(--group-soft); }
.settings-group-head h3 { margin: 0; flex: none; font-size: 13.5px; letter-spacing: -.1px; }
.settings-group-rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.settings-group-count { padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 900; font-variant-numeric: tabular-nums; }
.settings-group-hint { margin: 0 0 9px 0; padding-inline-start: 18px; color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.settings-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.settings-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 16px; align-items: start; gap: 13px;
  padding: 15px 15px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel);
  color: var(--ink); text-align: right; cursor: pointer;
  transition: border-color var(--speed), transform var(--speed), box-shadow var(--speed);
}
/* شعرة بلون المجموعة بتطلع من فوق مع الهوفر — إشارة إن الكارت قابل للفتح،
   من غير ما تحرّك أي نص أو تغيّر ارتفاع الكارت. */
.settings-card::before {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 2px;
  background: var(--group-ink); opacity: 0; transition: opacity var(--speed);
}
.settings-card:hover, .settings-card:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--group-ink) 45%, var(--line)); box-shadow: var(--shadow); }
.settings-card:hover::before, .settings-card:focus-visible::before { opacity: 1; }
.settings-card:focus-visible { outline: 2px solid var(--group-ink); outline-offset: 2px; }
.settings-card:active { transform: translateY(0); }
.settings-card-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: var(--group-soft); color: var(--group-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--group-ink) 16%, transparent);
}
.settings-card-copy { display: grid; gap: 4px; min-width: 0; padding-top: 2px; }
.settings-card-copy strong { font-size: 13.5px; letter-spacing: -.1px; }
.settings-card-copy small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.65; }
.settings-card-status {
  justify-self: start; margin-top: 3px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800;
  font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-card-status.good { background: var(--teal-soft); color: var(--teal-vivid); }
.settings-card-status.warn { background: var(--warning-soft); color: var(--warning); }
.settings-card-status.muted { opacity: .75; }
.settings-card-go { align-self: center; color: color-mix(in srgb, var(--muted) 60%, transparent); transition: transform var(--speed), color var(--speed); }
.settings-card:hover .settings-card-go { color: var(--group-ink); transform: translateX(-4px); }

.settings-detail-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.settings-back { flex: none; padding-inline: 12px; }
.settings-back .icon { transform: rotate(180deg); }
.settings-jump { display: flex; gap: 4px; flex-wrap: wrap; }
.settings-jump-chip { padding: 7px 13px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-size: var(--fs-min); font-weight: 700; cursor: pointer; transition: color var(--speed), background var(--speed); }
.settings-jump-chip:hover { background: var(--panel-2); color: var(--ink); }
.settings-jump-chip.active { background: var(--group-soft); color: var(--group-ink); }

.settings-detail-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; }
.settings-detail-icon {
  display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 17px;
  background: var(--group-soft); color: var(--group-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--group-ink) 16%, transparent);
}
.settings-detail-copy { flex: 1 1 260px; min-width: 0; }
.settings-detail-copy .eyebrow { color: var(--group-ink); }
.settings-detail-copy h2 { margin: 2px 0 4px; font-size: 18.5px; letter-spacing: -.2px; }
.settings-detail-copy p { margin: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; line-height: 1.7; }
.settings-detail-head .settings-card-status { margin-top: 0; }
.settings-detail-body { display: grid; gap: 16px; }
/* جوّه التفاصيل الترويسة فوق بتقول اسم القسم، فعنوان اللوحة بيتكرر مرتين
   ورا بعض — بنشيل التكرار ونسيب الشرح اللي تحته لأنه بيضيف معلومة. */
.settings-detail-body .section-head h2 { display: none; }

/* تبويبات المظهر: بتخبّي وبتظهر بس — الحقول كلها بتفضل في الفورم عشان الحفظ
   بيبعت الألوان والأيقونات والكروت مع بعض في طلب واحد. */
.appearance-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appearance-tabs-group { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.appearance-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; cursor: pointer; transition: color var(--speed), background var(--speed); }
.appearance-tab:hover { color: var(--ink); }
.appearance-tab.selected { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(18, 26, 44, .12); }
.appearance-tabs .appearance-live-badge { margin-inline-start: auto; }
.appearance-pane { display: grid; gap: 18px; }
.appearance-pane[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .settings-card, .settings-card-go, .settings-card::before { transition: none; }
  .settings-card:hover, .settings-card:focus-visible { transform: none; }
  .settings-card:hover .settings-card-go { transform: none; }
}

/* محرر الثيمات: ثيمات جاهزة أولًا، ثم تخصيص تفصيلي لمن يحتاجه. */
.appearance-settings { overflow: hidden; background: linear-gradient(145deg, var(--panel) 0%, color-mix(in srgb, var(--accent) 4%, var(--panel)) 100%); }
.appearance-live-badge { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 6px 10px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: var(--fs-min); font-weight: 800; }
.appearance-live-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent); }
.appearance-form { display: grid; gap: 18px; }
.theme-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.theme-preset-card { position: relative; display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 11px; min-height: 88px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); text-align: right; transition: border-color var(--speed), transform var(--speed), box-shadow var(--speed); }
.theme-preset-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.theme-preset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.theme-preset-preview { position: relative; width: 78px; height: 62px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--preset-sidebar) 12%, transparent); border-radius: 10px; background: var(--preset-page); box-shadow: 0 5px 12px rgba(18, 26, 44, .1); }
.theme-preset-preview i { position: absolute; display: block; }
.preset-sidebar { inset: 0 auto 0 0; width: 19px; background: var(--preset-sidebar); }
.preset-card { right: 8px; height: 13px; border-radius: 4px; background: #fff; }
.preset-card.one { top: 9px; width: 43px; }
.preset-card.two { top: 27px; width: 21px; }
.preset-action { right: 32px; top: 27px; width: 19px; height: 13px; border-radius: 4px; background: linear-gradient(135deg, var(--preset-primary), var(--preset-secondary)); }
.theme-preset-copy { display: grid; gap: 2px; min-width: 0; }
.theme-preset-copy strong { font-size: max(var(--fs-min), 12.5px); }
.theme-preset-copy small { color: var(--muted); font-size: var(--fs-min); line-height: 1.45; }
.theme-selected-mark { position: absolute; top: 7px; inset-inline-start: 7px; display: none; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--accent); color: white; font-size: var(--fs-min); font-weight: 900; }
.theme-preset-card.selected .theme-selected-mark { display: grid; }
.custom-theme-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--panel-2) 72%, var(--panel)); }
.custom-theme-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 54px; padding: 10px 14px; cursor: pointer; list-style: none; font-weight: 800; }
.custom-theme-panel summary::-webkit-details-marker { display: none; }
.custom-theme-panel summary > span { display: inline-flex; align-items: center; gap: 8px; }
.custom-theme-panel summary small { padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-min); }
.custom-theme-panel[open] summary { border-bottom: 1px solid var(--line); }
.theme-color-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.theme-color-field { display: grid; gap: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.theme-color-field > span:first-child { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.theme-color-control { display: flex; align-items: center; gap: 7px; direction: ltr; }
.theme-color-control input { width: 32px; height: 32px; flex: none; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); cursor: pointer; }
.theme-color-control code { overflow: hidden; padding: 2px 4px; background: transparent; color: var(--ink); font-size: var(--fs-min); text-transform: uppercase; }
.gradient-angle-field { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 14px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.gradient-angle-field > span:first-child { display: grid; gap: 2px; }
.gradient-angle-field small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.gradient-angle-control { display: flex; align-items: center; gap: 10px; min-width: 240px; direction: ltr; }
.gradient-angle-control input { width: 100%; accent-color: var(--accent); }
.gradient-angle-control output { min-width: 42px; color: var(--accent); font-weight: 900; }
.custom-theme-panel > .hint-text { display: block; padding: 0 14px 14px; }
.appearance-preview { display: grid; grid-template-columns: 78px 1fr; min-height: 140px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--page); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel) 40%, transparent); }
.appearance-preview-sidebar { display: grid; align-content: start; gap: 9px; padding: 22px 13px; background: var(--sidebar-bg); }
.appearance-preview-sidebar i { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--sidebar-ink) 68%, transparent); }
.appearance-preview-sidebar i:first-child { width: 70%; height: 10px; margin-bottom: 8px; background: var(--accent-light); }
.appearance-preview-page { position: relative; display: grid; align-content: center; gap: 13px; padding: 22px; }
.appearance-preview-title { width: 38%; height: 10px; border-radius: 999px; background: var(--ink); opacity: .75; }
.appearance-preview-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.appearance-preview-cards i { height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.appearance-preview-cards i:nth-child(2) { background: var(--accent-soft); }
.appearance-preview-button { justify-self: start; padding: 6px 15px; border-radius: 999px; background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end)); color: var(--action-ink); font-size: var(--fs-min); font-weight: 900; }
.appearance-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.appearance-actions .submit-btn { min-width: 210px; }

/* لوحة الأيقونات */
.icon-settings { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--panel-2) 72%, var(--panel)); }
.icon-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.icon-settings-head h3 { font-size: 15px; }
.icon-settings-head p { color: var(--muted); font-size: var(--fs-min); margin-top: 3px; }
.icon-settings-sample { display: inline-flex; align-items: center; gap: 10px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent); }
.icon-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.icon-preset-card { position: relative; display: grid; justify-items: center; gap: 8px; padding: 12px 9px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); text-align: center; transition: border-color var(--speed), transform var(--speed), box-shadow var(--speed); }
.icon-preset-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.icon-preset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.icon-preset-card.selected .theme-selected-mark { display: grid; }
/* عيّنة النمط بتتحرر من إعدادات المستخدم عشان كل كارت يوري نمطه هو. */
.icon-preset-sample { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 34px; }
.icon-preset-sample .icon { zoom: var(--sample-scale, 1); stroke-width: var(--sample-weight, 2); }
.icon-preset-copy { display: grid; gap: 2px; }
.icon-preset-copy strong { font-size: var(--fs-min); }
.icon-preset-copy small { color: var(--muted); font-size: var(--fs-min); line-height: 1.5; }
.icon-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.icon-control { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.icon-control[hidden] { display: none; }
.icon-control > span:first-child { display: grid; gap: 2px; }
.icon-control strong { font-size: max(var(--fs-min), 12.5px); }
.icon-control small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.5; }
.icon-control-input { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.icon-control-input input[type="range"] { width: 100%; accent-color: var(--accent); direction: ltr; }
.icon-control-input output { min-width: 46px; color: var(--accent); font-weight: 900; text-align: center; }
.icon-control-input select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-weight: 700; }

/* لوحة كروت الطلاب — بتشارك أصناف التحكم مع لوحة الأيقونات */
.tile-settings { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--panel-2) 72%, var(--panel)); }
.tile-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile-preset-card { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); text-align: right; transition: border-color var(--speed), transform var(--speed), box-shadow var(--speed); }
.tile-preset-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.tile-preset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.tile-preset-card.selected .theme-selected-mark { display: grid; }
/* عيّنة النمط: تلات مربعات بمقاس النمط نفسه — بتاخد ألوان اللوحة الحالية،
   وتغيير اللوحة نفسه بيبان في شريط المعاينة الكبير تحت. */
.tile-preset-sample { display: flex; gap: 4px; margin: 0; }
.tile-preset-sample .student-tile { width: calc(19px * var(--sample-tile, 1)); height: calc(19px * var(--sample-tile, 1)); padding: 0; border-radius: 6px; box-shadow: none; }
.tile-preset-sample .student-tile:hover { transform: none; }
.tile-preset-copy { display: grid; gap: 2px; min-width: 0; }
.tile-preset-copy strong { font-size: var(--fs-min); }
.tile-preset-copy small { color: var(--muted); font-size: var(--fs-min); line-height: 1.5; }
.icon-control.full { grid-column: 1 / -1; }
.tile-color-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tile-color-label { display: inline-flex; align-items: center; gap: 6px; }
/* مربع مصغّر بلون الحالة جنب اسمها — نفس أصناف المربع الحقيقي عشان ياخد نفس
   المتغيرات ويتحدّث لحظيًا مع اللون، من غير ما نكرر اللوحة في الـ CSS. */
.tile-color-chip { display: inline-flex; margin: 0; }
.tile-color-chip .student-tile { width: 13px; height: 13px; padding: 0; border-radius: 4px; box-shadow: none; }
.tile-color-chip .student-tile:hover { transform: none; }
.tile-preview { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
/* شريط المعاينة بيتقفل على خمس مربعات مهما كان مقاسها عشان يفضل صف واحد. */
.tile-sample-row { grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); justify-content: start; margin-top: 0; }
.tile-sample-row .student-tile { cursor: default; }
.tile-sample-row .student-tile:hover { transform: none; }

/* سلّم أولوية الحالات. بيبهت من غير ما يختفي لما الترتيب يبقى أبجدي أو بترتيب
   الإضافة: القايمة ساعتها بلا أثر، لكن إخفاءها كان هيخلّي التبويب ينطّ. */
.tile-order-panel { display: grid; gap: 10px; }
.tile-order-panel[data-idle] .tile-order-hint,
.tile-order-panel[data-idle] .tile-order-list { opacity: .45; pointer-events: none; }
.tile-order-hint { margin: 0; }
.tile-order-list {
  display: grid; gap: 6px; margin: 0; padding: 10px; list-style: none;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2);
}
.tile-order-row {
  display: grid; align-items: center; gap: 10px; padding: 6px 10px;
  grid-template-columns: 20px auto 1fr auto;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.tile-order-rank { color: var(--muted); font-size: var(--fs-min); font-weight: 700; text-align: center; }
.tile-order-name { font-size: var(--fs-min); font-weight: 600; }
.tile-order-moves { display: inline-flex; gap: 4px; }
.tile-order-move {
  width: 26px; height: 26px; padding: 0; color: var(--muted); font-size: var(--fs-min); line-height: 1;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tile-order-move:hover:not([disabled]) { color: var(--accent); background: var(--accent-soft); }
.tile-order-move[disabled] { cursor: default; opacity: .3; }

/* أنواع كروت الطلاب. كل نوع صف واحد: السطر الأول هو اللي بيتقرا من على بعد
   (رتبته + مربع بلونه + اسمه)، والتفاصيل تحته لأنها بتتفتح مرة وتتساب.
   الصف كله على خلفية تانية عشان حدود الأنواع تبان في قايمة طويلة. */
.card-types-form { display: grid; gap: 14px; }
.card-types-intro, .card-types-warning { margin: 0; }
.card-type-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.card-type-row {
  display: grid; gap: 10px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2);
}
/* النوع المقفول بيفضل مقروء بس واخد خطوة لورا: باهت شوية وبخط متقطّع، عشان
   عينك تعدّي عليه في القايمة زي ما السيستم بيعدّي عليه في التصنيف. */
.card-type-row.is-off { border-style: dashed; opacity: .72; }
.card-type-head {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: 22px auto minmax(0, 1fr) auto auto;
}
.card-type-rank { color: var(--muted); font-size: var(--fs-min); font-weight: 700; text-align: center; }
.card-type-name { display: block; min-width: 0; margin: 0; }
.card-type-name input { width: 100%; font-weight: 600; }
/* العدّاد: رقم واحد بيقول النوع ده شغّال على مين. الصفر بياخد نبرة تحذير
   لأنه غالبًا غلط في الترتيب مش اختيار. */
.card-type-count {
  padding: 3px 9px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
}
.card-type-count.is-empty { color: var(--warning); border-color: var(--warning); background: var(--warning-soft); }
.card-type-count.is-off { opacity: .7; }
.card-type-tools { display: inline-flex; align-items: center; gap: 4px; }
.card-type-switch {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  color: var(--muted); font-size: var(--fs-min); font-weight: 700;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.card-type-switch .icon { width: 14px; height: 14px; }
.card-type-switch.is-on { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.card-type-switch:hover { border-color: var(--accent); }
.card-type-icon-btn, .card-type-remove, .card-cond-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; color: var(--muted);
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.card-type-icon-btn .icon, .card-type-remove .icon, .card-cond-remove .icon { width: 15px; height: 15px; }
.card-type-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.card-type-remove:hover:not([disabled]), .card-cond-remove:hover:not([disabled]) {
  color: var(--danger); background: var(--danger-soft); border-color: var(--danger);
}
.card-type-remove[disabled], .card-cond-remove[disabled] { cursor: default; opacity: .3; }
.card-type-body {
  display: grid; gap: 10px; padding: 10px; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel);
}
.card-type-field { display: grid; gap: 5px; min-width: 0; margin: 0; }
.card-type-field > span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.card-type-field.full { grid-column: 1 / -1; }
.card-type-field.wide { grid-column: 2 / -1; }
.card-type-field input, .card-type-field select { width: 100%; }
.card-type-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--fs-min); line-height: 1.6; }

/* الشروط: كل شرط سطر مستقل بكلمة ربط على أوله، فالنوع بيتقرا جملة واحدة
   من فوق لتحت بدل ما يبقى إعداد مخبّي في قايمة منسدلة. */
.card-type-conditions {
  display: grid; gap: 8px; padding: 9px; grid-column: 1 / -1;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.card-cond-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-cond-caption > span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.card-cond-mode select { font-size: var(--fs-min); }
.card-cond-mode.is-idle { opacity: .5; }
.card-cond-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.card-cond-row {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 34px auto minmax(0, 1fr) auto 30px;
}
.card-cond-lead { color: var(--muted); font-size: var(--fs-min); font-weight: 700; text-align: center; }
.card-cond-not {
  display: inline-flex; align-items: center; gap: 4px; margin: 0;
  color: var(--muted); font-size: var(--fs-min); font-weight: 700; cursor: pointer;
}
.card-cond-not input { width: 14px; height: 14px; margin: 0; }
.card-cond-rule { width: 100%; min-width: 0; }
.card-cond-value { display: inline-flex; align-items: center; gap: 6px; }
.card-cond-value small { color: var(--muted); font-size: var(--fs-min); white-space: nowrap; }
.card-cond-value input { width: 74px; }
.card-cond-hint { grid-column: 1 / -1; margin: 0 0 0 42px; color: var(--muted); font-size: var(--fs-min); line-height: 1.6; }
.card-cond-add { justify-self: start; font-size: var(--fs-min); }

/* سطر الخلاصة: نفس الشروط مكتوبة عربي في جملة، عشان تتأكد إن اللي اخترته
   هو اللي في دماغك قبل ما تحفظ. */
.card-type-summary {
  grid-column: 1 / -1; margin: 0; padding: 7px 9px;
  color: var(--ink); font-size: var(--fs-min); line-height: 1.7;
  border: 1px dashed var(--line); border-radius: 9px; background: var(--panel-2);
}
.card-type-summary b { color: var(--muted); }
.card-type-flag { grid-column: 1 / -1; margin: 0; font-size: var(--fs-min); line-height: 1.6; }
.card-type-flag.muted { color: var(--muted); }
.card-type-flag.warning { color: var(--warning); font-weight: 600; }
.card-type-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-type-total { margin: 0; }
.card-type-var-list {
  display: grid; gap: 6px; margin: 0; padding: 0; list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.card-type-var-list li { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-min); }
.card-type-var-list code { color: var(--accent); font-size: var(--fs-min); font-weight: 700; white-space: nowrap; }
.card-type-var-list span { color: var(--muted); }

/* «جرّب على طالب»: السلّم بيتفرج عليه وهو بيمشي — كل نوع ونتيجته على الطالب
   ده، والكسبان متعلّم عليه. */
.card-probe-bar {
  display: grid; align-items: center; gap: 10px; margin-bottom: 8px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr);
}
.card-probe-tile { --sample-tile: .95; }
.card-probe-reason { margin: 0; color: var(--muted); font-size: var(--fs-min); line-height: 1.6; }
.card-probe-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.card-probe-row {
  display: grid; align-items: center; gap: 8px; padding: 6px 8px;
  grid-template-columns: 20px auto minmax(0, 1fr) auto;
  border: 1px solid transparent; border-radius: 9px; font-size: var(--fs-min);
}
.card-probe-row.is-win { border-color: var(--success); background: var(--success-soft); }
.card-probe-row.is-shadowed { border-color: var(--line); background: var(--panel-2); }
.card-probe-row.is-off, .card-probe-row.is-miss { opacity: .62; }
.card-probe-rank { color: var(--muted); font-size: var(--fs-min); font-weight: 700; text-align: center; }
.card-probe-name { font-weight: 600; }
.card-probe-verdict { color: var(--muted); font-size: var(--fs-min); white-space: nowrap; }
.card-probe-conds { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 3 / -1; }
.card-probe-conds i { font-size: var(--fs-min); font-style: normal; }
.card-probe-conds i.ok { color: var(--success); }
.card-probe-conds i.no { color: var(--muted); }

@media (max-width: 900px) {
  .card-type-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-type-field.wide { grid-column: 1 / -1; }
  .card-type-var-list { grid-template-columns: 1fr; }
  .card-probe-bar { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  /* الاسم بياخد سطر لوحده: خمس أعمدة في ٣٢٠ بكسل كانت بتخنق خانة الكتابة. */
  .card-type-head { grid-template-columns: 22px auto minmax(0, 1fr) auto; }
  .card-type-name { grid-column: 1 / -1; grid-row: 2; }
  .card-type-tools { flex-wrap: wrap; justify-content: flex-end; }
  .card-type-body { grid-template-columns: 1fr; }
  .card-type-remove, .card-type-icon-btn { width: 34px; height: 34px; }
  /* الشرط بينفرد على سطرين: القاعدة فوق ورقمها تحت، عشان القايمة المنسدلة
     ما تفضلش أربع كلمات في عمود ٩٠ بكسل. */
  .card-cond-row { grid-template-columns: 34px auto minmax(0, 1fr) 30px; }
  .card-cond-value { grid-column: 2 / 4; }
  .card-cond-hint { margin-inline-start: 0; }
  .card-probe-row { grid-template-columns: 20px auto minmax(0, 1fr); }
  .card-probe-verdict { grid-column: 2 / -1; }
  .card-probe-conds { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .theme-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-color-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .icon-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .icon-control-grid { grid-template-columns: 1fr; }
  .tile-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .appearance-live-badge { display: none; }
  /* الكارت على الموبايل بيتنازل عن السهم: العرض كله هدف للمس أصلاً. */
  .settings-cards { grid-template-columns: 1fr; }
  .settings-card { grid-template-columns: 40px minmax(0, 1fr); padding: 13px; border-radius: 16px; }
  .settings-card-icon { width: 40px; height: 40px; border-radius: 12px; }
  .settings-card-go { display: none; }
  .settings-hub, .settings-detail { gap: 18px; }
  .settings-hero { grid-template-columns: 1fr; gap: 14px; padding: 18px 18px 18px 20px; }
  .settings-hero-copy h2 { font-size: 17.5px; }
  .settings-detail-head { gap: 12px; padding: 15px 16px; }
  .settings-detail-icon { width: 44px; height: 44px; border-radius: 14px; }
  .settings-detail-copy h2 { font-size: 16.5px; }
  /* التبويبات بتلف جوّه الإطار المجمّع بدل ما تخرج بره الشاشة. */
  .appearance-tabs-group { display: flex; flex-wrap: wrap; width: 100%; }
  .appearance-tab { flex: 1 1 auto; justify-content: center; padding: 8px 10px; font-size: var(--fs-min); }
  .theme-presets { grid-template-columns: 1fr; }
  .theme-preset-card { grid-template-columns: 70px 1fr; min-height: 80px; }
  .theme-preset-preview { width: 70px; height: 56px; }
  .theme-color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .gradient-angle-field { align-items: stretch; flex-direction: column; margin-inline: 10px; }
  .gradient-angle-control { min-width: 0; width: 100%; }
  .icon-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-presets { grid-template-columns: 1fr; }
  /* المعاينة على الموبايل بتلف بدل ما تخرج بره البانل. */
  .tile-sample-row { grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); }
  .tile-order-list { padding: 8px; }
  .tile-order-row { gap: 8px; padding: 6px 8px; }
  /* السهم على اللمس محتاج مساحة إصبع — ٢٦ بكسل كانت هدف صغير لزرار مالوش بديل. */
  .tile-order-move { width: 34px; height: 34px; font-size: var(--fs-min); }
  /* الصف الأفقي بيتكسر لعمودين فوق بعض على الموبايل — من غير flex-basis عشان
     الاتجاه العمودي بيحوّلها لارتفاع ويرمي الحقل بره الشاشة. */
  .icon-control { align-items: stretch; flex-direction: column; }
  .icon-control-input { min-width: 0; width: 100%; }
  .appearance-preview { grid-template-columns: 56px 1fr; min-height: 120px; }
  .appearance-preview-page { padding: 15px; }
  .appearance-preview-cards i { height: 38px; }
  .appearance-actions > * { width: 100%; }
}

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.help-card { display: grid; gap: 8px; transition: transform var(--speed); }
.help-card:hover { transform: translateY(-3px); }
.help-card h2 { font-size: 15px; }
.help-card p { color: var(--muted); font-weight: 600; font-size: 13px; }
.help-icon { width: 26px; height: 26px; color: var(--accent); }

/* دليل المساعدة: كل جزء من السيستم سطر واحد مقفول — أيقونة واسم وسطر بيقول
   بيعمل إيه — وبيفتح على خطواته بالترتيب. الأرقام دواير بلون السيستم لأن
   الترتيب هنا معلومة: الخطوة التانية مابتشتغلش قبل الأولى. */
.help-page { display: grid; gap: 22px; }
.help-intro { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.help-intro .help-icon { width: 34px; height: 34px; }
.help-intro-copy { display: grid; gap: 4px; min-width: 0; }
.help-intro-copy h2 { font-size: 18px; text-wrap: balance; }
.help-intro-copy p { color: var(--muted); font-weight: 600; font-size: 13px; line-height: 1.8; max-width: 62ch; }
/* الجولة عمود لوحدها بعرض ثابت ورا خط فاصل: الزرار بعرض العمود كله والسطر
   اللي تحته متوسّط تحته. بـ`max-width` بس الزرار كان قد كلامه والسطر بيلف
   بعرض مختلف عنه، فكانوا بيبانوا مش راكبين على بعض. */
.help-intro-actions {
  display: grid; gap: 8px; width: 250px;
  padding-inline-start: 20px; border-inline-start: 1px solid var(--line);
}
.help-intro-actions .primary-mini { width: 100%; min-height: 42px; justify-content: center; font-size: max(var(--fs-min), 14px); }
.help-intro-actions small { color: var(--muted); font-size: var(--fs-min, 12px); font-weight: 600; line-height: 1.6; text-align: center; text-wrap: balance; }
.help-group { display: grid; gap: 10px; }
.help-group-title { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .02em; padding-inline-start: 4px; }
.help-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.panel.help-topic { padding: 0; overflow: clip; }
.help-topic > summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.help-topic > summary::-webkit-details-marker { display: none; }
.help-topic > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: inherit; }
.help-topic[open] > summary { border-bottom: 1px solid var(--line); }
.help-topic-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.help-topic-icon .icon { width: 20px; height: 20px; }
.help-topic-copy { display: grid; gap: 2px; min-width: 0; }
.help-topic-copy strong { font-size: 15px; color: var(--ink); }
.help-topic-copy small { color: var(--muted); font-weight: 600; font-size: 12.5px; line-height: 1.6; }
.help-topic-count { font-size: var(--fs-min, 12px); font-weight: 700; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.help-topic-toggle { width: 18px; height: 18px; color: var(--muted); transition: transform var(--speed, .2s); }
.help-topic[open] .help-topic-toggle { transform: rotate(45deg); color: var(--accent); }
.help-topic-body { display: grid; gap: 12px; padding: 14px 16px 16px; }
.help-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: help-step; }
.help-steps li {
  counter-increment: help-step;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.85;
}
.help-steps li::before {
  content: counter(help-step, arabic-indic);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.help-tip { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--warning-soft); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.8; }
.help-tip .icon { width: 18px; height: 18px; margin-top: 4px; color: var(--warning); }
.help-topic-go { justify-self: start; }
@media (max-width: 620px) {
  .help-intro { grid-template-columns: auto 1fr; }
  .help-intro-actions { grid-column: 1 / -1; width: auto; padding-inline-start: 0; border-inline-start: 0; }
  .help-topics { grid-template-columns: 1fr; }
  .help-topic > summary { grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px 14px; }
  .help-topic-count { display: none; }
  .help-topic-go { justify-self: stretch; }
}
@media (prefers-reduced-motion: reduce) { .help-topic-toggle { transition: none; } }

/* ------------------------------ الحالات الفارغة ------------------------------ */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 36px 20px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.empty-icon { width: 30px; height: 30px; opacity: 0.6; }

.empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-block-start: 2px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid transparent;
  color: var(--accent);
  font-weight: 800;
  transition: all var(--speed);
}
.empty-action:hover { background: var(--accent); color: #fff; }
.empty-action .icon { width: 16px; height: 16px; }
.empty-action.is-secondary { background: transparent; border-color: var(--line); color: var(--muted); }
.empty-action.is-secondary:hover { border-color: var(--accent); background: var(--panel-2); color: var(--accent); }

/* ------------------------------ النماذج ------------------------------ */

.field { display: grid; gap: 6px; }
.field span { font-size: var(--fs-min); font-weight: 800; color: var(--muted); }

.field input, .field select {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
  outline: 0;
  width: 100%;
  transition: border-color var(--speed), box-shadow var(--speed);
}

.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[readonly] { opacity: 0.7; }

/* السطر اللي تحت الخانة: شرطها وهي فاضية، وغلطها وهي غلط — نفس المكان في
   الحالتين. الرسالة في ركن الشاشة بتخلّي الزائر يدوّر على الخانة المقصودة
   بين تلات خانات، ودي شغلانة الصفحة مش شغلانته. */
.field-note {
  font-size: max(var(--fs-min), 11.5px);
  font-weight: 700;
  line-height: 1.6;
  color: var(--muted);
}
.field-note.bad { color: var(--danger); font-weight: 800; }
.field.bad input, .field.bad select { border-color: var(--danger); }
.field.bad input:focus, .field.bad select:focus { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.field.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.field.checkbox-field input { width: 20px; height: 20px; padding: 0; accent-color: var(--gold); grid-row: 1 / span 2; }
.field.checkbox-field span { color: var(--ink); font-size: 13px; }
.field.checkbox-field small { color: var(--muted); font-size: var(--fs-min); }

.field textarea {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
  font-family: inherit;
  line-height: 1.7;
  outline: 0;
  width: 100%;
  resize: vertical;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }

.settings-grid .full-span { grid-column: 1 / -1; }
.templates-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end));
  color: var(--action-ink);
  font-weight: 800;
  transition: transform var(--speed), opacity var(--speed);
}

.submit-btn:hover { transform: translateY(-1px); opacity: 0.93; }
.submit-btn:disabled { opacity: 0.5; cursor: wait; transform: none; }
.submit-btn.danger { background: var(--danger); color: #fff; }
.submit-btn.full { grid-column: 1 / -1; }

/* ------------------------------ النوافذ ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  /* فوق طبقة الكاميرا العائمة (z-index جوه app.js): من غير كده كانت الكاميرا
     المرسّاة في نص الشاشة السفلي بتغطي نص نافذة التحصيل. */
  z-index: 2147483600;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 16, 20, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--speed);
}

.modal.open { opacity: 1; pointer-events: auto; }

.dialog {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 18px;
  transform: translateY(14px) scale(0.98);
  transition: transform var(--speed);
}

.modal.open .dialog { transform: translateY(0) scale(1); }

/* جولة التعريف لأول دخول: الهدف منوّر والباقي معتّم، والكارت جنبه. تحت
   النوافذ (.modal) بقصد — لو حاجة فتحت نافذة وسط الجولة، النافذة تفضل فوق. */
.tour { position: fixed; inset: 0; z-index: 2147483500; }
.tour [hidden] { display: none !important; }
.tour-shade { position: fixed; inset: 0; }
.tour.is-centered .tour-shade { background: rgba(8, 10, 20, .6); backdrop-filter: blur(2px); }
.tour-spot {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 200vmax rgba(8, 10, 20, .6);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.tour-card {
  position: fixed; display: grid; gap: 8px; width: min(340px, calc(100vw - 24px));
  padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lg);
  transition: top .25s ease, left .25s ease;
}
.tour.is-centered .tour-card { top: 50%; left: 50%; width: min(380px, calc(100vw - 24px)); transform: translate(-50%, -50%); }
.tour-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-count { color: var(--muted); font-size: var(--fs-min); font-weight: 800; font-variant-numeric: tabular-nums; }
.tour-end { min-height: 32px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 800; }
.tour-end:hover, .tour-end:focus-visible { background: var(--panel-2); color: var(--ink); }
.tour-card h2 { margin: 0; font-size: 17px; font-weight: 900; }
.tour-card p { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 600; line-height: 1.75; }
/* خطوة التشغيل فيها تلات زراير (السابق، تخطي، افتح…): على كارت ضيق بينزلوا سطر
   لوحدهم تحت النقط بدل ما يتزنقوا. */
.tour-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.tour-dots { display: flex; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--line); transition: width .2s ease, background .2s ease; }
.tour-dots i.on { width: 16px; background: var(--accent); }
.tour-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-inline-start: auto; }
.tour-nav button { min-height: 38px; }
.tour-go-slot { display: contents; }
.tour-open .welcome-note { display: none; }
@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-card, .tour-dots i { transition: none; }
}

/* ------------------------------ حسابي ------------------------------ */
/* الكارت اللي فوق هو «مين أنا» — الصورة والاسم والدور — وتحته كروت بتجاوب
   على سؤال واحد كل واحد: اشتراكي لحد إمتى، وبياناتي المسجّلة إيه، وكلمة
   المرور. الحقائق في شبكة خانات بخط فاصل رفيع زي «نمو الأعداد» مش صفوف
   جدول، عشان تتقري على الموبايل من غير ما تتقلب كروت. */
.account-page { display: grid; gap: 14px; max-width: 980px; }
.account-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: 14px 18px; padding: 18px 20px;
}
.account-avatar { position: relative; width: 84px; height: 84px; }
.account-avatar-img, .account-avatar-initial {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 26px; object-fit: cover;
  background: var(--accent-soft); color: var(--accent); font-size: 34px; font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
}
.account-photo-pick {
  position: absolute; inset-inline-end: -6px; bottom: -6px; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 12px; background: var(--panel); color: var(--ink); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line), 0 4px 12px rgba(10, 14, 30, .14);
}
.account-photo-pick .icon { width: 17px; height: 17px; }
.account-photo-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.account-photo-pick:focus-within { box-shadow: 0 0 0 3px var(--accent); }
.account-id { display: grid; gap: 5px; min-width: 0; }
.account-id h2 { margin: 0; font-size: 22px; font-weight: 900; overflow-wrap: anywhere; text-wrap: balance; }
.account-handle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.account-role { padding: 2px 10px; border-radius: 999px; background: var(--panel-2); color: var(--ink); font-size: 12.5px; font-weight: 800; }
.account-space { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.account-space .icon { width: 15px; height: 15px; flex: none; }
.account-hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; gap: 14px; }
.account-card { display: grid; align-content: start; gap: 12px; padding: 16px 18px; }
.account-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-card-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 900; }
.account-card-head h3 .icon { width: 18px; height: 18px; color: var(--accent); }
.account-status { padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.account-status.is-good { background: var(--success-soft); color: var(--success); }
.account-status.is-warn { background: var(--warning-soft); color: var(--warning); }
.account-status.is-danger { background: var(--danger-soft); color: var(--danger); }
.account-status.is-info { background: var(--accent-soft); color: var(--accent); }
.account-remaining { display: grid; gap: 8px; margin: 0; }
.account-remaining strong { font-size: 20px; font-weight: 900; }
.account-meter { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: var(--panel-2); }
.account-meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.account-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0;
  overflow: hidden; border-radius: 12px; background: var(--line); box-shadow: 0 0 0 1px var(--line);
}
.account-facts > div { display: grid; gap: 3px; min-width: 0; padding: 10px 12px; background: var(--panel); }
/* عدد فردي: الأخيرة بتاخد السطر كله بدل خانة فاضية بلون الخط جنبها. */
.account-facts > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.account-facts dt { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.account-facts dd { margin: 0; font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.account-empty { color: var(--muted); font-weight: 700; }
.account-note { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 600; line-height: 1.7; }
.account-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-field-wide { grid-column: 1 / -1; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.account-logout { color: var(--danger); }

@media (max-width: 620px) {
  .account-hero { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 16px; }
  .account-avatar { width: 68px; height: 68px; }
  .account-avatar-img, .account-avatar-initial { border-radius: 22px; font-size: 28px; }
  .account-id h2 { font-size: 19px; }
  .account-hero-actions { display: grid; grid-column: 1 / -1; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .account-hero-actions button, .account-foot button { justify-content: center; }
  .account-card { padding: 14px; }
  .account-fields { grid-template-columns: 1fr; }
  .account-foot button { flex: 1 1 0; }
}

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 17px; font-weight: 800; }
.dialog-head p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; margin-top: 3px; }

/* إضافة الطالب عملية سريعة ومتكررة؛ الأساسيات تفضل قدام العين، والحقول اللي
   بتتملّى أحيانًا فقط تدخل في طبقة ثانية بدل ما تزاحم قرار الحفظ. */
.student-create-dialog {
  width: min(700px, 100%); max-height: min(780px, calc(100dvh - 32px)); padding: 0;
  overflow: hidden; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: 26px;
  box-shadow: 0 32px 90px -34px rgba(4, 18, 39, .7), 0 12px 28px -18px rgba(4, 18, 39, .35);
}
.student-create-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 13px 18px; color: var(--ink); border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--accent));
}
.student-create-title-row, .student-dialog-heading { min-width: 0; }
.student-dialog-heading h2 { margin: 0; overflow: hidden; color: var(--ink); font-size: 17px; font-weight: 900; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis; }
.student-create-head .close-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  padding: 0; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel);
}
.student-create-head .close-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.student-create-scroll {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px;
  background: color-mix(in srgb, var(--panel-2) 34%, var(--panel)); scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.student-core-section { display: grid; gap: 13px; margin-bottom: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 12px 30px -30px rgba(12, 31, 52, .7); }
.student-section-head { display: flex; align-items: center; gap: 10px; }
.student-section-head > span { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.student-section-head > span .icon { width: 17px; height: 17px; }
.student-section-head h3 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 900; }
.student-section-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.student-form-core { gap: 12px; }
.student-form-core .field input, .student-form-core .field select {
  background: var(--panel-2); border-color: color-mix(in srgb, var(--ink) 10%, var(--line));
}
.student-optional {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); box-shadow: 0 10px 30px -28px rgba(12, 31, 52, .55);
  transition: border-color var(--speed), box-shadow var(--speed);
}
.student-optional::before {
  content: ''; position: absolute; inset: 0 0 auto; z-index: 1; height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 25%, var(--gold)));
  opacity: 0; transform: scaleX(.7); transition: opacity var(--speed), transform var(--speed);
}
.student-optional > summary {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 11px;
  min-height: 68px; padding: 11px 14px; cursor: pointer; list-style: none; user-select: none;
  transition: background var(--speed), color var(--speed);
}
.student-optional > summary::-webkit-details-marker { display: none; }
.student-optional > summary:hover { background: color-mix(in srgb, var(--accent-soft) 32%, var(--panel)); }
.student-optional > summary:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: -3px; }
.student-optional-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 38%, var(--panel)));
  color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}
.student-optional-icon .icon { width: 19px; height: 19px; }
.student-optional-copy { display: grid; gap: 2px; min-width: 0; }
.student-optional-copy strong { color: var(--ink); font-size: 15px; font-weight: 900; }
.student-optional-copy small { color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.student-optional-badge { padding: 4px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap; }
.student-optional-toggle { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.student-optional-arrow { width: 18px; height: 18px; color: var(--muted); transform: rotate(0); transition: transform var(--speed); }
.student-optional[open] { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: 0 18px 42px -34px rgba(12, 88, 81, .7); }
.student-optional[open]::before { opacity: 1; transform: scaleX(1); }
.student-optional[open] > summary { background: color-mix(in srgb, var(--accent-soft) 30%, var(--panel)); }
.student-optional[open] .student-optional-toggle { border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); background: var(--accent-soft); }
.student-optional[open] .student-optional-arrow { transform: rotate(-90deg); }
.student-optional-body { display: grid; gap: 10px; padding: 12px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel-2) 58%, var(--panel)); animation: student-details-in 200ms ease-out both; }
.student-optional-section { display: grid; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.student-optional-section-head { display: flex; align-items: center; gap: 10px; }
.student-optional-section-head > span { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.student-optional-section-head .icon { width: 16px; height: 16px; }
.student-optional-section-head div { min-width: 0; }
.student-optional-section-head h3 { margin: 0; color: var(--ink); font-size: 13.5px; font-weight: 900; }
.student-optional-section-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.student-optional-grid { gap: 11px; }
.student-form-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 22px;
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 -16px 34px -32px rgba(6, 24, 43, .75); backdrop-filter: blur(12px);
}
.student-form-footer p { display: flex; align-items: flex-start; gap: 6px; max-width: 330px; color: var(--muted); font-size: var(--fs-min); font-weight: 650; line-height: 1.6; }
.student-form-footer p .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 2px; color: var(--success); }
.student-form-actions { display: flex; align-items: center; gap: 8px; }
.student-form-footer .submit-btn { min-width: 154px; }
.student-form-footer .ghost-btn { min-width: 82px; }

/* تعديل الطالب وإضافة الدفعة يستخدمان نفس لغة نافذة الإضافة، لكن كل مهمة
   لها عرض ومحتوى يناسبانها. الرأس والتذييل ثابتان، والتمرير داخل المحتوى فقط. */
.student-edit-dialog { width: min(760px, 100%); }
.student-edit-scroll { display: grid; gap: 12px; }
.student-edit-section {
  display: grid; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); box-shadow: 0 12px 30px -30px rgba(12, 31, 52, .7);
}
.student-edit-details { display: block; padding: 0; overflow: hidden; }
.student-edit-summary {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 11px;
  min-height: 66px; padding: 10px 13px; cursor: pointer; list-style: none;
  transition: background var(--speed);
}
.student-edit-summary::-webkit-details-marker { display: none; }
.student-edit-summary:hover { background: color-mix(in srgb, var(--accent-soft) 28%, var(--panel)); }
.student-edit-summary:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: -3px; }
.student-edit-summary > span:first-child {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.student-edit-summary > span:first-child .icon { width: 18px; height: 18px; }
.student-edit-summary h3 { margin: 0; font-size: 14px; font-weight: 900; }
.student-edit-summary p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.student-edit-count {
  padding: 4px 9px; border-radius: 999px; background: var(--panel-2);
  color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap;
}
.student-edit-details-body {
  padding: 13px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 50%, var(--panel));
  animation: student-details-in 180ms ease-out both;
}
.student-edit-details[open] { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.student-edit-details[open] .student-edit-summary { background: color-mix(in srgb, var(--accent-soft) 24%, var(--panel)); }
.student-edit-details[open] .student-optional-arrow { transform: rotate(-90deg); }
.student-status-section {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 14%, var(--panel));
}
.student-edit-section .field-hint {
  margin: 0; padding: 10px 12px; border-radius: 11px;
  background: var(--panel-2); line-height: 1.65;
}

.student-create-dialog.bulk-dialog { width: min(1080px, 100%); }
.bulk-dialog-scroll { display: grid; gap: 10px; padding-block: 13px; }
.bulk-shared-card { margin-bottom: 0; }
.bulk-list-card {
  display: grid; gap: 10px; min-width: 0; padding: 13px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel);
  box-shadow: 0 12px 30px -30px rgba(12, 31, 52, .7);
}
.bulk-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bulk-ready-count {
  flex: 0 0 auto; padding: 5px 10px; border-radius: 999px;
  background: var(--success-soft); color: var(--success); font-size: var(--fs-min); font-weight: 850;
}
.bulk-rows { border-radius: 14px; background: var(--panel-2); scrollbar-gutter: stable; }
.bulk-table thead { position: sticky; top: 0; z-index: 2; background: var(--panel-2); }
.bulk-table tbody tr { background: var(--panel); }
.bulk-add-row { justify-self: start; }
.bulk-actions .student-form-actions { margin-inline-start: auto; }
@keyframes student-details-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 620px) {
  #studentModal, #editStudentModal, #bulkStudentsModal { place-items: end center; padding: 8px 8px 0; }
  .student-create-dialog, .student-edit-dialog, .student-create-dialog.bulk-dialog { width: 100%; max-height: calc(100dvh - 8px); border-radius: 24px 24px 0 0; }
  .student-create-head { padding: 12px; }
  .student-dialog-heading h2 { font-size: 16px; }
  .student-create-scroll { padding: 12px; }
  .student-core-section { padding: 13px; }
  .student-optional > summary { grid-template-columns: auto minmax(0, 1fr) auto; padding-inline: 11px; }
  .student-optional-badge { display: none; }
  .student-optional-body { padding: 9px; }
  .student-optional-section { padding: 12px; }
  .student-edit-section, .bulk-list-card { padding: 13px; }
  .student-edit-details { padding: 0; }
  .student-edit-summary { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 62px; padding: 9px 11px; }
  .student-edit-count { display: none; }
  .student-edit-details-body { padding: 11px; }
  .bulk-list-head { align-items: flex-start; }
  .bulk-rows { max-height: none; overflow: visible; background: transparent; scrollbar-gutter: auto; }
  .bulk-table tbody > tr > td:first-child { display: none; }
  .bulk-table tbody > tr > td:last-child { grid-column: 1 / -1; }
  .bulk-table tbody > tr > td:last-child::before { display: none; }
  .bulk-table tbody > tr > td:last-child .table-action { width: 100%; justify-content: center; }
  .bulk-add-row { width: 100%; justify-content: center; }
  .student-form-footer { display: grid; gap: 9px; padding: 11px 12px max(11px, env(safe-area-inset-bottom)); }
  .student-form-footer p { max-width: none; }
  .student-form-actions { display: grid; grid-template-columns: minmax(0, .42fr) minmax(0, 1fr); }
  .student-form-footer .submit-btn, .student-form-footer .ghost-btn { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .student-optional, .student-optional::before, .student-optional-arrow { transition: none; }
  .student-optional-body, .student-edit-details-body { animation: none; }
  .subs-drawer.is-entering { animation: none; }
}

.close-btn { padding: 8px; border-radius: 10px; color: var(--muted); transition: all var(--speed); }
.close-btn:hover { background: var(--panel-2); color: var(--ink); }

.confirm-dialog { width: min(420px, 100%); text-align: right; }
.confirm-dialog p { color: var(--muted); font-weight: 600; white-space: pre-line; } /* pre-line عشان رسائل التأكيد المتعددة السطور */
/* قائمة العمليات المرفوضة جوه نافذة التنبيه — بتطول، فبتتمرّر لوحدها. */
.notice-list { margin: 12px 0; padding-inline-start: 18px; display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; color: var(--muted); font-weight: 600; font-size: 14px; }
.notice-list li { line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions .submit-btn { height: 44px; }

/* -------------------------- تعارضات المزامنة -------------------------- */

.conflict-dialog { width: min(540px, 100%); gap: 14px; }
.conflict-lead { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }
.conflict-counter { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.conflict-error { color: #b42318; font-size: max(var(--fs-min), 12.5px); font-weight: 700; }

.conflict-list { display: grid; gap: 12px; }

.conflict-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}
.conflict-entity { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.conflict-field { font-size: 15px; font-weight: 800; }
.conflict-note { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 600; }
.conflict-explanation { display: grid; gap: 4px; padding: 11px 12px; border-radius: 13px; color: var(--ink); background: var(--warning-soft); }
.conflict-explanation strong { color: var(--warning); font-size: var(--fs-min); font-weight: 900; }
.conflict-explanation p { color: var(--muted); font-size: var(--fs-min); font-weight: 650; line-height: 1.75; }

.conflict-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.conflict-value {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.conflict-value strong { font-size: 15px; font-weight: 800; }
.conflict-value small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.conflict-value-tag { font-size: var(--fs-min); font-weight: 800; color: var(--muted); }
.conflict-value.mine { border-color: #2e90fa; }
.conflict-value.mine .conflict-value-tag { color: #1849a9; }
.conflict-value.theirs { border-color: #f79009; }
.conflict-value.theirs .conflict-value-tag { color: #b54708; }
.dark-mode .conflict-value.mine .conflict-value-tag { color: #84caff; }
.dark-mode .conflict-value.theirs .conflict-value-tag { color: #fec84b; }

.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.conflict-actions button { flex: 1 1 160px; height: 42px; }
.conflict-apply-all { display: flex; align-items: center; gap: 8px; font-size: max(var(--fs-min), 12.5px); font-weight: 700; color: var(--muted); }
.conflict-history summary { cursor: pointer; font-weight: 800; font-size: 13px; margin-top: 12px; }

@media (max-width: 620px) {
  .conflict-values { grid-template-columns: 1fr; }
}

/* ------------------------------ التوست ------------------------------ */

.toast-container {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  /* أعلى من النوافذ والكاميرا: رسالة «تم الحفظ» لازم تبان فوق أي طبقة. */
  z-index: 2147483700;
  display: grid;
  gap: 8px;
  max-width: min(380px, calc(100vw - 44px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--page);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border-inline-start: 4px solid var(--success);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* التوست اللي عليه «تراجع» بيبقى سطرين على الموبايل وسطر واحد على الشاشة
   الواسعة. الزرار مقلوب الألوان عن التوست نفسه عشان يبان إنه زرار مش نص. */
.toast.with-undo { flex-wrap: wrap; }
.toast-text { min-width: 0; flex: 1 1 180px; line-height: 1.55; }
.toast-undo {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  font-weight: 900;
  font-size: 12.5px;
  transition: opacity var(--speed);
}
.toast-undo:hover { opacity: 0.82; }
.toast-undo:disabled { opacity: 0.5; cursor: progress; }
.toast-close { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-inline-end: -7px; border-radius: 9px; color: currentColor; font-size: 21px; line-height: 1; opacity: .72; }
.toast-close:hover, .toast-close:focus-visible { background: color-mix(in srgb, currentColor 12%, transparent); opacity: 1; outline: none; }

/* ------------------------------ السكيلتون ------------------------------ */

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.skeleton-panel { grid-column: 1 / -1; height: 320px; }

.skeleton-card, .skeleton-panel {
  height: 110px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--panel) 40%, var(--panel-2) 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border: 1px solid var(--line);
}

.skeleton-panel { height: 320px; }

/* ------------------------------ الحركات ------------------------------ */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tabIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes countIn { from { opacity: 0; transform: translateY(6px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes dash { to { stroke-dashoffset: 0; } }
@keyframes barIn { from { opacity: 0; transform: scaleY(0.2); } to { opacity: 1; transform: scaleY(1); } }
@keyframes hbarIn { from { opacity: 0; transform: scaleX(0.15); } to { opacity: 1; transform: scaleX(1); } }

/* ------------------------------ الطباعة ------------------------------ */

.print-only { display: none; }

@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .sidebar, .topbar, .quick-search, .notifications-panel, .no-print, .toast-container, .modal { display: none !important; }
  .app-shell { padding: 0; display: block; }
  .panel { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; margin-bottom: 12px; }
  .executive-card { background: #fff; color: #000; border: 1px solid #ddd; }
  .executive-card h2, .executive-card p { color: #000; }
  .print-only { display: block; }
  .donut-center, .donut-sub { fill: #000; }
  .bar-value, .hbar-value { color: #000; }
  .bar-label, .hbar-label { color: #333; }
  .bar-fill, .hbar-fill { animation: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  table { min-width: 0; }
}

/* ------------------------------ الاستجابة ------------------------------ */

/* ===== قواعد الموبايل المشتركة =====
   القواعد دي بتتطبق على كل الصفحات مرة واحدة، فأي جدول أو زر جديد بياخد
   نفس المعاملة من غير ما حد يفتكر يكتبله ميديا كويري خاصة بيه.

   الانتقاء متظبط بحيث الأجزاء اللي ليها شكل خاص (زي جدول الاشتراكات
   بصفوفه المفرودة) تقدر تكسر القاعدة دي بمجرد ما تستخدم كلاس واحد:
   الجزء `:where(.table-wrap)` وزنه صفر، فالمُحدِّد كله وزنه عناصر بس. */
@media (max-width: 760px) {
  /* كل جدول بيتحول لكروت بدل التمرير الأفقي. التمرير الأفقي جوه صندوق
     ضيق كان بيخبّي نص الأعمدة، وكل جدول كان بيتصرف بطريقة مختلفة. */
  :where(.table-wrap) { overflow-x: visible; border: 0; border-radius: 0; }
  /* !important عشان الجداول اللي بتفرض min-width بكلاس خاص بيها
     (.finance-table، .subs-operations-table، .groups-report-table…) —
     من غيره بتفضل بتتمرّر أفقيًا وهي متحولة لكروت. */
  :where(.table-wrap) > table { min-width: 0 !important; display: block; }
  /* الرأس بيفضل موجود لقارئ الشاشة، وبيتنقل لكل خلية عبر data-label. */
  :where(.table-wrap) > table > thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  :where(.table-wrap) > table > tbody { display: block; }
  :where(.table-wrap) > table > tbody > tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px;
    margin-bottom: 10px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  }
  :where(.table-wrap) > table > tbody > tr:last-child { margin-bottom: 0; }
  :where(.table-wrap) > table > tbody > tr > td {
    display: grid; align-content: start; gap: 3px; padding: 6px 0; border: 0;
  }
  /* العنوان بيورث تنسيق الخانة، فالخانات اللاتينية (رقم العملية بخط Courier
     ومسافات حروف واتجاه ltr) كانت بتطلع العنوان العربي متباعد الحروف ومقلوب
     الاتجاه. العنوان لغته لغة الواجهة مهما كانت القيمة اللي تحته. */
  :where(.table-wrap) > table > tbody > tr > td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: var(--fs-min); font-weight: 800;
    font-family: 'Cairo', Tahoma, Arial, sans-serif; letter-spacing: normal; direction: rtl; text-align: start;
  }
  /* الاسم والإجراءات بيمدوا على عرض الكارت كله. */
  :where(.table-wrap) > table > tbody > tr > td[colspan],
  :where(.table-wrap) > table > tbody > tr > td.cell-wide { grid-column: 1 / -1; }
  :where(.table-wrap) > table > tbody > tr > td.num { text-align: start; }

  /* حد أدنى للمس: صفوف البيانات هي طريقة التعامل الأساسية مع الطالب،
     وأزرارها كانت 26–36px يعني أقل من المساحة اللي الصباع محتاجها. */
  .table-action, .excellence-toggle, .zoom-step, .zoom-preset,
  .primary-mini, .period-chip, .rec-btn, .payment, .excellence-remove,
  .ghost-btn, .submit-btn, .primary-action {
    min-height: var(--tap);
  }
  .table-action, .excellence-toggle, .zoom-step, .toolbar-icon-btn {
    min-width: var(--tap); justify-content: center; padding: 8px 12px;
  }
  .toolbar-icon-btn { min-height: var(--tap); padding: 0; }
  .table-action .icon { width: 18px; height: 18px; }
  /* «تعديل» جوه كارت الطالب: زر صغير جنب السعر، بياخد ارتفاع أقل من الباقي
     عشان ما يكسرش شكل الكارت، بس لسه فوق حد اللمس المريح. */
  .inline-edit-fee { min-height: 36px; padding: 7px 12px; font-size: var(--fs-min); }
  /* اسم الطالب زرار بيفتح ملفه، وكان 22px يعني نص حد اللمس. بنكبّر مساحة
     اللمس بطبقة شفافة فوقه بدل ما نكبّر الصندوق نفسه — كده الكارت يفضل
     بنفس الكثافة والصباع يلاقي هدف كامل. */
  .student-name.link { position: relative; display: inline-block; padding-block: 6px; }
  .student-name.link::after { content: ''; position: absolute; inset: -5px -6px; }
  select, input:not([type="checkbox"]):not([type="radio"]), textarea,
  .field input, .field select { min-height: var(--tap); }
  /* صفوف الإجراءات بتتوزع بالتساوي بدل ما تتكدس في ركن. */
  .row-actions, .finance-entry-actions { flex-wrap: wrap; gap: 8px; }

  /* صف رصد الدرجة: الاسم سطر لوحده وخانة الدرجة تحته. الاسم كان
     white-space: nowrap فبيفرض عرض الصف كله، واللوحة تخرج بره الشاشة
     وتتقص من غير تمرير (body عنده overflow-x: clip). */
  .grade-row { flex-wrap: wrap; }
  .grade-row > .student-cell { flex: 1 1 100%; }
  .grade-row .student-name { white-space: normal; overflow: visible; }
  .grade-row input { flex: 1 1 auto; width: auto; }
  .grade-state-field { flex: 1 1 calc(50% - 5px); }
  .grade-state-field select { width: 100%; }
}

@media (max-width: 1150px) {
  .dashboard-main { grid-template-columns: 1fr 1fr; }
  .split-layout, .exams-layout { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 900px) {
  html, body { overflow-x: clip; } /* clip مش hidden: hidden بيكسر كل position:sticky في الصفحة */
  .app-shell { padding: 12px; gap: 12px; }

  /* القائمة الجانبية وزرارها بيختفوا خالص على الموبايل: الشريط السفلي فيه
     التبويبات الأربعة، وورقة «المزيد» فيها الاحداشر الباقيين والخروج والحقوق.
     يعني مفيش حاجة كانت في الدرج ومش موجودة تحت. */
  .sidebar, .menu-btn { display: none; }

  .dashboard-main { grid-template-columns: 1fr; }
  .topbar-title { gap: 9px; }
  .topbar-brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 8px 18px -10px rgba(6, 13, 46, .7);
  }
  .topbar-brand-mark .brand-logo { width: 28px; height: 28px; }
  .topbar-brand-name { font-size: 17px; font-weight: 900; }
  .page-heading { gap: 10px; padding: 11px 13px; border-radius: 16px; }
  .page-heading::after { width: 125px; height: 125px; inset: auto -38px -70px auto; }
  .page-heading-mark { width: 38px; height: 38px; border-radius: 12px; }
  .page-heading-mark .icon { width: 18px; height: 18px; }
  .page-heading-copy { gap: 0; }
  .page-heading-eyebrow { display: none; }
  .page-heading h1 { font-size: 19px; line-height: 1.35; }
  .page-heading p { font-size: var(--fs-min); line-height: 1.5; }
  /* الشريط العلوي بيلف أصلاً؛ الأزرار جواه لازم تلف كمان وإلا بتخرج بره الشاشة. */
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; row-gap: 8px; }
  .page-subtitle { display: none; }
  /* الإضافة قرار أساسي، فاسمها يفضل ظاهر بدل زر + مبهم. المقاس المدمج يمنع
     الشريط العلوي من التضخم على الموبايل. */
  .top-actions .primary-action { height: 42px; padding-inline: 13px; gap: 6px; font-size: var(--fs-min); }
  .primary-action span { display: inline; white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
  .students-card-grid { grid-template-columns: 1fr; }
  .activity-row { grid-template-columns: 1fr; gap: 4px; }
  .notifications-panel { inset-inline-end: 12px; top: 70px; }
}

@media (max-width: 620px) {
  .student-card-meta { grid-template-columns: 1fr; }
  .student-card-head { flex-direction: column; }
  .student-card-badges { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}

/* ---------------------- أزرار السنة والشهر في الداشبورد ---------------------- */

.period-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.period-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.period-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: max(var(--fs-min), 12.5px);
  color: var(--muted);
  min-width: 62px;
}
.period-label .icon { width: 16px; height: 16px; }

.compact-period-select { position: relative; display: inline-flex; align-items: center; }
.compact-period-select select {
  min-width: 145px;
  appearance: none;
  padding: 7px 13px 7px 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft), var(--panel-2));
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 65%, transparent);
  transition: border-color var(--speed), background var(--speed), box-shadow var(--speed);
}
.academic-year-select select { min-width: 185px; }
.compact-period-select select:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); background: var(--panel); }
.compact-period-select select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compact-period-select .icon { position: absolute; left: 11px; width: 15px; height: 15px; pointer-events: none; color: var(--accent); }

.discount-choice-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.discount-choice-or { align-self: center; color: var(--muted); font-size: var(--fs-min); font-weight: 900; padding-top: 20px; }

@media (max-width: 620px) {
  .discount-choice-grid { grid-template-columns: 1fr; }
  .discount-choice-or { padding: 0; text-align: center; }
  .attendance-trend-panel { grid-column: auto; }
  .dash-exams { grid-column: auto; }
}

.chip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }

/* الشيبس دي هي وسيلة الفلترة الوحيدة في المراحل والاشتراكات، وكانت أصغر
   عنصر على الشاشة (٣٤px) بينما أزرار الحضور اللي بتوصل لها اتظبطت على ٤٠px.
   نفس متغيّر اللمس بتاع الأزرار. */
.period-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  transition: all var(--speed);
}
/* الأيقونة جوه الشيب بمقاس ثابت — من غيرها كانت بتاخد مقاس .icon الافتراضي
   وتزوّد ارتفاع الشيب عن باقي شيبس نفس الصف. */
.period-chip .icon { width: 15px; height: 15px; flex-shrink: 0; }
.period-chip:hover { border-color: var(--accent); color: var(--accent); }

/* عدّاد الفلتر: خانة مستقلة، مش رقم لازق في الاسم بعد فاصلة نقطية.

   «دفعوا · ٠» كانت بتتقرا «دفعوا ٠٠»، لأن الفاصلة النقطية والصفر العربي (٠)
   شكلهم واحد بالظبط في الخط — والعين مش لاقية علامة تقول إن الاسم خلص والعدد
   بدأ. الخلفية والمسافة بيعملوا الفصل ده من غير أي علامة ترقيم أصلاً.

   `tabular-nums` عشان الأرقام تفضل على عرض واحد، فالشيبس تحت بعضها في القايمة
   السفلية تبقى أعمدتها مرصوصة بدل ما ترقص مع كل رقم. */
.chip-count {
  flex: none;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.5;
}
/* على الشيب المختار اللون كله متغيّر، فالخانة بتاخد شفافية بيضا بدل خليط
   `currentColor` اللي بيدوب في الخلفية الملوّنة. */
.period-chip.active .chip-count,
.risk-chip.active .chip-count { background: rgba(255, 255, 255, .28); }

/* نقطة بلون التصنيف قدام اسمه: نفس ألوان المربعات في الكشف، فاللي بتختاره من
   القايمة تعرف لونه قبل ما تشوف نتيجته. */
.card-type-chip::before {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--card-type-dot, var(--muted));
}
.card-type-chip.tone-good::before { background: var(--pulse-good); }
.card-type-chip.tone-info::before { background: var(--pulse-info); }
.card-type-chip.tone-warning::before { background: var(--pulse-warn); }
.card-type-chip.tone-danger::before { background: var(--pulse-danger); }
.card-type-chip.tone-violet::before { background: var(--pulse-violet); }
.card-type-chip.tone-teal::before { background: var(--pulse-teal); }
.card-type-chip.tone-idle::before { background: var(--pulse-idle-line); }
.card-type-chip.active::before { background: currentColor; }

/* تقسيمة التصنيفات في لوحة التحكم: كارت لكل نوع — لونه، اسمه، عدده، شريط
   نسبته. نفس تركيبة كروت الإحصائيات فوقها (اسم رمادي صغير، رقم كبير، سطر
   تفصيل تحت) عشان اللوحة تتقرا كلوحة واحدة — كانت صفوف أفقية رفيعة جوّه
   صفحة كلها كروت، فكانت بتبان كجدول متحطوط عليها مش جزء منها.

   الشريط مش زينة: الفرق بين «١٢ ملتزم مدفعش» و«٩٠» مابيبانش من الرقم
   بسرعة العين، وبيبان من طول الشريط على طول.

   والاسم بقى `card-type-card` مش `card-type-row`: `.card-type-row` هو صف
   النوع في شاشة الإعدادات، وكان الاتنين بيتسمّوا واحد فقواعد اللوحة كانت
   بتنطبق على قايمة الإعدادات كمان من غير ما حد يقصد. */
.card-type-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
}
.card-type-card {
  display: grid;
  align-content: start;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--pulse-idle-line);
  border-radius: var(--radius);
  /* الكارت ده جوّه لوحة، مش على خلفية الصفحة زي كروت الإحصائيات — لو أخد
     `--panel` زيهم كان هيبقى بنفس لون اللي وراه والحدود بس هي اللي تبيّنه.
     `--panel-2` بيديله نفس الإحساس المرفوع في مكانه الجديد. */
  background: var(--panel-2);
  color: var(--ink);
  text-align: right;
  transition: transform var(--speed), box-shadow var(--speed);
}
.card-type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-type-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-type-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
/* كل الأولاد متسنّدين على `.card-type-card`: من غير كده `.card-type-name`
   بتاعة الكارت — وهي أوطى في الملف — كانت بتلوّن اسم النوع في شاشة
   الإعدادات رمادي وتصغّره، وهو input المدرس بيكتب فيه. */
.card-type-card .card-type-swatch { flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--pulse-idle-line); }
/* الاسم بيلف بدل ما يتقص: أسماء زي «غياب متكرر — دافع» كانت بتوصل للنقط
   التلاتة في الصف الرفيع، والكارت عنده عرض سطرين مجاناً. */
.card-type-card .card-type-name { min-width: 0; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; line-height: 1.35; }
.card-type-card .card-type-value { font-size: 25px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.card-type-card .card-type-bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.card-type-card .card-type-bar i { display: block; height: 100%; border-radius: 999px; background: var(--pulse-idle-line); }
.card-type-card .card-type-share { color: var(--muted); font-size: var(--fs-min); font-weight: 700; font-variant-numeric: tabular-nums; }

.card-type-card.tone-good { border-inline-start-color: var(--pulse-good); }
.card-type-card.tone-info { border-inline-start-color: var(--pulse-info); }
.card-type-card.tone-warning { border-inline-start-color: var(--pulse-warn); }
.card-type-card.tone-danger { border-inline-start-color: var(--pulse-danger); }
.card-type-card.tone-violet { border-inline-start-color: var(--pulse-violet); }
.card-type-card.tone-teal { border-inline-start-color: var(--pulse-teal); }

.card-type-card.tone-good .card-type-swatch, .card-type-card.tone-good .card-type-bar i { background: var(--pulse-good); }
.card-type-card.tone-info .card-type-swatch, .card-type-card.tone-info .card-type-bar i { background: var(--pulse-info); }
.card-type-card.tone-warning .card-type-swatch, .card-type-card.tone-warning .card-type-bar i { background: var(--pulse-warn); }
.card-type-card.tone-danger .card-type-swatch, .card-type-card.tone-danger .card-type-bar i { background: var(--pulse-danger); }
.card-type-card.tone-violet .card-type-swatch, .card-type-card.tone-violet .card-type-bar i { background: var(--pulse-violet); }
.card-type-card.tone-teal .card-type-swatch, .card-type-card.tone-teal .card-type-bar i { background: var(--pulse-teal); }

/* بدل اختفاء القسم في المراكز الكبيرة: دعوة خفيفة للحساب عند الطلب، بنفس
   ارتفاع شريط عملي تقريبًا مش كارت أرقام وهمي. */
.card-type-deferred { display: flex; align-items: center; gap: 13px; padding-block: 15px; }
.card-type-deferred-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.card-type-deferred-icon .icon { width: 20px; height: 20px; }
.card-type-deferred > div { min-width: 0; flex: 1; }
.card-type-deferred h2 { font-size: 16px; font-weight: 900; }
.card-type-deferred p { margin-top: 2px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 650; }
.card-type-deferred .primary-mini { flex: none; }

/* الموبايل: كارتين في الصف بدل واحد. بعرض ٣٧٥ الحد ١٥٨ مابيسمحش غير بعمود
   واحد، فستة تصنيفات بيبقوا ستة كروت طويلة ورا بعض والمدرس بيسكرول عشان
   يشوف تقسيمة المفروض تتقرا بنظرة. */
@media (max-width: 620px) {
  .card-type-rows { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
  .card-type-card { padding: 12px; gap: 7px; border-radius: var(--radius-sm); }
  .card-type-card .card-type-value { font-size: 21px; }
  .card-type-deferred { align-items: flex-start; flex-wrap: wrap; }
  .card-type-deferred > div { flex-basis: calc(100% - 56px); }
  .card-type-deferred .primary-mini { width: 100%; justify-content: center; }
}
.period-chip.active {
  background: linear-gradient(var(--theme-gradient-angle), var(--action-bg), var(--action-bg-end));
  color: var(--action-ink);
  border-color: var(--action-bg);
  box-shadow: 0 7px 17px color-mix(in srgb, var(--action-bg) 22%, transparent);
}
.period-chip.future { border-style: dashed; opacity: 0.85; }
.period-chip.future::after { content: ' ↗'; font-size: var(--fs-min); opacity: 0.7; }
.period-chip.whole-year { font-weight: 800; }
.period-chip.suggested {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.period-chip.suggested.active { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }

/* رأس العام الدراسي داخل سجل اشتراكات الطالب */
.subscriptions-table .ay-header td {
  background: var(--panel-2);
  padding: 10px 14px;
  border-top: 2px solid var(--line);
}
.ay-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ay-head-row strong { font-size: 13.5px; font-weight: 800; }
.ay-head-row span { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }

/* ------------------------------ حجم العرض (زوم) ------------------------------ */

.zoom-control { display: grid; gap: 10px; margin-bottom: 4px; }
.zoom-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; }
.zoom-stepper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: start;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.zoom-step {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 800;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.zoom-step:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.zoom-value { min-width: 52px; text-align: center; font-weight: 800; font-size: 15px; }
.zoom-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.zoom-preset {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 700;
  font-size: max(var(--fs-min), 12.5px);
  color: var(--muted);
}
.zoom-preset:hover { color: var(--accent); border-color: var(--accent); }
.zoom-preset.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------ تفاصيل المجموعات ------------------------------ */

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.group-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--panel-2);
  display: grid;
  gap: 10px;
}
.group-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-card-head strong { font-size: 14px; font-weight: 800; }
.group-stages { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.group-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.group-metrics > div { display: flex; flex-direction: column; }
.group-metrics span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.group-metrics strong { font-size: 14px; font-weight: 800; }

/* ---------------------- نافذة توقيت الدفع + صفوف الشهور القادمة ---------------------- */

.pay-timing-q { font-weight: 800; margin-top: 4px; }
.pay-timing-actions { display: flex; gap: 10px; margin: 8px 0 4px; }
.pay-timing-actions .submit-btn { flex: 1; }
.pay-timing-actions .submit-btn[data-timing="end"] { background: var(--purple); }
tr.row-future { opacity: 0.72; }
tr.row-future td { background: repeating-linear-gradient(45deg, transparent, transparent 8px, var(--panel-2) 8px, var(--panel-2) 9px); }
.report-review-summary { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.report-review-summary > div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.report-review-summary span { display: block; color: var(--muted); font-size: var(--fs-min); }
.report-review-summary strong { display: block; margin-top: 4px; font-size: 22px; }
.report-row-excluded { opacity: .68; }
.report-message-preview { padding: 14px; border-radius: 12px; background: var(--panel-2); }
.report-message-preview pre { margin: 10px 0 0; white-space: pre-wrap; font: inherit; line-height: 1.9; direction: rtl; }
.batch-approved-notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: rgba(18, 183, 106, .12); color: var(--success); font-weight: 700; }
.batch-dismissed-notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--warning-soft); color: var(--warning); font-weight: 700; }
@media (max-width: 760px) { .report-review-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------ مركز التقارير الجديد ------------------------------ */
.reports-hub { position: relative; }
.reports-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px;
  padding: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
}
.reports-tabs button {
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 11px; color: var(--muted); font-weight: 800; transition: all var(--speed);
}
.reports-tabs button:hover { background: var(--panel-2); color: var(--ink); }
.reports-tabs button.active { background: var(--ink); color: var(--page); box-shadow: 0 8px 18px rgba(0,0,0,.12); }
.reports-tabs .icon { width: 18px; height: 18px; }
/* minmax(0, 1fr) زي .content-column بالظبط: العمود الضمني (auto) بياخد أكبر
   min-content بين أبنائه، وجدول عرضه 1050px كان بيفرد القسم كله لـ 1094px
   ويطلّعه بره الشاشة على التابلت بدل ما يتمرّر جوه صندوقه. */
.reports-section { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
/* شريط الشهر بيمشي مع الصفحة: وهو ملتصق كان بيفضل فوق الكشف طول ما المستخدم
   بينزل، ويغطي أول صفوف الجدول والكروت اللي تحته. */
.reports-month-toolbar {
  display: flex; align-items: end; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow);
}
.reports-month-field { min-width: 220px; }
.reports-month-field span { display: inline-flex; align-items: center; gap: 6px; }
.batch-state { display: grid; gap: 2px; text-align: end; }
.batch-state span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.batch-state strong { font-size: 14px; }
.eyebrow { color: var(--accent); font-size: var(--fs-min); font-weight: 900; letter-spacing: .4px; }
.report-batch-hero { overflow: hidden; }
.report-workflow { display: grid; gap: 16px; margin-top: 18px; }
/* minmax(0, 1fr) مش 1fr: الـ 1fr معناها minmax(auto, 1fr) فالعمود بيرفض يصغّر
   تحت مقاس نص الخطوة، وخمس خطوات كانوا بيفرضوا 1019px على اللوحة فتخرج بره
   الشاشة على التابلت. */
.report-workflow ol { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0; }
.report-workflow li { position: relative; display: grid; justify-items: center; gap: 7px; color: var(--muted); text-align: center; font-size: var(--fs-min); }
.report-workflow li::before { content: ''; position: absolute; top: 15px; inset-inline-start: calc(50% + 17px); width: calc(100% - 26px); height: 2px; background: var(--line); }
.report-workflow li:last-child::before { display: none; }
.report-workflow li > span { position: relative; z-index: 1; width: 31px; height: 31px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: var(--panel); font-weight: 900; }
.report-workflow li.done { color: var(--success); }
.report-workflow li.done > span { background: var(--success); border-color: var(--success); color: #fff; }
.report-workflow li.done::before { background: var(--success); }
.report-workflow .icon { width: 14px; height: 14px; }
.batch-progress { display: grid; grid-template-columns: auto minmax(180px, 1fr); align-items: center; gap: 16px; padding: 12px 14px; background: var(--panel-2); border-radius: 12px; }
.batch-progress > div { display: flex; align-items: baseline; gap: 8px; }
.batch-progress strong { font-size: 22px; }
.batch-progress span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.batch-progress progress { width: 100%; height: 9px; accent-color: var(--success); }
.report-status-grid { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); gap: 9px; }
.status-card { padding: 13px 14px; display: grid; gap: 4px; border-top: 3px solid var(--line); }
.status-card span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.status-card strong { font-size: 23px; }
.status-card.good { border-top-color: var(--success); }.status-card.low { border-top-color: var(--danger); }.status-card.info { border-top-color: var(--accent); }.status-card.warning { border-top-color: var(--warning); }
.report-filters { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(135px, 1fr)); gap: 10px; align-items: end; margin: 14px 0; }
.report-filters .searchbox { height: 44px; }
.reports-student-table td small, .groups-report-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-min); }
.reports-student-table table { min-width: 1050px; }
.reports-student-table tbody tr:hover { background: var(--panel-2); }
.report-preview-panel {
  position: fixed; top: 16px; bottom: 16px; inset-inline-end: 16px; z-index: 110; width: min(520px, calc(100vw - 32px)); overflow: auto;
  padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow-lg); animation: slideIn .22s ease both;
}
.report-preview-panel::before { content: ''; position: fixed; inset: 0; z-index: -1; background: rgba(15,16,20,.38); backdrop-filter: blur(2px); }
.preview-status { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 12px 0; }
.preview-status small { flex-basis: 100%; color: var(--muted); }
.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preview-actions .submit-btn, .preview-actions .ghost-btn { min-height: 42px; height: auto; padding: 10px 14px; }
.preview-actions a.submit-btn { text-decoration: none; }
.overview-kpis { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; }
.overview-kpis article { display: grid; gap: 5px; padding: 15px; }
.overview-kpis span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.overview-kpis strong { font-size: 19px; }
/* الرسم بقى بارتفاع ثابت من نفسه، فمفيش داعي لـ min-height كان بيسيب فراغ تحته. */
.chart-priority { min-height: 0; }
.analytics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.analytics-grid .panel { min-width: 0; }
.empty-report-chart { min-height: 190px; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 20px; text-align: center; color: var(--muted); }
.groups-report-table .report-filters { grid-template-columns: minmax(240px, 1fr) minmax(170px, 240px); }
.groups-report-table table { min-width: 840px; }
.exports-hero .section-head { align-items: end; }
.exports-hero .field { min-width: 230px; }
.export-cards { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 12px; }
.export-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.export-card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.export-card h2 { font-size: 15px; }.export-card p { color: var(--muted); font-size: var(--fs-min); margin-top: 4px; min-height: 38px; }
.export-card .submit-btn { grid-column: 1 / -1; width: 100%; height: 42px; }
.pdf-export-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pdf-export-card p { color: var(--muted); margin-top: 5px; }

/* متابعة فتح تقرير ولي الأمر — الجدول مرتّب بالأولوية: اللي محتاج تنبيه فوق،
   فالألوان هنا وظيفتها تفرّق الصفوف من على بعد مش تزوّق. */
.report-opens-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.report-opens-kpi { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.report-opens-kpi span { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.report-opens-kpi strong { font-size: 19px; }
.report-opens-kpi small { color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.report-opens-alert { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 800; }
.report-opens-alert .icon { width: 15px; height: 15px; }
/* أزرار التنبيه الجماعي جنب العدّاد: على الموبايل بتلف لسطر تحته بدل ما تزقّ
   العنوان بره الشاشة. */
.report-opens-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.report-opens-actions button { white-space: nowrap; }
.report-opens-actions button[disabled] { opacity: .55; cursor: not-allowed; }
.report-opens-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: 12px; font-weight: 700; }
.report-opens-note .icon { width: 16px; height: 16px; color: var(--accent); }
.report-opens-trend { margin-top: 16px; }
.report-opens-trend h3 { margin-bottom: 8px; font-size: 13px; }
.report-opens-table { min-width: 720px; }
.report-opens-table td small { display: block; color: var(--muted); font-size: 11px; }
/* شريط جانبي بلون الحالة: بيخلي «لسه ما فتحش» تتفرز بالعين قبل ما تقرا العمود. */
.report-opens-table tbody tr { border-inline-start: 3px solid transparent; }
.report-opens-table tbody tr.need-low { border-inline-start-color: var(--danger); }
.report-opens-table tbody tr.need-mid { border-inline-start-color: var(--warning); }
.report-opens-table tbody tr.need-good { border-inline-start-color: var(--success); }

/* الكشف كان قايمة واحدة بطول الكشف كله. مرتّبة بالحاجة، بس الترتيب من غير
   عنوان مابيبانش — فبتتقرا عشوائية، وطولها بيخلي حتى الصف المهم يضيع.
   دلوقتي: شيبس بتفلتر، بحث، وتلات مجموعات معنونة بعدّادها. */
.report-opens-chips { margin-top: 16px; }
.report-opens-chips .period-chip.need-low.active { background: var(--danger); border-color: var(--danger); color: #fff; }
.report-opens-chips .period-chip.need-mid.active { background: var(--warning); border-color: var(--warning); color: #fff; }
.report-opens-chips .period-chip.need-good.active { background: var(--success); border-color: var(--success); color: #fff; }
.report-opens-search { margin-top: 10px; }
.report-opens-groups { display: grid; gap: 12px; margin-top: 12px; }
.report-opens-group { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); overflow: hidden; }
/* اللون على حرف المجموعة، مش خلفية كاملة: تلات بلوكات ملوّنة ورا بعض بتبقى
   لافتة إعلانات، والحرف بيكفي إن العين تعرف بلوك مين من غير ما تقرا. */
.report-opens-group { border-inline-start: 4px solid var(--line); }
.report-opens-group.tone-low { border-inline-start-color: var(--danger); }
.report-opens-group.tone-mid { border-inline-start-color: var(--warning); }
.report-opens-group.tone-good { border-inline-start-color: var(--success); }
.report-opens-group-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  width: 100%; padding: 11px 13px; border: 0; background: transparent;
  color: var(--ink); text-align: start; cursor: pointer;
}
.report-opens-group-head:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.report-opens-group-head strong { font-size: 13.5px; font-weight: 800; }
.report-opens-group-head small { flex: 1 1 100%; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.5; }
/* نفس اتجاه سهم أي قسم بيتطوي في التطبيق (`.panel-toggle-action`): المطوي
   سهمه لتحت — «افتحني» — والمفتوح لفوق. الاتنين لازم يبقوا واحد، وإلا نفس
   الإيماءة بتقول حاجتين في شاشتين. */
.report-opens-group-head .icon {
  width: 15px; height: 15px; color: var(--muted);
  transform: rotate(-90deg);
  transition: transform var(--speed);
}
.report-opens-group-head[aria-expanded="true"] .icon { transform: rotate(90deg); }
.report-opens-group-count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font-size: 11.5px; font-weight: 900; font-variant-numeric: tabular-nums; text-align: center;
}
.report-opens-group .table-wrap { background: var(--panel); }
.report-opens-group-rest { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.report-opens-more { margin-top: 4px; }
.report-opens-empty { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.report-opens-empty .icon { width: 16px; height: 16px; }
.report-opens-empty-state { min-height: 250px; display: grid; place-items: center; align-content: center; gap: 9px; text-align: center; }
.report-opens-empty-state h2, .report-opens-empty-state p { margin: 0; }
.report-opens-empty-state p { max-width: 520px; color: var(--muted); line-height: 1.7; }
.report-opens-empty-state .empty-state-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.report-opens-empty-state .empty-state-icon .icon { width: 25px; height: 25px; }

@media (max-width: 1150px) {
  .report-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-opens-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .export-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .reports-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-tabs button { min-height: var(--tap); font-size: var(--fs-min); padding: 5px; }
  .reports-tabs .icon { display: none; }
  .reports-month-toolbar { position: static; align-items: center; }
  .reports-month-field { min-width: 0; flex: 1; }
  .batch-state { flex: 0 0 auto; }
  .report-workflow ol { overflow-x: auto; grid-template-columns: repeat(5, 105px); justify-content: start; padding-bottom: 4px; }
  .report-workflow li::before { width: 78px; }
  .batch-progress { grid-template-columns: 1fr; gap: 8px; }
  .report-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-filters, .groups-report-table .report-filters { grid-template-columns: 1fr 1fr; }
  .report-filters .searchbox { grid-column: 1 / -1; }
  /* الشكل الأساسي جاي من قواعد الموبايل المشتركة فوق — دي الفروق بس. */
  .reports-student-table td:nth-child(2), .reports-student-table td:last-child { grid-column: 1 / -1; }
  .reports-student-table td:last-child button { width: 100%; min-height: var(--tap); }
  .report-preview-panel { top: auto; bottom: 0; inset-inline: 0; width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; }
  .overview-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-opens-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-grid, .export-cards { grid-template-columns: 1fr; }
  .pdf-export-card { align-items: stretch; flex-direction: column; }
  /* العمود بيبقى ٢١ بكسل على الموبايل. المسافة العمودية بين سطرين مايلين
     متوازيين = عرض العمود × جيب الزاوية، فالزاوية بتزيد عشان السطور ما تلمسش
     بعضها، والخط بيصغّر يديها فسحة زيادة. */
  .bar-chart, .delta-chart { --label-tilt: -56deg; --label-h: 42px; }
  .bar-chart { gap: 7px 6px; padding-left: 14px; }
  .delta-chart { padding-left: 14px; }
  .bar-label { font-size: var(--fs-min); }
  .bar-value { font-size: var(--fs-min); }
  .hbar-row { grid-template-columns: minmax(0, 8em) minmax(0, 1fr) auto; }
}

/* ===== الاشتراكات: جدول مبسّط + قائمة تحصيل سريعة ===== */

/* الجدول اتقلّص من 10 أعمدة إلى 6، فمابقاش محتاج عرض 1180px. */
.subs-operations-table.subs-table-slim { min-width: 680px; }
.subs-table-slim .subs-row-times { font-size: var(--fs-min); opacity: .85; }
.subs-table-slim td.num > small { margin-top: 4px; }
.subs-table-slim .collection-progress { width: 100%; min-width: 90px; max-width: 160px; }
.subs-group-action-label { display: none; }

/* رأس قابل للطي — الرأس كله زرار: منطقة الضغط هي الكارت من أوله لآخره مش
   أيقونة صغيرة في الركن. مشترك بين كارت المستحقين وجدول المجموعات. */
.panel-toggle-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; text-align: start; cursor: pointer;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  transition: background var(--speed);
}
.panel-toggle-head:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.panel-toggle-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel-toggle-title { min-width: 0; }
.panel-toggle-head strong { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.panel-toggle-head small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-min); }
.panel-toggle-action {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 999px;
  color: var(--accent); background: var(--panel);
  font-size: var(--fs-min); font-weight: 800;
}
/* السهم بيلف لما الكارت يفتح فالحالة واضحة من غير ما تقرا. */
.panel-toggle-action .icon { width: 15px; height: 15px; transform: rotate(-90deg); transition: transform var(--speed); }
.is-open > .panel-toggle-head .panel-toggle-action .icon { transform: rotate(90deg); }

.due-now-panel { padding: 0; overflow: hidden; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.due-now-list { display: grid; gap: 8px; padding: 14px 18px; max-height: 340px; overflow-y: auto; }
.due-now-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.due-now-student strong { display: block; font-size: 13px; }
.due-now-student small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-min); }
.due-now-amount { text-align: center; }
.due-now-amount small { display: block; color: var(--muted); font-size: var(--fs-min); }
.due-now-amount strong { font-size: 14px; }

/* ============================ تبويب الغياب ============================
   التبويب كله مبني على فكرة واحدة: العين لازم توصل للأخطر قبل ما تقرا أي رقم.
   عشان كده اللون هنا مش زينة — شريط الكارت والحلقة والشارة كلهم بيقولوا نفس
   الدرجة بثلاث طرق مختلفة، فالمعلومة توصل حتى في الطباعة بالأبيض والأسود
   (الشريط بيفضل باين) أو لعين ما بتميّزش الأحمر والأخضر (الرقم جوه الحلقة).
   ====================================================================== */

.absence-workspace { display: grid; gap: 14px; }

/* -------------------------- شريط المؤشرات -------------------------- */

/* ------------------------- قايمة الانسحاب ------------------------- */

/* التحليل قبل الجدول عن قصد: الجدول بيرد على «مين مشي»، واللوحات بترد على
   «بيمشوا ليه» — والتاني هو اللي المدرس فاتح الشاشة عشانه. */
.withdraw-workspace { display: grid; gap: 14px; }

.withdraw-analysis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}
.withdraw-panel { display: grid; gap: 10px; padding: 15px; }
.withdraw-panel header { display: grid; gap: 3px; }
.withdraw-panel h3 { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.withdraw-panel .hint-text { font-size: var(--fs-min); line-height: 1.6; }

/* الشريط زخرفة فوق الرقم مش بديل عنه: الاسم والعدد والنسبة كلهم نص، فالصف
   بيتقرا كامل لو الألوان اختفت أو القارئ الآلي بيقراه. */
.withdraw-bars { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.withdraw-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'label value' 'track track';
  gap: 3px 8px;
  align-items: center;
}
.withdraw-bar-label {
  grid-area: label;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-min);
  font-weight: 700;
}
.withdraw-bar-value { grid-area: value; font-size: var(--fs-min); font-weight: 800; white-space: nowrap; }
.withdraw-bar-value small { color: var(--muted); font-weight: 700; }
.withdraw-bar-track {
  grid-area: track;
  block-size: 7px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.withdraw-bar-track i {
  display: block;
  block-size: 100%;
  border-radius: 999px;
  background: var(--withdraw-bar, var(--accent));
}
.withdraw-bar.tone-danger { --withdraw-bar: var(--danger); }
.withdraw-bar.tone-warning { --withdraw-bar: var(--warning); }
.withdraw-bar.tone-mid { --withdraw-bar: var(--accent-light); }
.withdraw-bar.tone-low { --withdraw-bar: var(--muted); }
/* العلامة اللي عدّادها صفر بتفضل في القايمة: «مفيش حد مشي وعليه فلوس» معلومة
   زي أي واحدة تانية، والشيل كان بيخلي الغياب يبان كأنه السبب الوحيد. */
.withdraw-bar.tone-idle { --withdraw-bar: var(--line); }
.withdraw-bar.tone-idle .withdraw-bar-label,
.withdraw-bar.tone-idle .withdraw-bar-value { color: var(--muted); }

.withdraw-months { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }

.withdraw-table td small { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.withdraw-table .withdraw-debt { color: var(--danger); font-weight: 800; }
.withdraw-blank { color: var(--muted); font-size: var(--fs-min); }

.withdraw-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.withdraw-flags i {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-min);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .withdraw-analysis { grid-template-columns: 1fr; }
}

/* الأرقام الست لوحة واحدة بفواصل رفيعة، مش ست كروت بستة ألوان على الحافة:
   قوس قزح الحواف كان بيخلّي الصف شكله عشوائي، والأولوية ضاعت وسط الألوان.
   اللون دلوقتي في الأيقونة بس، والرقم بيتلوّن للخطر والتحذير لوحدهم. */
.absence-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  box-shadow: var(--shadow);
}

.absence-kpi {
  min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
}
.absence-kpi > div { min-width: 0; display: grid; gap: 1px; }
.absence-kpi p { color: var(--muted); font-size: var(--fs-min); font-weight: 800; line-height: 1.35; }
.absence-kpi strong { font-size: 22px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.absence-kpi small { color: var(--muted); font-size: var(--fs-min); line-height: 1.35; }

.absence-kpi-icon {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.absence-kpi-icon .icon { width: 18px; height: 18px; }

.absence-kpi.tone-danger .absence-kpi-icon { background: var(--danger-soft); color: var(--danger); }
.absence-kpi.tone-danger strong { color: var(--danger); }
.absence-kpi.tone-warning .absence-kpi-icon { background: var(--warning-soft); color: var(--warning); }
.absence-kpi.tone-warning strong { color: var(--warning); }
.absence-kpi.tone-good .absence-kpi-icon { background: var(--success-soft); color: var(--success); }
.absence-kpi.tone-low .absence-kpi-icon { background: var(--danger-soft); color: var(--rose); }
.absence-kpi.tone-mid .absence-kpi-icon { background: var(--warning-soft); color: var(--amber); }

@media (max-width: 1150px) {
  .absence-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* الموبايل: تلات أعمدة × صفين، والأيقونة فوق الرقم. السطر الشارح بيستخبى
   (وموجود في title) لأنه كان بيتلف سطرين وتلاتة ويخلي الخانات بأطوال مختلفة. */
@media (max-width: 620px) {
  .absence-kpi { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; padding: 10px; }
  .absence-kpi-icon { width: 28px; height: 28px; border-radius: 8px; }
  .absence-kpi-icon .icon { width: 15px; height: 15px; }
  .absence-kpi strong { order: -1; font-size: 20px; }
  .absence-kpi small { display: none; }
}

/* --------------------------- أقسام التبويب --------------------------- */

/* شريط مقسّم زي تبويبات التكريم: صف واحد دايماً، وعلى الموبايل بيتسحب بالعرض
   بدل ما يتكسّر لكبسولة كبيرة فيها زرارين وزرارين وواحد لوحده. */
.absence-sections {
  display: flex; gap: 4px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  scrollbar-width: none;
}
.absence-sections::-webkit-scrollbar { display: none; }

.absence-section-tab {
  flex: 1 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 14px;
  border-radius: 10px;
  color: var(--muted); background: transparent;
  font-size: 13px; font-weight: 800; white-space: nowrap;
  transition: background var(--speed), color var(--speed);
}
.absence-section-tab:hover { color: var(--ink); }
.absence-section-tab.active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(15, 23, 42, .08);
}
.absence-section-tab.active .icon { color: var(--accent); }
.absence-section-tab .icon { width: 17px; height: 17px; }

/* ------------------------------ الفلاتر ------------------------------ */

.absence-filters-panel { display: grid; gap: 14px; }
/* تبويب المراحل بيستعمل نفس اللوحة جوه كارت المرحلة، مش ككارت مستقل. */
.stage-filters-panel { margin-bottom: 16px; }

/* الشريط الأول: بحث واسع + أدوات الكشف. الأدوات فوق مع البحث عشان تفضل في
   نفس مستوى «إيه اللي معروض» بدل ما تتوه تحت الفلاتر. */
.absence-filters-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.absence-filters-head .searchbox { flex: 1 1 280px; }
.absence-filters-head .absence-toolbar-actions { flex: 0 0 auto; }
/* زرار طي الفلاتر بيظهر على الموبايل بس: فوق ٩٠٠px الفلاتر مفتوحة على طول
   وفيه مساحة تكفيها، فالزرار يبقى ضوضا. */
.absence-filters-toggle { display: none; }
.absence-filters-toggle b { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: var(--fs-min); }

/* كل فلتر جوه مجموعة معنونة بمقاسها — الشيبس والقوايم مبقتش تسيح على السطر. */
/* سطرين واضحين: الأول «إيه اللي معروض» (فترة ومرحلة وترتيب)، والتاني
   «تصفية بالحالة» (خطورة ومتابعة) — كل سطر بيتملى بالكامل. */
.absence-filter-grid { display: grid; gap: 10px; }
.absence-filter-line { display: flex; flex-wrap: wrap; gap: 10px; }
.absence-filter-group {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 11px 13px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.absence-group-label {
  display: block;
  color: var(--muted);
  font-size: var(--fs-min);
  font-weight: 800;
  letter-spacing: 0.01em;
}
.absence-group-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* القوايم بتتقاسم عرض المجموعة بدل ما كل واحدة تاخد عرض أطول خيار فيها
   وتنزّل اللي بعدها سطر تاني. */
.absence-group-body > select { flex: 1 1 140px; min-width: 0; min-height: 36px; padding-inline: 11px; font-size: max(var(--fs-min), 12.5px); }
.absence-filter-group .chip-row { gap: 8px; }

/* المقاسات دي بتخلي كل صف يتملي بالكامل من غير ما شيبس أي مجموعة تلف
   لسطر تاني وتسيب فراغ في الصندوق اللي جنبها. */
.absence-filter-group.group-period { flex: 1 1 100%; }
.absence-filter-group.group-scope { flex: 1 1 340px; min-width: 340px; }
.absence-filter-group.group-sort { flex: 1 1 190px; min-width: 180px; }
.absence-filter-group.group-risk { flex: 1 1 520px; min-width: 500px; }
.absence-filter-group.group-followup { flex: 1 1 380px; min-width: 370px; }

/* «شهر بعينه» بقى قائمة مدمجة في نفس صف الشيبس بدل حقل بعنوان طايح لوحده. */
.absence-month-select {
  min-height: var(--tap);
  min-width: 158px;
  padding-inline: 12px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
}
.absence-month-select.active { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.absence-reset { margin-inline-start: auto; }

.risk-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 13px;
  border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--panel);
  font-size: var(--fs-min); font-weight: 800;
  transition: border-color var(--speed), color var(--speed), background var(--speed);
}
.risk-chip .icon { width: 14px; height: 14px; }
.risk-chip:hover { color: var(--ink); border-color: var(--accent); }
.risk-chip.active { color: var(--action-ink); background: var(--accent); border-color: var(--accent); }
.risk-chip.tone-danger { color: var(--danger); border-color: var(--danger-soft); }
.risk-chip.tone-danger.active { color: #fff; background: var(--danger); border-color: var(--danger); }
.risk-chip.tone-warning { color: var(--warning); border-color: var(--warning-soft); }
.risk-chip.tone-warning.active { color: #fff; background: var(--warning); border-color: var(--warning); }
.risk-chip.tone-good { color: var(--success); border-color: var(--success-soft); }
.risk-chip.tone-good.active { color: #fff; background: var(--success); border-color: var(--success); }

.absence-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 11px; border-top: 1px solid var(--line);
}
.absence-toolbar-count { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.absence-toolbar-count b { color: var(--ink); font-size: 15px; }
.absence-toolbar-count .icon { width: 15px; height: 15px; color: var(--accent); }
.absence-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.absence-selection-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: max(var(--fs-min), 12.5px); font-weight: 700;
}
.absence-selection-bar b { font-size: 15px; }
.absence-selection-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------- كروت المتابعة ---------------------------- */

.absence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

/* لوحة المتابعة بقت مربعات زي كشف المراحل: نفس `.student-tiles` ونفس
   `.student-tile` — نفس الشبكة، نفس ألوان النبض، ونفس إيماءات
   `tile-layer.js` (ضغطة مطوّلة = نظرة، دوسة = الكارت عايم فوق المربع).
   الكارت التفصيلي فضل هو هو، بس مابقاش مرصوص ستين مرة تحت بعضه: الكشف
   اللي فيه ٦٠ حالة كان صفحة طولها متر، والسؤال اللي بيتسأل عليه هو «مين
   الأحمر» — وده لون مش قراية.

   `.absence-tile` مالهاش خلفية ولا حدود خاصة بيها: كل ده جاي من
   `.student-tile`، وأي تعديل في شكل المربعات لازم يوصل للكشفين مع بعض. */
.absence-tile { position: relative; }
/* رقم الغياب المتتالي في ركن المربع. اللون بيقول «خطر»، والرقم بيقول «قد إيه»
   — والاتنين مع بعض بيمنعوا فتح الكارت عشان سؤال إجابته رقم واحد. */
.absence-tile-streak {
  position: absolute; inset-block-start: 4px; inset-inline-start: 5px;
  min-width: 15px; padding: 0 3px; border-radius: 999px;
  /* مصمتة مش شفافة: على الموبايل الاسم بيوصل لركن المربع، والشارة الشفافة
     كانت بتقعد فوق حرف — رقم وحرف فوق بعض مش الاتنين بيتقروا. */
  background: color-mix(in srgb, var(--tile-line) 20%, var(--page));
  color: var(--tile-ink);
  font-size: max(9px, calc(9px * max(1, var(--tile-scale, 1))));
  font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.5;
}
.absence-tile-pick {
  position: absolute; inset-block-start: 4px; inset-inline-end: 5px;
  display: grid; place-items: center; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent); color: #fff;
}
.absence-tile-pick .icon { width: 10px; height: 10px; }
/* المحدد لازم يبان وانت ماشي على الكشف، مش لما تفتح كارته: الرسالة الجماعية
   بتروح للمجموعة دي، والغلطة فيها بتوصل لبيت غلط. */
.absence-tile.is-picked { box-shadow: 0 0 0 2px var(--accent), 0 6px 16px var(--tile-glow); }

/* الكارت الطاير نسخة مصغّرة من كارت الكشف، مش نفسه بمسافات أضيق: الكارت
   بحجمه الطبيعي بيعدّي طول الشاشة فبيطلع سكرول جوّاه — وصف الأزرار، اللي
   بتفتح الكارت عشانه، بيقع تحت السكرول. فكل حاجة جوّه الطبقة بتنزل درجة:
   الحلقة، الاسم، الشارات، المصطلحات، والأزرار. */
/* الحد الأدنى للخط بينزل نص بكسل جوّه الطبقة بس: ده أسرع لتر للطول لأن
   نص الكارت كله سطور تانوية ماشية على `--fs-min`. الكارت طبقة عابرة فوق
   الكشف، والبديل إن صف الأزرار يقع تحت سكرول ومحدش ياخد باله إنه موجود. */
.absence-card-layer { width: min(352px, calc(100vw - 24px)); --fs-min: 11.5px; }
.absence-card-layer .absence-card {
  gap: 8px; padding: 12px;
  border-width: 2px; border-inline-start-width: 5px;
  border-color: color-mix(in srgb, var(--line) 40%, var(--ink) 60%);
  box-shadow: none;
}
.absence-card-layer .absence-card.tone-danger { border-inline-start-color: var(--danger); }
.absence-card-layer .absence-card.tone-warning { border-inline-start-color: var(--warning); }
.absence-card-layer .absence-card.tone-good { border-inline-start-color: var(--success); }
.absence-card-layer .absence-card.tone-mid { border-inline-start-color: var(--accent); }
.absence-card-layer .absence-card:hover { box-shadow: none; }

.absence-card-layer .absence-card-head { gap: 8px; }
.absence-card-layer .risk-dial { width: 44px; height: 44px; }
.absence-card-layer .risk-dial::after { inset: 4px; }
.absence-card-layer .risk-dial span { font-size: 13px; }
.absence-card-layer .absence-card-id .student-name { font-size: 14px; }
.absence-card-layer .absence-pick input { width: 16px; height: 16px; }
.absence-card-layer .absence-badges { gap: 5px; }
.absence-card-layer .absence-badges .pill { padding: 3px 9px; }
.absence-card-layer .absence-facts { gap: 6px; }
/* ٩٠ مش أقل: تحتها «الدرس اللي فاته» بيتلف سطرين، فالعمود الضيّق بياخد طول
   أكتر مما بيوفّر. */
.absence-card-layer .absence-facts > div { grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
.absence-card-layer .absence-facts dd { font-size: 12px; }
.absence-card-layer .absence-stats { gap: 4px 12px; padding: 7px 10px; }
.absence-card-layer .absence-stats b { font-size: 12.5px; }
.absence-card-layer .absence-read { gap: 6px; }
.absence-card-layer .absence-read p { gap: 6px; font-size: max(var(--fs-min), 12px); line-height: 1.45; }
.absence-card-layer .absence-read .icon,
.absence-card-layer .absence-followup .icon { width: 14px; height: 14px; }
.absence-card-layer .absence-action { padding: 7px 9px; }
.absence-card-layer .absence-followup { padding: 7px 9px; line-height: 1.45; }
.absence-card-layer .absence-followup-note { padding-inline-start: 20px; }
.absence-card-layer .absence-history ul { gap: 4px; margin-top: 6px; }
.absence-card-layer .absence-card-actions { gap: 6px; }
.absence-card-layer .absence-card-actions > * {
  flex: 1 1 104px; padding: 8px 10px; font-size: max(var(--fs-min), 12px);
}
.absence-card-layer .absence-card-actions .icon { width: 15px; height: 15px; }

/* الشاشات القصيرة: درجة تانية لتحت. `is-dense` بيتحط من tile-layer.js وقت
   ما الطول الطبيعي — بعد التصغير اللي فوق — لسه بيعدّي طول الشاشة. */
.absence-card-layer.is-dense { --fs-min: 11px; }
.absence-card-layer.is-dense .absence-card { gap: 6px; padding: 10px; }
.absence-card-layer.is-dense .risk-dial { width: 38px; height: 38px; }
.absence-card-layer.is-dense .risk-dial::after { inset: 3px; }
.absence-card-layer.is-dense .risk-dial span { font-size: 12px; }
.absence-card-layer.is-dense .absence-card-id .student-name { font-size: 13px; }
.absence-card-layer.is-dense .absence-stats { padding: 6px 9px; }
.absence-card-layer.is-dense .absence-action,
.absence-card-layer.is-dense .absence-followup { padding: 6px 8px; }
.absence-card-layer.is-dense .absence-facts { gap: 5px; }
.absence-card-layer.is-dense .absence-card-actions > * { padding: 7px 9px; }

/* شريط اللون على حافة الكارت هو أسرع إشارة للأولوية — الأحمر يتقرا قبل النص. */
.absence-card {
  display: grid; align-content: start; gap: 11px;
  padding: 16px; border: 1px solid var(--line); border-inline-start: 5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow);
  transition: box-shadow var(--speed), border-color var(--speed);
}
.absence-card:hover { box-shadow: var(--shadow-lg); }
.absence-card.tone-danger { border-inline-start-color: var(--danger); }
.absence-card.tone-warning { border-inline-start-color: var(--warning); }
.absence-card.tone-good { border-inline-start-color: var(--success); }
.absence-card.tone-mid { border-inline-start-color: var(--accent); }
.absence-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }

.absence-card-head { display: flex; align-items: start; gap: 10px; }
.absence-pick { flex: 0 0 auto; padding-top: 2px; }
.absence-pick input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.absence-card-id { flex: 1 1 auto; min-width: 0; }
/* الاسم بيلف هنا: .student-name أصلها white-space: nowrap عشان أعمدة الجداول،
   وجوه الكارت ده الاسم الطويل كان بيفرض عرض أدنى ٣٠٥px فالكارت يخرج برّه
   الشاشة على أجهزة ٣٢٠px. الكارت مساحته رأسية، فاللف مايضرّش. */
.absence-card-id .student-name { display: block; font-size: 15.5px; font-weight: 800; line-height: 1.3; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.absence-card-id small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-min); }

/* حلقة الخطورة: conic-gradient بيرسم القوس بنسبة الدرجة، والرقم في النص عشان
   المعلومة توصل حتى لو المستخدم مش بيميّز الألوان. */
.risk-dial {
  flex: 0 0 auto; position: relative;
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: conic-gradient(var(--dial) calc(var(--risk) * 1%), var(--panel-2) 0);
  --dial: var(--accent);
}
.risk-dial::after {
  content: ''; position: absolute; inset: 5px;
  border-radius: 50%; background: var(--panel);
}
.risk-dial span { position: relative; z-index: 1; font-size: 15px; font-weight: 900; color: var(--dial); }
.risk-dial.tone-danger { --dial: var(--danger); }
.risk-dial.tone-warning { --dial: var(--warning); }
.risk-dial.tone-good { --dial: var(--success); }
.risk-dial.tone-mid { --dial: var(--accent); }

.absence-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.absence-facts { display: grid; gap: 8px; margin: 0; }
.absence-facts > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.absence-facts dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.absence-facts dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.absence-facts .muted { color: var(--muted); font-weight: 500; }

.absence-stats {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  padding: 9px 12px; border-radius: 10px;
  background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 700;
}
.absence-stats b { color: var(--ink); font-size: 14px; }

/* قراءة الحالة والإجراء: سطرين مختصرين — الأثر ثم الخطوة التالية. */
.absence-read { display: grid; gap: 7px; }
.absence-read p { display: flex; align-items: start; gap: 7px; margin: 0; font-size: max(var(--fs-min), 12.5px); line-height: 1.55; }
.absence-read .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 2px; }
.absence-effect { color: var(--muted); font-weight: 600; }
.absence-action { padding: 9px 11px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-weight: 800; }
.absence-card.tone-danger .absence-action { background: var(--danger-soft); }
.absence-card.tone-warning .absence-action { background: var(--warning-soft); }
.absence-card.tone-danger .absence-action .icon { color: var(--danger); }

/* سطر المتابعة: أهم سطر في الكارت — بيمنع مكالمتين لنفس البيت. */
.absence-followup {
  display: flex; align-items: start; gap: 7px; margin: 0;
  padding: 9px 11px; border-radius: 10px;
  font-size: var(--fs-min); font-weight: 700; line-height: 1.5;
}
.absence-followup .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 2px; }
.absence-followup.done { background: var(--success-soft); color: var(--success); }
.absence-followup.stale { background: var(--warning-soft); color: var(--warning); }
.absence-followup.none { background: var(--panel-2); color: var(--muted); }
.absence-followup-note { margin: 0; padding-inline-start: 22px; color: var(--muted); font-size: var(--fs-min); font-style: italic; }

.absence-history summary { color: var(--accent); font-size: var(--fs-min); font-weight: 800; cursor: pointer; }
.absence-history ul { display: grid; gap: 5px; margin: 8px 0 0; padding-inline-start: 16px; color: var(--muted); font-size: var(--fs-min); }
.absence-history i { color: var(--muted); }

.absence-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.absence-card-actions > * { flex: 1 1 120px; justify-content: center; text-decoration: none; }
.absence-card-actions .wa-btn,
.absence-card-actions .ghost-btn { display: inline-flex; align-items: center; gap: 7px; }
.absence-card-actions .ghost-btn.disabled { color: var(--muted); cursor: not-allowed; }
.ghost-btn.primary-ghost { color: var(--accent); border-color: var(--accent); }
.ghost-btn.primary-ghost:hover { color: var(--action-ink); background: var(--accent); }

/* --------------------------- الكشف التفصيلي --------------------------- */

.absence-table { width: 100%; min-width: 940px; border-collapse: collapse; }
.absence-table th, .absence-table td { padding: 10px 11px; text-align: start; border-bottom: 1px solid var(--line); }
.absence-table thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.absence-table tbody tr:hover { background: var(--panel-2); }
.absence-table tbody tr.is-selected { background: var(--accent-soft); }
.absence-table td small { display: block; color: var(--muted); font-size: var(--fs-min); }
.absence-table .muted { color: var(--muted); }
.absence-table .student-name { font-weight: 800; text-align: start; }
.absence-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
/* شريط رفيع على أول العمود بيخلي الصف الخطر يبان من غير ما نلوّن الصف كله. */
.absence-table tbody tr.risk-critical > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.absence-table tbody tr.risk-high > td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.absence-table tbody tr.risk-medium > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.absence-table tbody tr.risk-low > td:first-child { box-shadow: inset 3px 0 0 var(--success); }

.risk-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: var(--fs-min); font-weight: 800; white-space: nowrap;
  background: var(--panel-2); color: var(--muted);
}
.risk-badge.tone-danger { background: var(--danger-soft); color: var(--danger); }
.risk-badge.tone-warning { background: var(--warning-soft); color: var(--warning); }
.risk-badge.tone-good { background: var(--success-soft); color: var(--success); }
.risk-badge.tone-mid { background: var(--accent-soft); color: var(--accent); }

.absence-row-actions { display: flex; gap: 5px; }

/* الكشف على الموبايل: القاعدة العامة بتحوّل أي جدول لكارت بخانتين، فكان
   مربع التحديد واخد خانة لوحده، والاسم نص عرض، و١٠ خانات بتترص بالترتيب —
   شكل عشوائي. هنا الكارت ليه ترتيب ثابت: الاسم فوق والتحديد في ركنه، بعده
   الخطورة والمتابعة، بعدها التلات أرقام في صف واحد، ثم التفاصيل والإجراءات. */
@media (max-width: 760px) {
  .absence-table > tbody > tr {
    position: relative;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "name name name name name name"
      "risk risk risk follow follow follow"
      "abs abs streak streak rate rate"
      "last last last reason reason reason"
      "group group group acts acts acts";
    gap: 2px 10px;
  }
  .absence-table > tbody > tr > td:first-child {
    position: absolute; inset-block-start: 12px; inset-inline-end: 12px;
    padding: 0; box-shadow: none !important;
  }
  .absence-table > tbody > tr > td:nth-child(2) {
    grid-area: name;
    margin-bottom: 4px; padding: 0 0 8px; padding-inline-end: 34px;
    border-bottom: 1px solid var(--line);
  }
  .absence-table > tbody > tr > td:nth-child(2)::before,
  .absence-table > tbody > tr > td:nth-child(11)::before { content: none; }
  .absence-table > tbody > tr > td:nth-child(2) .student-name { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
  .absence-table > tbody > tr > td:nth-child(3) { grid-area: group; }
  .absence-table > tbody > tr > td:nth-child(4) { grid-area: abs; }
  .absence-table > tbody > tr > td:nth-child(5) { grid-area: streak; }
  .absence-table > tbody > tr > td:nth-child(6) { grid-area: rate; }
  .absence-table > tbody > tr > td:nth-child(7) { grid-area: last; }
  .absence-table > tbody > tr > td:nth-child(8) { grid-area: reason; }
  .absence-table > tbody > tr > td:nth-child(9) { grid-area: risk; }
  .absence-table > tbody > tr > td:nth-child(10) { grid-area: follow; }
  .absence-table > tbody > tr > td:nth-child(11) { grid-area: acts; align-self: end; }
  .absence-table .absence-row-actions { justify-content: flex-end; }
  .absence-table td .pill, .absence-table .risk-badge { justify-self: start; }
  /* الشريط الملوّن على أول خانة كان على مربع التحديد اللي بقى في الركن. */
  .absence-table > tbody > tr.risk-critical { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
  .absence-table > tbody > tr.risk-high { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }

  /* جدول الانسحاب مالوش مربع تحديد في أول عمود، لذلك تخطيط كشف الغياب فوق
     كان بيعامل اسم الطالب كأنه checkbox ويحشر باقي الخانات في أماكن غلط.
     هنا كل منسحب كارت مستقل: الهوية أولاً، بعدها التواريخ والمؤشرات في أزواج
     سهلة للمسح بالعين، ثم السبب والعلامات بعرض الكارت كله. */
  .withdraw-table > tbody > tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "student action"
      "group group"
      "joined left"
      "stayed absence"
      "attendance grade"
      "debt debt"
      "reason reason"
      "flags flags";
    gap: 8px 10px;
    padding: 14px;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(20, 33, 70, 0.07);
  }
  .withdraw-table > tbody > tr > td {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--panel-2);
    overflow-wrap: anywhere;
  }
  .withdraw-table > tbody > tr > td:first-child {
    position: static;
    grid-area: student;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
  }
  .withdraw-table > tbody > tr > td:first-child::before { content: none; }
  .withdraw-table > tbody > tr > td:first-child .student-name {
    display: block;
    max-width: 100%;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
    white-space: normal;
  }
  .withdraw-table > tbody > tr > td:first-child small {
    margin-top: 1px;
    color: var(--muted);
    font-weight: 700;
  }
  .withdraw-table > tbody > tr > td:nth-child(2) {
    grid-area: group;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
  }
  .withdraw-table > tbody > tr > td:nth-child(2)::before { content: attr(data-label); }
  .withdraw-table > tbody > tr > td:nth-child(3) { grid-area: joined; }
  .withdraw-table > tbody > tr > td:nth-child(4) { grid-area: left; }
  .withdraw-table > tbody > tr > td:nth-child(5) { grid-area: stayed; }
  .withdraw-table > tbody > tr > td:nth-child(6) { grid-area: absence; }
  .withdraw-table > tbody > tr > td:nth-child(7) { grid-area: attendance; }
  .withdraw-table > tbody > tr > td:nth-child(8) { grid-area: grade; }
  .withdraw-table > tbody > tr > td:nth-child(9) {
    grid-area: debt;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .withdraw-table > tbody > tr > td:nth-child(9).withdraw-debt {
    border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
    background: var(--danger-soft);
  }
  .withdraw-table > tbody > tr > td:nth-child(10) {
    grid-area: reason;
    border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
    background: var(--accent-soft);
  }
  .withdraw-table > tbody > tr > td:nth-child(11) { grid-area: flags; }
  .withdraw-table > tbody > tr > td:nth-child(12) {
    grid-area: action;
    justify-self: end;
    align-self: start;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .withdraw-table > tbody > tr > td:nth-child(12)::before { content: none; }
  .withdraw-table > tbody > tr > td:nth-child(12) .table-action {
    border-color: var(--line);
    background: var(--panel-2);
  }
  .withdraw-table .withdraw-flags { gap: 6px; }
  .withdraw-table .withdraw-flags i { padding: 4px 8px; }
}

/* --------------------------- الخريطة الحرارية --------------------------- */

.absence-heatmap { display: grid; gap: 10px; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-key { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); }
.heat-key.present { background: var(--success); border-color: var(--success); }
.heat-key.late { background: var(--amber); border-color: var(--amber); }
.heat-key.absent { background: var(--danger); border-color: var(--danger); }
.heat-key.none { background: var(--panel-2); }

.heat-table { border-collapse: separate; border-spacing: 3px; }
.heat-table th { color: var(--muted); font-size: var(--fs-min); font-weight: 800; text-align: start; white-space: nowrap; }
.heat-table thead th { padding: 4px 2px; text-align: center; }
.heat-table tbody th { position: sticky; inset-inline-start: 0; z-index: 1; padding-inline-end: 10px; background: var(--panel); }
.heat-table tbody th .student-name { font-size: max(var(--fs-min), 12.5px); font-weight: 700; text-align: start; }
.heat-cell { width: 26px; height: 26px; border-radius: 6px; background: var(--panel-2); }
.heat-cell.present { background: var(--success); }
.heat-cell.late { background: var(--amber); }
.heat-cell.absent { background: var(--danger); }
.heat-cell.none { background: var(--panel-2); opacity: .5; }
.heat-total { padding-inline-start: 8px; color: var(--danger); font-size: 13px; font-weight: 800; text-align: center; }
.heat-note { color: var(--muted); font-size: var(--fs-min); }

/* ----------------------------- غياب اليوم ----------------------------- */

.today-absence-grid { display: grid; gap: 12px; }
.today-absence-card.has-absent { border-inline-start: 5px solid var(--danger); }
.today-absence-card.clean { border-inline-start: 5px solid var(--success); }
.today-pending-card { border-inline-start: 5px solid var(--warning); }
.today-pending-card h3 { display: flex; align-items: center; gap: 7px; }

.today-absent-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.today-absent-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
}
.today-absent-list .student-name { font-size: 13.5px; font-weight: 800; text-align: start; }
.today-absent-list small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-min); }
.today-absent-actions { display: flex; gap: 6px; }

/* ---------------------------- نوافذ الغياب ---------------------------- */

.followup-dialog .field { margin-bottom: 10px; }
.links-dialog-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; max-height: 46vh; overflow-y: auto; list-style: none; counter-reset: link; }
.links-dialog-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
  font-size: max(var(--fs-min), 12.5px); font-weight: 700; text-align: start;
}
.links-dialog-list li.opened { border-color: var(--success); background: var(--success-soft); }
.links-dialog-list small { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.links-dialog-list a { text-decoration: none; }

/* سبب الغياب جوه صف التحضير — بيظهر بس لما الطالب يتحدد غايب.
   الصف نفسه flex فالـ flex-basis:100% هو اللي بينزّله سطر لوحده. */
.att-reason { flex: 1 1 100%; display: grid; gap: 4px; margin-top: 2px; min-width: 0; }
.att-reason span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.att-reason input { width: 100%; max-width: 100%; }
.att-reason .auto-note { color: var(--warning); font-weight: 800; }

/* الصف اللي السيستم سجّله لوحده بيتعلّم بخط جانبي خفيف — المدرس يفرّقه بنظرة
   من غير ما يقرا كل شارة، ولمّا يعدّله الخط بيروح لوحده. */
.att-row.auto-marked { border-color: var(--warning); background: var(--warning-soft, var(--panel-2)); }
.pill.muted { background: var(--panel-2); color: var(--muted); }
.rec-btn.untested { font-size: var(--fs-min); }
.rec-btn.active.untested { background: var(--muted); color: #fff; }

/* تجهيز الحصة قبل ميعادها: التلات خانات وتحتهم زرار حفظ واحد. كان لكل خانة
   زرار لوحدها، والزرار كان بيحفظ التلاتة أصلاً — فالمدرس كان بيدوس تلات مرات
   على نفس الحفظ. */
.lesson-controls-hint { color: var(--muted); font-size: var(--fs-min); font-weight: 600; margin: 0 0 2px; }
.lesson-save-row { display: flex; justify-content: flex-end; }
.lesson-save-btn { white-space: nowrap; }
@media (max-width: 620px) {
  .lesson-save-row .lesson-save-btn { width: 100%; justify-content: center; }
}

.absence-print-head { margin-bottom: 10px; }
.absence-print-head p { color: #333; font-size: var(--fs-min); }

@media print {
  .absence-grid { grid-template-columns: 1fr 1fr; }
  .absence-card { box-shadow: none; break-inside: avoid; }
  .absence-kpis { grid-template-columns: repeat(3, 1fr); }
  .absence-kpi { box-shadow: none; }
  .heat-cell, .heat-key { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .absence-table { min-width: 0; font-size: 10px; }
}

@media (max-width: 760px) {
  .absence-grid { grid-template-columns: 1fr; }
  .absence-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .absence-card-actions > * { flex: 1 1 100%; }
  .absence-section-tab { padding: 0 12px; font-size: max(var(--fs-min), 12.5px); }
  /* الأدوات عمودين بدل ثلاثة أزرار مفرودة: اللوحة كانت بتاخد تلت الشاشة قبل
     ما أول فلتر يبان. */
  .absence-filters-head .absence-toolbar-actions {
    flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .absence-filters-head .absence-toolbar-actions > * { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; font-size: var(--fs-min); }
  .absence-filters-head .absence-toolbar-actions > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* min-width لازم يتصفّر مع الـ flex: مقاسات المجموعات على الديسكتوب بتوصل
     500px وما بتتأثرش بـ flex-basis لوحده، فكانت بتفرض عرض اللوحة كلها وتطلع
     برّه يسار الشاشة (RTL) من غير تمرير لأن body عنده overflow-x: clip. */
  .absence-filter-group { flex: 1 1 100% !important; min-width: 0 !important; }
  .absence-group-body > select, .absence-month-select { flex: 1 1 100%; min-width: 0; }
  .absence-reset { margin-inline-start: 0; }
  .absence-toolbar, .absence-selection-bar { align-items: stretch; }
  .absence-toolbar-actions > *, .absence-selection-actions > * { flex: 1 1 100%; }
}

/* جدول الاشتراكات ليه شكل خاص: الصف بينفرد تحته بتفاصيل المجموعة، فبدل
   كارت الشبكة المشترك بياخد صفوف مفرودة. باقي سلوك الموبايل (إخفاء الرأس،
   إلغاء التمرير الأفقي) جاي من القواعد المشتركة. */
@media (max-width: 760px) {
  .subs-groups-table-panel .table-wrap { overflow: visible; }
  .subs-operations-table.subs-table-slim { min-width: 0; display: block; }
  .subs-table-slim thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .subs-table-slim tbody, .subs-table-slim td { display: block; width: 100%; }
  .subs-table-slim tr { width: 100%; }
  /* تصفير كارت الشبكة المشترك — الصفوف دي بترسم إطارها بنفسها. */
  .subs-table-slim tbody > tr { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
  .subs-table-slim tr.subs-group-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 12px 28px -26px rgba(15, 35, 95, .65);
  }
  .subs-table-slim tr.subs-group-row.is-open { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent); }
  .subs-table-slim tr.subs-group-row > td { min-width: 0; border: 0; padding: 0; }
  .subs-table-slim tr.subs-group-row > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
  .subs-table-slim .subs-group-main { grid-column: 1 / -1; display: grid; gap: 4px; min-height: 58px; padding-inline-end: 52px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
  .subs-table-slim .subs-group-main::before { content: none !important; }
  .subs-table-slim .subs-group-main > strong { font-size: 15px; font-weight: 900; line-height: 1.45; }
  .subs-table-slim .subs-group-main > small { color: var(--muted); line-height: 1.5; }
  .subs-table-slim .subs-row-times { display: inline-flex; align-items: center; width: fit-content; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); }
  .subs-table-slim .subs-group-fact { display: grid; align-content: start; min-height: 74px; padding: 9px 10px !important; border-radius: 12px !important; background: var(--panel-2); }
  .subs-table-slim .subs-group-fact:not(.subs-group-students) { font-size: 13px; font-weight: 850; }
  .subs-table-slim .subs-group-students .count-badge { width: fit-content; min-width: 30px; }
  .subs-table-slim .subs-group-students small { margin-top: 3px; color: var(--muted); font-size: 11px; }
  .subs-table-slim .subs-group-remaining.neg { background: var(--danger-soft); }
  .subs-table-slim .subs-group-remaining.zero { background: var(--success-soft); color: var(--success); }
  .subs-table-slim .subs-group-collection { grid-column: 1 / -1; display: grid; gap: 7px; padding: 11px !important; border: 1px solid var(--line) !important; border-radius: 13px !important; background: color-mix(in srgb, var(--panel-2) 70%, var(--panel)); }
  .subs-table-slim .subs-group-collection::before { margin: 0 !important; }
  .subs-table-slim .subs-group-collection .collection-progress { max-width: none; height: 8px; }
  .subs-table-slim .subs-group-collection > small { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
  .subs-table-slim .subs-group-action { position: absolute; inset-inline-end: 12px; inset-block-start: 12px; width: auto; padding: 0; }
  .subs-table-slim .subs-group-action .table-action { gap: 5px; min-width: 40px; padding-inline: 11px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
  .subs-table-slim .subs-group-action-label { display: inline; font-size: 11px; font-weight: 850; white-space: nowrap; }
  .subs-table-slim .subs-group-row.is-open .subs-group-action .icon { transform: rotate(90deg); }
  .subs-table-slim tr.subs-expanded-row { display: block; margin: 0 12px 12px; }
  .subs-table-slim tr.subs-expanded-row > td { padding: 0; border: 0; }
  .subs-table-slim td.num { text-align: start; }
  .subs-groups-table-panel .panel-toggle-head { align-items: flex-start; padding: 14px; }
  .subs-groups-table-panel .panel-toggle-head small { line-height: 1.55; }
  .subs-groups-table-panel .panel-toggle-action { padding: 7px 10px; }
  .due-now-row { grid-template-columns: minmax(0, 1fr) auto; }
  .due-now-row .primary-mini { grid-column: 1 / -1; justify-content: center; }
}

@media print {
  .reports-tabs, .reports-month-toolbar, .report-preview-panel, .parent-reports-section:not(.print-target), .exports-section { display: none !important; }
  .overview-section { display: grid !important; }
  .overview-kpis { grid-template-columns: repeat(3, 1fr); }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .groups-report-table table { min-width: 0; }
}

/* ============================= مساحة التكريم ============================= */
.recognition-hub, .recognition-section { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
/* التلات أقسام جنب بعض في شريط واحد بسيط. كانوا عمودين، فالتالت بينزل لوحده
   سطر تحت وكأنه حاجة تانية مش قسم من نفس المكان. المفتوح بيبان كارت أبيض
   مرفوع جوّه الشريط، من غير تدرّج ذهبي تقيل. */
.recognition-tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2);
}
.recognition-tabs button {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 8px;
  border-radius: 10px; color: var(--muted); font-size: max(var(--fs-min), 13.5px); font-weight: 800; white-space: nowrap;
  transition: background var(--speed), color var(--speed), box-shadow var(--speed);
}
.recognition-tabs button:hover { color: var(--ink); }
.recognition-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(15, 23, 42, .08); }
.recognition-tabs button.active .icon { color: var(--gold); }
@media (max-width: 430px) {
  .recognition-tabs button { min-height: 50px; flex-direction: column; gap: 3px; padding: 4px; font-size: max(var(--fs-min), 12px); }
  .recognition-tabs button .icon { width: 16px; height: 16px; }
}
.recognition-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, #c99b2d 10%, var(--panel)), var(--panel)); }
.recognition-hero h2 { margin: 3px 0 5px; font-size: 24px; }
.recognition-hero p { color: var(--muted); max-width: 720px; }
.recognition-total { min-width: 130px; display: grid; justify-items: center; padding: 12px 18px; border: 1px solid color-mix(in srgb, #c99b2d 45%, var(--line)); border-radius: 16px; background: var(--panel); }
.recognition-total strong { color: #a67916; font-size: 34px; line-height: 1; }
.recognition-total span { margin-top: 5px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.recognition-filters { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.recognition-filters .full { grid-column: 1 / -1; }
.excellence-group { display: grid; gap: 13px; }
.excellence-group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.excellence-group-head span { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.excellence-group-head h3 { margin-top: 2px; font-size: 17px; }
.excellence-group-head > strong { color: #9b7217; padding: 6px 11px; border-radius: 999px; background: rgba(201, 155, 45, .12); font-size: var(--fs-min); }
.excellence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.excellence-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 9px 11px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); overflow: hidden; }
.excellence-card::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--line); }
.excellence-card.rank-1::before { background: #d5a514; }.excellence-card.rank-2::before { background: #9da7b1; }.excellence-card.rank-3::before { background: #b87333; }
/* حافة ذهبية معدنية ثابتة: الطبقة الأولى (padding-box) هي خلفية الكارت نفسه،
   والتانية (border-box) تدرّج ذهبي بيلف حوالين الحافة من غامق لفاتح فيدي إحساس
   المعدن المصقول، وحواليه توهج خارجي بتلات طبقات. من غير أي حركة. */
.excellence-card.rank-1,
.excellence-card-manual {
  border: 2px solid transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 218, .85),
    0 0 9px rgba(212, 160, 40, .8),
    0 0 22px rgba(212, 160, 40, .48),
    0 0 52px rgba(212, 160, 40, .26);
}
/* لمعة خفيفة على الحافة العليا بس — بتدي إحساس السطح المصقول من غير ما تمرّ فوق
   الأسماء وتقلّل وضوحها. الكارت أصلاً overflow: hidden فبتتقص على الزوايا. */
.excellence-card.rank-1::after,
.excellence-card-manual::after {
  content: ''; position: absolute; inset: 0 0 auto; height: 38%; z-index: 0; pointer-events: none;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .5), transparent);
}
/* اللمعة عنصر مطلق فبتترسم فوق النص لو سبناها — بنرفع محتوى الكارت فوقها. */
.excellence-card > * { position: relative; z-index: 1; }
.excellence-card.rank-1 {
  background-image:
    linear-gradient(135deg, rgba(231, 180, 34, .16), var(--panel-2)),
    var(--gold-sheen);
}
.excellence-card.rank-1::before { background: linear-gradient(180deg, #fff6d2, #d5a514 45%, #8a6712); }
.excellence-rank { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--panel); font-weight: 900; }
.excellence-student { display: grid; align-content: center; min-width: 0; }
.excellence-student strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.excellence-student span { color: var(--muted); font-size: var(--fs-min); }
.excellence-metrics { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.excellence-metrics span { display: flex; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 9px; background: var(--panel); color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.excellence-metrics b { color: var(--ink); }
.excellence-source { display: inline-flex; align-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(31, 107, 83, .12); color: #1f6b53; font-size: var(--fs-min); font-weight: 800; }
.excellence-source.manual { background: rgba(201, 155, 45, .16); color: #8a6712; }

/* شاشة المرشحين بالشروط */
.excellence-candidates { display: grid; gap: 12px; padding: 16px; min-width: 0; }
.excellence-candidates-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.excellence-candidates-head h3 { margin: 0; font-size: 16px; font-weight: 900; }
.excellence-candidates-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.excellence-candidates-head strong { font-variant-numeric: tabular-nums; }
.excellence-candidates-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.excellence-candidates-table th, .excellence-candidates-table td { padding: 9px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.excellence-candidates-table thead th { color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap; }
.excellence-candidates-table tbody tr:last-child > * { border-bottom: 0; }
.excellence-candidates-table tbody th small { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.excellence-candidates-table td { font-variant-numeric: tabular-nums; }
.excellence-candidate-reason { min-width: 14rem; color: var(--muted); line-height: 1.6; }
.excellence-candidate-actions { white-space: nowrap; }
.excellence-candidate-actions .table-action + .table-action { margin-inline-start: 6px; }
.excellence-matching { padding: 12px 16px; }
.excellence-matching summary { display: flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 800; }
.excellence-matching summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.excellence-matching p { margin: 8px 0 0; color: var(--muted); line-height: 1.8; }
.excellence-card-manual {
  background-image:
    linear-gradient(135deg, rgba(201, 155, 45, .12), var(--panel-2)),
    var(--gold-sheen);
}
.excellence-card-manual::before { background: linear-gradient(180deg, #fff6d2, #c99b2d 45%, #8a6712); }
.excellence-card-manual .excellence-rank { background: rgba(201, 155, 45, .18); color: #8a6712; }
.excellence-remove { grid-column: 1 / -1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); font: inherit; font-size: var(--fs-min); font-weight: 800; cursor: pointer; }
.excellence-remove:hover:not(:disabled) { border-color: rgba(180, 35, 24, .45); color: #b42318; }
.excellence-remove:disabled { opacity: .5; cursor: progress; }
.excellence-manual-add { position: relative; display: grid; gap: 11px; border-top-color: transparent; box-shadow: var(--shadow), 0 0 22px rgba(201, 155, 45, .25); }
/* شريط اللمعة نفسه فوق البانل — ::before عشان يحافظ على انحناء الزوايا. */
.excellence-manual-add::before {
  content: ''; position: absolute; inset-inline: -1px; top: -1px; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background-image: var(--gold-sheen); background-repeat: no-repeat;
}
.excellence-manual-add h3 { margin: 3px 0 4px; font-size: 17px; }
.excellence-manual-add p { color: var(--muted); font-size: max(var(--fs-min), 12.5px); }
.excellence-manual-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.excellence-manual-results button { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.excellence-manual-results button:hover:not(:disabled) { border-color: rgba(201, 155, 45, .55); background: rgba(201, 155, 45, .09); }
.excellence-manual-results button:disabled { opacity: .5; cursor: progress; }
.excellence-manual-results strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.excellence-manual-results span { color: var(--muted); font-size: var(--fs-min); }
.excellence-manual-results i { color: #8a6712; font-size: var(--fs-min); font-style: normal; font-weight: 800; }
/* الألوان الداكنة الثابتة بتبقى غير مقروءة فوق خلفية الوضع الليلي، فبنفتّحها. */
body.dark-mode .excellence-source { background: rgba(74, 222, 168, .16); color: #7ee2bb; }
body.dark-mode .excellence-source.manual { background: rgba(231, 180, 34, .18); color: #f0cf7a; }
body.dark-mode .excellence-card-manual .excellence-rank { color: #f0cf7a; }
body.dark-mode .excellence-manual-results i { color: #f0cf7a; }
/* على الخلفية الداكنة الذهبي بيلمع أكتر: بنكبّر هالة التوهج وبنهدّي الحلقة
   الداخلية واللمعة البيضاء عشان ما تبهرش العين. */
body.dark-mode .excellence-card.rank-1,
body.dark-mode .excellence-card-manual {
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 218, .3),
    0 0 12px rgba(231, 180, 34, .6),
    0 0 30px rgba(231, 180, 34, .34),
    0 0 66px rgba(231, 180, 34, .18);
}
body.dark-mode .excellence-card.rank-1::after,
body.dark-mode .excellence-card-manual::after { opacity: .3; }
@media print {
  .excellence-card.rank-1, .excellence-card-manual { box-shadow: none; }
}

.certificate-workspace { grid-template-columns: minmax(340px, .78fr) minmax(0, 1.6fr); align-items: start; gap: 18px; }
.certificate-picker { min-width: 0; border-top: 3px solid #c69a39; }
.certificate-preview-panel { min-width: 0; display: grid; gap: 12px; padding: 14px; overflow: hidden; }
.certificate-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 4px; }
.certificate-preview-head h2 { margin-top: 2px; font-size: 19px; }
.certificate-live-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid rgba(20, 151, 94, .2); border-radius: 999px; color: #147a50; background: rgba(20, 151, 94, .08); font-size: var(--fs-min); font-weight: 900; }
.certificate-live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #1cb777; box-shadow: 0 0 0 4px rgba(28, 183, 119, .13); }
.certificate-picker .section-head { align-items: center; }
.certificate-picker .section-head h2 { margin: 3px 0 5px; }
.certificate-picker .submit-btn { width: auto; min-width: 168px; }
.certificate-print-btn { background: linear-gradient(135deg, #c99b36, #a87518); box-shadow: 0 9px 20px rgba(168, 117, 24, .24); }
.certificate-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0 12px; padding: 6px; border-radius: 13px; background: var(--panel-2); }
.certificate-steps span { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 7px 5px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap; }
.certificate-steps b { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: var(--fs-min); }
.certificate-steps .done { color: var(--ink); }.certificate-steps .done b { border-color: rgba(185, 145, 47, .42); color: #8c6616; background: rgba(185, 145, 47, .12); }
.certificate-student-results { display: flex; gap: 8px; overflow-x: auto; padding: 10px 1px 14px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.certificate-student-results button { flex: 0 0 190px; scroll-snap-align: start; display: grid; gap: 3px; text-align: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--panel-2); transition: .18s ease; }
.certificate-student-results button:hover { transform: translateY(-1px); border-color: rgba(185, 145, 47, .55); }
.certificate-student-results button.active { border-color: #b9912f; background: linear-gradient(135deg, rgba(185, 145, 47, .16), rgba(185, 145, 47, .06)); box-shadow: 0 6px 16px rgba(117, 85, 21, .1); }
.certificate-student-results button.active::after { content: 'محدد'; justify-self: end; margin-top: -19px; color: #8c6616; font-size: var(--fs-min); font-weight: 900; }
.certificate-student-results strong { font-size: var(--fs-min); }.certificate-student-results span { overflow: hidden; color: var(--muted); font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
.certificate-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.certificate-editor .full { grid-column: 1 / -1; }
.certificate-editor-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.certificate-editor-title span { font-size: 13px; font-weight: 900; }.certificate-editor-title small { color: var(--muted); font-size: var(--fs-min); }
.certificate-preview-wrap { overflow: auto; min-height: 510px; display: grid; place-items: center; padding: 22px; border: 1px solid rgba(255,255,255,.07); border-radius: 18px; background: radial-gradient(circle at 50% 30%, #4a5260, #252b35 58%, #1c2129); box-shadow: inset 0 0 0 1px rgba(0,0,0,.28), inset 0 20px 45px rgba(255,255,255,.035); }

.certificate-sheet { --cert-primary: #b9912f; --cert-secondary: #e8d8a6; position: relative; isolation: isolate; width: min(100%, 980px); aspect-ratio: 297 / 210; margin: 0 auto; padding: 2.2cqw; overflow: hidden; color: #282117; background-color: #fffaf0; background-image: radial-gradient(circle at 50% 44%, rgba(255,255,255,.96) 0 17%, rgba(255,251,238,.5) 42%, transparent 67%), linear-gradient(135deg, rgba(185,145,47,.07), transparent 28%, rgba(185,145,47,.045) 68%, transparent), repeating-linear-gradient(0deg, rgba(121,93,37,.018) 0 1px, transparent 1px 4px); font-family: Cairo, serif; container-type: inline-size; box-shadow: 0 24px 55px rgba(0,0,0,.32), 0 4px 12px rgba(0,0,0,.18); }
.certificate-sheet::before { content: ''; position: absolute; z-index: -1; width: 54cqw; height: 54cqw; left: 23cqw; top: 8cqw; border: .09cqw solid rgba(185,145,47,.08); border-radius: 50%; box-shadow: 0 0 0 2.6cqw rgba(185,145,47,.025), 0 0 0 5.3cqw rgba(185,145,47,.022), inset 0 0 0 3cqw rgba(185,145,47,.018); }
.certificate-sheet::after { content: '✦'; position: absolute; z-index: -1; inset: 23% 34%; display: grid; place-items: center; color: rgba(185,145,47,.035); font-family: Georgia, serif; font-size: 24cqw; line-height: 1; transform: rotate(15deg); }
/* توزيع ارتفاع الشهادة
   ------------------------------------------------------------------
   قبل كده كان في صف مرن واحد (1fr) بين البيانات والتذييل، فكان بيبلع كل
   المساحة الفاضية ويرميها في مكان واحد: ١٧٠px من ٣٦٩ يعني ٤٦٪ من الشهادة
   فراغ متجمع في بند واحد، والكلام كله مكدوس في التلت الفوقاني.

   دلوقتي الفراغ متوزّع على تلات فواصل مرنة (بعد النص، وقبل التذييل، وحوالين
   بيانات المرحلة) فالمحتوى بينفرد على طول الشهادة. الصفوف مرقّمة صراحةً عشان
   الفواصل دي تبقى صفوف حقيقية من غير ما نضيف عناصر فاضية في الـ HTML. */
.certificate-frame {
  position: relative; height: 100%; min-height: 0; display: grid;
  grid-template-rows:
    auto                     /* 1  الترويسة */
    minmax(1cqw, 0.5fr)      /* 2  فاصل */
    auto                     /* 3  نص المنح */
    auto                     /* 4  «بكل فخر واعتزاز إلى» */
    auto                     /* 5  اسم الطالب */
    auto                     /* 6  سبب التكريم */
    minmax(.9cqw, 0.45fr)    /* 7  فاصل */
    auto                     /* 8  المرحلة والمجموعة والمادة */
    minmax(1cqw, 0.65fr)     /* 9  فاصل */
    auto                     /* 10 التذييل */
    auto;                    /* 11 التاريخ والختم والتوقيع */
  align-items: center; justify-items: center;
  padding: 3.6cqw 5.7cqw 2.8cqw;
  border: .28cqw solid var(--cert-primary);
  box-shadow: inset 0 0 0 .12cqw #fffaf0, inset 0 0 0 .24cqw var(--cert-secondary), inset 0 0 0 .45cqw #fffaf0, inset 0 0 0 .53cqw var(--cert-primary);
  text-align: center;
}

.certificate-top { grid-row: 1; }
.certificate-body { grid-row: 3; }
.certificate-recipient-label { grid-row: 4; }
.certificate-name { grid-row: 5; }
.certificate-achievement { grid-row: 6; }
.certificate-meta { grid-row: 8; }
.certificate-footer { grid-row: 10; }
.certificate-bottom { grid-row: 11; }
.certificate-frame::before { content: ''; position: absolute; inset: 1.15cqw; border: .07cqw solid rgba(185, 145, 47, .62); pointer-events: none; }
.certificate-frame::after { content: '◆'; position: absolute; bottom: .47cqw; left: 50%; padding: 0 .65cqw; color: var(--cert-primary); background: #fffaf0; font-family: Georgia, serif; font-size: .95cqw; line-height: 1; transform: translateX(-50%); pointer-events: none; }
.cert-corner { position: absolute; z-index: 2; width: 11.5cqw; height: 11.5cqw; color: var(--cert-primary); fill: rgba(185, 145, 47, .09); stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.cert-corner.c1 { top: .65cqw; right: .65cqw; transform: scaleX(-1); }.cert-corner.c2 { top: .65cqw; left: .65cqw; }
.cert-corner.c3 { right: .65cqw; bottom: .65cqw; transform: scale(-1); }.cert-corner.c4 { bottom: .65cqw; left: .65cqw; transform: scaleY(-1); }
.certificate-watermark { position: absolute; z-index: -1; top: 50%; left: 50%; width: 24cqw; height: 24cqw; display: grid; place-items: center; border: .12cqw solid rgba(185,145,47,.07); border-radius: 50%; color: rgba(185,145,47,.045); transform: translate(-50%, -43%); }
.certificate-watermark::before, .certificate-watermark::after { content: ''; position: absolute; inset: 2cqw; border: .1cqw dashed rgba(185,145,47,.08); border-radius: 50%; transform: rotate(18deg); }.certificate-watermark::after { inset: 4.1cqw; transform: rotate(-18deg); }
.certificate-watermark span { font-size: 11cqw; font-weight: 900; }
.certificate-top { width: 100%; display: grid; grid-template-columns: 1.1fr 3.8fr 1.1fr; align-items: center; direction: ltr; }
.certificate-brand, .certificate-heading, .certificate-authentic { direction: rtl; }
.certificate-brand { grid-column: 3; grid-row: 1; justify-self: end; display: grid; justify-items: center; gap: .45cqw; width: 11cqw; }
.certificate-brand-mark { width: 5.2cqw; height: 5.2cqw; display: grid; place-items: center; overflow: hidden; border: .12cqw solid var(--cert-primary); border-radius: 1.25cqw; color: #fffdf5; background: linear-gradient(145deg, #8d6e22, var(--cert-primary)); box-shadow: 0 .45cqw .9cqw rgba(105,73,16,.18); transform: rotate(45deg); }
.certificate-brand-mark span, .certificate-brand-mark img { transform: rotate(-45deg); }.certificate-brand-mark span { font-size: 2.7cqw; font-weight: 900; }.certificate-brand-mark img { width: 78%; height: 78%; object-fit: contain; }
.certificate-brand > strong { max-width: 13cqw; overflow: hidden; color: #5f5137; font-size: .9cqw; line-height: 1.45; }
.certificate-heading { grid-column: 2; grid-row: 1; }
.certificate-authentic { grid-column: 1; grid-row: 1; justify-self: start; display: grid; gap: .3cqw; width: 12cqw; padding: .7cqw .9cqw; border-top: .08cqw solid var(--cert-primary); border-bottom: .08cqw solid var(--cert-primary); color: #75643e; font-size: .78cqw; }
.certificate-authentic strong { color: #443a28; font-size: .72cqw; }
.certificate-basmala { color: #373023; font-family: 'Amiri', 'Traditional Arabic', serif; font-size: 1.5cqw; font-weight: 700; letter-spacing: .03cqw; }
.certificate-kicker { display: block; margin-top: .55cqw; color: #79683f; font-size: 1cqw; font-weight: 900; letter-spacing: .12cqw; }
.certificate-top h1 { margin: .12cqw 0 0; color: var(--cert-primary); font-family: 'Amiri', Cairo, serif; font-size: 4.4cqw; line-height: 1.08; font-weight: 900; text-shadow: 0 .08cqw 0 #fff, 0 .14cqw .18cqw rgba(96,66,16,.12); }
.certificate-title-ornament { display: flex; align-items: center; justify-content: center; gap: .55cqw; width: 18cqw; margin: .35cqw auto .35cqw; color: var(--cert-primary); font-family: Georgia, serif; font-size: .85cqw; }
.certificate-title-ornament i { width: 7cqw; height: max(1.5px, .08cqw); background: linear-gradient(90deg, transparent, var(--cert-primary)); }.certificate-title-ornament i:last-child { background: linear-gradient(90deg, var(--cert-primary), transparent); }
/* نص المنح كان 1.25cqw يعني ١٠.٦pt على A4 — تحت الحد الموصى بيه (١٢–١٨pt). */
.certificate-body { width: 84%; margin: .25cqw 0 0; color: #574b35; font-size: 1.75cqw; line-height: 1.3; font-weight: 700; }
.certificate-recipient-label { margin-top: .05cqw; color: #8b7647; font-size: 1.2cqw; font-weight: 800; }
/* اسم الطالب هو بؤرة الشهادة، فلازم يكون أكبر عنصر فيها — كان 3.45cqw يعني
   أصغر من العنوان (4.25cqw)، فالعين كانت بتروح للعنوان بدل الاسم. */
.certificate-name { position: relative; min-width: 56%; max-width: 84%; margin: .35cqw 0 .5cqw; padding: .05cqw 2.4cqw .8cqw; color: #211b13; font-family: 'Amiri', Cairo, serif; font-size: 5.4cqw; font-weight: 900; line-height: 1.15; }
.certificate-name::before { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: max(1.5px, .11cqw); background: linear-gradient(90deg, transparent, var(--cert-primary) 18%, var(--cert-primary) 82%, transparent); }
.certificate-name::after { content: '◆'; position: absolute; bottom: -.5cqw; left: 50%; padding: 0 .4cqw; color: var(--cert-primary); background: #fffaf0; font-family: Georgia, serif; font-size: .85cqw; transform: translateX(-50%); }
.certificate-achievement { width: 86%; margin: .1cqw 0 .5cqw; color: #403626; font-size: 1.7cqw; line-height: 1.35; font-weight: 700; }
/* الخانات بتتوزّع على العرض بعددها الفعلي: المادة اختيارية، وتلات أعمدة
   ثابتة كانت بتسيب فراغ مكان الخانة الناقصة في نص الشهادة المطبوعة. */
.certificate-meta { width: 74%; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: .8cqw; margin-top: .05cqw; }
.certificate-meta > span { display: grid; gap: .18cqw; padding: .65cqw .8cqw; border: .07cqw solid rgba(185, 145, 47, .3); border-radius: .55cqw; background: rgba(255,255,255,.48); }
.certificate-meta small { color: #8a7956; font-size: .86cqw; font-weight: 700; }.certificate-meta strong { overflow: hidden; color: #463a26; font-size: 1.15cqw; font-weight: 900; }
/* الصف بقى ليه صف خاص بيه في الشبكة، فمابقاش محتاج align-self: end عشان يلزق تحت. */
.certificate-footer { margin: .3cqw 0 .15cqw; color: #716243; font-size: 1.28cqw; font-weight: 800; }
.certificate-bottom { width: 88%; display: grid; grid-template-columns: 1fr .9fr 1fr; align-items: end; direction: ltr; }
.certificate-date, .certificate-signature { direction: rtl; display: grid; justify-items: center; gap: .22cqw; min-width: 13cqw; color: #766746; font-size: .95cqw; }
.certificate-date { justify-self: start; }.certificate-signature { justify-self: end; }
.certificate-date strong, .certificate-signature strong { color: #32291d; font-size: 1.32cqw; font-weight: 900; }
.certificate-date i, .certificate-signature i { width: 14cqw; height: max(1.5px, .08cqw); margin-top: .28cqw; background: linear-gradient(90deg, transparent, var(--cert-primary), transparent); }
.certificate-seal { position: relative; z-index: 2; justify-self: center; width: 8cqw; height: 8cqw; display: grid; place-content: center; justify-items: center; border: .35cqw double #fff1af; outline: .18cqw solid #b98217; outline-offset: -.11cqw; border-radius: 50%; color: #6b4905; background: radial-gradient(circle at 36% 28%, #fff3a8 0 8%, #ecc853 30%, #c79525 70%, #a56b0b); box-shadow: 0 .55cqw 1.1cqw rgba(103,69,9,.25), inset 0 0 0 .2cqw rgba(255,255,255,.34); line-height: 1; }
.certificate-seal::before { content: ''; position: absolute; inset: .65cqw; border: .08cqw dashed rgba(92,59,5,.55); border-radius: 50%; }
.certificate-seal .seal-star { color: #76500a; font-size: 1.25cqw; }.certificate-seal strong { margin-top: .15cqw; color: #614005; font-size: 1.25cqw; }.certificate-seal small { margin-top: .2cqw; color: #74500b; font-family: Arial, sans-serif; font-size: .56cqw; font-weight: 800; letter-spacing: .07cqw; }
.seal-ribbon { position: absolute; z-index: -1; bottom: -2.2cqw; width: 1.9cqw; height: 3.4cqw; background: linear-gradient(90deg, #a86e0c, #ddb743 48%, #9d6509); clip-path: polygon(0 0,100% 0,100% 100%,50% 76%,0 100%); }.seal-ribbon.r1 { left: 1.05cqw; transform: rotate(12deg); }.seal-ribbon.r2 { right: 1.05cqw; transform: rotate(-12deg); }
.recognition-settings { grid-column: 1 / -1; }
.recognition-settings summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 900; }
.recognition-settings[open] summary { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.certificate-toggles { display: flex; gap: 18px; flex-wrap: wrap; }
.certificate-toggles label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-min); font-weight: 800; }

@media (max-width: 1150px) {
  .certificate-workspace { grid-template-columns: 1fr; }
  .certificate-preview-wrap { min-height: 440px; }
}
@media (max-width: 760px) {
  .certificate-workspace { grid-template-columns: 1fr; }
  .recognition-hero { align-items: stretch; flex-direction: column; }.recognition-total { grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 8px; }
  .recognition-filters, .certificate-editor { grid-template-columns: 1fr 1fr; }
  .certificate-editor .full { grid-column: 1 / -1; }
  .certificate-picker .section-head { align-items: stretch; flex-direction: column; }.certificate-picker .submit-btn { width: 100%; }
  .certificate-preview-head { align-items: flex-start; flex-direction: column; }
  .certificate-preview-wrap { min-height: 330px; margin-inline: -4px; padding: 10px; }
}
@media (max-width: 620px) {
  .recognition-filters, .certificate-editor { grid-template-columns: 1fr; }.certificate-editor .full { grid-column: auto; }
  .certificate-steps { grid-template-columns: 1fr; }.certificate-steps span { justify-content: flex-start; }
  .certificate-editor-title { align-items: flex-start; flex-direction: column; }
  .certificate-preview-wrap { place-items: center start; min-height: 315px; }
  .certificate-sheet { width: 700px; max-width: none; }
}

/* ---------------- قالب «الإطار الملكي» ----------------
   الورقة نفسها A4 عرضية، وكل المقاسات بوحدة cqw (نسبة من عرض الورقة) عشان
   الشكل يفضل هو هو في المعاينة الصغيرة وفي الطباعة وفي ملف الـ PDF. الزخرفة
   كلها SVG بألوان مكتوبة على العناصر نفسها (شوف certificate-sheet.js). */
.certificate-sheet.cert-royal {
  padding: 0;
  color: #12305c;
  background: #0d2242;
  background-image: none;
  box-shadow: 0 24px 55px rgba(0, 0, 0, .38), 0 4px 12px rgba(0, 0, 0, .22);
}
.certificate-sheet.cert-royal::before, .certificate-sheet.cert-royal::after { content: none; }
.cert-royal-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cert-royal-body {
  position: relative; z-index: 2;
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 6.8cqw 11cqw 3.9cqw; text-align: center;
}
.cert-royal-title {
  margin: 0; color: #0d2242; font-family: Cairo, 'Traditional Arabic', serif;
  font-size: 7.2cqw; font-weight: 900; line-height: 1.14;
  text-shadow: 0 .1cqw 0 rgba(255, 255, 255, .8);
}
/* نفس حيلة كارت الباركود: كل كلمة في span والمسافة بينهم gap حقيقي، لأن
   html2canvas بيرسم الكلمة العربية أعرض من صندوقها فبتلزق في اللي بعدها. */
.cert-words { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .12em .3em; }
.cert-line { width: 100%; }
/* الفقرات: المسافة بين السطور بقت row-gap بدل line-height، فالمجموع بيدي نفس
   التنفّس القديم مع إن كل كلمة بقت عنصر مستقل. */
.cert-royal-text, .certificate-body, .certificate-achievement, .certificate-footer,
.certificate-recipient-label { display: flex; flex-direction: column; align-items: center; }
.cert-royal-text .cert-line { row-gap: .55em; column-gap: .34em; }
.certificate-body .cert-line, .certificate-achievement .cert-line { row-gap: .45em; column-gap: .32em; }
.cert-royal-presented {
  display: flex; align-items: center; justify-content: center; gap: 1.1cqw;
  width: 42cqw; margin-top: 1.1cqw; color: #315a8f; font-size: 1.9cqw; font-weight: 800;
}
/* الخطوط الشعرية بتاخد أرضية 1.5px مقصودة: html2canvas (اللي بيعمل PDF/PNG)
   بيرسم التدرّجات كـ pattern، وأي عنصر ارتفاعه بيقرّب لصفر بعد الضرب في الـ
   scale بيوقّع التصدير كله بخطأ createPattern. */
.cert-royal-presented i { flex: 1; height: max(1.5px, .12cqw); background: linear-gradient(90deg, transparent, #cfa74f); }
.cert-royal-presented i:last-child { background: linear-gradient(90deg, #cfa74f, transparent); }
.cert-royal-name {
  max-width: 100%; margin-top: 1.5cqw; padding: 0 1.5cqw;
  color: #0d2242; font-size: 5.2cqw; font-weight: 900; line-height: 1.22;
}
.cert-royal-rule { display: flex; align-items: center; justify-content: center; gap: .9cqw; width: 48cqw; margin-top: .9cqw; color: #cfa74f; font-size: 1.15cqw; }
.cert-royal-rule i { flex: 1; height: max(1.5px, .1cqw); background: linear-gradient(90deg, transparent, #cfa74f); }
.cert-royal-rule i:last-child { background: linear-gradient(90deg, #cfa74f, transparent); }
.cert-royal-text {
  width: 68cqw; margin: 2cqw 0 0; color: #1b3c67;
  font-size: 2.15cqw; font-weight: 700; line-height: 1.4;
}
/* الذيل مثبت في آخر الورقة مهما طال النص فوقه: التاريخ والصف يمين، الختم في
   النص، والتوقيع شمال — نفس ترتيب الشهادة المطبوعة. */
.cert-royal-foot {
  width: 100%; margin-top: auto; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: end; gap: 2cqw;
}
.cert-royal-facts { display: grid; gap: .75cqw; justify-items: start; text-align: start; }
.cert-royal-facts span { display: flex; align-items: baseline; gap: .7cqw; }
.cert-royal-facts small { color: #47679a; font-size: 1.35cqw; font-weight: 800; }
.cert-royal-facts b { min-width: 12cqw; padding-bottom: .25cqw; border-bottom: .1cqw dotted #9db0cc; color: #0d2242; font-size: 1.5cqw; font-weight: 900; }
.cert-royal-seal { width: 16.5cqw; justify-self: center; }
.cert-royal-seal svg { width: 100%; height: auto; display: block; }
.cert-royal-seal-placeholder { width: 16.5cqw; }
.cert-royal-sign { display: grid; justify-items: center; gap: .3cqw; justify-self: end; }
.cert-royal-sign small { color: #47679a; font-size: 1.35cqw; font-weight: 800; }
.cert-royal-sign i { width: 16cqw; height: max(1.5px, .1cqw); margin: .3cqw 0; background: linear-gradient(90deg, transparent, #cfa74f, transparent); }
.cert-royal-sign b { color: #0d2242; font-size: 1.75cqw; font-weight: 900; }
.cert-royal-sign em { color: #47679a; font-size: 1.2cqw; font-style: normal; font-weight: 700; }

/* ---------------- التصميمات التمانية التانية ----------------
   جسم واحد لكلهم. الألوان والمسافات متغيرات على الورقة نفسها (شوف
   certificate-designs.js)، والخطوط الشعرية لون سادة مش تدرّج عشان التصدير. */
.certificate-sheet.cert-design {
  padding: 0; color: var(--cd-text); background: var(--cd-ground); background-image: none;
  box-shadow: 0 24px 55px rgba(0, 0, 0, .34), 0 4px 12px rgba(0, 0, 0, .2);
}
.certificate-sheet.cert-design::before, .certificate-sheet.cert-design::after { content: none; }
.cert-design-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cert-design-body {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; align-items: center; padding: var(--cd-pad); text-align: center;
}
.cert-design-center { color: var(--cd-muted); font-size: 1.45cqw; font-weight: 800; }
.cert-design-title { margin: .3cqw 0 0; color: var(--cd-title); font-family: Cairo, 'Traditional Arabic', serif; font-size: 6.2cqw; font-weight: 900; line-height: 1.14; }
.cert-design-presented {
  display: flex; align-items: center; justify-content: center; gap: 1.1cqw;
  width: 40cqw; margin-top: .9cqw; color: var(--cd-muted); font-size: 1.8cqw; font-weight: 800;
}
.cert-design-presented i, .cert-design-rule i { flex: 1; height: max(1.5px, .11cqw); background: var(--cd-accent); }
.cert-design-name { max-width: 100%; margin-top: 1.3cqw; padding: 0 1.5cqw; color: var(--cd-name); font-size: 5cqw; font-weight: 900; line-height: 1.22; }
.cert-design-rule { display: flex; align-items: center; gap: .9cqw; width: 44cqw; margin-top: .8cqw; }
.cert-design-rule b { width: .95cqw; height: .95cqw; flex: none; background: var(--cd-accent); transform: rotate(45deg); }
.cert-design-text {
  width: 66cqw; margin: 1.8cqw 0 0; display: flex; flex-direction: column; align-items: center;
  color: var(--cd-text); font-size: 2.05cqw; font-weight: 700; line-height: 1.4;
}
.cert-design-text .cert-line { row-gap: .55em; column-gap: .34em; }
.cert-design-foot { width: 100%; margin-top: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 2cqw; }
.cert-design-facts { display: grid; gap: .7cqw; justify-items: start; text-align: start; }
.cert-design-facts span { display: flex; align-items: baseline; gap: .7cqw; }
.cert-design-facts small, .cert-design-sign small { color: var(--cd-muted); font-size: 1.3cqw; font-weight: 800; }
.cert-design-facts b { min-width: 12cqw; padding-bottom: .25cqw; border-bottom: .1cqw dotted var(--cd-muted); color: var(--cd-name); font-size: 1.45cqw; font-weight: 900; }
.cert-design-seal { width: 13.5cqw; justify-self: center; }
.cert-design-seal svg { width: 100%; height: auto; display: block; }
.cert-design-sign { display: grid; justify-items: center; gap: .3cqw; justify-self: end; }
.cert-design-sign i { width: 16cqw; height: max(1.5px, .1cqw); margin: .3cqw 0; background: var(--cd-accent); }
.cert-design-sign b { color: var(--cd-name); font-size: 1.7cqw; font-weight: 900; }
.cert-design-sign em { color: var(--cd-muted); font-size: 1.2cqw; font-style: normal; font-weight: 700; }

/* ---------------- شريط اختيار التصميم ----------------
   صورة مصغّرة حقيقية من كل تصميم (نفس ماركب الطباعة) — كل المقاسات بوحدة
   cqw، فالورقة بتصغر جوّه الزرار من غير أي أنماط مخصوصة للمصغّر. */
.design-picker { display: grid; gap: 10px; margin-bottom: 14px; }
.design-picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.design-picker-head strong { font-size: 14px; font-weight: 900; }
.design-picker-head span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.design-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.design-picker-grid.is-congrats { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.design-option {
  position: relative; min-width: 0; display: grid; align-content: start; gap: 7px; padding: 6px 6px 8px;
  border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--panel-2); text-align: center;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.design-option:hover { border-color: rgba(185, 145, 47, .55); transform: translateY(-1px); }
.design-option:focus-visible { outline: 2px solid #b9912f; outline-offset: 2px; }
.design-option.active { border-color: #b9912f; background: var(--panel); box-shadow: 0 0 0 2px rgba(185, 145, 47, .35); }
.design-option.active::after {
  content: '✓'; position: absolute; top: 11px; inset-inline-start: 11px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%; color: #fff; background: #b9912f; font-size: 12px; font-weight: 900;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.design-thumb { display: block; overflow: hidden; border-radius: 8px; pointer-events: none; }
.design-thumb :is(.certificate-sheet, .congrats-card) { width: 100%; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
.design-option-name { display: grid; gap: 1px; min-width: 0; }
.design-option-name b { overflow: hidden; font-size: 12.5px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.design-option-name small { overflow: hidden; color: var(--muted); font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .design-picker-grid, .design-picker-grid.is-congrats {
    display: flex; overflow-x: auto; margin-inline: -4px; padding: 2px 4px 8px;
    scroll-snap-type: x proximity; scrollbar-width: thin;
  }
  .design-option { flex: 0 0 136px; scroll-snap-align: start; }
  .design-picker-grid.is-congrats .design-option { flex-basis: 112px; }
}

/* ---------------- استوديو الشهادات: الوضع الجماعي ---------------- */
.certificate-mode-tabs {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 6px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow);
}
.certificate-mode-tabs button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; color: var(--muted); font-weight: 800; }
.certificate-mode-tabs button:hover { color: var(--ink); background: var(--panel-2); }
.certificate-mode-tabs button.active { color: #fff; background: linear-gradient(135deg, #123a70, #1f5ba8); box-shadow: 0 8px 20px rgba(18, 58, 112, .24); }
.certificate-workspace.is-batch { grid-template-columns: minmax(0, 1fr); }
.certificate-batch-panel { display: grid; gap: 14px; border-top: 3px solid #c69a39; }
.certificate-batch-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.certificate-batch-quick { display: flex; flex-wrap: wrap; gap: 7px; }
.certificate-batch-quick .period-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-min); }
.certificate-batch-quick .period-chip .icon { width: 14px; height: 14px; }
.certificate-batch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px;
  max-height: 340px; overflow-y: auto; padding: 2px; scrollbar-width: thin;
}
.certificate-batch-chip {
  min-width: 0; display: flex; align-items: center; gap: 9px; padding: 9px 11px; text-align: start;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); transition: .16s ease;
}
.certificate-batch-chip:hover { border-color: rgba(185, 145, 47, .55); transform: translateY(-1px); }
.certificate-batch-chip.selected { border-color: #b9912f; background: linear-gradient(135deg, rgba(185, 145, 47, .16), rgba(185, 145, 47, .05)); }
.certificate-batch-check {
  width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: #7a5a11; font-size: var(--fs-min); font-weight: 900;
}
.certificate-batch-chip.selected .certificate-batch-check { border-color: #b9912f; background: #f4e3b6; }
.certificate-batch-info { min-width: 0; display: grid; gap: 2px; }
.certificate-batch-info strong { overflow: hidden; font-size: max(var(--fs-min), 12.5px); text-overflow: ellipsis; white-space: nowrap; }
.certificate-batch-info small { overflow: hidden; color: var(--muted); font-size: var(--fs-min); text-overflow: ellipsis; white-space: nowrap; }
.certificate-output-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2);
}
.certificate-output-count { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.certificate-output-count b { color: var(--ink); font-size: 15px; }
.certificate-output-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.certificate-output-actions .submit-btn, .certificate-output-actions .ghost-btn { width: auto; min-width: 132px; justify-content: center; }
.certificate-output-actions button[disabled] { opacity: .5; cursor: not-allowed; }

/* جذر التصدير: نفس الورقة بمقاس بكسل ثابت خارج الشاشة، عشان جودة الـ PDF/PNG
   ما تتعلقش بحجم نافذة المتصفح ولا بزوم الواجهة. */
.certificate-export-root { position: fixed; inset: 0 auto auto -20000px; z-index: -1; width: 1400px; background: #fff; }
.certificate-export-root .certificate-print-page { width: 1400px; }
/* نفس تعويض كارت الباركود: html2canvas بيرسم كل كلمة عربية أعرض من صندوقها،
   فالمسافة اللي كفاية على الشاشة بتتاكل في الـ PDF/PNG والكلام يطلع ملزوق. */
.certificate-export-root .cert-words,
.certificate-export-root .cert-royal-text .cert-line,
.certificate-export-root .cert-design-text .cert-line,
.certificate-export-root .certificate-body .cert-line,
.certificate-export-root .certificate-achievement .cert-line { column-gap: .62em; }
.certificate-export-root .certificate-sheet { width: 1400px; height: 990px; max-width: none; margin: 0; box-shadow: none; }
/* ---------------- كارت تهنئة جروب التفوق ----------------
   مربع واحد بيتبعت على واتساب، مش ورقة بتتطبع. كل المقاسات بوحدة cqw (نسبة من
   عرض الكارت) عشان المعاينة الصغيرة والصورة المصدّرة (1080×1080) يطلعوا نفس
   الشكل بالحرف. من غير color-mix ولا letter-spacing هنا: html2canvas بيتعتّر
   فيهم فبتطلع الصورة بألوان تانية. */
.congrats-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 20px;
  color: #f7f4ec;
  /* اللونين جايين كمتغيرين على العنصر نفسه من الإعدادات — والقيمة الافتراضية
     هنا عشان الكارت يفضل مضبوط لو اتعرض من غير إعدادات. */
  background: var(--congrats-navy, #0d2242);
  font-family: Cairo, sans-serif;
  container-type: inline-size;
  box-shadow: 0 24px 55px rgba(0, 0, 0, .32), 0 4px 12px rgba(0, 0, 0, .18);
}
.congrats-art { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
/* عمود مرن: لو المدرس فتح كل السطور مرة واحدة، الميدالية هي اللي بتصغر لحد
   ١٢cqw بدل ما آخر سطر يتقص برّه الكارت. باقي العناصر مقاسها ثابت. */
.congrats-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4cqw; height: 100%; padding: 9cqw 8cqw; text-align: center; }
.congrats-body > * { flex: none; }
.congrats-body > .congrats-medal { flex: 0 1 21cqw; width: 19cqw; height: auto; min-height: 12cqw; margin-bottom: 1cqw; }
.congrats-kicker { color: var(--congrats-gold, #cfa74f); font-size: 3.2cqw; font-weight: 800; }
.congrats-headline { margin: 0; color: var(--congrats-gold-light, #f7e6b4); font-size: 12cqw; font-weight: 900; line-height: 1.08; }
.congrats-sub { margin: 0; color: var(--congrats-text, #ffffff); font-size: 4.4cqw; font-weight: 700; }
/* المستطيل فيه الاسم وبس. الاسم هو الخبر، وأي سطر تاني جوّه المستطيل بيخلي
   العين تقراهم مع بعض كأنهم سطر واحد — فالباقي نزل تحته على الأرضية الكحلي. */
.congrats-plate { display: grid; justify-items: center; width: 100%; margin-top: 3cqw; padding: 3.6cqw 4cqw; border: .7cqw solid var(--congrats-gold, #cfa74f); border-radius: 3cqw; background: var(--congrats-plate, #f7f4ec); }
.congrats-name { color: var(--congrats-plate-ink, #12305c); font-size: 7.6cqw; font-weight: 900; line-height: 1.22; }
/* سطر المدرس والمادة: اسم بالأبيض ومادة بالذهب والنقطة بينهم دايرة صغيرة —
   الدايرة عنصر مش حرف، عشان تفضل في نصّ السطر مهما اتغيّر الخط. */
.congrats-teacher { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .8cqw 2.4cqw; margin: 2.8cqw 0 0; font-size: 3.7cqw; font-weight: 800; }
.congrats-teacher-name { color: var(--congrats-text, #ffffff); }
.congrats-teacher-dot { flex: none; width: 1cqw; height: 1cqw; border-radius: 50%; background: var(--congrats-gold, #cfa74f); }
.congrats-subject { color: var(--congrats-gold-light, #f7e6b4); }
.congrats-place { margin: 1.8cqw 0 0; color: var(--congrats-soft, #c8d6ef); font-size: 3cqw; font-weight: 700; }
.congrats-date { margin: 2.2cqw 0 0; color: var(--congrats-gold, #cfa74f); font-size: 3.2cqw; font-weight: 700; }
.congrats-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1cqw 3cqw; margin-top: 2.6cqw; color: var(--congrats-soft, #c8d6ef); font-size: 2.9cqw; font-weight: 700; }

/* جذر التصدير: بره الشاشة وبمقاس ثابت بالبكسل، عشان الصورة ما تتأثرش بعرض
   النافذة ولا بالزوم — نفس أسلوب جذر الشهادات. */
.congrats-export-root { position: fixed; inset: 0 auto auto -20000px; z-index: -1; width: 1080px; background: #0d2242; }
.congrats-export-root .congrats-card { width: 1080px; height: 1080px; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
.congrats-export-root .cert-words { column-gap: .62em; }
.certificate-print-root { display: grid; gap: 0; }

@media print {
  body.printing-recognition-certificate { zoom: 1 !important; margin: 0 !important; background: #fff !important; }
  body.printing-recognition-certificate * { visibility: hidden !important; }
  body.printing-recognition-certificate .certificate-export-root,
  body.printing-recognition-certificate .certificate-export-root * { visibility: visible !important; }
  body.printing-recognition-certificate .certificate-export-root {
    position: absolute; inset: 0; width: auto; background: transparent;
  }
  body.printing-recognition-certificate .certificate-print-page {
    page: recognition-certificate; width: 297mm; height: 210mm; overflow: hidden;
    break-after: page; page-break-after: always; break-inside: avoid;
  }
  body.printing-recognition-certificate .certificate-print-page:last-child { break-after: auto; page-break-after: auto; }
  body.printing-recognition-certificate .certificate-sheet {
    width: 297mm; height: 210mm; max-width: none; margin: 0; box-shadow: none;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
}
@page recognition-certificate { size: A4 landscape; margin: 0; }

@media (max-width: 900px) {
  .certificate-batch-filters { grid-template-columns: 1fr 1fr; }
  .certificate-batch-filters label:last-child { grid-column: 1 / -1; }
  .certificate-output-bar { flex-direction: column; align-items: stretch; }
  .certificate-output-actions > button { flex: 1 1 auto; min-width: 0; }
}
@media (max-width: 620px) {
  .certificate-batch-filters { grid-template-columns: 1fr; }
  .certificate-batch-filters label:last-child { grid-column: auto; }
  .certificate-batch-grid { grid-template-columns: 1fr; max-height: 300px; }
  .certificate-output-actions { display: grid; grid-template-columns: 1fr; }
}

/* لوحات النسخ الاحتياطية: زراير فوق بعض، وحالة الربط بسطر واحد فيه نقطة
   بتقول مربوط ولا لأ من غير ما تقرا. */
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.backup-actions .ghost-btn { flex: 1 1 260px; }
.backup-schedule-form .backup-divider { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.backup-schedule-form h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 2px; font-size: 13.5px; }
.backup-last { display: grid; gap: 4px; }
.backup-last span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.backup-last strong { font-size: 13px; }

.drive-panel { display: grid; gap: 12px; }
.drive-status { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); }
.drive-status > div { flex: 1 1 240px; min-width: 0; display: grid; gap: 2px; }
.drive-status strong { font-size: 13px; }
.drive-status small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.drive-status-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 18%, transparent); }
.drive-status.is-connected .drive-status-dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.drive-steps { margin: 0 0 14px; padding-inline-start: 20px; color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 2; }
.drive-steps b { color: var(--ink); }
.drive-steps code { padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--ink); font-size: var(--fs-min); }
/* رابط العودة لازم يتنسخ حرف بحرف، فبياخد سطره لوحده وبيلف بدل ما يتقص. */
.drive-redirect { display: block; margin-top: 5px; padding: 7px 10px; direction: ltr; text-align: left; overflow-wrap: anywhere; user-select: all; }
.drive-credentials-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* --------------------------- الأتمتة وطابور الرسايل ---------------------------

   كل مهمة صندوق واحد فيه قرارها كله — مفعّلة ولا لأ، ساعتها، وشرحها — عشان
   الحقول المتجاورة في شبكة الإعدادات ماتتخلطش على بعضها. */

.job-field { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.job-field legend { padding: 0 6px; font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.job-field > .checkbox-field, .job-field > .field-hint { grid-column: 1 / -1; }
.job-field .field-hint { margin: 0; }

.outbox-panel { display: grid; gap: 9px; }
.outbox-panel h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.outbox-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
/* الرسالة نفسها هي المهم في الصف، فبتاخد العرض كله والأزرار بتلف تحتها على
   الموبايل بدل ما تدفع النص بره الكارت. */
.outbox-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 11px; flex-wrap: wrap; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.outbox-body { flex: 1 1 260px; min-width: 0; display: grid; gap: 3px; }
.outbox-body small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.outbox-body p { margin: 4px 0 0; color: var(--ink); font-size: max(var(--fs-min), 12.5px); line-height: 1.75; }
.outbox-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
@media (max-width: 620px) {
  .outbox-actions { width: 100%; }
  .outbox-actions > * { flex: 1 1 0; justify-content: center; }
}

/* ------------------------- اشتراكات المنصّة (المشتركين) -------------------------

   الشاشة دي بتتقرا من فوق لتحت كأنها غرفة تحكم: شريط الفلوس، بعده اللي محتاج
   قرار، بعده الرادار، بعده السجل التفصيلي. الأنماط هنا مترتبة بنفس الترتيب. */

.subscribers-command {
  position: relative; overflow: hidden; padding: 20px;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 11%, transparent) 0, transparent 38%),
    linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel-2) 72%, var(--panel)));
}
.subscribers-command::after {
  content: ''; position: absolute; inset-inline-end: -74px; top: -92px; width: 190px; height: 190px;
  border: 34px solid color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 50%; pointer-events: none;
}
.command-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.command-title-wrap { display: flex; align-items: center; gap: 13px; flex: 1 1 440px; min-width: 0; }
.command-mark {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 16px; background: var(--brand-navy); color: #fff;
  box-shadow: 0 12px 26px -15px color-mix(in srgb, var(--brand-navy) 72%, transparent);
}
.command-mark .icon { width: 23px; height: 23px; --icon-tint: #fff; }
.command-title { min-width: 0; }
.command-title h2 { margin: 3px 0 5px; }
.command-title .command-line { margin: 0; max-width: 650px; color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 650; line-height: 1.7; }
.command-actions { position: relative; z-index: 1; display: flex; gap: 9px; flex-wrap: wrap; }
.command-actions .ghost-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* اختصارات القرار: أرقام قليلة قابلة للضغط بدل جملة طويلة مليانة فواصل. */
.subscriber-command-deck {
  position: relative; z-index: 1; display: grid; gap: 9px;
  grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px;
}
.command-stat {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; min-width: 0;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink); font-family: inherit; text-align: start; cursor: pointer; transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.command-stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); }
.command-stat.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.command-stat > span { overflow: hidden; color: var(--muted); font-size: var(--fs-min); font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.command-stat > strong { grid-row: 1 / 3; grid-column: 2; font-size: 24px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.command-stat > small { overflow: hidden; font-size: var(--fs-min); font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.command-stat.attention > strong { color: var(--warning); }
.command-stat.live > strong { color: var(--success); }
.command-stat.expired > strong { color: var(--danger); }
.command-stat.pending > strong { color: var(--accent); }
.command-utilities { position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; margin-top: 10px; }
.command-utilities > span { margin-inline-end: 5px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.command-utilities .row-link { min-height: 34px; }

/* ------------------------------ شريط الفلوس ------------------------------ */

.subscriber-pulse { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pulse-card {
  display: grid; gap: 7px; align-content: start;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
  border-top: 3px solid var(--muted);
}
.pulse-card.revenue { border-top-color: var(--accent); }
.pulse-card.collected { border-top-color: var(--success); }
.pulse-card.risk { border-top-color: var(--danger); }
.pulse-card.pending { border-top-color: var(--warning); }
.pulse-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pulse-card header p { margin: 0; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.pulse-card > strong { font-size: 25px; font-weight: 900; letter-spacing: -0.4px; line-height: 1.15; }
.pulse-card small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.pulse-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 11px; background: var(--panel-2); }
.pulse-icon .icon { width: 17px; height: 17px; }
.pulse-scale { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }

/* الرسم البياني بيقرا من الشمال للنهاردة على اليمين — نفس اتجاه الرادار تحته،
   عشان «دلوقتي» تبقى في نفس الناحية في الاتنين. */
.spark { width: 100%; height: 34px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark polygon { fill: var(--accent-soft); stroke: none; }

/* الشريط الصغير بيتكرر في أكتر من مكان: نسبة التحصيل، استهلاك الباقة، تقدّم
   المدة. لونه هو اللي بيفرق، مش شكله. */
.meter { height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--success); transition: width 0.3s ease; }
.meter.near span { background: var(--warning); }
.meter.over span { background: var(--danger); }

/* ------------------------------ طابور التحقق ------------------------------ */

/* طابور التحقق هو أهم حاجة في الشاشة: هو الوحيد اللي فيه قرار مستني المدير،
   فبياخد إطار ملوّن لما يبقى فيه حاجة وبيهدى خالص لما يفضى. */
.pending-panel.needs-review { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.pending-panel.is-clear { padding: 14px 18px; }
.all-clear { display: flex; align-items: center; gap: 12px; }
.all-clear .icon { width: 20px; height: 20px; flex: none; color: var(--success); }
.all-clear strong { display: block; font-size: 13.5px; }
.all-clear span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.pending-panel .section-head h2 { display: flex; align-items: center; gap: 8px; }
.pending-panel .section-head h2 .icon { width: 17px; height: 17px; color: var(--warning); }
.pending-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* min-width صفر لأن الكارت عنصر في شبكة: الافتراضي (auto) بيوسّع العمود لحد
   أعرض حاجة جوّه — أربع أزرار في سطر واحد = ٣٩٥px — فالكارت كان بيخرج برّه
   شاشة الموبايل وأزرار التأكيد والرفض بتتقص. والأزرار بتلف بدل ما تدفع. */
.pending-payment { display: grid; gap: 11px; min-width: 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.pending-payment .head-actions { flex-wrap: wrap; }
.pending-payment header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pending-payment header strong { display: block; font-size: 14.5px; }
.pending-payment header span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }

.payment-facts { display: grid; gap: 9px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.payment-facts div { display: grid; gap: 2px; min-width: 0; }
.payment-facts dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.payment-facts dd { margin: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.payment-amount { color: var(--success); font-size: 15px; }
/* رقم العملية بيتقارن حرف بحرف بكشف المحفظة، فبيتكتب لاتيني من الشمال
   وبمسافات ثابتة عشان 0 وO ما يتلغبطوش. */
.payment-reference { direction: ltr; text-align: right; font-family: 'Courier New', monospace; letter-spacing: 0.4px; user-select: all; }
.payment-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--panel); color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.payment-effect { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--accent); font-size: var(--fs-min); font-weight: 700; }

/* كارت طلب فتح حساب: نفس هيكل كارت التحويل عشان الطابورين يتقروا بنفس
   العين، بس بحدّ ملوّن — القرار ده بيفتح مساحة جديدة، مش بيمدّ مدة. */
.pending-approval {
  display: grid; gap: 11px; min-width: 0; padding: 15px 16px;
  border: 1px solid var(--warning); border-radius: var(--radius-sm); background: var(--panel-2);
}
.pending-approval .head-actions { flex-wrap: wrap; }
.pending-approval header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pending-approval header strong { display: block; font-size: 14.5px; }
.pending-approval header span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }

/* ------------------------------ رادار التجديد ------------------------------ */

.renewal-radar.is-clear { padding: 15px 18px; }
.renewal-radar .section-head { align-items: flex-start; }
.radar-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.radar-legend .legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.radar-legend .legend::before { content: ''; width: 9px; height: 9px; border-radius: 50%; }
.radar-legend .expired::before { background: var(--danger); }
.radar-legend .expiring::before { background: var(--warning); }
.radar-legend .trial::before { background: var(--accent); }
.radar-legend .active::before { background: var(--success); }

.radar-body { display: flex; align-items: stretch; gap: 12px; }
/* المتأخرين مش على الشريط: مكانهم على المحور هو صفر، فكانوا هيتكوّموا كلهم
   فوق بعض في نقطة واحدة. خانة لوحدهم بتعدّهم وبتفتح الفلتر بتاعهم. */
.radar-overdue {
  display: grid; place-items: center; gap: 1px; flex: none; width: 78px;
  border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-soft);
  color: var(--danger); cursor: pointer; font-family: inherit;
}
.radar-overdue strong { font-size: 21px; font-weight: 900; }
.radar-overdue span { font-size: var(--fs-min); font-weight: 800; }
.radar-overdue:hover { background: var(--danger); color: #fff; }

/* الشريط والمقياس في عمود واحد عشان «النهاردة» تقع تحت أول الشريط بالظبط —
   لو المقياس أخو الخانة المتأخرة كان بيتزحلق بعرضها. */
.radar-track { flex: 1 1 auto; min-width: 0; }
.radar-rail { position: relative; min-height: 92px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); overflow: hidden; }
.radar-grid { position: absolute; inset: 0; }
.radar-grid i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.radar-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }

/* النقطة مكانها على الشريط هو المعلومة: قد إيه فاضل. اللي في نفس اليوم بياخدوا
   أدوار رأسية عشان مايختفوش تحت بعض. */
.radar-dot {
  position: absolute; top: calc(10px + var(--lane, 0) * 22px);
  display: grid; place-items: center; width: 30px; height: 30px; margin-inline-start: -15px;
  border: 2px solid var(--panel); border-radius: 50%; background: var(--success); color: #fff;
  font-family: inherit; font-size: var(--fs-min); font-weight: 900; cursor: pointer;
  box-shadow: 0 2px 7px rgba(15, 20, 40, 0.18); transition: transform 0.15s ease;
}
.radar-dot:hover { transform: scale(1.18); z-index: 3; }
.radar-dot.expiring { background: var(--warning); }
.radar-dot.trial { background: var(--accent); }
.radar-dot.expired { background: var(--danger); }

.radar-scale { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }

/* ------------------------------ سجل المشتركين ------------------------------ */

/* كان جدول بتسع أعمدة. على شاشة فيها قايمة جانبية ده معناه ١٥٠ بكسل للخانة،
   فالتاريخ بيتكسر على تلات سطور والأزرار بتبقى خمس أيقونات رمادية متشابهة.
   والمشتركين هنا عشرات مش آلاف — يعني المقارنة الرأسية بين الأعمدة مش هي
   الشغل، الشغل هو التصرف في حساب واحد. فبقى صف واسع لكل مشترك. */

.register-panel { overflow: hidden; }
.register-head { align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.register-heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
.register-heading-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 13px; background: var(--accent-soft); color: var(--accent);
}
.register-heading-icon .icon { width: 20px; height: 20px; }
.register-heading h2 { margin: 0 0 3px; }
.register-heading p { margin: 0; color: var(--muted); font-size: var(--fs-min); font-weight: 650; }
.register-result { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 5px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.register-result strong { color: var(--accent); font-size: 19px; font-weight: 900; line-height: 1; }
.register-result span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }

.register-toolbar {
  display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 11px; align-items: end;
  margin: 15px 0 13px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2);
}
.subscriber-search-box {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: text;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.subscriber-search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.subscriber-search-box > .icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.subscriber-search-box input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: inherit; font-size: max(var(--fs-min), 13px); font-weight: 700; }
.subscriber-search-box input::placeholder { color: var(--muted); font-weight: 600; }
.search-state { flex: none; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-min); font-weight: 800; }
.register-tools { display: flex; gap: 8px; flex-wrap: nowrap; align-items: end; }
.register-tools .compact-field { min-width: 145px; gap: 4px; }
.register-tools .compact-field > span { padding-inline: 2px; color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.register-tools .compact-field select { min-height: 44px; background-color: var(--panel); }
.sort-dir { gap: 6px; min-width: 96px; min-height: 44px; justify-content: center; font-size: var(--fs-min); }
.sort-dir .icon { width: 13px; height: 13px; transform: rotate(90deg); }

.subscriber-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.subscriber-filters .period-chip span { margin-inline-start: 5px; opacity: 0.7; font-variant-numeric: tabular-nums; }
/* «يحتاج إجراء» وهو فيه حاجة بياخد لون تحذير: هو الفلتر الوحيد اللي بيقول
   شغل مستني، والباقي بيوصف بس. */
.register-panel .period-chip.urgent:not(.active) { border-color: var(--warning); color: var(--warning); }

.select-all-row { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 11px; color: var(--muted); font-size: var(--fs-min); font-weight: 700; cursor: pointer; }
.select-all-row input { width: 16px; height: 16px; cursor: pointer; }
.register-select-all { min-height: 34px; padding: 5px 9px; border-radius: 10px; }
.register-select-all:hover { background: var(--panel-2); color: var(--ink); }
.register-select-all b { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--panel-2); color: var(--accent); font-size: var(--fs-min); font-weight: 900; }

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.bulk-bar strong { font-size: 13px; }

.sub-list { display: grid; gap: 12px; }
.sub-row {
  display: grid; gap: 12px;
  padding: 16px 17px; border: 1px solid var(--line); border-inline-start-width: 4px;
  border-radius: 16px; background: var(--panel);
  box-shadow: 0 7px 22px -21px rgba(15, 20, 40, .72);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.sub-row:hover { border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); box-shadow: 0 14px 30px -24px rgba(15, 20, 40, .62); }
/* لون الحافة بيقول الحالة من بعيد من غير ما تقرا الشارة. */
.sub-row.active { border-inline-start-color: var(--success); }
.sub-row.trial { border-inline-start-color: var(--accent); }
.sub-row.expiring { border-inline-start-color: var(--warning); }
.sub-row.expired,
.sub-row.suspended { border-inline-start-color: var(--danger); }
.sub-row.is-selected { background: var(--accent-soft); }
.sub-row.is-open { box-shadow: 0 6px 22px rgba(15, 20, 40, 0.09); }

.sub-head { display: flex; align-items: center; gap: 11px; }
.sub-check { width: 17px; height: 17px; flex: none; cursor: pointer; }
/* الغلاف موجود عشان الموبايل بس (بيكبّر مساحة اللمس)، فعلى الشاشة الواسعة
   بيتصرّف كأنه مش موجود. */
.sub-pick { display: inline-flex; align-items: center; flex: none; }
.sub-avatar {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 13px; background: linear-gradient(145deg, var(--brand-navy), color-mix(in srgb, var(--brand-navy) 68%, var(--accent)));
  color: #fff; font-size: 13px; font-weight: 900; box-shadow: 0 8px 18px -12px var(--brand-navy);
}
/* الاسم بياخد المساحة الفاضية كلها، فالشارة وزرار التفاصيل بيتثبتوا في آخر
   السطر مهما طال الاسم. */
.sub-identity { flex: 1 1 200px; display: grid; gap: 2px; min-width: 0; }
.sub-identity strong { font-size: 15.5px; }
.sub-identity span { color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.sub-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sub-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
  color: var(--muted); font-family: inherit; font-size: var(--fs-min); font-weight: 800; cursor: pointer;
}
.sub-toggle:hover { border-color: var(--accent); color: var(--accent); }
.sub-chevron { width: 12px; height: 12px; transition: transform 0.2s ease; }
.sub-row.is-open .sub-chevron { transform: rotate(180deg); }

.sub-flags { display: flex; gap: 8px; flex-wrap: wrap; }
.flag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: var(--fs-min); font-weight: 800; }
.flag .icon { width: 13px; height: 13px; }
.flag.pending { background: var(--warning-soft); color: var(--warning); }
.flag.over { background: var(--danger-soft); color: var(--danger); }
.flag.offer { background: var(--success-soft); color: var(--success); }

/* الحقايق شبكة auto-fit بحد أدنى للعرض: لما المساحة تقل بتنزل سطر تحت بدل
   ما تتزنق وتكسّر التاريخ على تلات سطور زي الجدول القديم. */
.sub-facts {
  display: grid; gap: 12px 18px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.fact { display: grid; gap: 3px; align-content: start; min-width: 0; }
.fact-label { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.fact-value { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.fact-value small { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.fact-sub { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
/* الوفر تحت السعر: هو السبب اللي المشترك وافق عشانه، فمينفعش يتقري كملاحظة رمادية. */
.fact-save { color: var(--success); font-size: var(--fs-min); font-weight: 800; }
.fact-save s { opacity: 0.75; font-weight: 700; }
.fact .meter { margin-top: 3px; }
/* المدة المتبقية هي الرقم اللي الشاشة كلها موجودة عشانه، فبتاخد حجم أكبر
   ولون حالتها. */
.fact-expiry .fact-value { font-size: 20px; font-weight: 900; letter-spacing: -0.3px; }
.fact-expiry.expiring .fact-value { color: var(--warning); }
.fact-expiry.expired .fact-value,
.fact-expiry.suspended .fact-value { color: var(--danger); }
.fact-expiry.active .fact-value { color: var(--success); }

.sub-note { display: flex; align-items: center; gap: 7px; margin: 0; padding: 8px 11px; border-radius: 11px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.sub-note .icon { width: 14px; height: 14px; flex: none; }

.sub-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sub-actions-primary { display: flex; gap: 9px; flex-wrap: wrap; }
.sub-actions-manage { display: flex; gap: 4px; flex-wrap: wrap; }

/* الزرار باسمه: الأيقونة لوحدها بتوفّر عرض في جدول ضيق، وهنا العرض موجود —
   والمدير لازم يعرف إن الزرار ده بيبعت رسالة قبل ما يدوس. */
.row-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px;
  border: 1px solid transparent; border-radius: 11px;
  font-family: inherit; font-size: max(var(--fs-min), 12.5px); font-weight: 800; text-decoration: none; cursor: pointer;
  transition: filter 0.15s ease;
}
.row-btn .icon { width: 15px; height: 15px; }
.row-btn:hover { filter: brightness(0.94); }
.row-btn.wa { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.row-btn.pay { background: var(--accent); color: #fff; }
.row-btn.pay .icon { --icon-tint: #fff; color: #fff; }
/* التمديد جنب «تسجيل تحويل» بس مش بنفس وزنه: التحويل هو الطريق العادي، وده
   استثناء بيتاخد لما يبقى فيه سبب. */
.row-btn.extend { border-color: var(--line); background: var(--panel-2); color: var(--ink); }
.row-btn.is-off { opacity: 0.45; cursor: not-allowed; }

.row-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px;
  border: 0; border-radius: 9px; background: none;
  color: var(--muted); font-family: inherit; font-size: var(--fs-min); font-weight: 700; cursor: pointer;
}
.row-link .icon { width: 13px; height: 13px; }
.row-link:hover { background: var(--panel-2); color: var(--ink); }
.row-link.danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-link.go { color: var(--success); }
.row-link.go:hover { background: var(--success-soft); color: var(--success); }

/* شريط حالة الحساب جوّه الصف: بيقعد فوق الحقايق عشان اللي بيفتح الصف يقرا
   «مش قادر يدخل» قبل ما يقرا «فاضل ٣٠ يوم» — الترتيب ده هو الفرق بين إنه
   ياخد القرار وإنه يقفل الصف وهو فاكر إن كل حاجة ماشية. */
.sub-account {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 11px 13px; border-radius: 12px;
}
.sub-account-say { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sub-account-say .icon { width: 17px; height: 17px; flex: none; }
.sub-account-say strong { display: block; font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.sub-account-say span { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.sub-account .head-actions { flex-wrap: wrap; }
.sub-account.waiting { border: 1px solid var(--warning); background: var(--warning-soft); }
.sub-account.waiting .sub-account-say strong,
.sub-account.waiting .sub-account-say .icon { color: var(--warning); }
.sub-account.closed { border: 1px solid var(--line); background: var(--panel-2); }
.sub-account.closed .sub-account-say .icon { color: var(--muted); }

/* ------------------------------ ملف المشترك ------------------------------ */

.sub-detail {
  display: grid; gap: 15px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  padding-top: 14px; border-top: 1px dashed var(--line);
}
.detail-main { display: grid; gap: 11px; align-content: start; }
.detail-side { display: grid; gap: 9px; align-content: start; }
.detail-side h3 { margin: 0; font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.detail-facts { display: grid; gap: 9px 14px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0; }
.detail-facts div { display: grid; gap: 2px; min-width: 0; }
.detail-facts dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.detail-facts dd { margin: 0; font-size: max(var(--fs-min), 12.5px); font-weight: 800; overflow-wrap: anywhere; }
.detail-warning { display: flex; align-items: center; gap: 7px; margin: 0; padding: 9px 11px; border-radius: 11px; background: var(--danger-soft); color: var(--danger); font-size: var(--fs-min); font-weight: 800; }
.detail-warning .icon { width: 15px; height: 15px; flex: none; }
.sub-detail .subscriber-form,
.sub-detail .subscriber-payment-form { grid-column: 1 / -1; padding-top: 13px; border-top: 1px dashed var(--line); }

/* السجل الزمني بيجاوب على «هو بيدفع بانتظام ولا بيتأخر» — وده اللي بيحدد
   تسيبه ولا توقفه، أكتر من رصيد اليوم. */
.payment-timeline { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.timeline-item { display: flex; gap: 10px; }
.timeline-item strong { display: block; font-size: max(var(--fs-min), 12.5px); }
.timeline-item small { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.timeline-dot { width: 10px; height: 10px; flex: none; margin-top: 4px; border-radius: 50%; background: var(--muted); }
.timeline-item.verified .timeline-dot { background: var(--success); }
.timeline-item.pending .timeline-dot { background: var(--warning); }
.timeline-item.rejected .timeline-dot { background: var(--danger); }
.timeline-item.rejected { opacity: 0.72; }

/* العرض المضغوط للكشوف الطويلة: بيصفّ الحقايق في سطر واحد صغير ويقرّب
   الهوامش — بيشيل المساحة مش المعلومات. */
.density-compact .sub-row { gap: 9px; padding: 11px 14px; }
.density-compact .sub-identity strong { font-size: 14px; }
.density-compact .sub-facts { gap: 8px 14px; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); padding: 9px 0; }
.density-compact .fact-value { font-size: 13px; }
.density-compact .fact-expiry .fact-value { font-size: 15px; }
.density-compact .fact .meter { height: 5px; }
.density-compact .row-btn { padding: 7px 12px; font-size: var(--fs-min); }

/* ------------------------------ الباقات والتحصيل ------------------------------ */

.subscribers-view .field-wide { grid-column: 1 / -1; }
.subscribers-view .inline-check { display: flex; align-items: center; gap: 8px; font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.subscribers-view .inline-check input { width: 17px; height: 17px; }
.settings-teaser { padding: 13px 18px; }
.settings-teaser .section-head { margin: 0; }

.channel-summary { display: flex; gap: 9px; flex-wrap: wrap; }
.channel-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); font-size: max(var(--fs-min), 12.5px); font-weight: 700; }
.subscriber-channels-form { align-items: start; }
.channel-block { display: grid; gap: 10px; margin: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.channel-block legend { display: flex; align-items: center; gap: 7px; padding: 0 6px; font-size: max(var(--fs-min), 12.5px); font-weight: 800; }

/* إعدادات صفحة الاشتراك العامة + مراجعة الإيصالات. */
.signup-settings-form .full { grid-column: 1 / -1; }
.signup-settings-form textarea { min-height: 66px; resize: vertical; }
.signup-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: max(var(--fs-min), 12.5px);
  font-weight: 700;
  line-height: 1.75;
}
.receipt-open { justify-self: start; }
/* الإيصال بيتقري بالعين، فبياخد الشاشة على قدها — بس من غير ما يعدّيها. */
.receipt-dialog { display: grid; gap: 12px; max-width: min(560px, 92vw); }
.receipt-dialog img {
  max-width: 100%;
  max-height: min(70vh, 620px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  object-fit: contain;
}

/* الخطط والباقات: كارت لكل باقة فيه الحد والأسعار وعدد اللي عليها. */
.package-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.package-card { display: grid; gap: 10px; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.package-card.inactive { opacity: 0.66; }
/* الباقة اللي بتتعدّل بتاخد عرض الشبكة كله عشان النموذج ما ينضغطش في عمود. */
.package-card.editing { grid-column: 1 / -1; background: var(--panel); }
.package-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.package-card header strong { font-size: 14.5px; }
.package-prices { display: grid; gap: 7px 12px; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); margin: 0; }
.package-prices div { display: grid; gap: 2px; }
.package-prices dt { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.package-prices dd { margin: 0; font-size: 13px; font-weight: 800; }
.package-usage { margin: 0; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
/* أحسن عرض على الباقة، جوّه الكارت نفسه: سعر القايمة لوحده بيخلّي المدير
   يفتكر عروضه بدماغه وهو بيتكلّم مع مدرس. */
.package-deal { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; margin: 0; padding: 8px 10px; border: 1px dashed var(--success); border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success); font-size: var(--fs-min); font-weight: 700; }
.package-deal .icon { width: 14px; height: 14px; align-self: center; }
.package-deal strong { font-size: var(--fs-min); }
.package-deal s { opacity: 0.7; }

/* العروض: كارت لكل عرض بيقول بيدّي إيه، على إيه، ولحد إمتى، وكام واحد خده. */
.offer-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.offer-card { display: grid; gap: 8px; align-content: start; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.offer-card.inactive { opacity: 0.66; }
.offer-card.editing { grid-column: 1 / -1; background: var(--panel); opacity: 1; }
.offer-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.offer-title { display: grid; gap: 3px; }
.offer-title strong { font-size: 14.5px; }
.offer-code { font-size: var(--fs-min); font-weight: 800; letter-spacing: 0.04em; }
/* الخصم هو الرقم اللي العين بتدوّر عليه في الكارت، فهو أكبر حاجة فيه. */
.offer-badge { margin: 0; color: var(--success); font-size: 17px; font-weight: 900; }
.offer-desc { margin: 0; font-size: var(--fs-min); font-weight: 600; line-height: 1.65; }
.offer-scope { margin: 0; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.offer-usage { margin: 0; font-size: var(--fs-min); font-weight: 800; }

/* اختيار المدد والباقات جوّه نموذج العرض: شيك بوكس في شكل شارة، عشان
   القايمة المنسدلة المتعددة على الموبايل حاجة محدش بيعرف يستخدمها. */
.chip-checks { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: var(--fs-min); font-weight: 700; cursor: pointer; }
.chip-checks input { width: 15px; height: 15px; }
.chip-checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.ledger-panel .section-head { align-items: flex-start; }
.ledger-more { margin: 10px 0 0; color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.subscriber-payments-table { width: 100%; border-collapse: collapse; }
.subscriber-payments-table th,
.subscriber-payments-table td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: start; font-size: max(var(--fs-min), 12.5px); }
.subscriber-payments-table th { color: var(--muted); font-size: var(--fs-min); font-weight: 800; }
.subscriber-payments-table small { display: block; color: var(--muted); font-size: var(--fs-min); font-weight: 600; }
.subscriber-payments-table tr.payment-rejected td { opacity: 0.72; }

@media (max-width: 1150px) {
  .sub-detail { grid-template-columns: 1fr; }
  .subscriber-command-deck { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .register-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .register-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
  .register-tools .compact-field { min-width: 0; }
}

/* الصف الواسع مابيحتاجش تحويل لكروت على الموبايل — هو أصلاً كارت. اللي
   بيتغيّر إن الأزرار بتاخد عرض الشاشة عشان الصباع يلاقيها. */
@media (max-width: 760px) {
  .subscribers-command { padding: 16px; }
  .command-title-wrap { flex-basis: 100%; }
  .command-actions { width: 100%; }
  .command-actions > * { flex: 1 1 160px; justify-content: center; }
  .subscriber-command-deck { margin-top: 14px; }
  .command-stat { min-height: 74px; }
  .command-utilities { padding-top: 7px; border-top: 1px solid var(--line); }
  .register-head { align-items: flex-start; }
  .register-result { margin-inline-start: auto; }
  .sub-row { padding: 13px 14px; }
  .sub-toggle { margin-inline-start: auto; }
  .sub-actions { align-items: stretch; }
  .sub-actions-primary { width: 100%; }
  .sub-actions-primary .row-btn { flex: 1 1 140px; justify-content: center; min-height: var(--tap); }
  .sub-actions-manage { width: 100%; justify-content: space-between; }
  .row-link { min-height: var(--tap); }
  .radar-body { flex-direction: column; }
  .radar-overdue { width: auto; flex-direction: row; gap: 9px; padding: 9px; }
}

@media (max-width: 620px) {
  .command-mark { width: 42px; height: 42px; border-radius: 14px; }
  .command-mark .icon { width: 20px; height: 20px; }
  .command-title h2 { font-size: 17px; }
  .command-title .eyebrow { font-size: var(--fs-min); }
  .command-title .command-line { line-height: 1.55; }
  .subscriber-command-deck { gap: 7px; }
  .command-stat { min-height: 70px; padding: 10px; }
  .command-stat > strong { font-size: 21px; }
  .command-stat > small { font-size: 10px; }
  .command-utilities { flex-wrap: wrap; }
  .command-utilities > span { width: 100%; margin: 0; }
  .command-utilities .row-link { flex: 1 1 120px; justify-content: center; background: color-mix(in srgb, var(--panel) 78%, transparent); }
  .register-heading-icon { width: 36px; height: 36px; border-radius: 12px; }
  .register-heading p { display: none; }
  .register-result { padding: 6px 9px; }
  .register-toolbar { margin-block: 12px; padding: 9px; }
  .register-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sort-dir { grid-column: 1 / -1; width: 100%; }
  .subscriber-search-box { min-height: 48px; }
  .search-state { display: none; }
  .register-select-all { width: 100%; }
  .register-select-all b { margin-inline-start: auto; }
  .sub-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 9px; }
  .sub-pick { grid-column: 1; grid-row: 1; width: 32px; height: 32px; justify-content: center; border-radius: 9px; background: var(--panel-2); }
  .sub-avatar { grid-column: 2; grid-row: 1; width: 40px; height: 40px; }
  .sub-identity { grid-column: 3; grid-row: 1; }
  .sub-head-actions { grid-column: 2 / -1; grid-row: 2; width: 100%; justify-content: space-between; }
  .sub-toggle { margin: 0; min-height: 36px; }
  .sub-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .fact { padding: 9px; border-radius: 11px; background: var(--panel-2); }
  .fact-expiry .fact-value { font-size: 17px; }
  .sub-actions-primary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sub-actions-primary .row-btn { min-width: 0; padding-inline: 8px; }
  .sub-actions-primary .row-btn.extend { grid-column: 1 / -1; }
  .sub-actions-manage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding-top: 8px; border-top: 1px dashed var(--line); }
  .sub-actions-manage .row-link { min-width: 0; justify-content: center; padding-inline: 4px; }
  .payment-facts { grid-template-columns: 1fr; }
  .pending-grid { grid-template-columns: 1fr; }
  /* أربع أزرار ملفوفة كانت بتنزل أربع سطور بعرض نصّها. شبكة عمودين بتخلّيهم
     في سطرين متساويين، و«تأكيد وصول المبلغ» بياخد السطر كله لأنه القرار
     اللي الكارت موجود عشانه — ومن غير كده اسمه بيتكسر على تلات سطور. */
  .pending-payment .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pending-payment .head-actions > .table-action { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; }
  .pending-payment .head-actions > .approve { grid-column: 1 / -1; }
  /* «ملف المشترك» بيظهر لو المشترك لسه في السجل، فالعدد ٣ أو ٤. لما يبقى ٤
     بيفضل زرار يتيم في نص السطر الأخير — بيتمدّ بدل ما يقف لوحده مايل. */
  .pending-payment .head-actions > .table-action:last-child:nth-child(even) { grid-column: 1 / -1; }
  /* نفس الحكاية في كارت طلب الحساب: تلات أزرار، و«موافقة وفتح المساحة» أطول
     اسم فيهم وهو القرار اللي الكارت موجود عشانه. */
  .pending-approval .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pending-approval .head-actions > .table-action { width: 100%; min-width: 0; justify-content: center; padding-inline: 8px; }
  .pending-approval .head-actions > .approve { grid-column: 1 / -1; }
  /* وشريط الحساب جوّه الصف: زراريه بيتحوّلوا لعرض كامل بدل ما «موافقة وفتح
     المساحة» يتكسر على سطرين جنب «رفض». */
  .sub-account { align-items: stretch; }
  .sub-account .head-actions { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; }
  .sub-account .head-actions > .table-action { width: 100%; min-width: 0; justify-content: center; }
  .package-grid { grid-template-columns: 1fr; }
  .offer-grid { grid-template-columns: 1fr; }
  .sub-facts { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .command-actions { width: 100%; }
  .command-actions .ghost-btn, .command-actions .submit-btn { flex: 1 1 140px; justify-content: center; }
  .register-tools { width: 100%; }
  .register-tools .compact-field { flex: 1 1 100%; }
}

/* حقوق المطوّر أسفل القايمة الجانبية: سطر هادي مايزاحمش التبويبات، وبيفضل
   مقروء على خلفية السايدبار الغامقة. */
.app-credit { display: grid; gap: 3px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.10); color: var(--sidebar-ink); font-size: var(--fs-min); font-weight: 600; line-height: 1.6; text-align: center; }
.app-credit a { color: #fff; font-weight: 800; text-decoration: none; letter-spacing: 0.3px; }
.app-credit a:hover { text-decoration: underline; }
.help-credit { display: grid; justify-items: center; gap: 8px; }
.help-credit .ghost-btn { margin-top: 4px; text-decoration: none; }

/* شريط الترحيب بعد الدخول. */
.welcome-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: opacity var(--speed) ease, transform var(--speed) ease;
}

/* الترحيب بيروح لوحده بعد تمن ثواني. الاختفاء المفاجئ في نص الشاشة بيتقرا
   زي غلطة رسم — والطلوع لفوق بيقول إنه راح مش إنه اتشال. */
.welcome-note.leaving { opacity: 0; transform: translateY(-6px); }
.welcome-text { display: grid; gap: 3px; min-width: 0; }
.welcome-hello { font-size: max(var(--fs-min), 15px); font-weight: 800; color: var(--ink); }
.welcome-line { font-size: max(var(--fs-min), 12.5px); font-weight: 600; color: var(--muted); }
.welcome-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
}
.welcome-close:hover { background: var(--panel-2); color: var(--ink); }

/* أماكن الدرس — صف واحد لكل مكان: الاسم، عدد طلابه، وأزراره. العدد هو
   اللي بيقول للمدرس المكان ده ينفع يتشال ولا لأ من غير ما يفتح الكشف. */
.venue-list { display: grid; gap: 9px; }
.venue-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.venue-row.is-off { opacity: 0.6; }
.venue-main { display: grid; gap: 2px; flex: 1 1 180px; min-width: 0; }
.venue-main strong { font-size: 14px; }
.venue-main small { color: var(--muted); font-size: var(--fs-min); }
.venue-count { padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: var(--fs-min); font-weight: 700; color: var(--muted); white-space: nowrap; }
.venue-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.venue-edit { border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 12px; background: var(--panel); }
/* وسم المكان على كارت الطالب وفي الصفوف — بيتقري بسرعة وسط باقي البيانات. */
.venue-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-min); font-weight: 700; }
/* «بالحصة» لازم يبان جنب الرقم: نفس الرقم بيتقري غلط لو المدرس فاكره اشتراك شهر. */
.pay-session { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: var(--fs-min); font-weight: 700; }
@media (max-width: 620px) {
  .venue-row { align-items: flex-start; }
  .venue-actions { width: 100%; }
}

/* إحصائية استخدام المنصّة — أرقام فوق وشرايح المدد تحت. الشرايح مش متوسط
   واحد عن قصد: المتوسط بيخبّي الحسابات اللي على وش الخروج. */
.usage-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); margin-top: 12px; }
.usage-cell { display: grid; gap: 3px; align-content: start; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.usage-cell > span { color: var(--muted); font-size: var(--fs-min); font-weight: 700; }
.usage-cell > strong { font-size: 20px; }
.usage-cell > small { color: var(--muted); font-size: var(--fs-min); display: grid; gap: 3px; }
.usage-buckets { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 13px; }
.usage-bucket { display: grid; gap: 6px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.usage-bucket-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.usage-bucket-head strong { font-size: 17px; }
.usage-bucket small { color: var(--muted); font-size: var(--fs-min); line-height: 1.5; }
@media (max-width: 620px) {
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* شغل اليوم في ٣ قرارات واضحة. على الديسكتوب صف واحد، وعلى الموبايل نفس
   الترتيب الرأسي المألوف؛ مفيش مهمة بتختفي لمجرد إن غيرها أكثر إلحاحاً. */
.today-bar {
  display: grid;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.today-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.today-bar-title { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 900; color: var(--ink); line-height: 1.35; }
.today-bar-title .icon { width: 18px; height: 18px; color: var(--accent); }
.today-bar-head time { flex: none; padding: 5px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-min); font-weight: 750; }
.today-bar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.today-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 86px;
  padding: 13px;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.today-cell:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.today-cell:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 26%, transparent); outline-offset: 2px; }
.today-count { flex: none; display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: var(--panel); color: var(--muted); font-size: 21px; font-weight: 950; }
.today-count .icon { width: 21px; height: 21px; }
.today-text { display: grid; gap: 4px; min-width: 0; flex: 1 1 auto; }
.today-text strong { font-size: 14px; font-weight: 900; line-height: 1.4; }
.today-text small { color: var(--muted); font-size: var(--fs-min); font-weight: 600; line-height: 1.45; }
.today-arrow { flex: none; width: 15px; height: 15px; color: var(--muted); }
.today-cell.warn .today-count { background: var(--warning-soft); color: var(--warning); }
.today-cell.danger .today-count { background: var(--danger-soft); color: var(--danger); }
.today-cell.clear .today-count { background: var(--success-soft); color: var(--success); }
.today-cell.clear .today-text strong { color: var(--muted); }

@media (max-width: 620px) {
  .today-bar { align-items: stretch; flex-direction: column; gap: 11px; padding: 12px; }
  .today-bar-grid { grid-template-columns: 1fr; }
}

/* المتصفح بيصغّر <small> لوحده لو مفيش قاعدة عليه — الأرضية بتلحقه. القاعدة
   دي أضعف من أي كلاس، فمابتلغيش أي حجم متظبّط بإيد. */
small { font-size: max(var(--fs-min), 0.86em); }

/* أرضية الخط: ١٢px على الشاشة الكبيرة، ١٣px على الموبايل لأن المسافة للعين
   أبعد والإضاءة أسوأ. الطباعة بتفضل على ١٠px عشان الكشوف تقعد على الصفحة. */
@media (max-width: 620px) {
  :root { --fs-min: 13px; }
}

@media print {
  :root { --fs-min: 10px; }
}

/* «أنهي تقرير عايز؟» — الاختيار قبل الرسم. نفس منطق شبكة الإعدادات: كارت
   لكل تقرير بعنوان وسطر بيقول هيوريك إيه، والمختار وحده هو اللي بينرسم. */
.report-picker { display: grid; gap: 9px; }
.report-picker-title { color: var(--muted); font-size: max(var(--fs-min), 12.5px); font-weight: 800; }
.report-picker-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }

.report-picker-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--tap);
  padding: 12px 13px;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  transition: all var(--speed);
}

.report-picker-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.report-picker-card.active { border-color: var(--accent); background: var(--accent-soft); }
.report-picker-icon { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--panel-2); color: var(--muted); }
.report-picker-card.active .report-picker-icon { background: var(--panel); color: var(--accent); }
.report-picker-copy { display: grid; gap: 2px; min-width: 0; }
.report-picker-copy strong { font-size: 13.5px; font-weight: 800; }
.report-picker-copy small { color: var(--muted); font-size: var(--fs-min); }

.analytics-grid.single { grid-template-columns: 1fr; }

@media (max-width: 620px) {
  .report-picker-grid { grid-template-columns: 1fr; }
}

/* على الورق الاختيار مالوش معنى — الملف بيتطبع كامل. */
@media print {
  .report-picker { display: none; }
}

/* ===================== الشريط السفلي وورقة «المزيد» =====================
   القياس: القائمة مخفية جانبياً بعرض ٢٤٠px و١٥ تبويب في قايمة مسطّحة. يعني
   كل تنقل على الموبايل ضغطتين، والقايمة بتغطي الشاشة فبتقطع سياق اللي كان
   شغّال. الأربعة اللي تحت هما شغل النهاردة، والباقي في ورقة متقسّمة تلات
   مجموعات. على اللابتوب القائمة الجانبية زي ما هي والشريط ده مابيظهرش. */
.bottom-nav { display: none; }
.more-sheet, .more-sheet-backdrop { display: none; }

@media (max-width: 900px) {
  body.logged-in .app-shell { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

  /* النافذة العائمة هي السياق الوحيد أثناء التعديل: إخفاء التنقل والبحث يمنع
     تغطية آخر الحقول أو اعتراض اللمس، ويرجعهم المتصفح فور إغلاق النافذة. */
  body:has(.subs-drawer-backdrop) .bottom-nav,
  body:has(.subs-drawer-backdrop) .student-search-fab,
  body:has(.subs-drawer-backdrop) .fab-dial {
    visibility: hidden;
    pointer-events: none;
  }

  /* الشريط فوق الورقة عشان زرار «المزيد» يفضل باين ويقفلها بضغطة تانية. */
  body.logged-in .bottom-nav {
    position: fixed;
    inset-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 93;
    display: flex;
    justify-content: space-around;
    gap: 4px;
    padding: 6px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
    border-radius: 22px;
    box-shadow: 0 14px 38px rgba(20, 32, 78, .17), 0 2px 8px rgba(20, 32, 78, .08);
    backdrop-filter: blur(18px) saturate(1.25);
  }

  /* الشريط ده ثابت في قاع الشاشة بـ z-index 93، وزرار البحث كان قاعد في نفس
     المساحة بالظبط بـ z-index 69 — يعني على أي موبايل كان مدفون تحت الشريط:
     مش باين ومش ممكن تضغطه. بنرفعه فوق الشريط بمسافة صغيرة.

     والقايمة نفسها بتقعد فوق الشريط كمان وبتغطي الزرار وهي مفتوحة. ده مقصود:
     القايمة فيها زرار إغلاق خاص بيها، والبديل إننا نرفعها فوق الزرار فتخسر
     ٥٦px من ارتفاع النتايج على شاشة ضيقة أصلاً. */
  body.logged-in .student-search-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); }

  body.logged-in .quick-search {
    z-index: 92;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    width: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 94px);
    max-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 154px);
  }

  .bottom-nav-item {
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--tap);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 4px;
    padding: 6px 2px 5px;
    border-radius: 16px;
    border: 1px solid transparent;
    background: none;
    color: var(--muted);
    font-size: var(--fs-min);
    font-weight: 700;
    transition: color var(--speed), background var(--speed), transform var(--speed), box-shadow var(--speed);
  }

  .bottom-nav-item .icon { width: 21px; height: 21px; transition: transform var(--speed); }
  .bottom-nav-item span { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav-item:active { transform: scale(.96); }
  .bottom-nav .nav-item:hover, .bottom-nav-more:hover { background: var(--panel-2); color: var(--accent); }

  .bottom-nav .nav-item.active {
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 14%, var(--panel)), color-mix(in srgb, var(--accent) 7%, var(--panel)));
    border-color: transparent;
    color: var(--accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 6px 14px color-mix(in srgb, var(--accent) 12%, transparent);
    font-weight: 850;
  }
  .bottom-nav .nav-item.active .icon { transform: translateY(-1px) scale(1.08); }

  /* ورقة «المزيد»: أقسام متبدلة بدل قائمة طويلة بسكرول داخلي. كل مرة ظاهر
     عدد صغير من الأدوات في شبكة، فمفيش سكرول جوه سكرول ولا عناصر مستخبية. */
  body.logged-in .more-sheet[hidden], body.logged-in .more-sheet-backdrop[hidden] { display: none; }

  body.logged-in .more-sheet {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 92;
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    max-height: calc(100dvh - 12px);
    overflow: hidden;
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px));
    border-radius: 28px 28px 0 0;
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -20px 50px rgba(20, 32, 78, 0.22);
  }

  body.logged-in .more-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 91;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
  }

  html.more-sheet-open, body.more-sheet-open { overflow: hidden; }

  .more-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .more-sheet-head > div { display: grid; gap: 1px; }
  .more-sheet-head strong { font-size: 16px; font-weight: 900; }
  .more-sheet-head span { color: var(--muted); font-size: 11px; font-weight: 700; }
  .more-sheet-head .quick-search-close { flex: 0 0 auto; }

  .more-sheet-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel-2);
  }

  .more-sheet-tab {
    min-width: 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    border: 0;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
  }
  .more-sheet-tab:hover { color: var(--ink); background: color-mix(in srgb, var(--panel) 76%, transparent); }
  .more-sheet-tab.is-active {
    color: var(--accent);
    background: var(--panel);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 12%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--accent) 11%, transparent);
  }
  .more-sheet-tab:active { transform: scale(.98); }
  .more-sheet-tab .icon { width: 17px; height: 17px; }

  .more-sheet-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .more-sheet-group[hidden] { display: none; }

  .more-sheet .nav-item {
    min-width: 0;
    min-height: 52px;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 14px;
    color: var(--ink);
    background: var(--panel-2);
    font-size: 12.5px;
    line-height: 1.35;
    font-weight: 800;
    text-align: start;
  }

  .more-sheet .nav-item:hover { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 18%, var(--line)); }
  .more-sheet .nav-item.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: none; }
  .more-sheet .icon { width: 18px; height: 18px; }

  /* ذيل الورقة: الخروج والحقوق. الاتنين متنسّقين للشريط الجانبي الغامق
     (`--sidebar-ink` ولينك أبيض)، والورقة دي كارت فاتح — فبيتعادوا هنا. */
  .more-sheet-foot { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
  .more-sheet-foot .logout-btn, .more-sheet-foot .utility-btn.logout-btn {
    min-height: 40px;
    justify-content: center;
    color: var(--danger);
    background: var(--danger-soft);
  }
  .more-sheet-foot .app-credit { border-top: 0; margin: 0; padding-top: 2px; color: var(--muted); }
  .more-sheet-foot .app-credit a { color: var(--accent); }
}

@media (max-width: 900px) and (max-height: 680px) {
  body.logged-in .more-sheet { gap: 8px; padding-top: 11px; }
  .more-sheet-head span, .more-sheet-foot .app-credit { display: none; }
  .more-sheet .nav-item { min-height: 46px; }
}

@media (max-width: 430px) {
  body.logged-in .bottom-nav { inset-inline: 6px; gap: 2px; padding: 5px; border-radius: 19px; }
  .bottom-nav-item { font-size: 10.5px; border-radius: 14px; }
  .bottom-nav-item .icon { width: 20px; height: 20px; }
}

/* «عرض المزيد» تحت كشف أولياء الأمور ولوحة متابعة الغياب: عرض كامل عشان يبان
   إنه نهاية الدفعة مش زرار تاني في صف. */
.report-more,
.absence-more { width: 100%; margin-top: 11px; min-height: var(--tap); }

/* لوحة مطويّة: المحتوى جوّاها لوحة كاملة، فبنشيل عنها الإطار والخلفية عشان
   ما يبقاش صندوق جوه صندوق. */
.fold-panel { padding: 0; overflow: hidden; }
.fold-panel .panel-toggle-head { width: 100%; }
.fold-panel-body { padding: 0 16px 16px; }
.fold-panel-body > .panel { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
.fold-panel-body > .panel > .section-head { padding-top: 0; }

/* ------------------------- الموبايل: طي وترتيب ------------------------- */
@media (max-width: 900px) {
  .absence-filters-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .absence-filters-head .searchbox { flex: 1 1 100%; order: 2; }
  .absence-filters-head .absence-toolbar-actions { order: 3; flex: 1 1 100%; }
  .sub-check { width: 24px; height: 24px; }
  /* «تحديد المعروض» كان ١٦px في سطر ٢٢px — بيحدد مين هيتبعتله رسالة، فمابيصحّش
     يكون أصغر خانة على الشاشة. */
  .select-all-row { min-height: var(--tap); }
  .select-all-row input { width: 24px; height: 24px; }
  /* الخانة نفسها ٢٤px، والـ label حواليها بتاخد ارتفاع لمسة كامل عشان اللمس
     جنبها يعدّ — نفس اللي اتعمل في كشف الغياب. */
  .sub-pick { display: flex; align-items: center; min-height: var(--tap); padding-inline-end: 4px; }
  .sub-toggle { min-height: var(--tap); }
  /* خانة التحديد في كشف الغياب كانت ١٨px — أصغر من إن صباع يظبطها من أول مرة،
     والغلطة فيها مكلفة لأنها بتحدد مين هيتبعتله رسالة. الخانة نفسها بتكبر،
     والـ label حواليها بتاخد ارتفاع لمسة كامل عشان اللمس جنبها يعدّ. */
  .absence-pick { padding-top: 0; min-height: var(--tap); display: flex; align-items: center; }
  .absence-pick input { width: 24px; height: 24px; }
  /* شرايح أسماء الطلاب في سجل النمو: الاسم هو الطريق الوحيد لملف الطالب من
     هنا، فبياخد ارتفاع لمسة كامل بدل ٢٢px. */
  .ledger-name { min-height: 36px; padding: 6px 12px; display: inline-flex; align-items: center; }
  /* اسم الطالب في راس كارت الغياب هو الطريق لملفه — بياخد ارتفاع لمسة كامل
     عشان الضغطة تنجح من أول مرة على الموبايل. */
  .absence-card-id .student-name { min-height: 36px; display: inline-flex; align-items: center; }
}

/* ==========================================================================
   قوايم الفلترة — الموبايل بس
   ==========================================================================
   الفلاتر كانت صفوف شيبس. على اللاب دي أحسن شكل: كل الاختيارات ظاهرة وبتتقارن
   بنظرة. على الموبايل نفس الصفوف كانت بتلف لأربع وخمس سطور، فالطالب مايعرفش
   الشيب ده بيفلتر بإيه، والشاشة كلها بتروح في الفلاتر قبل أول نتيجة.

   الحل: نفس الـHTML يترسم بشكلين. فوق ٧٦٠px كل أغلفة القايمة display: contents
   والزرار بيتصفّر ويرجع سطر عنوان — فالديسكتوب والتابلت مايتغيرش فيهم بكسل.
   تحت ٧٦٠px الغلاف بيبقى زرار واحد مكتوب عليه اسم الفلتر واختياره الحالي،
   والدوسة بتفتح ورقة سفلية فيها نفس الأزرار كقايمة كاملة العرض. */

.filter-menu.bare { display: contents; }
.filter-menu-sheet, .filter-menu-card { display: contents; }
.filter-menu-backdrop, .filter-menu-head { display: none; }
.filter-menu.bare .filter-menu-body { display: contents; }

/* الزرار على الشاشات الواسعة = نسخة طبق الأصل من .absence-group-label.
   pointer-events: none عشان مايبقاش قابل للدوس أصلاً بره الموبايل. */
.filter-menu-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  appearance: none;
  text-align: start;
  font-family: inherit;
  font-size: var(--fs-min);
  font-weight: 800;
  line-height: inherit;
  letter-spacing: 0.01em;
  color: var(--muted);
  pointer-events: none;
  cursor: default;
}
.filter-menu.bare .filter-menu-trigger { display: none; }
.filter-menu-value, .filter-menu-caret { display: none; }

/* الاستثناء الوحيد من قاعدة «HTML واحد للشاشتين»: منتقي المرحلة في تبويب
   المراحل. ده مش فلتر بيضيّق كشف — ده المفتاح اللي بيقرّر التبويب كله شغّال
   على أنهي مرحلة، وعلى الشاشة الواسعة `<select>` أصلي هو أحسن شكل ليه (سطر
   واحد، والقايمة بتفتح جنبه). على الموبايل قايمة النظام بتديك سطور رفيعة من
   غير عدد طلاب ولا علامة على المختار، فبتبقى ورقة زي باقي الفلاتر. العنصرين
   الاتنين بيتبنوا من نفس مصفوفة المراحل، فمفيش نسختين يفرقوا عن بعض. */
.filter-menu.narrow-only { display: none; }

/* التمرير ورا الورقة بيتقفل. clip مش hidden — hidden بيجبر overflow-x على
   hidden كمان ويقتل كل sticky في الصفحة. */
body.filter-menu-open { overflow-y: clip; }

@keyframes filter-menu-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes filter-menu-rise { from { transform: translateY(14%); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 760px) {
  .filter-menu, .filter-menu.bare { display: block; }
  /* القايمة المجرّدة بتقعد جوّه رأس قسم (flex) أو شبكة فلاتر، فمن غير العرض
     الكامل كانت بتتقلّص لعرض كلمتين جنب العنوان. */
  .filter-menu.bare { flex: 1 1 100%; width: 100%; }
  /* ورقة القايمة (كل <select> في السيستم) فوق كل حاجة غير التوستات: القايمة
     ممكن تكون جوّه ورقة فلتر، أو جوّه نافذة منبثقة (z-index بتاعها أعلى رقم
     تقريباً عشان تعلو على طبقة الكاميرا) — والورقة لازم تعلو على الاتنين. */
  .filter-menu-sheet.select-sheet { z-index: 2147483620; }
  .select-sheet .period-chip[disabled] { opacity: .45; }

  /* منتقي المرحلة: الورقة تحل محل الـ<select> وتاخد سطر الصف كله. */
  .filter-menu.narrow-only { display: block; flex: 1 1 100%; width: 100%; }
  .stage-picker .wide-only { display: none; }
  .stage-picker-menu .filter-menu-trigger { min-height: 50px; }
  /* المجموعة مابقتش صندوق جواه شيبس — بقت زرار، فإطارها وخلفيتها بيتشالوا
     وبينتقلوا للزرار نفسه. */
  .filter-menu.absence-filter-group { padding: 0; border: 0; border-radius: 0; background: none; }

  .filter-menu-trigger {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    min-height: var(--tap);
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--ink);
    pointer-events: auto;
    cursor: pointer;
    transition: border-color var(--speed), background var(--speed);
  }
  .filter-menu.bare .filter-menu-trigger { display: grid; }
  .filter-menu-name { grid-column: 1; grid-row: 1; color: var(--muted); font-size: var(--fs-min); font-weight: 800; line-height: 1.3; }
  .filter-menu-value {
    display: block;
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .filter-menu-caret {
    display: block;
    grid-column: 2;
    grid-row: 1 / -1;
    width: 17px;
    height: 17px;
    color: var(--muted);
    transform: rotate(-90deg);
    transition: transform var(--speed);
  }
  /* الفلتر اللي شغّال بيبان من برّه من غير ما المستخدم يفتحه. */
  .filter-menu.is-set .filter-menu-trigger { border-color: var(--accent); background: var(--accent-soft); }
  .filter-menu.is-set .filter-menu-value { color: var(--accent); }
  .filter-menu[data-open] .filter-menu-trigger { border-color: var(--accent); }
  .filter-menu[data-open] .filter-menu-caret { transform: rotate(90deg); }

  /* الورقة المفتوحة بتبقى بنت body مباشرةً (شوف closeFilterMenus في app.js)،
     فالفتح بيتقاس بمكانها مش بكلاس على الأب. */
  .filter-menu-sheet { display: none; position: fixed; inset: 0; z-index: 140; }
  body > .filter-menu-sheet { display: block; }
  .filter-menu-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 12, 20, 0.46);
    opacity: 1;
    animation: filter-menu-fade 0.18s ease;
  }
  .filter-menu-card {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    max-height: min(78vh, 580px);
    padding: 0 14px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    background: var(--panel);
    box-shadow: 0 -20px 48px rgba(0, 0, 0, 0.32);
    opacity: 1;
    transform: none;
    animation: filter-menu-rise 0.24s cubic-bezier(0.22, 0.9, 0.3, 1);
  }
  .filter-menu-grip {
    position: absolute;
    inset-inline: 0;
    top: 8px;
    width: 42px;
    height: 4px;
    margin: 0 auto;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 38%, transparent);
    z-index: 1;
  }
  .filter-menu-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-inline: -12px;
    padding: 17px 12px 9px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 88%, var(--accent));
    color: var(--ink);
  }
  .filter-menu-heading { display: block; min-width: 0; }
  .filter-menu-head strong { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 900; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis; }
  .filter-menu-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
  }
  .filter-menu-x:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
  .filter-menu-x .icon { width: 16px; height: 16px; }

  .filter-menu-body,
  .filter-menu.bare .filter-menu-body {
    display: grid;
    gap: 8px;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 0 4px;
  }
  .filter-menu-body .chip-row { display: grid; gap: 8px; }
  /* الشيب بقى صف كامل العرض في قايمة: الإصبع بيوصل له من غير تصويب، والاسم
     مابيتقصّش عشان يدخل جنب اللي بعده. */
  .filter-menu-body .period-chip,
  .filter-menu-body .risk-chip {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    min-height: 52px;
    padding: 12px 15px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    text-align: start;
  }
  .filter-menu-body .period-chip.active:not(.future),
  .filter-menu-body .risk-chip.active {
    border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
    background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--panel) 76%, var(--accent-soft)));
    /* النسخة الأساسية من الشيب المختار نصها بلون زر الإجراء (غالباً أبيض)،
       لكن ورقة الموبايل بتستعمل خلفية فاتحة أهدى. لازم نثبت لون النص هنا
       عشان الاسم وعلامة الصح يفضلوا مقروئين في كل الثيمات وكل قوائم النظام. */
    color: var(--ink);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .filter-menu-body .period-chip.active .chip-count,
  .filter-menu-body .risk-chip.active .chip-count {
    background: color-mix(in srgb, currentColor 11%, transparent);
  }
  .filter-menu-body .period-chip .icon, .filter-menu-body .risk-chip .icon { width: 17px; height: 17px; }
  /* علامة صح في آخر الصف — اللون لوحده مش كفاية للتمييز. */
  .filter-menu-body .period-chip.active:not(.future)::after,
  .filter-menu-body .risk-chip.active::after {
    content: '✓';
    margin-inline-start: auto;
    font-size: 15px;
    font-weight: 900;
  }
  .filter-menu-body > select,
  .filter-menu-body .absence-month-select {
    width: 100%;
    flex: none;
    min-width: 0;
    min-height: 50px;
    padding-inline: 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
  }
  .filter-menu-body .filter-note { font-size: var(--fs-min); color: var(--muted); }

  /* صف الأزرار بقى شبكة عمودين: خمس فلاتر بتبان كلها في مساحة سطرين ونص بدل
     ما تاخد الشاشة. */
  .absence-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .absence-filter-line { display: contents; }
  /* الفلتر اللي لوحده في سطره بياخد العرض كله. */
  .filter-menu.span-2 { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .filter-menu-backdrop, .filter-menu-card { animation: none; }
  .filter-menu-caret { transition: none; }
}

.summary-page { display: grid; gap: 14px; min-width: 0; }

/* الرأس: العنوان والتحديث في سطر، وتحتهم اختيار اليوم والمرحلة والمجموعة. */
.summary-head {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px 18px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--brand-navy) 34%, var(--line));
  background: linear-gradient(135deg, var(--brand-navy), color-mix(in srgb, var(--brand-navy) 72%, var(--accent)));
  color: #fff;
}
.summary-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.summary-head::after { content: ''; position: absolute; inset-inline-end: -55px; top: -82px; width: 190px; height: 190px; border: 34px solid rgba(255,255,255,.05); border-radius: 50%; pointer-events: none; }
.summary-head-title { display: grid; gap: 3px; min-width: 0; }
.summary-head-title h2 { margin: 0; font-size: 20px; font-weight: 900; text-wrap: balance; }
.summary-head-title p { margin: 0; color: rgba(255,255,255,.76); font-size: 13.5px; font-weight: 700; }
.summary-head-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.summary-updated { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.76); font-size: var(--fs-min); font-variant-numeric: tabular-nums; }
.summary-updated .icon { width: 15px; height: 15px; }
.summary-head .summary-refresh { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: #fff; }
.summary-head .summary-refresh:hover { background: rgba(255,255,255,.18); }
.summary-refresh[disabled] { opacity: 0.65; cursor: progress; }

.summary-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.2);
}
.summary-day { display: flex; align-items: center; gap: 6px; min-width: 0; }
.summary-day-input { min-width: 0; min-height: var(--tap); font-variant-numeric: tabular-nums; }
.summary-day-step { display: grid; place-items: center; width: var(--tap); min-width: var(--tap); min-height: var(--tap); padding: 0; }
.summary-day-step .icon { width: 16px; height: 16px; }
/* السهم في الـsprite بيشاور شمال. في العربي «اللي قبله» على اليمين، فبيتقلب. */
.summary-day-step.is-prev .icon { transform: rotate(180deg); }
.summary-today, .summary-reset { min-height: var(--tap); }
.summary-scope { flex: 1 1 320px; display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 8px 10px; min-width: 0; }
.summary-field { min-width: 0; }
.summary-field select { width: 100%; min-width: 0; }

.summary-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
}
.summary-banner > .icon { flex: 0 0 auto; width: 17px; height: 17px; color: var(--warning); }
.summary-nearest { min-height: var(--tap); }

/* كل قسم لوحة فيها كروت أرقام بس: اسم ورقم. */
.summary-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
  gap: 14px;
}
.summary-section { display: grid; gap: 12px; padding: 16px; min-width: 0; }
.summary-section-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 900; }
.summary-section-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.summary-section-icon .icon { width: 17px; height: 17px; }

.summary-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.summary-stat {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  min-height: 76px;
  padding: 11px 12px;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
}
.summary-stat-label { color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.35; }
.summary-stat-value { font-size: 24px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-stat.is-wide .summary-stat-value { font-size: 19px; }

.summary-stat.good .summary-stat-value { color: var(--success); }
.summary-stat.warn .summary-stat-value { color: var(--warning); }
.summary-stat.danger .summary-stat-value { color: var(--danger); }

.summary-stat.is-link { cursor: pointer; transition: transform var(--speed), border-color var(--speed); }
.summary-stat.is-link:hover { transform: translateY(-2px); border-color: var(--accent); }
.summary-stat.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.summary-stat.is-zero { background: transparent; border-style: dashed; }
.summary-stat.is-zero .summary-stat-value { color: var(--muted); }

/* التنبيهات: عرض الصف كله، والدرجة مكتوبة كلمة في شارة مش لون بس. */
.summary-section-insights { grid-column: 1 / -1; }
.summary-insights-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-inline-start: 4px;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.summary-insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.summary-insight, .insight-rule { --insight-tone: var(--accent); --insight-soft: var(--accent-soft); }
.summary-insight.is-danger, .insight-rule.is-danger { --insight-tone: var(--danger); --insight-soft: var(--danger-soft); }
.summary-insight.is-warning, .insight-rule.is-warning { --insight-tone: var(--warning); --insight-soft: var(--warning-soft); }
.summary-insight {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.summary-insight-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-insight-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--insight-soft);
  color: var(--insight-tone);
  font-size: var(--fs-min);
  font-weight: 900;
  white-space: nowrap;
}
.summary-insight-value { color: var(--insight-tone); font-size: 22px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-insight-value.is-wide { font-size: 17px; }
.summary-insight-title { margin: 0; font-size: 14.5px; font-weight: 900; text-wrap: balance; }
.summary-insight-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.summary-insight-action { justify-self: start; min-height: var(--tap); margin-top: 2px; }
.summary-insight-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.summary-insights-clear {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success);
  font-weight: 800;
}
.summary-insights-clear .icon { flex: 0 0 auto; width: 18px; height: 18px; }

/* القايمة اللي بتفتح من كارت الملخص في «الطلاب»، وفلتر كشف الحضور. */
.stage-focus-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.stage-focus-head h2 { margin: 2px 0; font-size: 19px; font-weight: 900; text-wrap: balance; }
.stage-focus-kicker { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--accent); font-size: var(--fs-min); font-weight: 800; }
.stage-focus-kicker .icon { width: 15px; height: 15px; }
.stage-focus-count { margin: 0; color: var(--muted); font-weight: 700; }
.stage-focus-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-focus-empty { margin: 10px 0 0; color: var(--muted); }

.att-status-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-block-end: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 13.5px;
}
.att-status-filter .icon { width: 16px; height: 16px; vertical-align: -3px; }

/* في وضع العمود `flex-basis` بيبقى طول مش عرض، فالمرحلة والمجموعة بيرجعوا
   `flex: none` هنا وإلا كانوا هياخدوا ٣٢٠px ارتفاع فاضي. */
@media (max-width: 620px) {
  .summary-head, .summary-section { padding: 12px; }
  .summary-controls { align-items: stretch; flex-direction: column; }
  .summary-day { flex-wrap: wrap; }
  .summary-day-input { flex: 1 1 0; }
  .summary-scope { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-stat-value { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .summary-stat.is-link, .summary-stat.is-link:hover { transition: none; transform: none; }
}
