/* ==========================================================================
   app.css — إضافات نظام إيجارات أبو فارس فوق manhl-ui.css
   القاعدة: لا لون مباشر — كل الألوان من متغيرات manhl-ui.css.
   ========================================================================== */

/* ---- صفحة الدخول ---- */
.login-page{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  padding:var(--sp-4);
  background:linear-gradient(160deg,var(--purple-darker),var(--purple-dark));
}
.login-card{
  width:100%; max-width:380px;
  background:var(--white);
  border:var(--frame);
  border-radius:var(--frame-radius-lg);
  box-shadow:var(--shadow-lg);
  overflow:hidden;
}
.login-card .frame-head{ justify-content:center; padding:var(--sp-5) var(--sp-4); border-radius:0; }
.login-card .frame-title{ flex-direction:column; font-size:var(--fs-lg); text-align:center; }
.login-card .frame-title i{ font-size:2.2rem; }
.login-card .frame-body{ display:flex; flex-direction:column; gap:var(--sp-4); padding:var(--sp-6) var(--sp-5); }

/* ---- خانة الحالة في الجداول ---- */
.cell-state{ width:1%; white-space:nowrap; }

/* ---- قائمة التصفية بجوار البحث (المرحلة 2) ---- */
.search-bar .filter-select{ flex:0 0 160px; width:160px; }
@media (max-width:767.98px){
  .search-bar .filter-select{ flex:1 1 auto; width:100%; }
}

/* ---- المرحلة 3: العقود ---- */
.pre-line{ white-space:pre-line; }

/* إطار قابل للطي (إنهاء العقد) — الرأس هو زر الفتح */
details.frame > summary{ list-style:none; cursor:pointer; border-radius:6px; }
details.frame > summary::-webkit-details-marker{ display:none; }
details.frame:not([open]) > summary{ border-bottom:none; }
details.frame > summary::after{ content:'\25BE'; color:var(--ink-muted); margin-inline-start:auto; }
details.frame[open] > summary::after{ content:'\25B4'; }

/* ---- المرحلة 4: سندات القبض ---- */
/* مفتاحا «تلقائي/يدوي» داخل الرأس الملوّن */
.frame-head .switch .label{ color:var(--white); }

/* خانة التوزيع في جدول الأقساط */
.alloc-cell{ width:150px; }
.alloc-cell .form-control{ min-width:110px; }
.alloc-cell .form-control[readonly]{ background:var(--teal-bg); color:var(--teal-dark); font-weight:800; }

/* ---- المرحلة 6: جرس التنبيهات في الشريط العلوي ---- */
.alert-bell{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:38px; height:38px; margin-inline-start:auto;
  border:1.5px solid var(--frame-color); border-radius:10px;
  color:var(--ink-muted); font-size:1.1rem; background:var(--white);
}
.alert-bell:hover{ border-color:var(--purple); color:var(--purple); }
.alert-bell.has{ border-color:var(--danger-line); color:var(--danger); background:var(--danger-bg); }
.alert-bell span{
  position:absolute; top:-7px; left:-7px; min-width:20px; height:20px; padding:0 5px;
  border-radius:10px; background:var(--danger); color:var(--white);
  font-size:var(--fs-xs); font-weight:900; line-height:20px; text-align:center;
}
/* الجرس يأخذ الهامش التلقائي فتلتصق بطاقة المستخدم به */
.alert-bell + .user-chip{ margin-inline-start:var(--sp-3); }

/* بطاقة الأرقام رابطًا: النص لا يأخذ لون الروابط */
a.stat{ color:inherit; }

/* ---- المرحلة 7: التقارير ---- */
/* زر «عرض» يحاذي أسفل الحقول بجواره */
.report-go{ display:flex; align-items:flex-end; }

/* ==========================================================================
   التجاوب — إضافات فوق أقسام 17 و19 في manhl-ui.css
   القاعدة: لا تمرير أفقي للصفحة؛ الجداول وحدها تمرَّر داخل إطارها.
   ========================================================================== */

/* لوحي فأصغر: العمود الجانبي (بيانات العقد، ملخص البنود) يصعد فوق الجدول
   لأنه يحمل الأرقام المهمة ونموذج الإدخال */
/* (.narrow فقط — في نموذج العقد ونموذج السند يبقى الجانب تحت المحتوى) */
@media (max-width:991.98px){
  .layout-side.narrow > .side-panel{ order:-1; }
}

@media (max-width:767.98px){
  /* جداول التقارير تمرَّر أفقيًا بدل أن تنضغط أعمدتها */
  .report-doc .table-scroll .report-table{ min-width:640px; }
  .report-doc{ padding:.75rem; }
  .report-bar{ flex-direction:column; align-items:flex-start; gap:2px; }

  /* أزرار التصفية في رأس إطار التنبيهات تأخذ سطرًا كاملًا */
  .frame-head > .d-flex{ width:100%; }
  .frame-head > .d-flex .btn{ flex:1 1 0; }

  /* خانة التوزيع في نموذج السند */
  .alloc-cell{ width:110px; }
  .alloc-cell .form-control{ min-width:90px; }

  /* زر «عرض» في التقارير بعرض كامل */
  .report-go{ display:block; }

  /* الجرس أصغر قليلًا */
  .alert-bell{ width:34px; height:34px; font-size:1rem; }
}

@media (max-width:479.98px){
  /* بطاقات أرقام اللوحة: الرقم الكبير لا يكسر البطاقة */
  .stat-num{ font-size:var(--fs-md); word-break:break-word; }
  .stat-lbl{ font-size:var(--fs-xs); }
  .chip .l{ font-size:9.5px; }
}
