/* =========================================================
   نظام المبيعات وإصدار الفواتير - Stylesheet
   Modern, Sleek, Arabic RTL Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-dark: #1e40af;
  
  --secondary: #475569;
  --success: #059669;
  --success-light: #ecfdf5;
  --success-dark: #047857;
  
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-dark: #92400e;

  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-dark: #991b1b;

  --telegram: #0284c7;
  --telegram-dark: #0369a1;
  --telegram-light: #e0f2fe;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 30px -6px rgba(0, 0, 0, 0.12);

  --font-family: 'IBM Plex Sans Arabic', 'Cairo', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "lnum" 1, "tnum" 1;
  font-feature-settings: "lnum" 1, "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Base Container */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem 1.5rem;
}

/* Header: Modern Executive Topbar */
.app-header {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.85rem 1.5rem 0.4rem 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #1e293b;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.15);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.75rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 0.15rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.header-info-badge {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Navigation Tabs: Sleek Modern Segmented Nav */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.nav-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-tab-btn span:first-child {
  font-size: 1rem;
}

.nav-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-telegram { background: var(--telegram-light); color: var(--telegram-dark); }

/* Quick Status Banner */
.telegram-status-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow-xs);
}

.telegram-status-banner.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Sections */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: tabTransitionEffect 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes tabTransitionEffect {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.995);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Cards: Flat, Clean, Modern Single Elevation */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #f1f5f9;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  outline: none;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: var(--success-dark);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
  transform: translateY(-1px);
}

.btn-telegram {
  background: var(--telegram);
  color: white;
}
.btn-telegram:hover {
  background: var(--telegram-dark);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-outline-success {
  background: #ffffff;
  color: var(--success-dark);
  border: 1px solid #a7f3d0;
}
.btn-outline-success:hover {
  background: #ecfdf5;
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Form Inputs */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-label .req {
  color: var(--danger);
  margin-right: 2px;
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.6rem 0.85rem;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: all 0.15s ease;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Products Catalog Layout */
.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.75rem;
  flex: 1;
  max-width: 450px;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-box input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.45rem 0.5rem;
  width: 100%;
  color: var(--text-main);
  background: transparent;
}

.category-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.chip {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.chip:hover {
  background: var(--bg-alt);
  border-color: #cbd5e1;
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* نظام التصنيفات الهرمي المتطور (5 تصنيفات كبرى + تصنيفات فرعية) */
.categories-hub {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.categories-hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.categories-hub-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.main-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
}

.main-cat-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-align: right;
  position: relative;
  overflow: hidden;
}

.main-cat-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.main-cat-card.active {
  background: #eff6ff;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.15);
}

.main-cat-card.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--primary);
}

.main-cat-icon {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
}

.main-cat-info {
  flex: 1;
  min-width: 0;
}

.main-cat-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-cat-card.active .main-cat-title {
  color: var(--primary-dark);
}

.main-cat-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  display: inline-block;
}

.main-cat-card.active .main-cat-count {
  background: var(--primary);
  color: white;
}

/* شريط الأقسام الفرعية */
.sub-categories-wrapper {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sub-cat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
}

.sub-chips-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.sub-chip {
  padding: 0.28rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}

.sub-chip:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.sub-chip.active {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.sub-chip-count {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* Product Cards — شبكة متجاوبة مع تكبير الصفحة:
   عند zoom 100% على شاشة عادية (≥600px) → عمودان
   عند التكبير يضيق الـ viewport → ينهار لعمود واحد */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
}

.product-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.product-img-wrapper {
  height: 180px;
  background-color: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.product-card:hover .product-img-wrapper img {
  transform: scale(1.03);
}

.product-category-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  color: white;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
}

.product-stock-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.product-content {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-code {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.product-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.75rem;
  height: 2.8rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Pricing Matrix for Employees */
.employee-pricing-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}

.price-row:last-child {
  margin-bottom: 0;
  padding-top: 0.35rem;
  border-top: 1px dashed #cbd5e1;
}

.price-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.price-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cost-val {
  color: #475569;
}

.sell-val {
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.profit-val {
  color: var(--success-dark);
  font-weight: 800;
}

.product-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: auto;
}

/* Invoice Creation Layout (Two Columns) */
.invoice-create-container {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 1.25rem;
  align-items: start;
}

/* Selected Items Table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.items-table th {
  background: #f8fafc;
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1.5px solid var(--border-color);
  letter-spacing: 0.2px;
}

.items-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
  vertical-align: middle;
}

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

.item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: white;
}

.quantity-btn {
  background: #f8fafc;
  border: none;
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease;
  color: #334155;
}

.quantity-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.quantity-input {
  width: 42px;
  border: none;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
  background: transparent;
}

/* Payment Method Tabs / Radio */
.payment-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.15rem;
}

.payment-option {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  user-select: none;
}

.payment-option:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.payment-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}

.payment-option .icon {
  font-size: 1.25rem;
  line-height: 1;
}

.payment-option .title {
  font-weight: 600;
  font-size: 0.82rem;
}

/* Installments Box */
.installments-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-bottom: 1.15rem;
  animation: fadeIn 0.2s ease;
}

/* Summary Box in Invoice Sidebar */
.invoice-summary-card {
  position: sticky;
  top: 1.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.summary-row .val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.summary-row.highlight {
  background: #f0fdf4;
  margin: 0.5rem -0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
  font-size: 1rem;
  font-weight: 800;
  color: #166534;
}

.summary-row.total-final {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary-dark);
  padding-top: 0.75rem;
  border-bottom: none;
}

/* Dashboard KPI Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.15s ease;
}

.stat-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.stat-icon.blue { background: #dbeafe; color: #1e40af; }
.stat-icon.green { background: #d1fae5; color: #065f46; }
.stat-icon.amber { background: #fef3c7; color: #92400e; }
.stat-icon.purple { background: #ede9fe; color: #5b21b6; }

.stat-info .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-info .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}
.close-btn:hover {
  color: var(--danger);
}

/* Printable Invoice Styling */
.printable-invoice {
  background: white;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  color: #1e293b;
  font-family: 'Cairo', sans-serif;
  line-height: 1.5;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #0f172a;
  margin-bottom: 1.5rem;
}

.inv-company-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.inv-company-sub {
  font-size: 0.88rem;
  color: #64748b;
}

.inv-number-badge {
  text-align: left;
}

.inv-number-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.inv-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  background: #f8fafc;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.inv-table th {
  background: #0f172a;
  color: white;
  padding: 0.75rem 0.9rem;
  text-align: right;
  font-size: 0.85rem;
}

.inv-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

.inv-totals-box {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.inv-totals-table {
  width: 320px;
}

.inv-totals-table tr td {
  padding: 0.4rem 0.6rem;
  font-size: 0.92rem;
}

.inv-totals-table tr.total-row td {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  border-top: 2px solid #0f172a;
}

.inv-installment-schedule {
  background: #fefce8;
  border: 1px solid #fef08a;
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.inv-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px dashed #cbd5e1;
  font-size: 0.85rem;
  color: #64748b;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideUp 0.25s ease;
  min-width: 300px;
}

.toast.success { background: #065f46; border-right: 4px solid #10b981; }
.toast.error { background: #991b1b; border-right: 4px solid #ef4444; }
.toast.info { background: #1e3a8a; border-right: 4px solid #3b82f6; }

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

/* =========================================================
   Categories Hub - Hierarchical Navigation
   ========================================================= */
.categories-hub {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.categories-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.categories-hub-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ---- Main Category Cards Grid ---- */
.main-categories-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 0;
}

.main-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 0.5rem;
  background: var(--bg-alt);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.main-cat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.25s ease;
}

.main-cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.main-cat-card.active {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.main-cat-icon {
  font-size: 1.75rem;
  line-height: 1;
  display: block;
}

.main-cat-info {
  width: 100%;
}

.main-cat-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.main-cat-count {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  transition: all 0.25s ease;
}

/* ---- Sub-categories Row ---- */
.sub-categories-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.sub-cat-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sub-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.875rem;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.sub-chip:hover {
  background: var(--bg-alt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sub-chip.active {
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.sub-chip-count {
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 500;
}

/* Responsive: collapse to 3 columns then 2 columns */
@media (max-width: 992px) {
  .main-categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .main-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .main-cat-icon {
    font-size: 1.4rem;
  }
}

/* Responsive Media Queries */

@media (max-width: 992px) {
  .invoice-create-container {
    grid-template-columns: 1fr;
  }
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .app-header {
    padding: 1rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .printable-invoice {
    padding: 1rem;
  }
}

/* =========================================================
   Receipts & Inventory Styling
   ========================================================= */

/* Receipts Layout */
.receipts-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .receipts-layout {
    grid-template-columns: 1fr;
  }
}

.tafqeet-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.receipts-kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.receipt-kpi-item {
  background: var(--bg-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  text-align: center;
}

.receipt-kpi-item .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.receipt-kpi-item .val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Printable Receipt Card */
.printable-receipt {
  background: white;
  padding: 2.25rem;
  color: #1e293b;
  font-family: var(--font-family);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  position: relative;
}

.receipt-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.receipt-badge-title {
  text-align: center;
  border: 2px solid #2563eb;
  color: #2563eb;
  padding: 0.4rem 1.25rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 1.1rem;
  display: inline-block;
  background: #eff6ff;
}

.receipt-details-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  line-height: 2.2;
  font-size: 1.05rem;
}

.receipt-details-box .receipt-line {
  display: flex;
  align-items: baseline;
  border-bottom: 1px dotted #cbd5e1;
  padding: 0.4rem 0;
}

.receipt-details-box .receipt-line:last-child {
  border-bottom: none;
}

.receipt-details-box .line-title {
  font-weight: 700;
  color: #475569;
  min-width: 150px;
}

.receipt-details-box .line-content {
  font-weight: 800;
  color: #0f172a;
  flex: 1;
}

.receipt-amount-display {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  border: 2px solid #059669;
  padding: 0.25rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1.35rem;
  font-weight: 900;
}

.receipt-signatures-row {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.receipt-sig-box {
  text-align: center;
  width: 180px;
}

.receipt-sig-line {
  margin-top: 2.5rem;
  border-top: 1px solid #475569;
  padding-top: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
}

/* =========================================================
   Inventory Audit System
   ========================================================= */
.inventory-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 6rem; /* Extra space for floating save bar */
}

.inventory-toolbar {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.inventory-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.inventory-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-alt);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.inventory-stat-pill.warning {
  background: #fffbeb;
  color: #b45309;
}

.inventory-stat-pill.danger {
  background: #fef2f2;
  color: #b91c1c;
}

.inventory-stat-pill.success {
  background: #ecfdf5;
  color: #047857;
}

/* Vertical Inventory Items List */
.inventory-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inventory-item-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto minmax(260px, 340px);
  gap: 1.25rem;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.inventory-item-card:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-md);
}

.inventory-item-card.is-modified {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.inv-prod-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.inv-prod-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inv-prod-code {
  font-size: 0.75rem;
  font-family: monospace;
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.inv-prod-category {
  font-size: 0.75rem;
  background: #e2e8f0;
  color: #334155;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.inv-prod-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.inv-prod-prices {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Stepper Quantity Controls */
.inv-stepper-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
}

.inv-step-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.inv-step-btn.minus {
  background: #fee2e2;
  color: #dc2626;
}

.inv-step-btn.minus:hover {
  background: #fca5a5;
  color: #b91c1c;
}

.inv-step-btn.plus {
  background: #dcfce7;
  color: #16a34a;
}

.inv-step-btn.plus:hover {
  background: #86efac;
  color: #15803d;
}

.inv-qty-input {
  width: 75px;
  height: 42px;
  border: 1px solid transparent;
  background: white;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.inv-qty-input:focus {
  border-color: var(--primary);
  background: #fff;
}

/* Metadata Col */
.inv-meta-col {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.inv-meta-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.inv-meta-editor-row {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.inv-meta-editor-row strong {
  color: var(--text-main);
}

.inv-delta-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.inv-delta-badge.pos {
  background: #dcfce7;
  color: #15803d;
}

.inv-delta-badge.neg {
  background: #fee2e2;
  color: #b91c1c;
}

/* =========================================================
   Fixed / Floating Save Action Bar
   ========================================================= */
.inventory-floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 0.65rem 1.25rem 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: floatBarIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 95vw;
}

@keyframes floatBarIn {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.inventory-floating-bar.has-changes {
  border-color: #10b981;
  box-shadow: 0 16px 36px -4px rgba(16, 185, 129, 0.35), 0 0 25px rgba(16, 185, 129, 0.25);
}

.audit-info-col {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audit-icon-pulse {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.inventory-floating-bar.has-changes .audit-icon-pulse {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.audit-title {
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.audit-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
}

.audit-emp-col {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0 1rem;
}

.audit-emp-col label {
  font-size: 0.82rem;
  color: #cbd5e1;
  white-space: nowrap;
}

.audit-input {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-family);
  width: 150px;
  outline: none;
  transition: all 0.2s;
}

.audit-input:focus {
  background: rgba(255, 255, 255, 0.22);
  border-color: #3b82f6;
}

.audit-input::placeholder {
  color: #94a3b8;
}

.audit-actions-col {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-floating-save {
  padding: 0.55rem 1.35rem !important;
  font-size: 0.95rem !important;
  border-radius: 9999px !important;
  font-weight: 800 !important;
  white-space: nowrap;
}

.btn-secondary-dark {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border: none;
  border-radius: 9999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-family: var(--font-family);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary-dark:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
}

/* زر الخطر - منطقة الحذف */
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border: none;
  font-weight: 700;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.45);
  transform: translateY(-1px);
}
.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* بطاقة منطقة الخطر */
.danger-zone-card {
  border: 2px solid #fca5a5 !important;
  border-top: 4px solid #dc2626 !important;
}

@media (max-width: 900px) {
  .inventory-item-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .inventory-floating-bar {
    border-radius: var(--radius-lg);
    bottom: 12px;
    padding: 0.75rem;
    flex-direction: column;
    width: 94%;
    gap: 0.75rem;
  }
  .audit-emp-col {
    border: none;
    padding: 0;
    width: 100%;
    justify-content: space-between;
  }
  .audit-input {
    flex: 1;
    width: auto;
  }
  .audit-actions-col {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Print Rules */
@media print {
  /* ======================================================
     قاعدة الصفحة: ورقة A4 بهوامش ضيقة لأقصى استخدام للمساحة
     ====================================================== */
  @page {
    size: A4 portrait;
    margin: 8mm 10mm;
  }

  /* إخفاء كل شيء بحيث تظهر فقط منطقة الطباعة */
  body:not(.printing-stocktake-active) * {
    visibility: hidden;
  }

  /* منطقة الطباعة الرئيسية (الفاتورة، سند القبض، الجرد، الكفالة) */
  #printableArea,                 #printableArea *,
  #printableReceiptArea,          #printableReceiptArea *,
  #printableInventoryReportArea,  #printableInventoryReportArea * {
    visibility: visible;
  }

  /* تموضع منطقة الطباعة لتملأ الصفحة من الأعلى */
  #printableArea,
  #printableReceiptArea,
  #printableInventoryReportArea {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
  }

  /* طباعة كشف الجرد الفعلي للموظفين (متعدد الصفحات - خالي تماماً من أي أسعار) */
  body.printing-stocktake-active {
    visibility: visible !important;
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    position: static !important;
  }
  body.printing-stocktake-active > *:not(#modalStocktakeSheet) {
    display: none !important;
    visibility: hidden !important;
  }
  body.printing-stocktake-active #modalStocktakeSheet,
  body.printing-stocktake-active #modalStocktakeSheet.modal-backdrop {
    display: block !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    z-index: auto !important;
  }
  body.printing-stocktake-active #modalStocktakeSheet .modal-card,
  body.printing-stocktake-active #modalStocktakeSheet .modal-body {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    animation: none !important;
  }
  body.printing-stocktake-active #modalStocktakeSheet .no-print,
  body.printing-stocktake-active #modalStocktakeSheet .modal-header,
  body.printing-stocktake-active #modalStocktakeSheet .modal-footer {
    display: none !important;
    visibility: hidden !important;
  }
  body.printing-stocktake-active #printableStocktakeSheetArea {
    display: block !important;
    position: static !important;
    visibility: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 2mm !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  body.printing-stocktake-active #printableStocktakeSheetArea * {
    visibility: visible !important;
  }
  body.printing-stocktake-active .stocktake-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 6px !important;
    page-break-inside: auto !important;
  }
  body.printing-stocktake-active .stocktake-table thead {
    display: table-header-group !important;
  }
  body.printing-stocktake-active .stocktake-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  body.printing-stocktake-active .stocktake-table th {
    background: #0f172a !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 5px 6px !important;
    font-size: 0.8rem !important;
    border: 1px solid #334155 !important;
  }
  body.printing-stocktake-active .stocktake-table td {
    border: 1px solid #94a3b8 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 4px 6px !important;
  }
  body.printing-stocktake-active .stocktake-write-box {
    border: 1.5px dashed #000000 !important;
    background-color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    height: 22px !important;
    min-height: 22px !important;
  }
  body.printing-stocktake-active .stocktake-table td,
  body.printing-stocktake-active .stocktake-table tr,
  body.printing-stocktake-active .stocktake-cat-badge,
  body.printing-stocktake-active .stocktake-legend-pill,
  body.printing-stocktake-active .stocktake-legend-bar {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  body.printing-stocktake-active .stocktake-doc-header {
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin-bottom: 8px !important;
  }
  body.printing-stocktake-active .stocktake-signatures {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 15px !important;
  }

  /* ======================================================
     إخفاء جميع عناصر التنقل والأزرار والقوائم
     ====================================================== */
  .no-print,
  .app-header,
  .nav-tabs,
  .tab-nav,
  .floating-cart,
  .modal-footer,
  .modal-header button,
  button,
  .btn,
  input[type="button"],
  input[type="submit"],
  .invoice-action-bar,
  #printModeSelector,
  .quick-add-section,
  .card-header .btn,
  .inv-actions,
  #invPrintControls,
  .action-buttons,
  .printable-invoice > .no-print {
    display: none !important;
    visibility: hidden !important;
  }

  /* ======================================================
     تصغير الخط بنسبة ذكية لضمان الاحتواء في صفحة واحدة
     يستخدم vw لضمان التناسب مع عرض ورقة A4
     ====================================================== */
  #printableArea .inv-header,
  #printableArea .inv-details-grid,
  #printableArea .inv-table,
  #printableArea .inv-totals-box,
  #printableArea .inv-footer,
  #printableArea .inv-installment-schedule,
  #printableArea div,
  #printableArea p,
  #printableArea span,
  #printableArea td,
  #printableArea th {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  /* حفاظ على الأحجام الكبيرة للعناوين الرئيسية لكن بتقليص مناسب */
  #printableArea .inv-company-title { font-size: 16px !important; }
  #printableArea .inv-number-title  { font-size: 14px !important; }
  #printableArea .total-row td      { font-size: 13px !important; font-weight: 900 !important; }

  /* ======================================================
     ضغط الـ padding والـ margin لتوفير المساحة
     ====================================================== */
  #printableArea .inv-header        { padding: 6px 0 8px !important; margin-bottom: 8px !important; }
  #printableArea .inv-details-grid  { gap: 8px !important; margin-bottom: 8px !important; padding: 6px 8px !important; }
  #printableArea .inv-table         { margin-bottom: 8px !important; font-size: 10.5px !important; }
  #printableArea .inv-table td,
  #printableArea .inv-table th      { padding: 4px 6px !important; }
  #printableArea .inv-totals-box    { margin-bottom: 6px !important; padding: 6px 8px !important; }
  #printableArea .inv-footer        { margin-top: 10px !important; padding-top: 6px !important; font-size: 10px !important; }
  #printableArea .inv-installment-schedule { padding: 6px 8px !important; margin-bottom: 6px !important; }

  /* سند القبض */
  #printableReceiptArea div,
  #printableReceiptArea p,
  #printableReceiptArea span,
  #printableReceiptArea td,
  #printableReceiptArea th {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }
  #printableReceiptArea { padding: 12px !important; }

  /* تقرير الجرد */
  #printableInventoryReportArea div,
  #printableInventoryReportArea p,
  #printableInventoryReportArea span,
  #printableInventoryReportArea td,
  #printableInventoryReportArea th {
    font-size: 10px !important;
    line-height: 1.3 !important;
  }
  #printableInventoryReportArea td,
  #printableInventoryReportArea th { padding: 3px 5px !important; }

  /* ======================================================
     منع فصل الصفوف والجداول بين الصفحات
     ====================================================== */
  table    { page-break-inside: auto !important; }
  tr       { page-break-inside: avoid !important; page-break-after: auto !important; }
  thead    { display: table-header-group !important; }
  tfoot    { display: table-footer-group !important; }

  /* إجبار كل المحتوى على صفحة واحدة عبر تقليص التحويل */
  #printableArea,
  #printableReceiptArea {
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    transform-origin: top center;
  }

  /* تحريم الانتقال لصفحة ثانية */
  html, body {
    height: auto !important;
    overflow: visible !important;
  }
}


/* =========================================================
   1. Visual Live Search (البحث المرئي الذكي عن المنتجات)
   ========================================================= */
.quick-add-section {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
  position: relative;
}

.visual-search-wrapper {
  position: relative;
  flex: 2;
  min-width: 280px;
}

.visual-search-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.visual-search-input-box .search-lens-icon {
  position: absolute;
  right: 14px;
  font-size: 1.15rem;
  color: var(--text-light);
  pointer-events: none;
}

.visual-search-input {
  width: 100%;
  padding: 0.75rem 2.75rem 0.75rem 5.5rem !important;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: white;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.visual-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn-clear-search {
  position: absolute;
  left: 95px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: bold;
}
.btn-clear-search:hover {
  background: #e2e8f0;
  color: var(--danger);
}

.search-keyboard-hint {
  position: absolute;
  left: 10px;
  font-size: 0.72rem;
  background: #f1f5f9;
  color: #64748b;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  pointer-events: none;
}

/* Floating Dropdown Results */
.live-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.2), 0 5px 15px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  max-height: 440px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.live-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #334155;
  font-weight: 700;
}

.live-search-results-list {
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.live-search-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: #64748b;
}

.live-search-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  background: #ffffff;
}

.live-search-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateX(-3px);
}

.live-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}

.live-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-item-info {
  flex: 1;
  min-width: 0;
}

.live-item-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.live-item-code {
  font-size: 0.75rem;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.live-item-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-item-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.live-item-cat {
  color: #64748b;
}

.live-item-stock {
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.72rem;
}

.stock-ok {
  background: #ecfdf5;
  color: #047857;
}

.stock-low {
  background: #fffbeb;
  color: #b45309;
}

.stock-out {
  background: #fef2f2;
  color: #b91c1c;
}

.live-item-pricing {
  text-align: left;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.live-item-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.live-item-profit {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 700;
}

.btn-live-add {
  padding: 0.4rem 0.8rem !important;
  font-size: 0.82rem !important;
  border-radius: var(--radius-sm) !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-select-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1.2;
  min-width: 260px;
}

/* =========================================================
   2. Floating Cart Bar (زر وشريط الذهاب المباشر للفاتورة)
   ========================================================= */
.floating-cart-bar {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translateX(50%);
  width: calc(100% - 3rem);
  max-width: 680px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-radius: var(--radius-xl);
  padding: 0.85rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
  z-index: 995;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: slideUpFloating 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFloating {
  from { opacity: 0; transform: translate(50%, 40px); }
  to { opacity: 1; transform: translate(50%, 0); }
}

.floating-cart-bar:hover {
  transform: translate(50%, -4px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.5), 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.floating-cart-bar.pulse-highlight {
  animation: pulseCartBorder 0.8s ease;
}

@keyframes pulseCartBorder {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.floating-cart-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.floating-cart-icon-pulse {
  position: relative;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.6);
  flex-shrink: 0;
}

.floating-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  border: 2px solid #0f172a;
}

.floating-cart-details {
  display: flex;
  flex-direction: column;
}

.floating-cart-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
}

.floating-cart-total {
  font-size: 1.05rem;
  font-weight: 800;
  color: #38bdf8;
}

.btn-floating-jump {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 9999px;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-floating-jump:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

.toast-action-btn {
  background: white;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.toast-action-btn:hover {
  background: #f1f5f9;
  transform: scale(1.05);
}

/* =========================================================
   3. Settings Security Password Modal & Security Bar
   ========================================================= */
.settings-pin-modal {
  max-width: 430px !important;
  text-align: center;
  padding: 2.25rem 2rem !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35) !important;
}

.settings-lock-badge {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #bfdbfe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
  font-size: 2rem;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.15);
}

.pin-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.4rem;
}

.pin-modal-subtitle {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.pin-input-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.pin-password-input {
  width: 100%;
  text-align: center;
  font-size: 1.4rem !important;
  letter-spacing: 6px;
  font-weight: 800;
  padding: 0.8rem 2.8rem 0.8rem 2.8rem !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: var(--radius-md) !important;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.pin-password-input:focus {
  border-color: var(--primary) !important;
  background: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.btn-toggle-eye {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.4rem;
  color: #64748b;
  transition: transform 0.2s;
}
.btn-toggle-eye:hover {
  transform: scale(1.15);
}

.pin-error-alert {
  background: #fef2f2;
  border: 1px solid #fecdd3;
  color: #b91c1c;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.pin-shake {
  animation: shake 0.4s ease-in-out;
  border-color: #ef4444 !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.pin-actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-pin-submit {
  padding: 0.8rem !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  border-radius: var(--radius-md) !important;
}

.btn-pin-cancel {
  padding: 0.6rem !important;
  border-radius: var(--radius-md) !important;
}

.settings-security-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  background: white;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.security-status-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #047857;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

/* =========================================================
   4. Dashboard Time Period Toolbar & Inventory Capital
   ========================================================= */
.dashboard-filter-toolbar {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.period-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.period-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #1e293b;
}

.current-period-display {
  font-size: 0.82rem;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid #bfdbfe;
}

.period-chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.period-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.period-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.period-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.custom-period-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  animation: fadeInDown 0.2s ease;
}

.custom-date-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.custom-date-field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
}

/* Inventory Capital Banner */
.inventory-capital-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 2px solid #cbd5e1;
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.capital-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}

.capital-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.capital-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  transition: all 0.2s ease;
}

.capital-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.capital-card.capital-main {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #93c5fd;
}

.capital-card-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.4rem;
}

.capital-card-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.capital-card.capital-main .capital-card-val {
  color: #1d4ed8;
}

.capital-card-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.35rem;
}

.text-blue { color: #0284c7 !important; }
.text-purple { color: #7c3aed !important; }
.text-green { color: #059669 !important; }

/* =========================================================
   5. Comprehensive Mobile & Tablet (iPad) Responsive Overhaul
   ========================================================= */
@media (max-width: 1024px) {
  .app-container {
    padding: 0 1rem 4rem 1rem;
  }
  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.35rem;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .nav-tab-btn {
    flex-shrink: 0;
  }
  .capital-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 1rem 1.2rem;
    margin-bottom: 1.25rem;
  }
  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .brand-section {
    justify-content: center;
  }
  .header-actions {
    justify-content: center;
  }
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }
  .product-img-wrapper {
    height: 135px;
  }
  .product-content {
    padding: 0.75rem;
  }
  .product-title {
    font-size: 0.88rem;
    height: 2.5rem;
  }
  .employee-pricing-box {
    padding: 0.5rem;
    font-size: 0.78rem;
  }
  .product-actions {
    flex-direction: column;
    gap: 0.4rem;
  }
  .floating-cart-bar {
    width: calc(100% - 1.5rem);
    bottom: 12px;
    padding: 0.65rem 1rem;
  }
  .btn-floating-jump {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
  }
  .capital-stats-grid {
    grid-template-columns: 1fr;
  }
  .period-chips-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.35rem;
  }
  .period-btn {
    flex-shrink: 0;
  }
  .quick-add-section {
    flex-direction: column;
  }
  .visual-search-wrapper, .quick-select-wrapper {
    width: 100%;
    min-width: unset;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr !important;
  }
  .product-img-wrapper {
    height: 170px;
  }
  .floating-cart-details .floating-cart-title {
    font-size: 0.82rem;
  }
  .floating-cart-total {
    font-size: 0.95rem;
  }
  .btn-floating-jump span:first-child {
    display: none;
  }
  .btn-floating-jump {
    padding: 0.55rem 0.85rem;
  }
}

/* =========================================================
   Brand Management & Filtering System (نظام تصنيف وجرد الماركات)
   ========================================================= */
.product-brand-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
  letter-spacing: 0.2px;
}

.inv-prod-brand {
  font-size: 0.75rem;
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.brand-summary-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #3730a3 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 6px 18px rgba(49, 46, 129, 0.2);
  border: 1px solid rgba(199, 210, 254, 0.2);
  animation: fadeIn 0.25s ease-out;
}

.brand-summary-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.brand-summary-stats {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.brand-summary-stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.brand-summary-stat-label {
  font-size: 0.72rem;
  opacity: 0.85;
  color: #c7d2fe;
}

.brand-summary-stat-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
}

.brand-summary-stat-val.capital {
  color: #34d399;
}

/* =========================================================
   Smart Brand Hub & Interactive Explorer (مركز الماركات الذكي والفاخر)
   ========================================================= */
.brand-hub-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.25s ease;
}

.brand-hub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.brand-hub-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-hub-main-icon {
  font-size: 1.6rem;
  background: #eff6ff;
  color: #2563eb;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
}

.brand-hub-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-hub-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Brand Hub Action Group */
.brand-hub-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Quick Brand Search Input Pill */
.brand-search-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  gap: 0.5rem;
  min-width: 240px;
  max-width: 320px;
  transition: all 0.2s ease;
}

.brand-search-pill:focus-within {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.brand-search-pill input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-main);
  width: 100%;
}

.brand-search-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: #eff6ff;
  color: #2563eb;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}

.btn-clear-input {
  background: #e2e8f0;
  border: none;
  color: #64748b;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-clear-input:hover {
  background: #cbd5e1;
  color: #1e293b;
}

/* Brand Quick Select Dropdown */
.brand-select-dropdown {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.42rem 0.85rem;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 220px;
}

.brand-select-dropdown:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* View Mode Toggle Button */
.btn-toggle-brands-view {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-toggle-brands-view:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Popular Brands Quick Row */
.popular-brands-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #f8fafc;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.popular-bar-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #475569;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.popular-chips-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0;
}

.popular-chips-wrap::-webkit-scrollbar {
  display: none;
}

.popular-chip {
  padding: 0.28rem 0.75rem;
  border-radius: 9999px;
  background: white;
  border: 1px solid #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.popular-chip:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.popular-chip.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
  color: white !important;
  border-color: #1e40af !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35) !important;
}

/* Brand Tabs Strip */
.brand-tabs-strip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
  border-bottom: 1.5px solid #f1f5f9;
}

.brand-tabs-strip::-webkit-scrollbar {
  display: none;
}

.brand-tab-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.brand-tab-btn:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.brand-tab-btn.active {
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-weight: 800;
}

/* Active Brand Lock Banner */
.brand-active-lock-bar {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #93c5fd;
  border-radius: 12px;
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: fadeIn 0.2s ease-in-out;
}

.lock-brand-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: #1e3a8a;
  flex-wrap: wrap;
}

.lock-indicator {
  font-weight: 800;
  color: #1d4ed8;
}

.lock-sub-hint {
  font-size: 0.8rem;
  color: #2563eb;
  font-weight: 600;
  margin-inline-start: 0.25rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
}

.active-brand-glow {
  background: #1d4ed8;
  color: white;
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3);
}

.active-brand-badge {
  font-size: 0.8rem;
  background: white;
  color: #1e40af;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid #bfdbfe;
}

.btn-reset-brand-filter {
  background: white;
  border: 1.5px solid #f87171;
  color: #dc2626;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);
}

.btn-reset-brand-filter:hover {
  background: #dc2626;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.25);
}

/* Brands Display Area */
.brands-display-area {
  position: relative;
  transition: all 0.3s ease;
}

/* 1. Ribbon Mode (Horizontal Smooth Scrolling) */
.brands-display-area.ribbon-mode {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brands-display-area.ribbon-mode .brands-cards-scroll {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.4rem 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}

.brands-display-area.ribbon-mode .brands-cards-scroll::-webkit-scrollbar {
  display: none;
}

/* 2. Grid Mode (Full Expansive Visual View) */
.brands-display-area.grid-mode .ribbon-arrow-btn {
  display: none !important;
}

.brands-display-area.grid-mode .brands-cards-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem 0.35rem;
  scrollbar-width: thin;
}

/* Arrow Buttons */
.ribbon-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  color: #334155;
  flex-shrink: 0;
  transition: all 0.2s ease;
  z-index: 3;
}

.ribbon-arrow-btn:hover {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

/* Individual Brand Chip Card */
.brand-chip-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.95rem;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.brand-chip-card:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(59, 130, 246, 0.15);
}

.brand-chip-card.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
  color: white !important;
  border-color: #1e40af !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4) !important;
  transform: translateY(-1px);
}

.brand-chip-icon {
  font-size: 1.25rem;
  line-height: 1;
  background: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.brand-chip-card.active .brand-chip-icon {
  background: rgba(255, 255, 255, 0.22);
}

.brand-chip-names {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-chip-primary {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.brand-chip-card.active .brand-chip-primary {
  color: #ffffff;
}

.brand-chip-secondary {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 600;
}

.brand-chip-card.active .brand-chip-secondary {
  color: #bfdbfe;
}

.brand-chip-count {
  font-size: 0.75rem;
  font-weight: 800;
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  margin-right: auto;
}

.brand-chip-card.active .brand-chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.brand-no-results {
  padding: 1rem;
  color: #64748b;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =========================================================
   Compact Brand Hub & Small Grid (عرض شبكة ماركات صغيرة وسهلة الوصول)
   ========================================================= */
.brand-compact-hub {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.85rem;
}

.brand-compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #f1f5f9;
}

.brand-compact-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-compact-icon {
  font-size: 1.2rem;
}

.brand-compact-title {
  font-weight: 800;
  color: #1e293b;
  font-size: 0.95rem;
}

.brand-compact-count {
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #64748b;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
}

.brand-compact-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.brand-search-box-mini {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  transition: all 0.2s;
}

.brand-search-box-mini:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.brand-search-box-mini input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.82rem;
  width: 150px;
}

.btn-clear-mini {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  display: flex;
  align-items: center;
}

.btn-clear-mini:hover {
  color: #dc2626;
}

.btn-all-brands-mini {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.btn-all-brands-mini:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Small Grid Layout: All brands visible at a glance */
.brands-small-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.25rem 0.15rem;
  scrollbar-width: thin;
}

.brands-small-grid::-webkit-scrollbar {
  width: 5px;
}

.brands-small-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.brand-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.brand-mini-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.brand-mini-chip.active {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3) !important;
}

.brand-mini-chip .chip-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.brand-mini-chip .chip-count {
  font-size: 0.72rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #475569;
  padding: 0.05rem 0.4rem;
  border-radius: 9999px;
  margin-inline-start: 0.15rem;
}

.brand-mini-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* =========================================================
   Dedicated Customers Tab & Debt Management
   ========================================================= */
.customers-section-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customers-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.cust-kpi-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: white;
  box-shadow: var(--shadow-sm);
}

.cust-kpi-card.danger {
  border-inline-start: 5px solid #dc2626;
}

.cust-kpi-card.danger .kpi-value {
  color: #dc2626;
}

.cust-kpi-card.primary {
  border-inline-start: 5px solid #2563eb;
}

.cust-kpi-card.primary .kpi-value {
  color: #2563eb;
}

.cust-kpi-card.warning {
  border-inline-start: 5px solid #d97706;
}

.cust-kpi-card.warning .kpi-value {
  color: #d97706;
}

.cust-kpi-card .kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.cust-kpi-card .kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.cust-kpi-card .kpi-value {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.2;
}

.cust-kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* Customer Autocomplete Dropdown List */
.customer-autocomplete-list {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  max-height: 250px;
  overflow-y: auto;
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.cust-auto-item {
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

.cust-auto-item:hover {
  background-color: #eff6ff;
}

.cust-auto-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cust-auto-sysnum {
  font-size: 0.75rem;
  color: #64748b;
  font-family: monospace;
  background: #f1f5f9;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.cust-auto-phone {
  font-size: 0.75rem;
  color: #64748b;
}

.cust-auto-debt {
  font-size: 0.88rem;
  font-weight: 800;
  color: #047857;
  white-space: nowrap;
}

.cust-auto-debt.has-debt {
  color: #dc2626;
}

.cust-auto-item.add-new-cust-item {
  background: #fffbeb;
  border-top: 1.5px dashed #fde68a;
  color: #b45309;
  font-weight: 700;
}

.cust-auto-item.add-new-cust-item:hover {
  background: #fef3c7;
}

/* Customer Debt Banner */
.customer-debt-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #92400e;
}

/* =========================================================
   Zero Stock Styling (التمييز الفوري للأصناف ذات الكمية 0)
   ========================================================= */
.product-card.is-out-of-stock {
  border-color: #fca5a5 !important;
  background-color: #fffafb !important;
}

.product-card.is-out-of-stock .product-img-wrapper img {
  filter: grayscale(60%);
  opacity: 0.82;
}

.product-stock-tag.zero-stock-badge {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
}

.zero-stock-overlay-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(220, 38, 38, 0.92);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.85rem;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* في الجرد: الصنف الذي كميته صفر تكون خلفية الصف لونها رمادي للتمييز */
.inventory-item-card.is-zero-stock {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  border-right: 5px solid #dc2626 !important;
}

.inventory-item-card.is-zero-stock .inv-prod-name {
  color: #475569 !important;
}

.inventory-item-card.is-zero-stock .inv-qty-input {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}

/* في تقرير PDF المطبوع: خلفية رمادية للأصناف نافدة المخزون */
.printable-inventory-report tr.zero-stock-row,
.printable-inventory-report tr.zero-stock-row td {
  background-color: #e2e8f0 !important;
  color: #475569 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* =========================================================
   Compact Inventory Floating Save Bar & Pill (مضغوط وصغير ولا يعطل الأزرار)
   ========================================================= */
.inventory-floating-bar.compact-audit-bar {
  display: none !important;
}

/* Ultra-compact Modern Floating Save Pill */
.inventory-floating-pill {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.2);
  animation: pillSlideUp 0.25s ease-out;
}

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

.pill-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
  padding-left: 0.4rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.pill-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.btn-pill-save {
  background: #059669;
  color: white;
  border: none;
  border-radius: 9999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-pill-save:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
}

.btn-pill-undo {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn-pill-undo:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-toolbar-save.has-pending {
  background: #059669 !important;
  color: white !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25);
  animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* =========================================================
   Brand Collapse / Expand Styles
   ========================================================= */
.btn-toggle-brands {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

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

.btn-toggle-brands.collapsed-state {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.brands-small-grid.collapsed {
  display: none !important;
}

.brand-compact-collapsed-notice {
  padding: 0.5rem 0.85rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  border: 1px dashed #cbd5e1;
}

/* =========================================================
   Executive Invoice Type Switch (Sales vs Purchase)
   ========================================================= */
.invoice-type-toggle-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .invoice-type-toggle-bar {
    grid-template-columns: 1fr;
  }
}

.invoice-type-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: right;
  width: 100%;
}

.invoice-type-tab-btn:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.invoice-type-tab-btn .type-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  transition: all 0.2s;
}

.invoice-type-tab-btn .type-btn-content {
  flex: 1;
}

.invoice-type-tab-btn .type-btn-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.15rem;
}

.invoice-type-tab-btn .type-btn-sub {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

.invoice-type-tab-btn .type-active-indicator {
  display: none;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Active Sales Mode */
.invoice-type-tab-btn.sales-mode-btn.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18);
}

.invoice-type-tab-btn.sales-mode-btn.active .type-btn-icon {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.invoice-type-tab-btn.sales-mode-btn.active .type-btn-title {
  color: #1d4ed8;
}

.invoice-type-tab-btn.sales-mode-btn.active .type-active-indicator {
  display: inline-block;
  background: #2563eb;
  color: white;
}

/* Active Purchase Mode */
.invoice-type-tab-btn.purchase-mode-btn.active {
  background: #ecfdf5;
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.18);
}

.invoice-type-tab-btn.purchase-mode-btn.active .type-btn-icon {
  background: #059669;
  color: white;
  border-color: #059669;
}

.invoice-type-tab-btn.purchase-mode-btn.active .type-btn-title {
  color: #047857;
}

.invoice-type-tab-btn.purchase-mode-btn.active .type-active-indicator {
  display: inline-block;
  background: #059669;
  color: white;
}

/* Mode Banner */
.invoice-mode-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.75rem;
  transition: all 0.2s;
}

.invoice-mode-banner.sales {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.invoice-mode-banner.purchase {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

/* =========================================================
   Brand Toggle Button Enhancement
   ========================================================= */
.btn-toggle-brands {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-toggle-brands:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.btn-toggle-brands.collapsed-state {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-toggle-brands .toggle-icon {
  font-size: 0.85rem;
  transition: transform 0.25s ease;
}

.btn-toggle-brands.collapsed-state .toggle-icon {
  transform: rotate(180deg);
}

/* =========================================================
   Zero Stock Separator & Badges
   ========================================================= */
.zero-stock-divider {
  grid-column: 1 / -1;
  margin: 1.25rem 0 0.75rem 0;
  padding: 0.75rem 1.25rem;
  background: #fff1f2;
  border: 1.5px dashed #f43f5e;
  border-radius: var(--radius-md);
  color: #9f1239;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(244, 63, 94, 0.06);
}

.zero-stock-divider .zero-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.zero-stock-divider .zero-badge {
  background: #ffe4e6;
  color: #be123c;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.inventory-zero-separator {
  background: #fff1f2 !important;
  color: #9f1239 !important;
  font-weight: 800 !important;
  text-align: right !important;
  padding: 0.75rem 1.25rem !important;
  border-top: 2px dashed #f43f5e !important;
  border-bottom: 2px dashed #f43f5e !important;
  font-size: 0.9rem !important;
}

/* =========================================================
   Customer Last Receipt Timer Badges
   ========================================================= */
.cust-timer-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
  line-height: 1.3;
}

.cust-timer-badge.timer-recent {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.cust-timer-badge.timer-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.cust-timer-badge.timer-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  animation: pulseLight 2s infinite;
}

.cust-timer-badge.timer-urgent-30 {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
  animation: pulseLight 1.8s infinite;
}

.urgent-debt-row {
  background: #fff5f5 !important;
  border-right: 4px solid #ef4444 !important;
}

.urgent-debt-row:hover {
  background: #fee2e2 !important;
}

.cust-timer-badge.timer-none {
  background: #f8fafc;
  color: #64748b;
  border: 1px dashed #cbd5e1;
}

.cust-timer-badge.timer-settled {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

@keyframes pulseLight {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); }
  70% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.btn-cust-reminder {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
}

.btn-cust-reminder:hover {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(2, 132, 199, 0.4);
}

/* =========================================================
   Auditor Input Wrap
   ========================================================= */
.inv-audit-emp-wrap {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.inv-audit-emp-wrap:focus-within {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18) !important;
}

/* Preset Amount Buttons */
.btn-amt-preset {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-amt-preset:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
  transform: translateY(-1px);
}

.pill-emp-wrap {
  transition: all 0.2s ease;
}

.pill-emp-wrap:focus-within {
  border-color: #047857 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

/* =========================================================
   Customer Debts, Net Balance & Statement Styles
   ========================================================= */
.customers-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cust-kpi-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: white;
  transition: all 0.2s ease;
}

.cust-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cust-kpi-card.danger {
  border-color: #fecaca;
  background: #fffafa;
}

.cust-kpi-card.danger .kpi-icon-wrap {
  background: #fee2e2;
  color: #dc2626;
}

.cust-kpi-card.danger .kpi-value {
  color: #dc2626;
}

.cust-kpi-card.info {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.cust-kpi-card.info .kpi-icon-wrap {
  background: #e0f2fe;
  color: #0284c7;
}

.cust-kpi-card.info .kpi-value {
  color: #0284c7;
}

.cust-kpi-card.net-positive {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.cust-kpi-card.net-positive .kpi-icon-wrap {
  background: #dcfce7;
  color: #15803d;
}

.cust-kpi-card.net-positive .kpi-value {
  color: #15803d;
}

.cust-kpi-card.net-negative {
  border-color: #fed7aa;
  background: #fff7ed;
}

.cust-kpi-card.net-negative .kpi-icon-wrap {
  background: #ffedd5;
  color: #c2410c;
}

.cust-kpi-card.net-negative .kpi-value {
  color: #c2410c;
}

.cust-kpi-card .kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.cust-kpi-card .kpi-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.cust-kpi-card .kpi-value {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
}

.cust-kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* Balance Tags in Table */
.bal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.bal-tag.debit {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.bal-tag.credit {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.bal-tag.settled {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Excel Upload Drag & Drop Zone */
.excel-drop-zone {
  border: 2.5px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.excel-drop-zone:hover,
.excel-drop-zone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.excel-drop-zone .drop-icon {
  font-size: 3.2rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Customer Statement Timeline */
.statement-timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 1rem;
}

.statement-timeline-table th {
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1;
  text-align: right;
  font-weight: 800;
}

.statement-timeline-table td {
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
}

.statement-timeline-table tr:hover {
  background: #f8fafc;
}

.btn-statement {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn-statement:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #000;
}

/* =========================================================
   PWA - Progressive Web App Styles
   ========================================================= */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: 20px;
  max-width: 520px;
  margin: 0 auto;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 9999;
  animation: slideUpPwa 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pwa-banner-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pwa-banner-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.pwa-banner-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-pwa-header {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
}

.btn-pwa-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.45);
}

.pwa-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10000;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pwa-toast-update {
  background: #1e40af;
  pointer-events: auto;
}

/* =============================================================
   تنسيقات استمارة كشف الجرد الفعلي للموظفين (تعبئة يدوية بدون أسعار)
   ============================================================= */
.printable-stocktake-container {
  background: white;
  border-radius: var(--radius-md);
  max-height: 65vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
}

.stocktake-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: #0f172a;
}

.stocktake-table th {
  background: #0f172a;
  color: #ffffff;
  padding: 8px 6px;
  font-weight: 700;
  border: 1px solid #334155;
  text-align: center;
  font-size: 0.82rem;
}

.stocktake-table td {
  padding: 6px 6px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  color-adjust: exact !important;
}

/* أحجام وتنسيقات جدول كشف الجرد الفعلي للموظفين (كبير، متوسط، مدمج، مدمج جداً) */
.stocktake-table.size-large th,
.stocktake-table.size-large td {
  font-size: 0.92rem !important;
  padding: 8px 8px !important;
  line-height: 1.4 !important;
}
.stocktake-table.size-large .stocktake-write-box {
  height: 32px !important;
  width: 75px !important;
}
.stocktake-table.size-large .stocktake-notes-line {
  height: 28px !important;
}

.stocktake-table.size-normal th,
.stocktake-table.size-normal td {
  font-size: 0.82rem !important;
  padding: 5px 6px !important;
  line-height: 1.3 !important;
}
.stocktake-table.size-normal .stocktake-write-box {
  height: 26px !important;
  width: 65px !important;
}
.stocktake-table.size-normal .stocktake-notes-line {
  height: 22px !important;
}

.stocktake-table.size-compact th,
.stocktake-table.size-compact td {
  font-size: 0.72rem !important;
  padding: 3px 4px !important;
  line-height: 1.2 !important;
}
.stocktake-table.size-compact .stocktake-write-box {
  height: 20px !important;
  width: 55px !important;
}
.stocktake-table.size-compact .stocktake-notes-line {
  height: 18px !important;
}

.stocktake-table.size-xcompact th,
.stocktake-table.size-xcompact td {
  font-size: 0.63rem !important;
  padding: 2px 3px !important;
  line-height: 1.1 !important;
}
.stocktake-table.size-xcompact .stocktake-write-box {
  height: 16px !important;
  width: 48px !important;
}
.stocktake-table.size-xcompact .stocktake-notes-line {
  height: 15px !important;
}

.stocktake-table tr.stocktake-row td {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  color-adjust: exact !important;
}

.stocktake-table tbody tr.stocktake-row:hover td {
  filter: brightness(0.96);
}

.stocktake-legend-bar {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  color-adjust: exact !important;
}

.stocktake-legend-pill {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  color-adjust: exact !important;
}

.stocktake-write-box {
  display: block;
  width: 68px;
  height: 28px;
  border: 1.5px dashed #475569;
  background-color: #ffffff;
  border-radius: 4px;
  margin: 0 auto;
}

.stocktake-notes-line {
  display: block;
  min-width: 90px;
  height: 22px;
  border-bottom: 1px dotted #94a3b8;
}

.stocktake-doc-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stocktake-info-badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.86rem;
  border: 1px solid #e2e8f0;
}

.stocktake-signatures {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1.5px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
}










/* =========================================================
   نظام استجابة الجوال الشامل والفاخر - Comprehensive Mobile System
   ========================================================= */

/* 1. إخفاء أسهم وأزرار شريط التمرير القبيحة في المتصفحات نهائياً */
::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* 2. إخفاء شريط التمرير في كل القوائم الأفقية القابلة للسحب باللمس */
.nav-tabs,
.category-chips,
.popular-chips-wrap,
.brand-tabs-strip,
.period-chips-group,
.brands-small-grid,
.brands-cards-scroll,
.sub-chips-list,
.no-scrollbar {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar,
.category-chips::-webkit-scrollbar,
.popular-chips-wrap::-webkit-scrollbar,
.brand-tabs-strip::-webkit-scrollbar,
.period-chips-group::-webkit-scrollbar,
.brands-small-grid::-webkit-scrollbar,
.brands-cards-scroll::-webkit-scrollbar,
.sub-chips-list::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* 3. شريط تمرير ناعم ومختصر لعناصر التمرير الرأسي (الجداول والنوافذ المنبثقة) */
.table-wrapper::-webkit-scrollbar,
.inv-table-wrapper::-webkit-scrollbar,
div[style*="overflow-x: auto"]::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb,
.inv-table-wrapper::-webkit-scrollbar-thumb,
div[style*="overflow-x: auto"]::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 999px;
}
.table-wrapper::-webkit-scrollbar-track,
.inv-table-wrapper::-webkit-scrollbar-track,
div[style*="overflow-x: auto"]::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   نظام التصميم الفاخر والاستجابة الكاملة للهواتف والشاشات الذكية (v4.0)
   ========================================================= */

/* شريط التنقل السفلي للهواتف (Mobile Bottom Navigation Bar) */
.mobile-bottom-nav {
  display: none;
}

.mobile-more-backdrop {
  display: none;
}

.mobile-more-sheet {
  display: none;
}

/* شبكة الإدخال السريع لصنف وماركة جديدة داخل الفاتورة */
.quick-new-product-grid {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr 1fr 0.8fr auto;
  gap: 8px;
  align-items: end;
}

/* 4. استجابة شاشات التابلت والجوال (أقل من 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-container {
    padding: 0 0.65rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 0.65rem !important;
  }
  
  /* شريط التطبيق العلوي - تم تكبيره وإضافة مساحة علوية للأندرويد والنوتش والـ PWA */
  .app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 0.65rem !important;
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    min-height: calc(76px + env(safe-area-inset-top, 0px));
    margin-bottom: 0.85rem;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  }

  /* مخصص عند فتح الموقع كتطبيق PWA مثبت */
  @media all and (display-mode: standalone) {
    .app-header {
      padding-top: calc(32px + env(safe-area-inset-top, 0px)) !important;
      min-height: calc(92px + env(safe-area-inset-top, 0px));
      padding-bottom: 0.75rem !important;
    }
  }
  
  .header-top {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.6rem;
    padding-bottom: 0.35rem;
  }
  
  .brand-section {
    justify-content: flex-start !important;
    text-align: right !important;
    gap: 0.6rem;
  }

  .brand-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.35rem !important;
    border-radius: 12px !important;
    flex-shrink: 0;
  }
  
  .brand-title {
    font-size: 1.2rem !important;
    font-weight: 800;
    white-space: nowrap;
    line-height: 1.2;
  }
  
  .brand-subtitle {
    display: none !important;
  }
  
  .header-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    width: auto !important;
  }
  
  #currentDateDisplay {
    display: none !important;
  }

  .header-info-badge,
  .telegram-status-badge,
  .btn-install-app {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    white-space: nowrap;
  }

  @media (max-width: 580px) {
    #telegramStatusText, #dbStatusText {
      display: none;
    }
    .header-info-badge {
      padding: 0.25rem 0.45rem;
      font-size: 0.85rem;
    }
  }

  /* تبويبات التصفح العلوية (شريط تمرير جانبي ناعم) */
  .nav-tabs {
    padding: 0.3rem 0.15rem;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    flex-wrap: nowrap;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    white-space: nowrap;
    border-radius: 10px;
    flex-shrink: 0;
  }

  /* شريط التنقل السفلي الفاخر للهواتف (تم تكبيره وإضافة مؤثرات انتقال تفاعلية) */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: calc(64px + env(safe-area-inset-bottom, 0px));
    height: auto;
    padding: 4px 0.3rem max(4px, env(safe-area-inset-bottom, 0px)) 0.3rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1.5px solid #e2e8f0;
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.09);
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
  }

  .mob-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #64748b;
    padding: 4px 2px;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mob-nav-btn:active {
    transform: scale(0.86);
    transition: transform 0.1s ease;
  }

  .mob-nav-btn.active {
    color: #2563eb;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.05));
  }

  .mob-nav-btn.active .mob-nav-icon {
    transform: translateY(-2px) scale(1.18);
    filter: drop-shadow(0 3px 8px rgba(37, 99, 235, 0.45));
    animation: mobIconBounce 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* ─── Android: backdrop-filter fallback ─── */
  /* الشريط السفلي: خلفية صلبة كـ fallback لأندرويد القديم */
  .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.98) !important;
  }
  @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .mobile-bottom-nav {
      background: rgba(255, 255, 255, 0.95) !important;
      backdrop-filter: blur(24px) !important;
      -webkit-backdrop-filter: blur(24px) !important;
    }
  }

  @keyframes mobIconBounce {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.28) translateY(-4px); }
    100% { transform: scale(1.18) translateY(-2px); }
  }

  .mob-nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 22px;
    height: 3.5px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 99px;
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.55);
    animation: indicatorGrow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes indicatorGrow {
    from { width: 0; opacity: 0; }
    to { width: 22px; opacity: 1; }
  }

  .mob-nav-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mob-nav-icon {
    font-size: 1.55rem;
    line-height: 1;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .mob-nav-label {
    font-size: clamp(0.64rem, 2.3vw, 0.78rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }

  .mob-nav-btn.active .mob-nav-label {
    font-weight: 800;
    color: #1d4ed8;
  }

  .mob-cart-badge {
    position: absolute;
    top: -5px;
    right: -9px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.70rem;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
    animation: badgePulse 0.3s ease;
  }

  @keyframes badgePulse {
    0% { transform: scale(0.6); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
  }

  .mob-cart-badge.warning {
    background: #d97706;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
  }

  /* قائمة المزيد السفلية (Bottom Sheet Drawer) */
  .mobile-more-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-more-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-more-sheet {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    padding: 0.75rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 1rem;
    z-index: 10001;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
  }

  .mobile-more-sheet.active {
    transform: translateY(0);
  }

  .sheet-drag-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 99px;
    margin: 0 auto 0.85rem auto;
  }

  .sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.85rem;
  }

  .sheet-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .sheet-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .sheet-item-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: right;
    font-family: inherit;
  }

  .sheet-item-btn:active {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: scale(0.97);
  }

  .sheet-item-icon {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
  }

  .sheet-item-title {
    font-weight: 800;
    font-size: 0.88rem;
    color: #0f172a;
    line-height: 1.25;
  }

  .sheet-item-desc {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
  }

  /* Catalog Toolbar */
  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  
  .catalog-toolbar .search-box {
    width: 100% !important;
    min-width: unset !important;
  }

  .catalog-toolbar > div:last-child {
    width: 100%;
  }

  .catalog-toolbar > div:last-child button {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
  }

  /* Brands Hub */
  .brand-compact-hub {
    padding: 0.65rem 0.8rem;
    margin-bottom: 0.75rem;
    border-radius: 14px;
  }
  
  .brand-compact-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .brand-compact-actions {
    display: flex;
    gap: 0.4rem;
    width: 100%;
    flex-wrap: wrap;
  }

  .brands-small-grid {
    max-height: 110px;
    gap: 0.3rem;
  }

  .brand-mini-chip {
    padding: 0.25rem 0.55rem;
    font-size: 0.76rem;
  }

  /* Invoice Form Layout */
  .invoice-create-container {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .quick-new-product-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .quick-new-product-grid > div:first-child {
    grid-column: 1 / -1;
  }
  .quick-new-product-grid > div:last-child {
    grid-column: 1 / -1;
  }
  .quick-new-product-grid > div:last-child button {
    width: 100% !important;
    height: 44px !important;
  }

  .items-table {
    min-width: 540px;
  }

  .items-table th, .items-table td {
    padding: 0.55rem 0.45rem;
    font-size: 0.8rem;
  }

  /* Customer KPI Cards (2x2 Grid) */
  .customers-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
  }
  .cust-kpi-card {
    padding: 0.75rem 0.65rem !important;
    border-radius: 12px !important;
  }
  .cust-kpi-card .kpi-icon-wrap {
    font-size: 1.25rem !important;
    width: 32px !important;
    height: 32px !important;
  }
  .cust-kpi-card .kpi-label {
    font-size: 0.72rem !important;
  }
  .cust-kpi-card .kpi-value {
    font-size: 1.05rem !important;
  }
  .cust-kpi-card .kpi-sub {
    font-size: 0.66rem !important;
  }

  /* النوافذ المنبثقة على الهواتف كأسلوب Bottom Sheet */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 22px 22px 0 0 !important;
    max-height: 90vh !important;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem !important;
  }

  .modal-header {
    padding: 0.9rem 1rem !important;
    border-top-left-radius: 22px !important;
    border-top-right-radius: 22px !important;
  }

  .modal-footer {
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 1rem !important;
    position: sticky;
    bottom: 0;
    background: #ffffff;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 110px;
    height: 42px;
  }

  /* Prevent auto zoom on iOS Safari */
  input[type="text"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
    border-radius: 10px;
  }

  .btn {
    min-height: 42px;
    border-radius: 10px;
  }

  /* الأشرطة العائمة تعلو شريط التنقل السفلي */
  .floating-cart-bar {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 8px) !important;
    right: 0.5rem !important;
    left: 0.5rem !important;
    width: calc(100% - 1rem) !important;
    border-radius: 14px !important;
    padding: 0.65rem 0.9rem !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
    z-index: 9998 !important;
  }

  .inventory-floating-pill {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 8px) !important;
    right: 0.5rem !important;
    left: 0.5rem !important;
    width: calc(100% - 1rem) !important;
    z-index: 9998 !important;
  }

  /* =========================================================
     [1] تحسين تجربة فاتورة جديدة (tab-create-invoice) على الجوال
     ========================================================= */
  .invoice-type-toggle-bar {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .invoice-type-tab-btn {
    padding: 0.65rem 0.5rem !important;
    border-radius: 12px !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.35rem !important;
  }
  .type-btn-icon {
    font-size: 1.45rem !important;
    margin: 0 !important;
  }
  .type-btn-title {
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    line-height: 1.25;
  }
  .type-btn-sub {
    display: none !important;
  }
  .type-active-indicator {
    display: none !important;
  }

  /* جدول الأصناف المختارة يتحول إلى كروت منتجات تطبيق فاخرة */
  #selectedItemsTable {
    display: block !important;
    min-width: unset !important;
    width: 100% !important;
    border: none !important;
  }
  #selectedItemsTableHead {
    display: none !important;
  }
  #selectedItemsTableBody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }
  #selectedItemsTableBody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 0.75rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    gap: 0.5rem !important;
    position: relative !important;
  }

  #selectedItemsTableBody tr td:first-child {
    padding: 0 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    padding-left: 2.4rem !important;
  }
  #selectedItemsTableBody tr td:first-child img.item-thumb {
    width: 48px !important;
    height: 48px !important;
    border-radius: 10px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
  }

  #selectedItemsTableBody tr td:last-child {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    padding: 0 !important;
    border: none !important;
  }
  #selectedItemsTableBody tr td:last-child .btn-danger {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
  }

  #selectedItemsTableBody tr td:not(:first-child):not(:last-child) {
    padding: 0.35rem 0 !important;
    border: none !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px dashed #f1f5f9 !important;
    font-size: 0.84rem !important;
  }

  #selectedItemsTableBody tr td.col-sell-price::before {
    content: 'سعر البيع للقطعة:';
    font-weight: 700;
    color: #64748b;
  }
  #selectedItemsTableBody tr td:nth-child(2)::before {
    content: 'سعر التكلفة:';
    font-weight: 700;
    color: #64748b;
  }
  #selectedItemsTableBody tr td.col-profit::before {
    content: 'صافي الربح:';
    font-weight: 700;
    color: #059669;
  }

  .quantity-control {
    background: #f1f5f9 !important;
    border-radius: 10px !important;
    padding: 2px !important;
    gap: 4px !important;
  }
  .quantity-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }
  .quantity-input {
    width: 44px !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    text-align: center !important;
  }

  .payment-selector {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .payment-option {
    padding: 0.65rem 0.5rem !important;
    border-radius: 12px !important;
    text-align: center !important;
  }
  .payment-option .icon {
    font-size: 1.45rem !important;
    margin-bottom: 0.2rem !important;
  }
  .payment-option .title {
    font-size: 0.85rem !important;
    font-weight: 800 !important;
  }
  .payment-option > div:last-child {
    display: none !important;
  }

  .invoice-summary-card {
    position: static !important;
  }
  .invoice-summary-card .card {
    border-radius: 16px !important;
    padding: 1rem !important;
  }
  .summary-row {
    padding: 0.4rem 0 !important;
    font-size: 0.88rem !important;
  }
  .summary-row.total-final {
    font-size: 1.25rem !important;
    margin-top: 0.5rem !important;
    padding-top: 0.75rem !important;
  }
  #btnSubmitInvoice {
    height: 48px !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    border-radius: 12px !important;
  }
  #btnSubmitQuotation {
    height: 44px !important;
    font-size: 0.86rem !important;
    border-radius: 12px !important;
  }

  /* =========================================================
     [2] تحسين تجربة سند قبض (tab-receipts) على الجوال
     ========================================================= */
  .receipts-top-actions-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    padding: 0.75rem 0.85rem !important;
  }
  .receipts-top-actions-bar > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
  }
  .receipts-top-actions-bar button {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
  }

  .rcp-quick-amounts {
    display: flex !important;
    gap: 0.35rem !important;
    flex-wrap: wrap !important;
    margin-top: 0.5rem !important;
  }
  .btn-amt-preset {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    padding: 6px 12px !important;
    border-radius: 99px !important;
    font-size: 0.82rem !important;
    min-height: 36px !important;
    transition: all 0.15s ease !important;
  }
  .btn-amt-preset:active {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
    transform: scale(0.94) !important;
  }

  .receipts-kpi-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .receipt-kpi-item {
    padding: 0.6rem 0.5rem !important;
    border-radius: 10px !important;
  }
  .receipt-kpi-item .label {
    font-size: 0.72rem !important;
  }
  .receipt-kpi-item .value {
    font-size: 1.1rem !important;
  }

  /* سجل سندات القبض يتحول لكروت معاملات مالية سهلة القراءة */
  #receiptsTableBody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }
  #receiptsTableBody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 0.85rem !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03) !important;
    gap: 0.45rem !important;
  }
  #receiptsTableBody tr td {
    padding: 0 !important;
    border: none !important;
  }
  #receiptsTableBody tr td:first-child {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-weight: 800 !important;
    font-size: 0.9rem !important;
    color: #2563eb !important;
  }
  #receiptsTableBody tr td:nth-child(2) {
    font-size: 0.74rem !important;
    color: #64748b !important;
  }
  #receiptsTableBody tr td:nth-child(3) {
    font-size: 0.98rem !important;
    color: #0f172a !important;
    padding-top: 0.25rem !important;
    border-top: 1px solid #f1f5f9 !important;
  }
  #receiptsTableBody tr td:nth-child(4) {
    font-size: 1.25rem !important;
    font-weight: 900 !important;
    color: #059669 !important;
  }
  #receiptsTableBody tr td:nth-child(5) {
    display: flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }
  #receiptsTableBody tr td:nth-child(6) {
    font-size: 0.78rem !important;
    color: #64748b !important;
  }
  #receiptsTableBody tr td:last-child {
    padding-top: 0.5rem !important;
    border-top: 1px solid #f1f5f9 !important;
    display: flex !important;
    justify-content: flex-end !important;
  }
  #receiptsTableBody tr td:last-child .btn {
    min-height: 36px !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.82rem !important;
  }

  /* =========================================================
     [3] تحسين تجربة الزبائن والديون (tab-customers) على الجوال
     ========================================================= */
  .customers-section-container .card {
    padding: 0.75rem 0.65rem !important;
  }
  .customers-section-container .search-box {
    width: 100% !important;
    min-width: unset !important;
  }
  
  .customers-section-container > .card:nth-of-type(2) > div > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
  }
  .customers-section-container > .card:nth-of-type(2) > div > div:last-child button {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.78rem !important;
    padding: 0.5rem 0.4rem !important;
  }

  /* جدول الزبائن يتحول إلى كروت عملاء منظمة وفاخرة جداً */
  #customersMainTable {
    display: block !important;
    min-width: unset !important;
    width: 100% !important;
    border: none !important;
  }
  #customersMainTable thead {
    display: none !important;
  }
  #customersMainTableBody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  #customersMainTableBody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 0.85rem !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    gap: 0.5rem !important;
    transition: transform 0.15s ease !important;
  }
  #customersMainTableBody tr:active {
    transform: scale(0.99) !important;
  }

  #customersMainTableBody tr.urgent-debt-row {
    border-color: #ef4444 !important;
    background: #fffbfa !important;
  }

  #customersMainTableBody tr td {
    padding: 0 !important;
    border: none !important;
  }

  /* الاسم والتصنيف */
  #customersMainTableBody tr td:nth-child(2) {
    order: 1 !important;
  }
  #customersMainTableBody tr td:nth-child(2) strong {
    font-size: 1.05rem !important;
    color: #0f172a !important;
  }

  /* كود العميل والهاتف */
  #customersMainTableBody tr td:first-child {
    order: 2 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.78rem !important;
    color: #64748b !important;
    padding-bottom: 0.35rem !important;
    border-bottom: 1px dashed #f1f5f9 !important;
  }
  #customersMainTableBody tr td:nth-child(3) {
    order: 2 !important;
    font-size: 0.85rem !important;
  }

  /* الرصيد والدين */
  #customersMainTableBody tr td:nth-child(4) {
    order: 3 !important;
    padding: 0.45rem 0.65rem !important;
    background: #f8fafc !important;
    border-radius: 10px !important;
    text-align: right !important;
  }
  #customersMainTableBody tr td:nth-child(4) .debt-badge {
    font-size: 1.15rem !important;
    font-weight: 900 !important;
    padding: 0.35rem 0.75rem !important;
    display: block !important;
    text-align: center !important;
    border-radius: 8px !important;
  }

  /* مؤقت وتاريخ آخر حركة */
  #customersMainTableBody tr td:nth-child(5) {
    order: 4 !important;
  }
  #customersMainTableBody tr td:nth-child(5) .cust-timer-badge {
    padding: 0.4rem 0.6rem !important;
    border-radius: 10px !important;
  }

  /* الملاحظات */
  #customersMainTableBody tr td:nth-child(6) {
    order: 5 !important;
    font-size: 0.78rem !important;
    color: #64748b !important;
  }

  /* أزرار العمليات السريعة بأزرار لمس كبيرة وسلسة */
  #customersMainTableBody tr td:last-child {
    order: 6 !important;
    padding-top: 0.65rem !important;
    border-top: 1px solid #f1f5f9 !important;
  }
  #customersMainTableBody tr td:last-child > div {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.35rem !important;
    flex-wrap: wrap !important;
  }
  #customersMainTableBody tr td:last-child .btn,
  #customersMainTableBody tr td:last-child .btn-statement {
    width: 100% !important;
    min-height: 38px !important;
    padding: 0.4rem 0.25rem !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    justify-content: center !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  #customersMainTableBody tr td:last-child .btn-secondary,
  #customersMainTableBody tr td:last-child .btn-danger,
  #customersMainTableBody tr td:last-child .btn-cust-reminder {
    grid-column: span 1 !important;
  }
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 5. استجابة شاشات الهواتف المحمولة (أقل من 640px) */
@media (max-width: 640px) {
  /* كروت المنتجات: شبكة ثنائية الأعمدة غاية في الأناقة والتنظيم */
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }

  .product-card {
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .product-card:active {
    transform: scale(0.98);
  }

  .product-img-wrapper {
    height: 135px !important;
    position: relative;
    background: #f8fafc;
    overflow: hidden;
  }

  .product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    padding: 6px;
  }

  .product-content {
    padding: 0.6rem !important;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
  }

  .product-title {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    height: 2.7em !important;
    margin-bottom: 0.35rem !important;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-category-tag,
  .product-brand-tag,
  .product-stock-tag {
    font-size: 0.65rem !important;
    padding: 2px 5px !important;
    border-radius: 5px !important;
  }

  .employee-pricing-box {
    padding: 0.35rem 0.5rem !important;
    margin-bottom: 0.45rem !important;
    border-radius: 8px !important;
  }

  .sell-val {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: #1e40af !important;
  }

  .price-row {
    font-size: 0.72rem !important;
  }

  .product-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.35rem !important;
  }

  .product-actions .btn {
    padding: 0.45rem 0.5rem !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
    white-space: nowrap;
  }

  .product-actions .btn-add-to-cart {
    flex: 2;
  }

  /* الأقسام الرئيسية في الكتالوج */
  .main-categories-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.45rem !important;
  }

  .main-category-card {
    padding: 0.6rem 0.4rem !important;
    border-radius: 12px !important;
    font-size: 0.76rem !important;
  }

  .main-cat-icon {
    font-size: 1.3rem !important;
    margin-bottom: 2px !important;
  }

  /* البطاقات والإحصائيات */
  .capital-stats-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .card {
    padding: 0.85rem;
    border-radius: 14px;
  }

  /* الفلاتر السريعة */
  .category-chips {
    padding-bottom: 0.4rem;
    gap: 0.35rem;
  }

  .chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    border-radius: 20px;
  }
}

/* 6. شاشات الهواتف شديدة الصغر (أقل من 380px) */
@media (max-width: 380px) {
  .app-container {
    padding: 0 0.4rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 0.4rem !important;
  }

  .brand-title {
    font-size: 0.95rem !important;
  }

  .main-categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .product-img-wrapper {
    height: 120px !important;
  }

  .product-title {
    font-size: 0.78rem !important;
  }
}

/* ========================================================
   Customer Product Showroom Modal & Android Media Styling
======================================================== */
.customer-preview-card {
  animation: modalZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(15px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.customer-preview-image-container img:hover {
  transform: scale(1.05);
}

.product-img-wrapper:hover .product-img-preview-overlay {
  background: rgba(37, 99, 235, 0.9) !important;
}

@media (max-width: 640px) {
  .customer-preview-card {
    width: 95% !important;
    margin: 10px auto !important;
  }

  .customer-preview-image-container {
    height: 240px !important;
  }

  #custPrevPrice {
    font-size: 1.45rem !important;
  }
}

/* ========================================================
   Pure Image Lightbox & Zoom Viewer (Customer Clean Preview)
======================================================== */
.pure-image-preview-backdrop {
  z-index: 100000 !important;
  transition: opacity 0.25s ease;
}

.pure-image-preview-backdrop.active {
  display: flex !important;
  opacity: 1;
}

.preview-float-close-btn:hover {
  background: rgba(239, 68, 68, 0.85) !important;
  border-color: #ef4444 !important;
  transform: scale(1.08) rotate(90deg);
}

.preview-nav-arrow:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-50%) scale(1.1);
}

.btn-zoom-tool {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.btn-zoom-tool:hover {
  background: rgba(37, 99, 235, 0.8);
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.cust-prev-mini-thumb {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  opacity: 0.65;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cust-prev-mini-thumb.active,
.cust-prev-mini-thumb:hover {
  opacity: 1;
  border-color: #38bdf8;
  transform: scale(1.08);
}

.cust-prev-mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* مصغرات إدارة الصور داخل نافذة تعديل المنتج */
.prod-modal-thumb-item {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  transition: all 0.18s ease;
}

.prod-modal-thumb-item.is-primary {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px #fef3c7, 0 4px 8px rgba(245, 158, 11, 0.2);
}

.prod-modal-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prod-modal-thumb-del {
  position: absolute;
  top: 3px;
  left: 3px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.prod-modal-thumb-del:hover {
  transform: scale(1.18);
  background: #dc2626;
}

.prod-modal-thumb-star {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(15, 23, 42, 0.75);
  color: #fbbf24;
  border: none;
  border-radius: 4px;
  font-size: 0.65rem;
  padding: 1px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
}

.prod-modal-thumb-star.active {
  background: #f59e0b;
  color: #ffffff;
  font-weight: 800;
}

/* =========================================================
   قفل PIN — شاشة الدخول
   ========================================================= */

/* النقاط الأربع */
.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.35);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pin-dot-filled {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.7);
}
.pin-dot-error {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.6);
}

/* لوحة الأرقام */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

.pin-key {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 68px;
}
.pin-key:active {
  background: rgba(37, 99, 235, 0.45);
  border-color: #3b82f6;
  transform: scale(0.88);
}
.pin-key-empty {
  background: transparent !important;
  border-color: transparent !important;
  cursor: default;
  pointer-events: none;
}
.pin-key-del {
  font-size: 1.3rem;
}

/* اهتزاز الخطأ */
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  15%  { transform: translateX(-10px); }
  30%  { transform: translateX(10px); }
  45%  { transform: translateX(-8px); }
  60%  { transform: translateX(8px); }
  75%  { transform: translateX(-4px); }
  90%  { transform: translateX(4px); }
}
.pin-shake {
  animation: pinShake 0.55s ease;
}

/* =========================================================
   زر مسح الباركود بالكاميرا داخل خانة البحث
   ========================================================= */
.btn-barcode-scan {
  position: absolute;
  left: 2.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 1.05rem;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.15s ease;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.btn-barcode-scan:active {
  transform: translateY(-50%) scale(0.88);
}

/* تعديل padding الـ input لمكان زر الكاميرا */
.visual-search-input {
  padding-left: 5.5rem !important;
}

@media (max-width: 768px) {
  .btn-barcode-scan {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
}

/* =========================================================
   [ANDROID FIX] إصلاحات شاملة لأجهزة الأندرويد
   - منع التأكل الأفقي (horizontal overflow)
   - إصلاح صفحة سند القبض
   - إصلاح dropdown الزبائن
   - إصلاح safe-area للأندرويد
   ========================================================= */

/* ─── منع أي overflow أفقي على مستوى الصفحة كلها ─── */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* ─── إصلاح overflow في صفحة سند القبض على الأندرويد ─── */
@media (max-width: 768px) {
  /* منع خروج محتوى سند القبض من الشاشة */
  #tab-receipts {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .receipts-layout {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  /* كل .card داخل سند القبض يبقى بداخل الشاشة */
  #tab-receipts .card {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  /* نموذج سند القبض - grid يتحول لعمود واحد */
  #tab-receipts .grid-2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* كل حقول النموذج تأخذ العرض الكامل */
  #tab-receipts .form-group,
  #tab-receipts .form-control,
  #tab-receipts input,
  #tab-receipts select,
  #tab-receipts textarea {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  /* wrapper الجدول يتجنب overflow أفقي وشريط تمرير خارج الحدود */
  #tab-receipts [style*="overflow-x: auto"],
  #tab-receipts [style*="overflow-x:auto"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* إخفاء رأس جدول السندات لأن الصفوف تعرض كبطاقات مالية متكاملة على الهواتف */
  #tab-receipts table thead {
    display: none !important;
  }
  #tab-receipts table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }

  /* تأكيد: tafqeet-box لا يخرج من الشاشة */
  .tafqeet-box {
    word-break: break-word !important;
    white-space: normal !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ─── إصلاح dropdown الزبائن على الأندرويد ─── */
  /* يُثبّت الـ dropdown بـ position:fixed كي لا يخرج من الشاشة */
  .customer-autocomplete-list {
    position: fixed !important;
    right: 0.75rem !important;
    left: 0.75rem !important;
    width: auto !important;
    max-width: calc(100vw - 1.5rem) !important;
    max-height: 220px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    z-index: 99999 !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2) !important;
    border-radius: 12px !important;
  }

  /* ─── إصلاح backdrop للـ more-backdrop على الأندرويد ─── */
  .mobile-more-backdrop {
    background: rgba(15, 23, 42, 0.65) !important;
  }
  @supports not (backdrop-filter: blur(1px)) {
    .mobile-more-backdrop {
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
  }

  /* ─── إصلاح header الشفاف على أندرويد قديم ─── */
  .app-header {
    background: rgba(15, 23, 42, 0.97) !important;
  }
  @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .app-header {
      background: rgba(15, 23, 42, 0.94) !important;
      backdrop-filter: blur(16px) !important;
      -webkit-backdrop-filter: blur(16px) !important;
    }
  }

  /* ─── تحسين touch على الأندرويد عموماً ─── */
  button, .btn, .mob-nav-btn, .sheet-item-btn {
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }

  /* ─── منع الـ layout break في items-table wrapper ─── */
  .table-wrapper-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ─── إصلاح modal على أندرويد: منع الشفافية عند غياب backdrop-filter ─── */
  .modal-overlay {
    background: rgba(15, 23, 42, 0.6) !important;
  }
  @supports not (backdrop-filter: blur(1px)) {
    .modal-overlay {
      backdrop-filter: none !important;
    }
  }

  /* ─── إصلاح quick-amounts pills لا تتكدس عمودياً ─── */
  .rcp-quick-amounts {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .btn-amt-preset {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* ─── إصلاح KPI cards في سند القبض لا تتجاوز العرض ─── */
  .receipts-kpi-row {
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .receipt-kpi-item {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* ─── إصلاح safe-area-inset-bottom على أندرويد ─── */
  /* Android ما قبل 12 لا يدعم env() → fallback صريح */
  body {
    padding-bottom: 90px !important;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .mobile-bottom-nav {
    min-height: 64px !important;
    height: auto !important;
    padding: 4px 0.3rem max(6px, env(safe-area-inset-bottom, 0px)) 0.3rem !important;
  }

  /* ─── منع content انزلاق تحت شريط النظام على أندرويد ─── */
  .app-container {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* ─── إصلاح نموذج الفاتورة: حقول لا تتجاوز الشاشة ─── */
  #tab-create-invoice .form-control,
  #tab-create-invoice input,
  #tab-create-invoice select {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ─── تمرير ناعم لكل القوائم والجداول على الأندرويد ─── */
  .nav-tabs,
  .brands-small-grid,
  .mobile-more-sheet,
  .modal-body {
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ─── إصلاح overflow خارج نطاق 768px (عام لكل الشاشات) ─── */
.receipts-layout,
#tab-receipts,
.customers-section-container {
  box-sizing: border-box;
}

/* ─── منع أي عنصر من التسبب بـ horizontal scroll ─── */
@media (max-width: 480px) {
  /* شاشات صغيرة جداً: منع تداخل كروت الأصناف وتنسيق النصوص */
  .products-grid:not(.view-list-mode) {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  .product-img-wrapper {
    height: 175px !important;
  }
  .product-title {
    font-size: 0.92rem !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    -webkit-line-clamp: 2 !important;
  }
  .brand-title {
    font-size: 1.05rem !important;
  }
  .header-actions {
    gap: 0.25rem !important;
  }
  /* شاشات صغيرة جداً: ضغط إضافي */
  .card {
    border-radius: 12px !important;
  }
  .modal-content {
    border-radius: 18px 18px 0 0 !important;
  }
  .receipt-kpi-item .value {
    font-size: 1rem !important;
    word-break: break-all !important;
  }
  /* الزر داخل كرت سند القبض */
  #receiptsTableBody tr td:last-child .btn {
    width: 100% !important;
    justify-content: center !important;
  }
  /* تقليل padding الكروت على شاشات 480px */
  #receiptsTableBody tr {
    padding: 0.7rem 0.65rem !important;
  }
  #selectedItemsTableBody tr {
    padding: 0.65rem !important;
  }
}

/* =========================================================
   [NEW] نظام قفل PIN التفاعلي الحديث والمستخدمين والصلاحيات
   ========================================================= */

/* الشاشة الزجاجية الكاملة للقفل */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: radial-gradient(circle at 50% 20%, #1e3a5f 0%, #0f172a 75%, #020617 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px)) 1rem;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  user-select: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-lock-container {
  width: 100%;
  max-width: 330px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto !important;
  padding: 1rem 0;
}

.pin-brand-header {
  margin-bottom: 1.25rem;
}
.pin-brand-icon {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 0.4rem;
  filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.4));
  animation: floatBrandIcon 3s ease-in-out infinite alternate;
}
@keyframes floatBrandIcon {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.pin-brand-title {
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
  letter-spacing: -0.3px;
}
.pin-brand-sub {
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
}

/* أزرار التبديل السريع للمستخدمين */
.pin-user-pills {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1.1rem;
  width: 100%;
}
.pin-user-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}
.pin-user-pill.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.5);
}
.pin-user-pill:not(.active):active {
  background: rgba(255, 255, 255, 0.14);
}

/* تلميح الدور والدخول */
.pin-role-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
  min-height: 24px;
  margin-bottom: 1.25rem;
  transition: color 0.2s ease;
}

/* صف نقاط الأرقام */
.pin-dots-row {
  display: flex;
  gap: 1.1rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.pin-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.38);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pin-dot-filled {
  background: #3b82f6 !important;
  border-color: #60a5fa !important;
  transform: scale(1.22);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.85);
}
.pin-dot-error {
  background: #ef4444 !important;
  border-color: #f87171 !important;
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
}

/* لوحة المفاتيح الرقمية - اتجاه LTR ليظهر رقم 1 من اليسار */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  direction: ltr !important;
  gap: 0.85rem;
  width: 100%;
  max-width: 285px;
  margin: 0 auto 1.25rem auto;
}
.pin-key {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 64px;
  padding: 0;
}
.pin-key .k-num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.pin-key .k-sub {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #94a3b8;
  margin-top: 2px;
}
.pin-key:active {
  background: rgba(37, 99, 235, 0.45);
  border-color: #60a5fa;
  transform: scale(0.9);
}
.pin-key-empty {
  background: transparent !important;
  border-color: transparent !important;
  cursor: default;
  pointer-events: none;
}
.pin-key-del {
  font-size: 1.45rem;
}

/* بطاقات التلميحات السفلية */
.pin-footer-hints {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  width: 100%;
}
.hint-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 0.35rem 0.75rem;
  font-size: 0.74rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hint-chip strong {
  color: #60a5fa;
}
.hint-chip:active {
  background: rgba(37, 99, 235, 0.25);
  border-color: #3b82f6;
  transform: scale(0.95);
}

/* =========================================================
   شارة المستخدم وقفل الشاشة في الهيدر
   ========================================================= */
.header-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  padding: 0.3rem 0.75rem;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.header-user-badge:active {
  transform: scale(0.94);
  background: rgba(37, 99, 235, 0.3);
}
.h-user-role-icon {
  font-size: 1.15rem;
}
.h-user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.1;
}
.h-user-name {
  font-size: 0.82rem;
  font-weight: 800;
}
.h-user-sub {
  font-size: 0.65rem;
  color: #94a3b8;
}
.h-user-lock-icon {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-right: 2px;
}

@media (max-width: 580px) {
  .h-user-sub { display: none; }
  .header-user-badge { padding: 0.25rem 0.55rem; }
}

/* =========================================================
   قواعد الصلاحيات المطبقة على الكاشير (role-cashier)
   ========================================================= */
body.role-cashier .col-profit,
body.role-cashier .live-item-profit,
body.role-cashier .capital-card,
body.role-cashier .inventory-capital-banner,
body.role-cashier #invBrandSummaryBanner,
body.role-cashier #tab-create-invoice .summary-row:has(.col-profit),
body.role-cashier button[onclick*="openProductModalForEdit"],
body.role-cashier button[onclick*="confirmDeleteProduct"] {
  display: none !important;
}

/* =========================================================
   نافذة تفاصيل الصنف السريعة
   ========================================================= */
#productDetailSheet {
  z-index: 9999;
}

#productDetailSheetBox {
  animation: pdsSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pdsSlideIn {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

/* إخفاء حقلي التكلفة والربح عن الكاشير في نافذة التفاصيل */
body.role-cashier #pdsProfitBox {
  display: none !important;
}

/* عند الكاشير: حقول الأسعار تملأ العرض كاملاً بدل عمودين */
/* pds prices flexible */

/* =========================================================
   أزرار الباركود في بطاقات الجرد
   ========================================================= */
.inv-barcode-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  border: 1.5px solid;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.inv-barcode-tag-btn.has-barcode {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
}
.inv-barcode-tag-btn.has-barcode:hover {
  background: #dcfce7;
  border-color: #22c55e;
}
.inv-barcode-tag-btn.no-barcode {
  background: #f8fafc;
  color: #64748b;
  border-color: #cbd5e1;
  border-style: dashed;
}
.inv-barcode-tag-btn.no-barcode:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #93c5fd;
  border-style: solid;
}
.inv-barcode-tag-btn:active {
  transform: scale(0.92);
}

/* وميض الصنف بالجرد عند البحث */
@keyframes flashYellowPulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); background: #fef3c7; }
  50% { box-shadow: 0 0 25px 5px rgba(245, 158, 11, 0.4); background: #fef08a; }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.flash-highlight {
  animation: flashYellowPulse 1.2s ease 2 !important;
  border-color: #f59e0b !important;
}

/* =========================================================
   نافذة تعريف الباركود للصنف (Assign Barcode Modal)
   ========================================================= */
.assign-prod-preview {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.85rem;
}
.assign-prod-thumb {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}
.assign-prod-details {
  flex: 1;
  min-width: 0;
  text-align: right;
}
.assign-prod-code-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 6px;
  margin-bottom: 2px;
}
.assign-prod-name {
  display: block;
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-prod-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}
.assign-prod-current-bc {
  font-size: 0.76rem;
  color: #475569;
  margin-top: 4px;
}
.current-bc-tag {
  font-weight: 800;
  color: #64748b;
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
}
.current-bc-tag.has-val {
  background: #dcfce7;
  color: #15803d;
}

/* ⛔ تنبيه الباركود المكرر الصارم */
.barcode-dup-alert {
  background: #fef2f2;
  border: 2px solid #ef4444;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  animation: dupAlertPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.15);
}
@keyframes dupAlertPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.dup-alert-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #dc2626;
  font-size: 1.05rem;
  border-bottom: 1.5px dashed #fca5a5;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
}

.dup-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.75rem;
  border: 1px solid #fee2e2;
  margin-bottom: 0.85rem;
}
.dup-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.dup-lbl {
  color: #64748b;
  font-weight: 600;
}
.dup-val {
  color: #0f172a;
}
.dup-val.highlight {
  color: #dc2626;
  font-weight: 800;
}
.dup-barcode-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.95rem;
}

.dup-actions-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dup-actions-bar .btn {
  flex: 1;
  min-width: 140px;
}

/* إشعار النجاح */
.barcode-success-alert {
  background: #ecfdf5;
  border: 2px solid #10b981;
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  color: #065f46;
  font-weight: 700;
  animation: dupAlertPop 0.3s ease;
}

/* =========================================================
   منطقة تغذية الكاميرا وشبكة الليزر
   ========================================================= */
.scanner-live-wrapper {
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
  border: 1.5px solid #334155;
  position: relative;
  margin-bottom: 0.85rem;
}
.scanner-feed-box {
  width: 100%;
  height: 250px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
}
.scanner-live-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.82);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: liveDotPulse 1.2s infinite;
}
@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
.scanner-reticle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.reticle-box {
  width: 220px;
  height: 120px;
  border: 2.5px solid #3b82f6;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}
.scan-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, #ef4444, #f87171, #ef4444, transparent);
  box-shadow: 0 0 8px #ef4444;
  animation: laserScanLine 1.8s ease-in-out infinite alternate;
}
@keyframes laserScanLine {
  0% { top: 5%; }
  100% { top: 95%; }
}

.scanner-tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.95);
  padding: 0.45rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-native-cam {
  font-weight: 800 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.barcode-manual-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
}

/* مفتاح الـ Toggle في الإعدادات */
.switch-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.switch-toggle-wrap input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.switch-toggle-wrap input:checked + .toggle-slider {
  background-color: #2563eb;
}
.switch-toggle-wrap input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* زر تصوير الباركود بكاميرا الهاتف العريض والبارز */
.btn-native-snap-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  font-weight: 800;
  font-size: 0.94rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-native-snap-big:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.45);
}

/* =========================================================
   [NEW] شاشة تسجيل باركود المنتجات الجماعي والذكي (Batch Registration)
   ========================================================= */

.batch-session-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.25rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  text-align: center;
  transition: transform 0.15s ease;
}
.stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}
.stat-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
}
.stat-success .stat-num { color: #10b981; }
.stat-skipped .stat-num { color: #64748b; }
.stat-conflict .stat-num { color: #f59e0b; }
.stat-failed .stat-num { color: #ef4444; }

.batch-detected-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1.5px solid #334155;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.detected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.detected-title {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}
.detected-status-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.status-waiting {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}
.status-new {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.status-registered {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.4);
}
.status-conflict {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.detected-code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detected-code-val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #38bdf8;
  font-family: 'IBM Plex Sans Arabic', monospace;
  word-break: break-all;
}
.detected-hint {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

.batch-link-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}
.section-title-sm {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.6rem;
}

.batch-search-results {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  margin-bottom: 0.6rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.search-res-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s ease;
}
.search-res-item:last-child {
  border-bottom: none;
}
.search-res-item:hover, .search-res-item:active {
  background: #f8fafc;
}
.search-res-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-res-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
}
.search-res-meta {
  font-size: 0.72rem;
  color: #64748b;
}

.batch-selected-product {
  margin-top: 0.6rem;
}
.sel-prod-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(37, 99, 235, 0.05);
  border: 1.5px solid #3b82f6;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}
.sel-prod-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.sel-prod-info {
  flex: 1;
}
.sel-prod-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}
.sel-prod-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #64748b;
  margin: 2px 0;
}
.tag-curr-bc {
  font-weight: 700;
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
}

.batch-actions-bar {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
}



/* ═══════════════════════════════════════════════════════════
   FIXED MODAL OVERLAY & POPUP SYSTEM (نافذة منبثقة حقيقية فوق كل عناصر الصفحة)
   ═══════════════════════════════════════════════════════════ */
.modal-overlay,
.modal-backdrop.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: rgba(15, 23, 42, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  z-index: 25000 !important;
  padding: 1rem !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.modal-overlay.active,
.modal-backdrop.modal-overlay.active,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"],
.modal-backdrop.modal-overlay[style*="display: flex"],
.modal-backdrop.modal-overlay[style*="display:flex"] {
  display: flex !important;
}

.modal-overlay .modal-content,
.modal-backdrop.modal-overlay .modal-content {
  background: var(--bg-card, #ffffff) !important;
  border-radius: 20px !important;
  width: 100% !important;
  max-width: 580px !important;
  max-height: 90vh !important;
  max-height: 90dvh !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
  animation: modalCenterPop 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden !important;
  position: relative !important;
  z-index: 25001 !important;
  margin: auto !important;
}

@keyframes modalCenterPop {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 768px) {
  .modal-overlay,
  .modal-backdrop.modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
    overflow-y: hidden !important;
  }
  .modal-overlay .modal-content,
  .modal-backdrop.modal-overlay .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    margin: 0 !important;
    animation: modalSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
}

@keyframes modalSheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ─── ضبط أبعاد وتغذية الفيديو للماسح داخل الحاوية ─── */
#batchScannerQrContainer,
#assignScannerQrContainer,
#universalScannerQrContainer {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #020617 !important;
}

#batchScannerQrContainer video,
#assignScannerQrContainer video,
#universalScannerQrContainer video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 14px !important;
  display: block !important;
}

#batchScannerQrContainer img,
#assignScannerQrContainer img,
#universalScannerQrContainer img {
  display: none !important;
}

#batchScannerQrContainer > div[style*="border-left"],
#assignScannerQrContainer > div[style*="border-left"],
#universalScannerQrContainer > div[style*="border-left"] {
  display: none !important;
}

/* ─── شارة توجيه المسح الذكية ─── */
.scanner-guidance-pill {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.5);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 12;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: pulseGuidance 2s infinite;
  white-space: nowrap;
}

@keyframes pulseGuidance {
  0%, 100% { opacity: 0.95; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.03); }
}



/* =========================================================
   [NEW] إخفاء ميزات الباركود مؤقتاً بناءً على رغبة المستخدم
   ========================================================= */
.inv-barcode-tag-btn,
#btnOpenBarcode,
#btnBatchRegisterBarcodes,
#btnScanInventoryBarcode,
.catalog-barcode-btn,
.product-barcode-pill {
  display: none !important;
}

/* =========================================================
   [NEW] شريط التبديل بين طريقة عرض الأصناف في الكتالوج
   ========================================================= */
.catalog-view-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.view-mode-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.view-mode-switcher-group {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
  border: 1px solid #e2e8f0;
}

.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.btn-view-toggle:hover {
  color: #0f172a;
}

.btn-view-toggle.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* =========================================================
   [NEW] نمط العرض العريض (صنف لكل صف - Default List View)
   صورة كبيرة وبجانبها التفاصيل الكاملة
   ========================================================= */
.products-grid.view-list-mode {
  display: flex !important;
  flex-direction: column !important;
  gap: 1.15rem !important;
}

.products-grid.view-list-mode .product-card {
  display: flex !important;
  flex-direction: row !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  min-height: 210px !important;
  contain: content;
}

.products-grid.view-list-mode .product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.09) !important;
  border-color: #cbd5e1 !important;
}

.products-grid.view-list-mode .product-img-wrapper {
  width: 260px !important;
  min-width: 260px !important;
  max-width: 260px !important;
  height: auto !important;
  min-height: 210px !important;
  background: #f8fafc !important;
  position: relative !important;
  border-left: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.products-grid.view-list-mode .product-img-wrapper img {
  width: 100% !important;
  height: 100% !important;
  max-height: 200px !important;
  object-fit: contain !important;
  padding: 0.75rem !important;
  transition: transform 0.3s ease;
}

.products-grid.view-list-mode .product-card:hover .product-img-wrapper img {
  transform: scale(1.06);
}

.products-grid.view-list-mode .product-content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 1.25rem 1.5rem !important;
}

.products-grid.view-list-mode .product-title {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  height: auto !important;
  margin: 0.25rem 0 0.65rem 0 !important;
  line-height: 1.4 !important;
  cursor: pointer;
}

.products-grid.view-list-mode .product-title:hover {
  color: #2563eb !important;
}

.products-grid.view-list-mode .employee-pricing-box {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1rem 2rem !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 0.65rem 1rem !important;
  margin: 0.5rem 0 0.85rem 0 !important;
}

.products-grid.view-list-mode .employee-pricing-box .price-row {
  margin-bottom: 0 !important;
  gap: 0.4rem;
}

.products-grid.view-list-mode .product-actions {
  display: flex !important;
  gap: 0.5rem !important;
  max-width: 360px !important;
  margin-top: auto !important;
}

/* استجابة شاشات الهواتف في نمط العرض العريض */
@media (max-width: 680px) {
  .products-grid.view-list-mode .product-card {
    flex-direction: column !important;
  }
  .products-grid.view-list-mode .product-img-wrapper {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    border-left: none !important;
    border-bottom: 1px solid #f1f5f9;
  }
  .products-grid.view-list-mode .product-content {
    padding: 1rem !important;
  }
  .products-grid.view-list-mode .employee-pricing-box {
    flex-direction: column !important;
    gap: 0.4rem !important;
  }
  .products-grid.view-list-mode .product-actions {
    max-width: 100% !important;
  }
}

/* =========================================================
   [NEW] نافذة عرض تفاصيل الصنف الفاخرة (Product Showcase Modal)
   ========================================================= */
.pds-showcase-box {
  max-width: 680px !important;
  width: 95% !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  padding: 0 !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28) !important;
  background: #ffffff !important;
}

.pds-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.pds-header-info {
  flex: 1;
}

.pds-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.pds-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.pds-badge-code {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
}

.pds-badge-cat {
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.pds-badge-brand {
  background: #10b981;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.pds-badge-stock {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
}

.pds-badge-stock.available {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.pds-badge-stock.zero {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.pds-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pds-close-btn:hover {
  background: rgba(239, 68, 68, 0.85);
  transform: rotate(90deg);
}

.pds-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 72vh;
  overflow-y: auto;
}

.pds-image-showcase {
  text-align: center;
}

.pds-main-img-wrap {
  width: 100%;
  height: 280px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pds-main-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 1rem;
  transition: transform 0.3s;
}

.pds-main-img-wrap:hover img {
  transform: scale(1.04);
}

.pds-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 12px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.pds-thumbnails-strip {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pds-thumb-btn {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.pds-thumb-btn.active {
  border-color: #2563eb;
  transform: scale(1.05);
}

.pds-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.pds-pricing-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.pds-price-card {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
}

.pds-card-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.35rem;
}

.pds-card-val {
  font-size: 1.25rem;
  font-weight: 800;
}

.pds-sell-card {
  background: #f0fdf4;
  border-color: #86efac;
}
.pds-sell-card .pds-card-lbl { color: #166534; }
.pds-sell-val { color: #15803d; font-size: 1.35rem; }

.pds-cost-card {
  background: #fef9f0;
  border-color: #fde68a;
}
.pds-cost-card .pds-card-lbl { color: #92400e; }
.pds-cost-val { color: #b45309; }

.pds-profit-card {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.pds-profit-card .pds-card-lbl { color: #3730a3; }
.pds-profit-val { color: #4338ca; }

.pds-details-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.25rem;
}

.pds-details-card-header {
  font-size: 0.85rem;
  font-weight: 800;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.pds-details-text {
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.6;
  white-space: pre-wrap;
}

.pds-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.pds-btn-cart {
  padding: 0.65rem 1.5rem;
  font-weight: 700;
  border-radius: 10px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pds-btn-close {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
}


/* سجل الفواتير: تمرير أفقي سلس ومريح على الهواتف */
#invoicesListTable {
  min-width: 760px !important;
  width: 100% !important;
}
#tab-invoices-list div[style*="overflow-x: auto"] {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  width: 100% !important;
}
