/* إصلاحات مراجعة الجودة (3 ديسمبر 2026): تُحمّل بعد باقي ملفات التنسيق */

/* 1) كروت لوحة التحكم: خلفيات تتبع الثيم بدل التدرجات الفاتحة الثابتة (كانت تُخفي الأرقام في الثيمات الداكنة) */
body .kpi-card.cyan {
  background: linear-gradient(145deg, color-mix(in srgb, var(--neon-cyan) 14%, var(--surface-kpi)), var(--surface-kpi) 78%);
}
body .kpi-card.purple {
  background: linear-gradient(145deg, color-mix(in srgb, var(--neon-purple) 14%, var(--surface-kpi)), var(--surface-kpi) 78%);
}
body .kpi-card.rose {
  background: linear-gradient(145deg, color-mix(in srgb, var(--neon-rose) 14%, var(--surface-kpi)), var(--surface-kpi) 78%);
}
body .kpi-card .kpi-title { color: var(--text-muted); }
body .kpi-card .kpi-val { color: var(--text-main); }
body .kpi-card .kpi-sub { color: var(--text-muted); }

/* 2) ثيم «استوديو أخضر هادئ»: القائمة الجانبية كانت بخلفية فاتحة ونص فاتح (شبه مخفي). الآن لوح أخضر داكن بنص فاتح واضح. */
body[data-theme="sage-studio"] .sidebar {
  background: radial-gradient(ellipse at 100% 0, rgba(120, 190, 150, 0.18), transparent 40%), #1f3b2d !important;
  color: #f3f7fc;
  border-color: rgba(255, 255, 255, 0.08);
}
body[data-theme="sage-studio"] .sidebar .nav-btn { color: #d3e3d9; }
body[data-theme="sage-studio"] .sidebar .nav-btn:hover,
body[data-theme="sage-studio"] .sidebar .nav-btn.active { color: #ffffff; }
body[data-theme="sage-studio"] .sidebar .nav-label { color: #b4cbbd; }
body[data-theme="sage-studio"] .data-panel { color: var(--text-main); }

/* 3) زر المساعد العائم: كان يغطي كارت المستخدم أسفل القائمة الجانبية. ينتقل لأسفل يسار الشاشة. */
.ai-orb {
  right: auto;
  left: 24px;
  bottom: 24px;
}
@media (max-width: 1100px) {
  .ai-orb {
    left: 16px;
    right: auto;
  }
}

/* 4) الشريط العلوي: خلفية معتمة حتى لا يظهر المحتوى أسفله مشوشًا، ولا يثبت على الشاشات القصيرة */
.top-console {
  background: var(--surface-toolbar, var(--bg-panel));
  backdrop-filter: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
body .top-console {
  background: var(--bg-panel) !important;
}
@media (max-height: 760px), (max-width: 900px) {
  .top-console {
    position: static;
  }
}
.main-stage {
  scroll-padding-top: 96px;
}

/* 5) عنوان الصفحة في الشريط العلوي لا يُقطع بنقاط */
#pageBreadcrumb {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.5;
  min-width: 140px;
}

/* 6) الجداول داخل الحاوية: تمرير أفقي بدل الخروج منها، وعمود الإجراءات والملاحظات لا يُقص */
.table-container {
  max-width: 100%;
  overflow-x: auto;
}
.data-table {
  min-width: 100%;
  width: max-content;
  max-width: none;
}
.data-table th,
.data-table td {
  white-space: normal;
  overflow-wrap: break-word;
}
.data-table td:last-child {
  min-width: 110px;
}
.data-table .sku-tag {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* 7) كل الخطوط من نفس العائلة (بعض العناوين كانت تسقط إلى serif) */
.panel-title,
.report-section-title,
.modal-card h3,
.location-card h4,
.supplier-card h4,
.location-card strong,
.supplier-card strong,
.data-panel h3,
.data-panel h4,
.app-confirm-dialog h2 {
  font-family: var(--font-display, "Alfont Arabic"), "Alfont Arabic", Tahoma, Arial, sans-serif;
}
.loc-card *,
.sup-card *,
.card-grid *,
[class*="card"] h3,
[class*="card"] h4 {
  font-family: inherit;
}

/* 8) ترقيم الصفحات: يمنع تشوه الأرقام والاتجاه (BiDi) */
#productPageLabel,
#movementPageLabel,
#returnPageLabel,
#auditPageLabel,
#approvalPageLabel,
#activityPageLabel {
  direction: rtl;
  unicode-bidi: isolate;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}

/* 9) مظهر موحد لحقول التاريخ */
input[type="date"] {
  direction: ltr;
  text-align: center;
}

.badge { white-space: nowrap; overflow-wrap: normal; }
.badge.perm { white-space: normal; max-width: 280px; line-height: 1.6; display: inline-block; }
.data-table td.nowrap, .data-table td bdi { white-space: nowrap; }
