:root {
  --primary: #0047CC;
  --primary-dark: #003399;
  --primary-light: #e6f0ff;
  --accent: #00b894;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0, 71, 204, 0.08);
  --font: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #334155;
  --primary-light: #1e3a8a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Global Mode Switcher Bar */
.system-switcher {
  background: linear-gradient(90deg, #091e42 0%, #003399 50%, #0047CC 100%);
  color: #fff;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1200;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
}

.switcher-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
}

.cloud-badge {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #6ee7b7;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.switcher-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-btn:hover {
  background: rgba(255,255,255,0.24);
}

.mode-btn.active {
  background: #ffffff;
  color: #0047CC;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.switcher-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.curr-select {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 10px;
  border-radius: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.curr-select option {
  color: #1e293b;
  background: #fff;
}

/* ==================== STOREFRONT (الويب للمتجر وتطبيق العملاء) ==================== */
.store-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 47px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.store-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.store-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-logo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
}

.store-title h1 {
  font-size: 20px;
  color: var(--primary);
  font-weight: 800;
}

.store-title p {
  font-size: 12px;
  color: var(--muted);
}

.store-search-bar {
  flex: 1;
  min-width: 260px;
  max-width: 580px;
  display: flex;
  position: relative;
}

.store-search-bar input {
  width: 100%;
  padding: 11px 16px 11px 90px;
  border: 2px solid var(--primary);
  border-radius: 99px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.store-search-bar button {
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 0 18px;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
}

.store-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-pill {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(0,71,204,0.2);
  padding: 8px 13px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.action-pill:hover {
  background: var(--primary);
  color: #fff;
}

.action-pill.cart-pill {
  background: var(--primary);
  color: #fff;
}

.badge-count {
  background: #ff3b30;
  color: #fff;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
}

.store-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px 80px;
}

/* Hero Banner & Quick Services */
.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.hero-slider {
  background: linear-gradient(135deg, #002b80 0%, #0047CC 60%, #1a75ff 100%);
  border-radius: 16px;
  padding: 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
  min-height: 220px;
  box-shadow: var(--shadow);
}

.hero-content {
  max-width: 62%;
  z-index: 2;
}

.hero-tag {
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 10px;
}

.hero-content h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
}

.hero-content p {
  font-size: 14px;
  opacity: 0.92;
  margin-bottom: 16px;
}

.hero-QuickCards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.q-service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.q-service-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.q-service-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Groups Horizontal Strip */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.groups-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scrollbar-width: thin;
}

.group-chip {
  flex: 0 0 auto;
  width: 118px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.group-chip:hover, .group-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.group-chip img {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  margin-bottom: 6px;
  border: 1px solid #edf2f7;
}

.group-chip span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  height: 31px;
  overflow: hidden;
}

/* Subcategories Pills */
.subcats-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.subcat-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.subcat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.22s;
  position: relative;
  box-shadow: var(--shadow);
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.prod-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  z-index: 2;
}

.prod-badge.scale {
  background: #0d9488;
}

.prod-img-box {
  width: 100%;
  height: 185px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.prod-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s;
}

.product-card:hover .prod-img-box img {
  transform: scale(1.05);
}

.prod-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.prod-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.prod-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  min-height: 42px;
}

.prod-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.prod-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

.prod-price small {
  font-size: 11px;
  font-weight: 600;
}

.btn-add-cart {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 7px 13px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-add-cart:hover {
  background: var(--primary-dark);
}

/* ==================== WINDOWS / WEB ADMIN ERP LAYOUT ==================== */
.erp-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 48px);
}

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

.erp-sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 10px;
  border-left: 1px solid #1e293b;
  overflow-y: auto;
}

.erp-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 16px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 10px;
}

.erp-sidebar-header img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 2px solid #38bdf8;
}

.erp-nav-group-title {
  font-size: 11px;
  color: #64748b;
  font-weight: 800;
  padding: 10px 12px 4px;
  text-transform: uppercase;
}

.erp-nav-item {
  width: 100%;
  text-align: right;
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  transition: all 0.15s;
}

.erp-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.erp-nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.erp-main {
  padding: 20px;
  overflow-x: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card h4 {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-card .val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* ERP Panels & Tables */
.erp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.erp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.erp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.erp-table th, table.erp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

table.erp-table th {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

table.erp-table tr:hover {
  background: rgba(0, 71, 204, 0.03);
}

.btn {
  padding: 8px 15px;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13.5px;
  background: var(--bg);
  color: var(--text);
}

/* Modal / Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-box {
  background: var(--card);
  border-radius: 16px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* Floating AI & WhatsApp Buttons */
.floating-dock {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1500;
}

.fab-btn {
  padding: 12px 18px;
  border-radius: 99px;
  border: none;
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fab-ai { background: linear-gradient(135deg, #0047CC, #7c3aed); }
.fab-wa { background: #25D366; }

@media print {
  .system-switcher, .erp-sidebar, .floating-dock, .no-print {
    display: none !important;
  }
  .erp-layout {
    display: block !important;
  }
  body {
    background: #fff !important;
  }
}
