/* ═══════════════════════════════════════════════════════════════════════════
   تحفيظ — تنسيق موبايل أولًا
   ───────────────────────────────────────────────────────────────────────────
   الألوان مسحوبة بالبكسل من logo.jpeg. التفاصيل والتباين في DESIGN.md.
   القاعدة: يبدأ من الموبايل ويكبر بـ min-width. كل اللي فوق = موبايل.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bs-body-font-family: 'Cairo', system-ui, -apple-system, sans-serif;

  /* ── هوية جمعية الدعاة ── */
  --brand-royal:      #1140FF;   /* الخلفية الخارجية للوجو — أزرار وتبويب نشط بس */
  --brand-royal-dark: #0E2ECC;
  --brand-royal-soft: #EEF1FF;
  --brand-navy:       #0C4A9D;   /* جسم المربّع — كروت وبانرات */
  --brand-navy-mid:   #0E56BA;   /* الزخرفة */
  --brand-navy-deep:  #07305F;
  --brand-gold:       #CDAA06;   /* التشكيل — تمييز فقط */
  --brand-gold-deep:  #8A6F00;   /* البديل لو لازم نص ذهبي على أبيض */

  /* بوتستراب بيقرا المتغيّرات دي في مكونات كتير */
  --bs-primary: #1140FF;
  --bs-primary-rgb: 17, 64, 255;

  /* ── الأسطح ── */
  --bg:      #f8fafc;            /* slate خفيف — أريح من الأبيض الفاقع في الشمس */
  --surface: #ffffff;
  --line:    #e2e8f0;
  --muted:   #475569;            /* 7.4:1 على --bg */
  --text:    #0f172a;            /* 16.1:1 على --bg */

  /* ── دلالات ── */
  --ok: #16a34a;      --ok-bg: #dcfce7;
  --warn: #b45309;    --warn-bg: #fef3c7;
  --danger: #dc2626;  --danger-bg: #fee2e2;

  /* ── مقاسات ── */
  --nav-h: 62px;
  --topbar-h: 56px;
  --tap: 44px;                   /* أصغر هدف لمس مسموح */
  --rate-h: 48px;                /* ارتفاع أزرار التقييم */
  --safe-b: env(safe-area-inset-bottom, 0px);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .03);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 6px -1px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 25px -5px rgba(17, 64, 255, .20), 0 8px 10px -6px rgba(15, 23, 42, .06);
}

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  font-family: var(--bs-body-font-family);
  background-color: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

/* ───────────────────────────────────────────────────────────────────────────
   مؤشر التحميل العالمي
   ─────────────────────────────────────────────────────────────────────────── */

.global-progress {
  position: fixed; top: 0; inset-inline: 0;
  height: 3px; z-index: 100;
  background: rgba(17, 64, 255, .12);
  overflow: hidden;
}
.global-progress-bar {
  height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--brand-royal), #4d6bff, var(--brand-gold));
  border-radius: 2px;
  animation: global-progress-anim 1.2s infinite ease-in-out;
}
@keyframes global-progress-anim {
  0%   { transform: translateX(-100%); width: 30%; }
  50%  { width: 60%; }
  100% { transform: translateX(300%); width: 30%; }
}

.global-loader-badge {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  inset-inline-start: 50%;
  transform: translateX(50%);
  z-index: 95;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1.1rem;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  font-size: .85rem; font-weight: 600; color: #1e293b;
  animation: badge-bounce-in .22s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes badge-bounce-in {
  from { opacity: 0; transform: translate(50%, -10px) scale(.92); }
  to   { opacity: 1; transform: translate(50%, 0) scale(1); }
}

/* ───────────────────────────────────────────────────────────────────────────
   الإدخال — 16px حد أدنى لمنع الزوم في iOS
   ⚠️ `input` العارية بتشمل الـ checkbox والـ radio كمان، فلازم الاستثناء
      وإلا بيتمطّوا لمستطيل طويل وتضيع دايرة الراديو.
   ─────────────────────────────────────────────────────────────────────────── */

input:not([type="checkbox"]):not([type="radio"]),
select, textarea, .form-control, .form-select {
  font-size: 16px !important;
  min-height: var(--tap);
  border-color: var(--line);
  border-radius: 12px;
  max-width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus, .form-control:focus, .form-select:focus {
  border-color: var(--brand-royal);
  box-shadow: 0 0 0 3px rgba(17, 64, 255, .15);
}

textarea.form-control { min-height: 92px; resize: none; }

.form-check, .form-check.form-switch {
  display: flex; align-items: center; gap: .6rem;
  padding: 0; min-height: var(--tap); margin-bottom: 0;
}
/* لازم `.form-check .form-check-input`: بوتستراب RTL بيرصّ الـ float والمارجن
   السالب بالتخصيص ده بالظبط، والمارجن بيفضل شغال جوه الفلكس فيسحب المربع فوق. */
.form-check .form-check-input {
  float: none; margin: 0; flex-shrink: 0;
  width: 1.4rem; height: 1.4rem;
  border-color: #cbd5e1; cursor: pointer;
}
.form-check .form-check-input[type="checkbox"] { border-radius: 6px; }
.form-check .form-check-input[type="radio"]    { border-radius: 50%; }
.form-check.form-switch .form-check-input {
  width: 2.6rem; height: 1.45rem; border-radius: 2rem;
}
.form-check .form-check-input:checked {
  background-color: var(--brand-royal);
  border-color: var(--brand-royal);
}
.form-check .form-check-input:focus {
  border-color: var(--brand-royal);
  box-shadow: 0 0 0 3px rgba(17, 64, 255, .15);
}
.form-check-label { margin: 0; cursor: pointer; line-height: 1.4; }

/* ── الأزرار ── */

.btn {
  min-height: var(--tap);
  font-weight: 600;
  border-radius: 12px;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background-color: var(--brand-royal);
  border-color: var(--brand-royal);
  box-shadow: 0 2px 8px rgba(17, 64, 255, .25);
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
  background-color: var(--brand-royal-dark);
  border-color: var(--brand-royal-dark);
}
.btn-outline-primary {
  color: var(--brand-navy);
  border-color: var(--brand-royal);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
  background-color: var(--brand-royal);
  border-color: var(--brand-royal);
}
.btn-sm { min-height: 38px; border-radius: 10px; }

/* أرقام الهواتف والأكواد تتعرض من الشمال لليمين */
.ltr { direction: ltr; text-align: center; letter-spacing: .04em; }

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

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: .5rem;
  padding: 0 .75rem;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo {
  width: 32px; height: 32px; flex-shrink: 0;
  object-fit: contain;
}
.topbar-title {
  flex: 1; margin: 0;
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 12px;
  font-size: 1.15rem; color: var(--muted);
  transition: background-color .15s ease, transform .12s ease;
}
.topbar-btn:active { background: rgba(15, 23, 42, .06); transform: scale(.94); }
.topbar-actions { display: flex; align-items: center; gap: .25rem; }

/* شارة الإشعارات غير المقروءة في الهيدر */
.notif-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  min-width: 18px;
  height: 18px;
  padding: 2px 4px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
}

/* بطاقات الإشعارات في صندوق الوارد والمرسل */
.notif-card {
  position: relative;
  transition: transform .12s ease, box-shadow .12s ease;
}
.notif-card.is-clickable {
  cursor: pointer;
}
.notif-card.is-clickable:active {
  transform: scale(.99);
}
.notif-card.is-unread {
  border-inline-start: 4px solid var(--brand-royal);
  background: rgba(17, 64, 255, .02);
}
.notif-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-royal);
  border-radius: 50%;
  display: inline-block;
  margin-inline-end: 6px;
  flex-shrink: 0;
}

/* ───────────────────────────────────────────────────────────────────────────
   الشاشة والكروت
   ─────────────────────────────────────────────────────────────────────────── */

.view { padding: 1rem .875rem 1.5rem; max-width: 720px; margin: 0 auto; }

.card-soft {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}

/* كارت داكن بهوية الجمعية — البانرات وكارت النقط */
.card-brand {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
  color: #fff;
  border: 1px solid var(--brand-navy-mid);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: var(--shadow-md);
}
.card-brand .muted,
.card-brand .text-muted { color: rgba(255, 255, 255, .82) !important; }
/* الذهبي على الكحلي = 3.7:1 — للعناوين الكبيرة والأيقونات بس */
.card-brand .gold { color: var(--brand-gold); }
.card-brand .preview-lesson-row {
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.card-brand .preview-lesson-row:last-child {
  border-bottom: none;
}
.card-brand .preview-lesson-row .lesson-title {
  color: #fff;
  font-weight: 700;
}
.card-brand .preview-lesson-row .lesson-date {
  color: rgba(255, 255, 255, 0.85);
}

.section-title {
  font-size: .82rem; font-weight: 700; color: var(--muted);
  margin: 1.25rem .25rem .5rem;
}

.row-tap {
  display: flex; align-items: center; gap: .75rem;
  min-height: 58px; padding: .85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: .6rem;
  width: 100%; text-align: start;
  color: inherit; text-decoration: none;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.row-tap:active { transform: scale(.985); background: #f1f5f9; }
.row-tap .row-icon { font-size: 1.25rem; color: var(--muted); flex-shrink: 0; }
.row-tap .row-main { flex: 1; min-width: 0; }
.row-tap .row-title { font-weight: 600; }
.row-tap .row-sub { font-size: .82rem; color: var(--muted); }

/* رقاقة الانتقال للحلقة (تارجت لمس 44px متوافق مع الموبايل) */
.halaqa-chip {
  min-height: 44px;
  padding: .35rem .75rem;
  border-radius: 10px;
  font-size: .84rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
  user-select: none;
}
.halaqa-chip:active {
  transform: scale(.97);
}
.halaqa-chip.is-active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
}
.halaqa-chip.is-inactive {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: var(--muted);
  opacity: .8;
}

/* ───────────────────────────────────────────────────────────────────────────
   الشريط السفلي
   ─────────────────────────────────────────────────────────────────────────── */

.bottomnav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: flex;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.navitem {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  border: 0; background: transparent;
  color: var(--muted); text-decoration: none;
  font-size: .72rem; font-weight: 600;
  transition: color .15s ease, transform .12s ease;
}
.navitem i { font-size: 1.35rem; line-height: 1; }
.navitem.active { color: var(--brand-royal); font-weight: 700; }
.navitem:active { transform: scale(.92); }

/* ───────────────────────────────────────────────────────────────────────────
   الدرج السفلي — بديل الموبايل للنوافذ المنبثقة
   ─────────────────────────────────────────────────────────────────────────── */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(7, 48, 95, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .22s ease;
}
.sheet-backdrop.show { opacity: 1; }

.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 55;
  display: flex; flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  max-width: 100vw;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -10px 30px rgba(7, 48, 95, .18);
}
.sheet.show { transform: translateY(0); }

.sheet-head {
  position: relative;
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem .6rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sheet-grip {
  position: absolute; top: 8px; inset-inline-start: 50%;
  transform: translateX(50%);
  width: 42px; height: 5px; border-radius: 3px; background: #cbd5e1;
}
.sheet-title { flex: 1; margin: .4rem 0 0; font-size: 1.05rem; font-weight: 700; }
.sheet-body {
  padding: 1.1rem;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  max-height: calc(92vh - 120px);
  max-height: calc(92dvh - 120px);
  flex: 1 1 auto;
}
.sheet-footer { padding: .85rem 1.1rem; border-top: 1px solid var(--line); flex-shrink: 0; }

/* ───────────────────────────────────────────────────────────────────────────
   مكوّن التقييم — 5 أزرار ملتصقة، بيخدم الحفظ والمراجعة والأدب والواجب
   كلهم من 5، فمكوّن واحد يكفي. النجوم هدفها 30px = ضغط غلط.
   ─────────────────────────────────────────────────────────────────────────── */

/* `.rating` = الدرجة من ٥ · `.seg` = أي اختيار واحد من مجموعة (حالة الحضور).
   نفس الشكل، واسمين مختلفين عشان الكود مايتلغبطش. */
.rating, .seg {
  display: flex; width: 100%; gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.rating-btn, .seg-btn {
  flex: 1;
  min-height: var(--rate-h);
  min-width: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-inline-start: 1px solid var(--line);
  background: transparent;
  font-size: 1.02rem; font-weight: 700; color: var(--muted);
  transition: background-color .12s ease, color .12s ease;
}
.seg-btn { font-size: .88rem; }
.rating-btn:first-child, .seg-btn:first-child { border-inline-start: 0; }
.rating-btn.on, .seg-btn.on { background: var(--brand-royal); color: #fff; }
.rating-btn:active, .seg-btn:active { background: var(--brand-royal-soft); }
.rating-btn.on:active, .seg-btn.on:active { background: var(--brand-royal-dark); }
.rating-btn:disabled, .seg-btn:disabled { opacity: .5; }

/* عدّاد أخطاء التسميع — أصفر، بيعدّ لفوق */
.errbtn {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 0 .7rem;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: var(--warn-bg);
  font-size: .85rem; font-weight: 600; color: var(--warn);
}
.errbtn:disabled { opacity: .45; }
.errbtn .n {
  min-width: 22px; height: 22px;
  display: inline-grid; place-items: center;
  border-radius: 7px;
  background: #fff; color: var(--warn);
  font-size: .78rem;
}

/* ± ترتيب الوصول — رمادي محايد، شكل مختلف تمامًا عن عدّاد الأخطاء
   عشان الإبهام مايغلطش بينهم وهما في نفس الكارت */
.stepbtn {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
}
.stepbtn:active { background: #f1f5f9; }
.stepbtn:disabled { opacity: .45; }

/* ───────────────────────────────────────────────────────────────────────────
   منتقي القرآن
   ─────────────────────────────────────────────────────────────────────────── */

/* عنصر في قايمة السور جوه الدرج */
.picker-opt {
  width: 100%;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem .65rem;
  text-align: start;
  background: transparent;
  border: 0; border-radius: 10px;
  color: inherit;
}
.picker-opt:active { background: #e2e8f0; }
.picker-opt.on {
  background: var(--brand-royal-soft);
  color: var(--brand-navy);
  font-weight: 700;
}
.picker-opt-main { min-width: 0; display: flex; flex-direction: column; }
.picker-opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-opt-hint { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* الزرار اللي بيعرض المدى المختار ويفتح المنتقي */
.picker-btn {
  width: 100%;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .85rem;
  font-size: 16px;              /* أقل من كده iOS بيزوّم */
  text-align: start;
  background: var(--surface);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.picker-btn.has-value { border-color: var(--brand-royal); }
.picker-btn > .bi { color: var(--brand-navy); flex-shrink: 0; font-size: 1.1rem; }
.picker-btn-main { min-width: 0; display: flex; flex-direction: column; }
.picker-btn-label {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-btn-hint { font-size: .78rem; color: var(--brand-gold-deep); font-weight: 600; }

/* ───────────────────────────────────────────────────────────────────────────
   كارت الطالب في الحصة — أهم مكوّن في التطبيق
   ─────────────────────────────────────────────────────────────────────────── */

.stcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: .6rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.stcard.open {
  border-color: var(--brand-royal);
  box-shadow: var(--shadow-md);
}

.stcard-head {
  display: flex; align-items: center; gap: .7rem;
  min-height: 62px;
  padding: .7rem .9rem;
  cursor: pointer;
}
.stcard-head:active { background: #f1f5f9; }

.stcard-main { flex: 1; min-width: 0; }
.stcard-name {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stcard-sub {
  font-size: .8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stcard-caret { color: var(--muted); flex-shrink: 0; }

.stcard-body {
  padding: 0 .9rem 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

/* زرار «وصل الآن» — 48px عشان الإبهام يلاقيه من غير تصويب */
.btn-arrive {
  min-height: 48px;
  padding: 0 .85rem;
  border-radius: 12px;
  background: var(--brand-royal);
  border: 0;
  color: #fff;
  font-weight: 700; font-size: .84rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(17, 64, 255, .25);
}
.btn-arrive:active { transform: scale(.96); background: var(--brand-royal-dark); }
.btn-arrive:disabled { opacity: .45; box-shadow: none; }

/* «المطلوب منه» من آخر مرة — قراءة فقط */
.prevbox {
  background: var(--brand-royal-soft);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: .7rem .85rem;
}
.prevbox-title {
  font-size: .74rem; font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: .3rem;
}
.prevbox-line { font-size: .85rem; color: var(--text); }

/* ألوان الحالة — بوتستراب مافيهوش الاتنين دول */
.text-ok   { color: var(--ok) !important; }
.text-warn { color: var(--warn) !important; }

/* ───────────────────────────────────────────────────────────────────────────
   شارات ومراكز
   ─────────────────────────────────────────────────────────────────────────── */

.rank-badge {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-royal); color: #fff;
  font-weight: 700; font-size: .92rem;
  box-shadow: 0 2px 6px rgba(17, 64, 255, .25);
}
.rank-badge.plain { background: #e2e8f0; color: var(--muted); box-shadow: none; }
.rank-badge.gold  { background: var(--brand-gold); color: var(--brand-navy-deep); }

/* الدائرة اللي فيها الحرف الأول للاسم (طالب، محفّظ، حلقة). كانت بتستخدم
   `.rank-badge` نفسها، فأي تعديل على شارات المراكز كان بيغيّر الصور كمان. */
.avatar-circle {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-royal); color: #fff;
  font-weight: 700; font-size: .92rem;
  box-shadow: 0 2px 6px rgba(17, 64, 255, .25);
}
.avatar-circle.plain { background: #e2e8f0; color: var(--muted); box-shadow: none; }
.avatar-circle.gold  { background: var(--brand-gold); color: var(--brand-navy-deep); }

/* شريط الحفظ — ثابت فوق شريط التنقّل */
.savebar {
  position: fixed; inset-inline: 0; z-index: 35;
  bottom: calc(var(--nav-h) + var(--safe-b));
  padding: .75rem 1rem;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.savebar-space { height: 86px; }

/* ───────────────────────────────────────────────────────────────────────────
   حالات
   ─────────────────────────────────────────────────────────────────────────── */

.empty, .loading { text-align: center; padding: 3rem 1rem; }
.empty-icon { font-size: 2.85rem; color: #cbd5e1; margin-bottom: .5rem; }
.empty-title { font-weight: 700; margin-bottom: .25rem; }
.empty-text { color: var(--muted); font-size: .92rem; }
.loading-text { color: var(--muted); font-size: .92rem; margin-top: .75rem; }

.toast-host {
  position: fixed; z-index: 70;
  inset-inline: .75rem;
  bottom: calc(var(--nav-h) + var(--safe-b) + .75rem);
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast-host .toast { pointer-events: auto; width: 100%; border-radius: 14px; box-shadow: var(--shadow-md); }

/* ───────────────────────────────────────────────────────────────────────────
   شاشة الدخول — اللوجو هنا على خلفية زرقاء فخلفيته بتندمج
   ─────────────────────────────────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 1.5rem 1.1rem calc(2rem + var(--safe-b));
  max-width: 460px; margin: 0 auto;
}
.auth-logo {
  width: 96px; height: 96px;
  border-radius: 24px;
  display: grid; place-items: center;
  background: var(--brand-royal);
  margin: 0 auto 1.1rem;
  box-shadow: 0 10px 24px rgba(17, 64, 255, .3);
  overflow: hidden;
}
.auth-logo img { width: 84%; height: 84%; object-fit: contain; }
.auth-title { text-align: center; font-weight: 700; margin-bottom: .2rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: .92rem; margin-bottom: 1.5rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   من 768px وفوق — الزيادات بس. الموبايل فوق كده كله.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  body { padding-bottom: 0; }

  .global-loader-badge { top: calc(var(--topbar-h) + 16px); }

  .bottomnav {
    position: sticky; top: var(--topbar-h); bottom: auto;
    height: var(--topbar-h); padding-bottom: 0;
    border-top: 0; border-bottom: 1px solid var(--line);
    justify-content: center; gap: .5rem;
  }
  .navitem {
    flex: 0 0 auto; flex-direction: row; gap: .45rem;
    padding: 0 1.1rem; font-size: .9rem; border-radius: 12px;
  }
  .navitem i { font-size: 1.1rem; }

  .view { padding: 1.75rem 1rem 2.5rem; max-width: 860px; }

  .toast-host { inset-inline: auto 1rem; bottom: 1rem; width: 380px; }

  .sheet {
    inset-inline: 50%; bottom: auto; top: 50%;
    transform: translate(50%, -45%) scale(.98);
    width: min(560px, 92vw);
    border-radius: 20px;
    opacity: 0; transition: opacity .18s ease, transform .18s ease;
  }
  .sheet.show { transform: translate(50%, -50%) scale(1); opacity: 1; }
  .sheet-grip { display: none; }

  /* الشريط السفلي بقى فوق — فشريط الحفظ يرجع في تدفق الصفحة عادي */
  .savebar {
    position: static;
    border-top: 0; padding: 1rem 0 0;
    background: transparent;
    max-width: 860px; margin: 0 auto;
  }
  .savebar-space { display: none; }
}

/* زرار قايمة الإجراءات جوه صف الحصة — بيقعد فوق الصف من غير زرار جوه زرار */
.rowmenu {
  position: absolute;
  inset-inline-end: .5rem;
  top: 50%;
  transform: translateY(-50%);
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  border-radius: 10px;
  color: var(--muted); font-size: 1.05rem;
}
.rowmenu:active { background: rgba(15, 23, 42, .08); }

/* كروت المستخدمين وإجراءات الصف والتحديد الجماعي */
.user-card-wrap {
  position: relative;
  margin-bottom: .6rem;
}
.user-card-wrap .row-tap {
  margin-bottom: 0;
  padding-inline-end: 98px;
}
.user-card-wrap.is-selected .row-tap,
.lesson-card-wrap.is-selected .row-tap {
  background: rgba(26, 86, 219, .06);
  border-color: var(--brand-royal);
}
.user-select-check {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-inline-start: -.35rem;
  margin-inline-end: .25rem;
}
.user-select-check input[type="checkbox"] {
  width: 22px; height: 22px;
  cursor: pointer;
  accent-color: var(--brand-royal);
}
.user-row-actions {
  position: absolute;
  inset-inline-end: .4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
}
.user-action-btn {
  min-width: 44px; min-height: 44px;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  border-radius: 12px;
  color: var(--muted); font-size: 1.15rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .15s ease, color .15s ease;
}
.user-action-btn:hover {
  background: rgba(15, 23, 42, .05);
  color: var(--text);
}
.user-action-btn:active {
  background: rgba(15, 23, 42, .08);
}
.user-action-btn.btn-delete:hover {
  background: rgba(239, 68, 68, .08);
  color: var(--danger);
}
.user-action-btn.btn-delete:active {
  background: rgba(239, 68, 68, .15);
}

/* شريط الإجراءات الجماعية */
.students-action-bar {
  position: fixed; inset-inline: 0; z-index: 45;
  bottom: calc(var(--nav-h) + var(--safe-b));
  padding: .75rem 1rem;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem;
}
.students-action-bar-space { height: 96px; }

@media (min-width: 768px) {
  .students-action-bar {
    /* left/right فيزيائيين مش inset-inline: في RTL الـ end = شمال، فـ
       translateX(50%) كان بيزق الشريط برّه الشاشة يمين */
    bottom: 1.5rem; left: 50%; right: auto;
    transform: translateX(-50%);
    max-width: 760px; width: calc(100% - 2rem);
    border-radius: 16px; border: 1px solid var(--line);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
  }
}

/* ───────────────────────────────────────────────────────────────────────────
   الواجبات — الرفع والتسجيل
   ─────────────────────────────────────────────────────────────────────────── */

/* أزرار التسليم — 56px عشان ولد صغير يلاقيها من غير تصويب */
.btn-big {
  min-height: 56px;
  font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}

.rec-time {
  font-size: 2.2rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.rec-time.warn { color: var(--danger); }

/* نقطة التسجيل — ساكنة قبل ما يبدأ، وبتنبض وهو شغال */
.rec-dot {
  width: 18px; height: 18px; margin: 0 auto;
  border-radius: 50%;
  background: #cbd5e1;
}
.rec-dot.live {
  background: var(--danger);
  animation: rec-pulse 1s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .45; transform: scale(.82); }
}

/* سطر «المطلوب منه» — النص وزرار نسخه الخاص بيه على نفس السطر */
.prevbox-row {
  display: flex; align-items: baseline; gap: .5rem;
  padding: .12rem 0;
}
.prevbox-row .prevbox-line { flex: 1; min-width: 0; }

/* ───────────────────────────────────────────────────────────────────────────
   النقط والمستويات
   ─────────────────────────────────────────────────────────────────────────── */

.points-big {
  font-size: 3rem; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: .2rem 0;
}

.level-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .9rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--brand-gold);
  color: var(--brand-gold);
  font-weight: 700; font-size: .9rem;
}

.lvl-track {
  height: 10px; border-radius: 6px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}
.lvl-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-gold), #f0d04a);
  border-radius: 6px;
  transition: width .4s ease;
}

.medal { font-size: 1.7rem; width: 36px; text-align: center; }

/* خيار وضع العرض في الإعدادات — الصف كله هدف لمس */
.mode-opt {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .7rem .2rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.mode-opt:last-of-type { border-bottom: 0; }
.mode-opt-main { flex: 1; min-width: 0; }

/* ───────────────────────────────────────────────────────────────────────────
   إشعار ثابت — ميتشالش غير بالضغط على X
   ─────────────────────────────────────────────────────────────────────────── */

.notice {
  position: relative;
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 2.4rem .85rem .9rem;
  margin-bottom: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
  border: 1px solid var(--brand-gold);
  color: #fff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  animation: notice-in .3s cubic-bezier(.34, 1.3, .64, 1);
}
.notice:active { transform: scale(.99); }

@keyframes notice-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notice-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(205, 170, 6, .18);
  color: var(--brand-gold);
  font-size: 1.3rem;
}
.notice-main { flex: 1; min-width: 0; }
.notice-title { font-weight: 700; font-size: .96rem; }
.notice-text { font-size: .8rem; color: rgba(255, 255, 255, .8); line-height: 1.5; }

/* هدف لمس 44px بس الأيقونة صغيرة — الحشو بيعمل الفرق */
.notice-x {
  position: absolute;
  inset-inline-end: 2px; top: 2px;
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  color: rgba(255, 255, 255, .75);
  border-radius: 10px;
  font-size: .95rem;
}
.notice-x:active { background: rgba(255, 255, 255, .14); color: #fff; }

/* ───────────────────────────────────────────────────────────────────────────
   خط السير والشارات
   ─────────────────────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
}
.stat-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .8rem .6rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-cell .bi { font-size: 1.25rem; color: var(--brand-navy); }
.stat-value {
  font-size: 1.35rem; font-weight: 700; line-height: 1.2;
  margin-top: .2rem;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: .76rem; color: var(--muted); }

/* ── الأوسمة ── */

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
}
.badge-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .9rem .7rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  /* المقفولة باهتة مش مخفية — الطفل لازم يشوف اللي جاي */
  opacity: .55;
}
.badge-cell.earned {
  opacity: 1;
  border-color: var(--brand-gold);
  background: linear-gradient(180deg, #fffdf5, var(--surface));
}
.badge-medal {
  width: 46px; height: 46px; margin: 0 auto .45rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #e2e8f0; color: #94a3b8;
  font-size: 1.2rem;
}
.badge-cell.earned .badge-medal {
  background: linear-gradient(135deg, var(--brand-gold), #f0d04a);
  color: var(--brand-navy-deep);
  box-shadow: 0 3px 10px rgba(205, 170, 6, .35);
}
.badge-title { font-weight: 700; font-size: .88rem; }
.badge-sub { font-size: .73rem; color: var(--muted); line-height: 1.5; margin-top: .15rem; }

/* ── الخط الزمني ── */

.timeline { position: relative; padding-inline-start: 6px; }
.tl-item {
  position: relative;
  display: flex; gap: .75rem;
  padding: 0 0 .9rem;
}
/* الخط الواصل بين النقط — بيتوقف عند آخر عنصر */
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  inset-inline-start: 5px;
  top: 16px; bottom: 0;
  width: 2px;
  background: var(--line);
}
.tl-dot {
  width: 12px; height: 12px; margin-top: 5px;
  flex-shrink: 0; z-index: 1;
  border-radius: 50%;
  background: var(--brand-royal);
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-dot.miss { background: #cbd5e1; }
.tl-body { flex: 1; min-width: 0; }
.tl-date { font-size: .74rem; color: var(--muted); }
.tl-main { font-weight: 600; font-size: .92rem; }
.tl-sub { font-size: .78rem; color: var(--muted); }

/* ── إشعار الحفظ التلقائي الخفيف ── */
.autosave-pill {
  position: fixed;
  top: calc(14px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  background: rgba(16, 185, 129, 0.96);
  color: #fff;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.autosave-pill.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── إدخال ترتيب الوصول يدوياً ── */
.rank-input {
  width: 58px;
  height: 38px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 .25rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-royal);
  -moz-appearance: textfield;
}
.rank-input::-webkit-outer-spin-button,
.rank-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rank-input:focus {
  border-color: var(--brand-royal);
  box-shadow: 0 0 0 3px rgba(17, 64, 255, 0.15);
  outline: none;
}

/* ── بطاقة المطلوب للمرة القادمة المحفوظ ── */
.next-assignment-badge {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 9px;
  padding: .4rem .75rem;
  font-size: .84rem;
  color: #854d0e;
  margin-top: .4rem;
}
.next-assignment-badge i {
  color: #ca8a04;
}

/* ── حاوية بحث منتقي السور لتتكيف مع الموبايل والكيبورد ── */
.picker-surah-wrap {
  display: flex;
  flex-direction: column;
  height: 52vh;
  height: 52dvh;
  min-height: 220px;
}
.picker-surah-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .35rem;
  background: #f8fafc;
}

/* ── مكوّن كشف الرقم السري ── */
.input-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-pass-wrap .form-control {
  padding-inline-end: 2.75rem !important;
}
.btn-toggle-pass {
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 2.75rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  transition: color 0.15s ease;
}
.btn-toggle-pass:hover, .btn-toggle-pass:focus {
  color: var(--brand-royal);
  outline: none;
}

/* ── شريط وضع عدم الاتصال والمزامنة ── */
.offline-status-bar {
  background: #fffbeb;
  color: #92400e;
  border-bottom: 1px solid #fef3c7;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
}
.offline-status-bar.has-pending {
  background: #eff6ff;
  color: #1e40af;
  border-bottom-color: #dbeafe;
}
.offline-status-bar.has-failed {
  background: #fef2f2;
  color: #991b1b;
  border-bottom-color: #fecaca;
}
.offline-status-bar .sync-btn {
  font-size: 0.78rem;
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  background: var(--brand-royal);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
.offline-status-bar .sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ───────────────────────────────────────────────────────────────────────────
   بطاقات التثبيت وإذن الإشعارات العائمة
   ─────────────────────────────────────────────────────────────────────────── */

.prompt-dock {
  position: fixed;
  inset-inline: 0.75rem;
  bottom: calc(var(--nav-h) + var(--safe-b) + 0.75rem);
  z-index: 45;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.prompt-card {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-lg);
  animation: prompt-card-in 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes prompt-card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .prompt-card {
    animation: none;
  }
}

@media (min-width: 768px) {
  .prompt-dock {
    inset-inline: auto 1.5rem;
    bottom: 1.5rem;
  }
}

.prompt-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.prompt-card-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-royal-soft);
  color: var(--brand-royal);
  font-size: 1.35rem;
}

.prompt-card-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.prompt-card-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0;
  color: var(--text);
}

.prompt-card-close {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  font-size: 1rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.prompt-card-close:active {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.prompt-card-body {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.prompt-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prompt-card-actions .btn {
  min-height: var(--tap);
}

.prompt-card-actions .btn:not(.btn-snooze) {
  flex: 1;
}

.prompt-card-actions .btn-snooze {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.prompt-card-actions .btn-snooze:active {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

/* ───────────────────────────────────────────────────────────────────────────
   لوحة المتابعة Power BI — تنسيقات متقدمة وطباعة
   ─────────────────────────────────────────────────────────────────────────── */
.dash-chips-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 1rem;
}
.dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: var(--brand-royal-soft);
  color: var(--brand-royal);
  border: 1px solid rgba(17, 64, 255, 0.2);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}
.dash-chip-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--brand-royal);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  min-width: 20px;
  min-height: 20px;
}
.dash-kpis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 576px) {
  .dash-kpis-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 992px) {
  .dash-kpis-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dash-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.dash-kpi-title {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.dash-kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.72rem;
}
.dash-kpi-delta {
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 4px;
}
.dash-kpi-delta.pos { color: var(--ok); background: var(--ok-bg); }
.dash-kpi-delta.neg { color: var(--danger); background: var(--danger-bg); }
.dash-kpi-delta.neu { color: var(--muted); background: var(--line); }

.dash-chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.dash-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.dash-chart-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dash-drill-btn {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--brand-royal);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dash-drill-btn:hover {
  background: var(--brand-royal-soft);
  border-color: var(--brand-royal);
}

.dash-unit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  transition: background-color 0.15s ease;
}
.dash-unit-card.is-selected {
  border-color: var(--brand-royal);
  background: var(--brand-royal-soft);
}

/* هيكل تحميل مؤقت (Skeleton Loader) */
.dash-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: dash-skeleton-pulse 1.5s infinite;
  border-radius: 8px;
}
@keyframes dash-skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* مظهر الطباعة */
@media print {
  body {
    padding-bottom: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .topbar, .bottom-nav, .global-progress, .global-loader-badge,
  .dash-actions-bar, .dash-filters-box, .dash-drill-btn, #btn-export,
  .btn, .pagination, .sheet, .sheet-backdrop {
    display: none !important;
  }
  .dash-chart-card, .dash-kpi-card, .card-soft {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .dash-kpis-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .table-responsive {
    overflow: visible !important;
  }
}




/* ── رسالة «الموقع اتنقل» (moved-notice.js) — على العنوان القديم بس ── */
.moved-notice {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(7, 48, 95, .72);
}
.moved-card {
  width: 100%; max-width: 420px; padding: 24px 20px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  text-align: center; color: var(--text);
}
.moved-card h2 { font-size: 1.25rem; font-weight: 800; margin: 8px 0 12px; }
.moved-card p { margin-bottom: 8px; }
.moved-icon { font-size: 2.5rem; color: var(--brand-royal); }
.moved-host {
  font-size: 1.15rem; font-weight: 700; color: var(--brand-navy);
  background: var(--brand-royal-soft); border-radius: 10px; padding: 8px;
}
.moved-hint { font-size: .9rem; color: var(--muted); }
.moved-go, .moved-stay { min-height: var(--tap); }
.moved-go { margin-top: 8px; font-weight: 700; }

/* ── لينك استمارة المتابعة أعلى شاشة الحصة (للمحفّظ) ── */
.form-link {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap); margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--brand-royal-soft); color: var(--brand-navy);
  font-size: .9rem; text-decoration: none;
}
.form-link span { flex: 1; }
.form-link > .bi:first-child { font-size: 1.2rem; color: var(--brand-royal); }
.form-link:hover, .form-link:focus-visible { color: var(--brand-navy-deep); border-color: var(--brand-royal); }
