/* ============================================================
   بن عبدالعزيز لإدارة المخازن — Odoo UI/UX RTL Smart Theme
   ============================================================ */

:root {
  --primary: #714B67; /* ألوان هوية Odoo الأساسية الفاخرة */
  --primary-hover: #5d3d54;
  --primary-light: #f5eff4;
  --secondary: #008784; /* Odoo Teal */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  font-size: 14px;
}

/* تخطيط التطبيق (App Shell) - سايد بار ثابت وتمرير مستقل */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 270px;
  height: 100vh;
  height: 100dvh;
  background: #1e293b;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid #334155;
  transition: all 0.2s ease;
  z-index: 50;
  overflow: hidden;
}

.sidebar .nav-section {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 10px;
}

.sidebar .nav-section::-webkit-scrollbar {
  width: 5px;
}
.sidebar .nav-section::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.sidebar .nav-section::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.brand-logo {
  width: 52px;
  height: 38px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
}

.brand-info b {
  display: block;
  font-size: 15px;
  color: #ffffff;
}

.brand-info small {
  font-size: 11px;
  color: #94a3b8;
}

.workspace {
  padding: 12px 18px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace .avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.nav-section {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.nav-title {
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #38bdf8;
  padding: 12px 14px 6px;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.nav-section > .nav-title:first-child,
.nav-section > .nav-title:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  font-size: 13.5px;
  cursor: pointer;
}

.nav-item:hover {
  background: #334155;
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.nav-item .icon {
  margin-left: 10px;
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.nav-badge {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

/* المحتوى الرئيسي والـ Topbar */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background-color: var(--bg-main);
}

.topbar {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.global-search {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 14px;
  width: 380px;
  gap: 10px;
}

.global-search input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  font-size: 13px;
}

.kbd-shortcut {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 10px;
  padding: 2px 5px;
  color: #64748b;
}

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

/* مسار التنقل العلوي Odoo Breadcrumbs */
.breadcrumbs-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  position: sticky;
  top: 60px;
  z-index: 39;
  flex-shrink: 0;
}

.breadcrumbs-bar a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs-bar a:hover {
  color: var(--primary);
}

.breadcrumbs-bar .current {
  color: var(--text-main);
  font-weight: 600;
}

/* شريط المراحل والتدفق Odoo Pipeline Status Bar */
.pipeline-bar {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.pipeline-step {
  padding: 6px 18px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: #f8fafc;
  border-left: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pipeline-step.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: bold;
}

.pipeline-step.completed {
  background: #ecfdf5;
  color: var(--success);
}

/* أزرار Odoo Stat Buttons الذكية */
.stat-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.stat-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.stat-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.stat-btn .stat-icon {
  font-size: 20px;
  color: var(--primary);
}

.stat-btn .stat-data b {
  display: block;
  font-size: 15px;
  color: var(--text-main);
}

.stat-btn .stat-data small {
  font-size: 11px;
  color: var(--text-muted);
}

/* شاشة الرصيد الذكية Smart Quant View */
.quant-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.quant-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.quant-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.quant-pill {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 12px;
  display: inline-block;
}

.quant-pill.main { background: #e0e7ff; color: #3730a3; }
.quant-pill.sub1 { background: #fef3c7; color: #92400e; }
.quant-pill.sub2 { background: #dcfce7; color: #166534; }

/* بطاقات لوحة التحكم والشبكة */
.page-container {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* الأزرار والنماذج */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-teal { background: var(--secondary); color: #fff; }
.btn-teal:hover { opacity: 0.9; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
  background: #fff;
  transition: border 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* شبكة الصلاحيات النقطية (Granular Permission Checklist) */
.perms-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px 4px;
}

.perm-category-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px 14px;
}

.perm-category-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  cursor: pointer;
}

.perm-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* واجهة الكشك الميداني للعمال (Barcode Kiosk) */
.kiosk-screen {
  background: #0f172a;
  color: #ffffff;
  min-height: calc(100vh - 60px);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kiosk-box {
  width: 100%;
  max-width: 680px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.kiosk-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  background: #0f172a;
  border: 2px solid var(--secondary);
  color: #38bdf8;
  border-radius: 10px;
  outline: none;
  letter-spacing: 2px;
  box-shadow: 0 0 15px rgba(0, 135, 132, 0.3);
}

.kiosk-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  text-align: center;
}

.kiosk-stat-item b {
  display: block;
  font-size: 28px;
  color: #38bdf8;
}

.kiosk-stat-item span {
  font-size: 12px;
  color: #94a3b8;
}



/* النوافذ المنبثقة Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-box.large {
  max-width: 900px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* شارات الحالة Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #dcfce7; color: #15803d; }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-teal { background: #ccfbf1; color: #0f766e; }

/* بطاقات ومؤشرات شاشة الجرد الميدانية للعمال والمشرفين */
.inv-progress-bar {
  width: 100%;
  height: 9px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.inv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 6px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.inv-diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.inv-diff-pill.matched { background: #dcfce7; color: #15803d; }
.inv-diff-pill.shortage { background: #fee2e2; color: #b91c1c; }
.inv-diff-pill.surplus { background: #dbeafe; color: #1d4ed8; }
.inv-diff-pill.pending { background: #f1f5f9; color: #64748b; }
.inv-active-card {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}
.inv-row-matched { background-color: #f0fdf4 !important; }
.inv-row-shortage { background-color: #fff1f2 !important; }
.inv-row-surplus { background-color: #eff6ff !important; }
.inv-row-recount { background-color: #fefce8 !important; }

/* التنبيهات Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
}

.toast.success { border-right: 4px solid var(--success); }
.toast.error { border-right: 4px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* صندوق الجداول والبيانات ذو التمرير المستقل الأفقي والرأسي */
.card-table-scroll {
  padding: 0 !important;
  overflow: auto !important; /* تفعيل التمرير الأفقي والرأسي المستقل داخل المربع */
  max-height: calc(100vh - 240px);
  min-height: 420px;
  position: relative;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
  -webkit-overflow-scrolling: touch;
}

/* شريط تمرير شيك وأنيق جداً (Horizontal & Vertical Custom Scrollbar) */
.card-table-scroll::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.card-table-scroll::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 6px;
}

.card-table-scroll::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
  border: 2px solid #f8fafc;
}

.card-table-scroll::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.card-table-scroll::-webkit-scrollbar-corner {
  background: #f8fafc;
}

/* تثبيت رؤوس الجداول عند التمرير الرأسي داخل الصندوق (Sticky Table Headers) */
.card-table-scroll thead th,
.card-table-scroll .data-table thead th,
.card-table-scroll .quant-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8fafc !important;
  box-shadow: inset 0 -1px 0 var(--border), 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* توسيع المساحات ومنع انكسار النصوص والبيانات (Roomy & Crystal Clear) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th {
  background: #f8fafc;
  padding: 13px 18px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* تحسين مساحات كارت الصنف ومخزون المواد */
.quant-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.quant-table th {
  background: #f8fafc;
  padding: 13px 18px;
  font-size: 12.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.quant-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

.quant-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.quant-actions .btn-sm {
  padding: 5px 10px !important;
  font-size: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  height: 30px !important;
  line-height: 1 !important;
}

/* ============================================================
   النظام المتجاوب المتقدم للهواتف والأجهزة اللوحية (Mobile Responsive WMS)
   ============================================================ */

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  font-size: 20px;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* الأجهزة اللوحية والشاشات المتوسطة (Tablets & Medium Screens <= 1024px) */
@media (max-width: 1024px) {
  .global-search {
    width: 240px;
  }
}

/* شاشات الهواتف والأجهزة اللوحية الصغيرة (Phones & Small Tablets <= 768px) */
@media (max-width: 768px) {
  /* إظهار زر الهمبرجر */
  .mobile-menu-btn {
    display: inline-flex;
  }

  /* تحويل القائمة الجانبية إلى قائمة منزلقة من اليمين (Off-canvas Drawer) */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -6px 0 25px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* الشريط العلوي */
  .topbar {
    height: 56px;
    padding: 0 12px;
  }

  .global-search {
    width: auto;
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
  }

  .global-search input {
    font-size: 13px;
  }

  .kbd-shortcut {
    display: none !important;
  }

  .top-actions {
    gap: 6px;
  }

  /* شريط مسار التنقل */
  .breadcrumbs-bar {
    padding: 8px 14px;
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* مساحة الصفحة */
  .page-container {
    padding: 12px 14px 24px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-title h1 {
    font-size: 19px;
  }

  .page-title p {
    font-size: 12px;
  }

  .page-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-header .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* النوافذ المنبثقة للموبايل */
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 8px 8px !important;
    margin: 0 !important;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
    padding: 10px 12px;
  }

  /* استجابة شبكات الفورم داخل النوافذ المنبثقة */
  form div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* استجابة شبكات كروت المخازن والمؤشرات */
  div[style*="grid-template-columns:repeat(auto-fill, minmax(340px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(200px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(140px, 1fr))"],
  div[style*="grid-template-columns:repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* الجداول والتمرير الأفقي اللمسي المريح */
  .card {
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 10px;
  }

  .card-table-scroll,
  .card[style*="overflow:hidden"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .data-table {
    min-width: 580px;
  }

  .data-table th, .data-table td {
    padding: 10px 10px;
    font-size: 12.5px;
  }

  /* شريط Odoo Pipeline والمراحل */
  .pipeline-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .pipeline-bar::-webkit-scrollbar {
    display: none;
  }

  .pipeline-step {
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* التنبيهات المنبثقة (Toast) أسفل الشاشة للموبايل */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: 12.5px;
  }

  /* شاشة السكانر والكاميرا للموبايل */
  #kiosk-camera-reader, #qs-camera-reader {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 10px !important;
  }

  #kiosk-camera-reader video, #qs-camera-reader video {
    width: 100% !important;
    border-radius: 10px !important;
  }

  /* كروت وإحصائيات الكشك في الموبايل */
  div[style*="grid-template-columns: 1.2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* سهولة اللمس للأزرار والحقول */
  .btn, .form-control, select.form-control {
    min-height: 40px;
    font-size: 13.5px;
  }
}

/* شاشات الهواتف الصغيرة جداً (Very Small Phones <= 480px) */
@media (max-width: 480px) {
  .topbar-btn-text {
    display: none;
  }

  .topbar-btn-icon {
    font-size: 16px;
    margin: 0 !important;
  }

  #topbar-kiosk-btn, #topbar-excel-btn {
    padding: 6px 10px !important;
  }

  .page-container {
    padding: 10px 10px 20px;
  }

  .page-title h1 {
    font-size: 17px;
  }

  .modal-box {
    border-radius: 12px 12px 0 0 !important;
  }

  .modal-footer .btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .data-table {
    min-width: 520px;
  }
}

/* -------------------------------------------------------------
   Searchable Product Combobox Component
   ------------------------------------------------------------- */
.searchable-prod-combobox {
  position: relative;
  width: 100%;
}

.searchable-prod-combobox input.form-control {
  cursor: text;
  background-color: #fff;
  transition: all 0.2s ease;
}

.searchable-prod-combobox input.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.prod-dropdown-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s ease;
  user-select: none;
}

.prod-dropdown-item:last-child {
  border-bottom: none;
}

.prod-dropdown-item:hover,
.prod-dropdown-item.active {
  background: #f0fdf4 !important;
  border-right: 3px solid var(--primary);
}

.prod-dropdown-item mark {
  background: #fef08a;
  color: #0f172a;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 800;
}

#line-prod-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
#line-prod-dropdown-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
#line-prod-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   مركز التقارير وكشوف الحسابات المتقدمة (Reports Hub & Statements Styling)
   ========================================================================== */
.reports-tabs-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px 0;
  margin-bottom: 14px;
  border-bottom: 2px solid #e2e8f0;
  scrollbar-width: thin;
}

.report-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.report-tab-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.report-tab-btn.active {
  background: #1e3a8a !important;
  color: #ffffff !important;
  border-color: #1e3a8a !important;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

.date-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.date-preset-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.date-preset-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.date-preset-pill.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

.reports-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-kpi-card {
  padding: 13px 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.report-partner-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-right: 4px solid #1e3a8a;
  border-radius: 8px;
  margin-bottom: 16px;
}

