:root {
  --zm-blue: #1d4e89;
  --zm-blue-dark: #153a66;
  --zm-orange: #f0a500;
  --zm-orange-dark: #d89400;
  --zm-bg: #f7f8fa;
  --zm-white: #ffffff;
  --zm-text: #1f2937;
  --zm-muted: #6b7280;
  --zm-border: #e5e7eb;
  --zm-radius: 12px;
  --zm-shadow: 0 4px 18px rgba(29, 78, 137, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Tajawal", sans-serif;
  background: var(--zm-bg);
  color: var(--zm-text);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.container {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

main.container {
  flex: 1 0 auto;
  width: min(1180px, calc(100% - 2rem));
}

/* Header */
.site-header {
  background: var(--zm-white);
  border-bottom: 1px solid var(--zm-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
}

.search-form {
  display: flex;
  align-items: center;
  background: #f1f3f6;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  max-width: 280px;
}

.search-form input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  padding: 0.35rem;
}

.search-form button {
  border: 0;
  background: transparent;
  color: var(--zm-blue);
  cursor: pointer;
}

.brand {
  text-align: center;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.55rem;
}

.brand-logo .zaid { color: var(--zm-blue); }
.brand-logo .market { color: var(--zm-orange); }

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--zm-blue), var(--zm-blue-dark));
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.brand-tagline {
  margin: 0.15rem 0 0;
  color: var(--zm-muted);
  font-size: 0.85rem;
}

.header-support {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--zm-blue);
  font-weight: 700;
}

.header-support small {
  display: block;
  color: var(--zm-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--zm-border);
  background: white;
  display: grid;
  place-items: center;
  color: var(--zm-blue);
  cursor: pointer;
  font-size: 1.15rem;
}

.menu-toggle {
  font-size: 1.25rem;
  line-height: 1;
}

.home-btn .home-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.home-btn .home-roof {
  stroke: var(--zm-orange);
}

.home-btn .home-body,
.home-btn .home-door {
  stroke: var(--zm-blue);
}

.home-btn:hover .home-roof {
  stroke: var(--zm-orange-dark);
}

.home-btn:hover .home-body,
.home-btn:hover .home-door {
  stroke: var(--zm-blue-dark);
}

/* القائمة الجانبية */
body.drawer-open {
  overflow: hidden;
}

.side-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 55, 0.45);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.side-drawer-overlay.is-visible {
  opacity: 1;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 86vw);
  height: 100%;
  background: #fff;
  z-index: 90;
  box-shadow: 8px 0 28px rgba(29, 78, 137, 0.18);
  transform: translateX(-105%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

.side-drawer.is-open {
  transform: translateX(0);
}

.side-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--zm-border);
  color: var(--zm-blue);
}

.side-drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f3f6fb;
  color: var(--zm-blue);
  cursor: pointer;
  font-size: 1rem;
}

.side-drawer-user {
  padding: 0.85rem 1.15rem 0.35rem;
  color: var(--zm-muted);
  font-size: 0.92rem;
}

.side-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem 1rem;
  gap: 0.25rem;
}

.side-drawer-nav a {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  color: var(--zm-blue-dark);
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease;
}

.side-drawer-nav a:hover {
  background: #eef4fb;
  color: var(--zm-blue);
}

.side-drawer-logout {
  color: #b91c1c !important;
  margin-top: 0.35rem;
}

.cart-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--zm-orange);
  color: white;
  font-size: 0.7rem;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: none;
  place-items: center;
  font-weight: 700;
}

.cart-badge.is-visible {
  display: grid;
}

.main-nav-wrap {
  border-top: 1px solid #eef1f5;
  background: #fff;
}

.main-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
}

.main-nav-home {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
}

.main-nav-home.is-active {
  background: var(--zm-blue);
  border-color: var(--zm-blue);
}

.main-nav-home.is-active .home-roof {
  stroke: var(--zm-orange);
}

.main-nav-home.is-active .home-body,
.main-nav-home.is-active .home-door {
  stroke: #fff;
}

.main-nav {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0;
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  justify-content: flex-start;
  align-items: center;
}

.main-nav li {
  margin: 0;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--zm-blue);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover {
  background: #eef4fc;
}

.main-nav a.active {
  background: var(--zm-blue);
  color: #fff;
}

@media (max-width: 860px) {
  .main-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.15rem 0.15rem 0.15rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { white-space: nowrap; }
}

/* Hero banners — عمودان (يمين / يسار) */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.5rem;
}

.hero-grid--mobile {
  display: none;
}

.hero-slot {
  position: relative;
  min-width: 0;
}

.hero-track {
  position: relative;
  min-height: 230px;
  /* ارتفاع ثابت حتى لا تُعاد حسابات التخطيط عند تبديل الشريحة */
  aspect-ratio: 16 / 9;
}

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--zm-blue);
  font-size: 1.45rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29, 78, 137, 0.2);
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.hero-nav:hover {
  background: var(--zm-blue);
  color: #fff;
}

.hero-nav:active {
  transform: translateY(-50%) scale(0.94);
}

.hero-nav-prev {
  right: 0.55rem;
}

.hero-nav-next {
  left: 0.55rem;
}

.hero-banner {
  min-height: 210px;
  border-radius: var(--zm-radius);
  background: #f2f5f9;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--zm-shadow);
  text-decoration: none;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.hero-placeholder {
  background: linear-gradient(135deg, #163f70, #1d4e89 55%, #0f2f52);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

a.hero-banner {
  cursor: pointer;
}

a.hero-banner:hover .hero-image {
  transform: scale(1.02);
}

.hero-image {
  transition: transform 0.35s ease;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease;
  /* تبقى كل الشرائح absolute حتى لا يُفرَّغ الـ decode عند الإخفاء */
  z-index: 0;
}

.hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

.hero-slide .hero-image {
  /* تبقى في الذاكرة بعد أول تحميل — التبديل عبر opacity فقط */
  transform: translateZ(0);
}

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #c5d4e8;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-dot.is-active {
  background: var(--zm-orange);
  transform: scale(1.15);
}

.hero-slider {
  position: relative;
  margin: 1.25rem 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-orange {
  background: var(--zm-orange);
  color: #1a1a1a;
}
.btn-orange:hover { background: var(--zm-orange-dark); }

.btn-blue {
  background: var(--zm-blue);
  color: white;
}
.btn-blue:hover { background: var(--zm-blue-dark); }

.btn-outline {
  background: white;
  border: 1px solid var(--zm-border);
  color: var(--zm-blue);
}

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.9rem; }

/* Categories */
.section { margin: 1.75rem 0; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  color: var(--zm-blue);
  font-size: 1.35rem;
}

.toggle-more {
  border: 0;
  background: transparent;
  color: var(--zm-blue);
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: color 0.35s ease, transform 0.35s ease, opacity 0.35s ease;
}

.toggle-more:hover {
  color: var(--zm-orange-dark);
  transform: translateX(-2px);
}

.toggle-more.is-busy {
  pointer-events: none;
  opacity: 0.65;
}

/* توسعة سلسة تدفع الأقسام للأسفل/الأعلى */
.extras-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.extras-panel.is-open {
  grid-template-rows: 1fr;
}

.extras-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.extras-panel .extras-row {
  padding-top: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    padding-top 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.extras-panel.is-open .extras-row {
  padding-top: 0.9rem;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.12s,
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    padding-top 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.category-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.85rem;
}

.category-chip {
  background: white;
  border: 1px solid var(--zm-border);
  border-radius: var(--zm-radius);
  padding: 1rem 0.5rem;
  text-align: center;
  box-shadow: var(--zm-shadow);
  transition: transform 0.15s ease;
}

.category-chip:hover { transform: translateY(-3px); }

.category-chip .icon {
  font-size: 1.8rem;
  margin-bottom: 0.35rem;
}

.category-chip span {
  display: block;
  color: var(--zm-blue);
  font-weight: 700;
  font-size: 0.88rem;
}

/* Products */
.product-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: stretch;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
}

.product-card {
  width: 100%;
  max-width: 100%;
  background: white;
  border: 1px solid #e8ecf1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(29, 78, 137, 0.06);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 300px;
  transition: box-shadow 0.35s ease;
}

.product-card .badge-new {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--zm-blue);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  z-index: 1;
}

.product-card .thumb {
  display: block;
  height: 160px;
  padding: 1rem 1rem 0.35rem;
  background: #fff;
  overflow: hidden;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* بديل مؤقت للمنتجات القادمة من الإداري قبل رفع صورها */
.product-card .thumb-placeholder,
.detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f6f8fb, #eef2f7);
  border-radius: 10px;
  color: #c2cbd8;
}

.product-card .thumb-placeholder svg,
.detail-placeholder svg {
  width: 44%;
  max-width: 72px;
  height: auto;
}

.detail-placeholder {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.75rem 0 0.5rem;
  flex-wrap: wrap;
}

.pagination__btn {
  padding: 0.5rem 1.1rem;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #fff;
  color: var(--zm-blue);
  font-weight: 700;
  text-decoration: none;
}

.pagination__btn:hover {
  background: #f4f7fb;
}

.pagination__btn.is-disabled {
  color: #b6bec9;
  background: #f7f9fb;
  cursor: default;
}

.pagination__status {
  color: #4b5563;
  font-weight: 600;
}

.pagination__nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination__count {
  color: #8a94a2;
  font-weight: 500;
}

.pagination__jump {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.pagination__jump-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #4b5563;
  font-weight: 600;
  font-size: 0.9rem;
}

.pagination__jump-input {
  width: 4.2rem;
  padding: 0.45rem 0.35rem;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
  color: var(--zm-blue);
}

.pagination__jump-input:focus {
  outline: 2px solid rgba(29, 78, 137, 0.25);
  border-color: var(--zm-blue);
}

.stock-out {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #fdf1f1;
  border: 1px solid #f3d2d2;
  border-radius: 8px;
  color: #b3261e;
  font-weight: 700;
}

.cart-item-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #f2f5f9;
  border-radius: 10px;
  font-size: 1.5rem;
}

.product-card .body {
  padding: 0.55rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  flex: 1;
}

.product-card h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #222;
  line-height: 1.4;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .price {
  color: #1a1a1a;
  font-weight: 800;
  font-size: 0.98rem;
}

.price {
  color: var(--zm-blue);
  font-weight: 800;
  font-size: 1.05rem;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
  padding-top: 0.35rem;
}

.card-actions form { margin: 0; }

.cart-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #d7e3f2;
  border-radius: 10px;
  background: #fff;
  color: var(--zm-blue);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.cart-icon-btn .cart-svg {
  width: 20px;
  height: 20px;
  display: block;
}

.cart-icon-btn:hover {
  background: #f5f9ff;
  border-color: #bfd3eb;
  transform: translateY(-1px);
}

.cart-icon-btn:active {
  transform: scale(0.94);
}

.cart-icon-btn.is-in-cart {
  background: #7ba3d4;
  border-color: #7ba3d4;
  color: #fff;
  box-shadow: 0 4px 12px rgba(123, 163, 212, 0.35);
}

.cart-icon-btn.is-in-cart:hover {
  background: #6a94c7;
  border-color: #6a94c7;
}

.cart-toggle-form {
  margin: 0;
  display: grid;
}

/* عنصر يطير نحو السلة */
.fly-to-cart {
  position: fixed;
  z-index: 200;
  border-radius: 12px;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(29, 78, 137, 0.28);
  will-change: transform, opacity;
  background: transparent;
}

.fly-to-cart img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@keyframes cartBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.icon-btn.cart-bump {
  animation: cartBump 0.4s ease;
}

.wish-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--zm-blue);
  font-size: 1.45rem;
  line-height: 1;
  user-select: none;
  border: 0;
  border-radius: 10px;
  background: #eef3f9;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.wish-icon:hover {
  color: var(--zm-orange);
  background: #fff4df;
  transform: scale(1.04);
}

.wish-icon.is-active {
  color: #fff;
  background: var(--zm-orange);
}

.wish-icon.is-active:hover {
  background: var(--zm-orange-dark);
  color: #fff;
}

.favorite-form {
  margin: 0;
  display: grid;
}

@media (max-width: 1100px) {
  .product-row,
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .product-row,
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .product-card .thumb { height: 140px; }
  .product-card { min-height: 280px; }
}

@media (max-width: 560px) {
  .product-row,
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .product-card .thumb { height: 120px; padding: 0.65rem 0.65rem 0.25rem; }
  .product-card { min-height: 250px; border-radius: 12px; }
  .product-card h3 { font-size: 0.84rem; min-height: 2.4em; }
  .cart-icon-btn,
  .wish-icon { width: 34px; height: 34px; }
}

/* Page helpers */
.page-title {
  margin: 1.25rem 0 1rem;
  color: var(--zm-blue);
}

.flash-messages {
  margin-top: 1rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: #e8f0fe;
  color: var(--zm-blue);
  border: 1px solid #c9daf8;
}

.flash.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash.warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.site-footer {
  margin-top: auto;
  background: var(--zm-blue);
  color: white;
  padding: 1.1rem 0;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: space-between;
  align-items: center;
}

.site-footer .footer-bar {
  position: relative;
  justify-content: center;
  min-height: 3rem;
}

.site-footer .footer-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  line-height: 1.35;
}

.brand-logo--footer {
  font-size: 1.55rem;
  font-weight: 800;
}

.brand-logo--footer .zaid {
  color: #fff;
}

.brand-logo--footer .market {
  color: var(--zm-orange);
}

.brand-tagline--footer {
  margin: 0.15rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.85rem;
}

.site-footer a { color: #ffd989; }

/* Cart / forms */
.panel {
  background: white;
  border: 1px solid var(--zm-border);
  border-radius: var(--zm-radius);
  padding: 1.25rem;
  box-shadow: var(--zm-shadow);
}

/* لوحة البانرات */
.banner-panel-title {
  margin: 0 0 1rem;
  color: var(--zm-blue);
}

.banner-add-panel {
  margin-bottom: 1.5rem;
}

.banner-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.banner-fields .admin-field-check {
  justify-content: flex-end;
}

.banner-fields .admin-field-check .zm-switch {
  height: 42px;
  align-items: center;
}

/* مفتاح التفعيل */
.zm-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  margin: 0;
  font-weight: 700;
  color: #334;
}

.zm-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.zm-switch-track {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #c5ced8;
  flex-shrink: 0;
  transition: background 0.22s ease;
  direction: ltr;
}

.zm-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s cubic-bezier(0.33, 1, 0.32, 1);
}

.zm-switch input:checked + .zm-switch-track {
  background: var(--zm-blue);
}

.zm-switch input:checked + .zm-switch-track .zm-switch-knob {
  transform: translateX(22px);
}

.zm-switch input:focus-visible + .zm-switch-track {
  outline: 2px solid rgba(29, 78, 137, 0.35);
  outline-offset: 2px;
}

.zm-switch-labels {
  position: relative;
  min-width: 4.5rem;
  font-size: 0.9rem;
}

.zm-switch-on,
.zm-switch-off {
  display: none;
}

.zm-switch input:checked ~ .zm-switch-labels .zm-switch-on {
  display: inline;
  color: var(--zm-blue);
}

.zm-switch input:not(:checked) ~ .zm-switch-labels .zm-switch-off {
  display: inline;
  color: #6b7280;
}

.zm-switch-text {
  font-size: 0.9rem;
  color: #445;
}

.product-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 0.35rem 0 1rem;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.1rem;
}

.banner-card {
  background: #fff;
  border: 1px solid var(--zm-border);
  border-radius: 16px;
  box-shadow: var(--zm-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.banner-card:hover {
  box-shadow: 0 10px 26px rgba(29, 78, 137, 0.12);
  transform: translateY(-2px);
}

.banner-card.is-just-saved {
  box-shadow: 0 0 0 2px var(--zm-orange), 0 10px 26px rgba(29, 78, 137, 0.12);
}

.banner-card.is-disabled {
  opacity: 0.72;
}

.banner-card-preview {
  position: relative;
  aspect-ratio: 16 / 7;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.banner-noimg {
  color: #98a4b3;
  font-weight: 700;
  font-size: 0.9rem;
}

.banner-badge {
  position: absolute;
  top: 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.banner-badge-right {
  right: 0.6rem;
  background: rgba(29, 78, 137, 0.92);
}

.banner-badge-left {
  right: 0.6rem;
  background: rgba(240, 165, 0, 0.95);
}

.banner-badge-off {
  left: 0.6rem;
  background: rgba(90, 100, 115, 0.9);
}

.banner-card-form {
  padding: 1rem 1.1rem 0.5rem;
  margin: 0;
  flex: 1;
}

.banner-link-note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.banner-link-note strong {
  color: var(--zm-blue);
}

.banner-card-actions {
  margin-top: 0.85rem;
}

.banner-delete-form {
  margin: 0;
  padding: 0 1.1rem 1.1rem;
}

.banner-delete-form .btn {
  width: 100%;
}

.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--zm-border);
}

.cart-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.form-grid label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--zm-blue-dark);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--zm-border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: #fff;
}

.cart-item__aside {
  text-align: left;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.qty-stepper--form input[type="hidden"] {
  display: none;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--zm-muted);
}

.settings-panel {
  margin: 2rem auto;
  max-width: 520px;
}

/* ---------- ربط الإداري ---------- */
.edari-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--zm-blue-dark);
}

.edari-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.edari-stat {
  background: #fff;
  border: 1px solid var(--zm-border);
  border-radius: var(--zm-radius);
  padding: 0.85rem 1rem;
}

.edari-stat__label {
  display: block;
  color: var(--zm-muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.edari-stat__value {
  font-size: 1.1rem;
  color: var(--zm-blue-dark);
  word-break: break-all;
}

.edari-actions-panel {
  margin-bottom: 1.25rem;
}

.edari-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.edari-hint {
  margin: 0;
  color: var(--zm-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.edari-setup,
.edari-last {
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

.edari-code {
  direction: ltr;
  text-align: left;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.edari-status--success { color: #047857; font-weight: 700; }
.edari-status--failed { color: #b91c1c; font-weight: 700; }
.edari-status--running { color: #b45309; font-weight: 700; }

.edari-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}

.edari-error-inline {
  color: #991b1b;
  font-size: 0.8rem;
  margin-top: 0.2rem;
  max-width: 320px;
}

.settings-section + .settings-section {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--zm-border);
}

.settings-section__title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  color: var(--zm-blue-dark);
}

.input-readonly {
  background: #f3f6fb;
  color: #555;
}

/* Admin */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: #eef2f7;
}

.admin-side {
  background: var(--zm-blue);
  color: white;
  padding: 1.5rem 1rem;
}

.admin-side h1 {
  margin: 0 0 1.25rem;
  font-size: 1.2rem;
}

.admin-side a {
  display: block;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.25rem;
  color: #e8eef7;
}

.admin-side a:hover,
.admin-side a.active {
  background: rgba(255, 255, 255, 0.12);
}

.admin-main { padding: 1.5rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: white;
  border-radius: var(--zm-radius);
  padding: 1rem;
  box-shadow: var(--zm-shadow);
}

.stat-card strong {
  display: block;
  font-size: 1.6rem;
  color: var(--zm-blue);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--zm-radius);
  overflow: hidden;
  box-shadow: var(--zm-shadow);
}

.table th,
.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--zm-border);
  text-align: right;
  vertical-align: top;
}

.table th {
  background: #f3f6fb;
  color: var(--zm-blue);
}

.admin-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-form.inline-fields {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #eef1f5;
}

.admin-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.admin-row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
  flex: 1;
  min-width: 220px;
  margin: 0;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 160px;
  margin: 0;
  font-weight: 700;
  color: #334;
}

.admin-field span {
  font-size: 0.82rem;
  color: #6b7280;
}

.admin-field input,
.admin-field select {
  width: 100%;
  border: 1px solid var(--zm-border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  line-height: 1.35;
  background: #fff;
  box-sizing: border-box;
  min-height: 42px;
}

.admin-field-sm {
  flex: 0 0 120px;
  min-width: 110px;
}

.admin-field-stock {
  flex: 0 0 120px;
  min-width: 110px;
}

.admin-field-stock input {
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 42px;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.admin-inline-delete {
  margin: 0;
  display: inline-flex;
}

.check {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

/* شريط أدوات المخزون */
.inv-toolbar {
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inv-pagination-top .pagination {
  margin: 0 0 1rem;
  justify-content: flex-start;
}

.inv-scroll-top-wrap {
  margin: 1.25rem 0 0;
  display: flex;
  justify-content: flex-start;
}

.inv-scroll-top {
  font-weight: 700;
}

.inv-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 480px;
}

.inv-search input[type="search"] {
  flex: 1;
  border: 1px solid var(--zm-border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  background: #fff;
}

.inv-search button {
  border: 0;
  background: var(--zm-blue);
  color: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 1rem;
}

.inv-search button:hover {
  background: var(--zm-blue-dark);
}

.inv-clear {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.85rem;
}

.inv-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  background: #fff;
  border: 1px solid #eef1f5;
  border-radius: 12px;
}

.inv-nav a {
  color: var(--zm-blue);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.inv-nav a:hover {
  background: #eef4fc;
}

.inv-nav a.active {
  background: var(--zm-blue);
  color: #fff;
}

/* صفوف المخزون ونموذج التعديل */
.inv-table {
  table-layout: fixed;
  width: 100%;
}

.inv-table th,
.inv-table .inv-product-row td {
  padding: 0.85rem 0.65rem;
  vertical-align: middle;
  text-align: center;
  overflow-wrap: anywhere;
}

/* نسب متوازنة بدون فراغ كبير بين المنتج والسعر */
.inv-table th:nth-child(1),
.inv-table .inv-product-row td:nth-child(1) { width: 11%; }

.inv-table th:nth-child(2),
.inv-table .inv-product-row td:nth-child(2) {
  width: 22%;
  text-align: right;
}

.inv-table th:nth-child(3),
.inv-table .inv-product-row td:nth-child(3) { width: 12%; }

.inv-table th:nth-child(4),
.inv-table .inv-product-row td:nth-child(4),
.inv-table .inv-col-stock {
  width: 10%;
  text-align: center !important;
}

.inv-table th:nth-child(5),
.inv-table .inv-product-row td:nth-child(5) { width: 22%; }

.inv-table th:nth-child(6),
.inv-table .inv-product-row td:nth-child(6) { width: 23%; }

.inv-col-image {
  padding: 0.5rem !important;
}

.inv-image-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  margin: 0 auto;
  max-width: 72px;
}

.inv-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.inv-image-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--zm-blue);
}

.inv-image-picker:hover .inv-image-hint {
  text-decoration: underline;
}

.inv-category-select {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.35rem;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #fff;
}

.inv-category-select:focus {
  outline: 2px solid rgba(29, 78, 137, 0.25);
  border-color: var(--zm-blue);
}

.inv-inline-form {
  margin: 0;
}

.inv-tag--off {
  background: #fef2f2;
  color: #b91c1c;
}

.inv-table .inv-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.inv-table .inv-thumb--empty {
  display: grid;
  place-items: center;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-size: 1.2rem;
}

.inv-nav a.inv-nav-review {
  color: #b45309;
  background: #fffbeb;
}

.inv-nav a.inv-nav-review:hover {
  background: #fef3c7;
}

.inv-nav a.inv-nav-review.active {
  background: var(--zm-orange);
  color: #fff;
}

.inv-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-inline-start: 0.35rem;
  vertical-align: middle;
}

.inv-tag--edari {
  background: #eef4fc;
  color: var(--zm-blue);
}

.inv-tag--missing {
  background: #fef2f2;
  color: #b91c1c;
}

.inv-table td.inv-actions {
  white-space: nowrap;
}

.inv-actions-wrap {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
}

.inv-actions {
  white-space: nowrap;
}

.inv-delete-form {
  display: inline;
  margin: 0;
}

.inv-product-row td {
  transition: background-color 0.42s ease, border-bottom-color 0.42s ease;
}

.inv-product-row.is-editing {
  background: #f3f7fc;
}

.inv-product-row.is-editing td {
  background: #f3f7fc;
  border-bottom-color: transparent;
}

.inv-edit-row td {
  padding: 0 !important;
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background-color 0.42s ease, border-bottom-color 0.42s ease;
}

.inv-edit-row.is-open td {
  background: #f3f7fc;
  border-bottom-color: #e5e7eb;
}

.inv-edit-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.42s cubic-bezier(0.33, 1, 0.32, 1);
}

.inv-edit-row.is-open .inv-edit-panel {
  grid-template-rows: 1fr;
}

.inv-edit-panel-inner {
  overflow: hidden;
  min-height: 0;
  margin: 0;
  padding: 0 1rem;
  background: transparent;
  border: 0;
  border-right: 3px solid transparent;
  transition: border-color 0.42s ease, padding 0.42s cubic-bezier(0.33, 1, 0.32, 1);
  pointer-events: none;
}

.inv-edit-row.is-open .inv-edit-panel-inner {
  padding: 0.35rem 1rem 1rem;
  border-right-color: var(--zm-blue);
  pointer-events: auto;
}

.inv-edit-form {
  margin: 0;
}

.inv-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1rem;
}

.inv-edit-full {
  grid-column: 1 / -1;
}

.inv-edit-form textarea {
  width: 100%;
  border: 1px solid var(--zm-border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  resize: vertical;
  min-height: 72px;
  background: #fff;
}

.inv-edit-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 1rem 0 1.1rem;
}

.inv-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* محادثة الطلب */
.order-chat-log {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}
.order-chat-bubble {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.order-chat-bubble.customer {
  align-self: flex-start;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.order-chat-bubble.staff {
  align-self: flex-end;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.order-chat-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.2rem;
}
.order-chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.order-chat-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
}

/* بنود الطلب — إطارات جذابة */
.order-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.order-item-frame {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.order-item-frame:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 16px rgba(29, 78, 137, 0.1);
  transform: translateY(-1px);
}

.order-item-frame__thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #eff6ff;
  display: grid;
  place-items: center;
  border: 1px solid #dbeafe;
}

.order-item-frame__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.order-item-frame__placeholder {
  font-size: 1.4rem;
  opacity: 0.55;
}

.order-item-frame__body {
  min-width: 0;
  flex: 1;
}

.order-item-frame__name {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.order-item-frame__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.order-item-frame__prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: left;
}

.order-item-frame__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.order-item-frame__qty {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1d4e89;
  background: #eff6ff;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.order-item-frame__price {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--zm-orange, #e67e22);
  line-height: 1.2;
}

.order-item-frame__unit {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.2;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1px;
  flex-shrink: 0;
  direction: ltr; /* − يسار ، + يمين */
}

.qty-stepper__btn {
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  box-shadow: none;
}

.qty-stepper__btn:hover {
  background: #fff;
  color: var(--zm-orange, #e67e22);
}

.qty-stepper__btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.qty-stepper__value {
  min-width: 1.25rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #0f172a;
  padding: 0 0.15rem;
}

@media (max-width: 520px) {
  .order-items-grid {
    grid-template-columns: 1fr;
  }
}

/* مجهز الطلبات — كروت القائمة */
.prep-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.prep-order-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.prep-order-card {
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  padding: 1rem 1.15rem;
  border-inline-start: 5px solid var(--zm-blue, #1d4e89);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  scroll-margin-top: 1rem;
}

.prep-order-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.11);
}

.prep-order-card.status-awaiting_customer {
  border-inline-start-color: var(--zm-orange, #e67e22);
}

.prep-order-card.status-preparing {
  border-inline-start-color: #0d9488;
}

.prep-order-card.status-shipped {
  border-inline-start-color: #6366f1;
}

.prep-order-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.prep-order-card__number {
  display: block;
  font-weight: 800;
  font-size: 1.05rem;
  color: #0f172a;
}

.prep-order-card__id time {
  color: #6b7280;
  font-size: 0.85rem;
}

.prep-status {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: #eff6ff;
  color: #1d4e89;
}

.prep-status--awaiting_customer {
  background: #fff7ed;
  color: #c2410c;
}

.prep-status--preparing {
  background: #f0fdfa;
  color: #0f766e;
}

.prep-status--shipped {
  background: #eef2ff;
  color: #4338ca;
}

.prep-status--pending {
  background: #f8fafc;
  color: #475569;
}

.prep-order-card__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.prep-order-card__label {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 0.15rem;
}

.prep-order-card__meta strong {
  font-size: 0.95rem;
  color: #1e293b;
  word-break: break-word;
}

.prep-order-card__total {
  color: var(--zm-orange, #e67e22) !important;
}

.prep-order-card__items {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prep-order-card__items li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: #334155;
}

.prep-order-card__qty {
  color: #64748b;
  font-weight: 600;
  flex-shrink: 0;
}

.prep-order-card__empty {
  color: #94a3b8;
}

.prep-order-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  justify-content: space-between;
}

.prep-order-card.is-editing {
  border-color: #93c5fd;
  box-shadow: 0 6px 18px rgba(29, 78, 137, 0.1);
}

.prep-edit-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.42s cubic-bezier(0.33, 1, 0.32, 1);
  margin-top: 0;
}

.prep-edit-wrap.is-open {
  grid-template-rows: 1fr;
  margin-top: 0.85rem;
}

.prep-edit-panel {
  overflow: hidden;
  min-height: 0;
}

.prep-edit-panel-inner {
  overflow: hidden;
  min-height: 0;
  padding: 0 0.15rem;
  border-top: 0 solid transparent;
  pointer-events: none;
  opacity: 0;
  transition: padding 0.42s cubic-bezier(0.33, 1, 0.32, 1),
              border-color 0.42s ease,
              opacity 0.28s ease;
}

.prep-edit-wrap.is-open .prep-edit-panel-inner {
  padding: 0.85rem 0 0.15rem;
  border-top: 1px solid #e2e8f0;
  pointer-events: auto;
  opacity: 1;
}

.prep-edit-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: center;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  color: #334155;
}

.prep-edit-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  color: #1d4e89;
}

.prep-edit-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.prep-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prep-edit-table th,
.prep-edit-table td {
  text-align: right;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}

.prep-edit-table th {
  color: #64748b;
  font-weight: 600;
}

.prep-qty-input {
  width: 4.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
}

.prep-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.prep-inline-chat {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
}

.prep-status-locked {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 18rem;
}

.prep-status-locked strong {
  color: #c2410c;
  font-size: 0.88rem;
  line-height: 1.35;
}

.prep-status--delivered {
  background: #f0fdf4;
  color: #15803d;
}

.prep-status--cancelled {
  background: #fef2f2;
  color: #b91c1c;
}

.prep-order-card.status-delivered {
  border-inline-start-color: #16a34a;
}

.prep-order-card.status-cancelled {
  border-inline-start-color: #dc2626;
}

.prep-order-card__status-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-end;
}

.prep-order-card__status-form .prep-order-card__label {
  width: 100%;
  margin: 0;
}

.prep-order-card__status-form select {
  min-width: 10.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

@media (max-width: 640px) {
  .prep-order-card__meta {
    grid-template-columns: 1fr;
  }
  .prep-order-card__foot {
    flex-direction: column;
    align-items: stretch;
  }
  .prep-order-card__status-form select {
    flex: 1;
  }
}

@media (max-width: 860px) {
  /* شريط علوي واحد مثل الكمبيوتر */
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0;
    justify-items: stretch;
  }

  .search-form {
    justify-self: stretch;
    max-width: none;
    min-width: 0;
    padding: 0.25rem 0.55rem;
  }

  .search-form input {
    font-size: 0.85rem;
    padding: 0.25rem;
  }

  .brand {
    justify-self: center;
    text-align: center;
    min-width: 0;
  }

  .brand-logo {
    font-size: 1.05rem;
    gap: 0.25rem;
  }

  .brand-tagline {
    display: none;
  }

  .header-actions {
    justify-self: end;
    justify-content: flex-end;
    gap: 0.35rem;
    max-width: none;
  }

  .header-actions .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .install-app-btn .install-app-icon {
    width: 17px;
    height: 17px;
  }

  /* بانر واحد على الهاتف */
  .hero-grid--desktop {
    display: none;
  }

  .hero-grid--mobile {
    display: grid;
    grid-template-columns: 1fr;
    margin: 0.85rem 0 1.1rem;
  }

  .hero-track {
    min-height: 180px;
    aspect-ratio: 16 / 9;
  }

  .admin-shell { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 70px 1fr; }
}

/* كروت الطلبات في لوحة الإدارة */
.admin-orders-heading h2 {
  margin: 0;
  color: #1d4e89;
}

.admin-orders-heading p {
  margin: 0.25rem 0 1.25rem;
  color: #64748b;
}

.admin-orders-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.admin-order-card {
  overflow: hidden;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-inline-start: 5px solid #64748b;
  border-radius: 15px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.07);
}

.admin-order-card--awaiting_customer { border-inline-start-color: #f59e0b; }
.admin-order-card--preparing { border-inline-start-color: #0d9488; }
.admin-order-card--shipped { border-inline-start-color: #6366f1; }
.admin-order-card--delivered { border-inline-start-color: #16a34a; }
.admin-order-card--cancelled { border-inline-start-color: #dc2626; }

.admin-order-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.admin-order-card__number {
  display: block;
  color: #0f172a;
  font-size: 1.05rem;
}

.admin-order-card__header time {
  display: block;
  margin-top: 0.1rem;
  color: #64748b;
  font-size: 0.8rem;
}

.admin-order-status {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-order-status--awaiting_customer { background: #fff7ed; color: #c2410c; }
.admin-order-status--preparing { background: #f0fdfa; color: #0f766e; }
.admin-order-status--shipped { background: #eef2ff; color: #4338ca; }
.admin-order-status--delivered { background: #f0fdf4; color: #15803d; }
.admin-order-status--cancelled { background: #fef2f2; color: #b91c1c; }

.admin-order-card__details {
  display: grid;
  grid-template-columns: 1.15fr 0.8fr 1.6fr 0.8fr;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.admin-order-card__details > div {
  min-width: 0;
}

.admin-order-card__details span,
.admin-order-card__details small {
  display: block;
  color: #94a3b8;
  font-size: 0.75rem;
}

.admin-order-card__details strong {
  display: block;
  margin-top: 0.12rem;
  color: #1e293b;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.admin-order-card__details .admin-order-card__total {
  color: #e67e22;
  font-size: 1rem;
}

.admin-order-items {
  padding: 0.85rem 1rem;
}

.admin-order-items h3 {
  margin: 0 0 0.6rem;
  color: #1d4e89;
  font-size: 0.95rem;
}

.admin-order-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid #eef2f7;
}

.admin-order-item__thumb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}

.admin-order-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.admin-order-item__name strong,
.admin-order-item__name small {
  display: block;
}

.admin-order-item__name strong { color: #1e293b; font-size: 0.9rem; }
.admin-order-item__name small { color: #94a3b8; font-size: 0.73rem; }
.admin-order-item__qty {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4e89;
  font-size: 0.82rem;
  font-weight: 700;
}
.admin-order-item__total { color: #e67e22; font-size: 0.88rem; white-space: nowrap; }
.admin-order-card__legacy { white-space: pre-line; color: #64748b; }

.admin-order-card__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.admin-order-status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem;
}

.admin-order-status-form label {
  width: 100%;
  color: #64748b;
  font-size: 0.75rem;
}

.admin-order-status-form select {
  min-width: 11rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

@media (max-width: 900px) {
  .admin-order-card__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .admin-order-card__details { grid-template-columns: 1fr; }
  .admin-order-item { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .admin-order-item__total { grid-column: 2 / -1; }
  .admin-order-card__footer { align-items: stretch; flex-direction: column; }
  .admin-order-status-form,
  .admin-order-status-form select { width: 100%; }
}

/* تفاصيل طلب الإدارة */
.admin-order-back {
  margin: 0 0 0.85rem;
}

.admin-order-back a {
  color: #1d4e89;
  text-decoration: none;
  font-weight: 600;
}

.admin-order-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-inline-start: 5px solid #1d4e89;
  border-radius: 14px;
}

.admin-order-detail-head h2 {
  margin: 0;
  color: #1d4e89;
}

.admin-order-detail-head p {
  margin: 0.3rem 0 0;
  color: #64748b;
}

.admin-order-summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-order-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.admin-order-summary-card h3 {
  margin: 0 0 0.85rem;
  color: #1d4e89;
  font-size: 1.05rem;
}

.admin-order-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin: 0;
}

.admin-order-dl dt {
  color: #94a3b8;
  font-size: 0.75rem;
}

.admin-order-dl dd {
  margin: 0.15rem 0 0;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.admin-order-dl--full {
  grid-column: 1 / -1;
}

.admin-order-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-order-timeline li {
  position: relative;
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.admin-order-timeline li.is-done {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.admin-order-timeline li.is-current {
  border-color: #fdba74;
  background: #fff7ed;
}

.admin-order-timeline strong {
  display: block;
  color: #0f172a;
  margin-bottom: 0.2rem;
}

.admin-order-timeline p {
  margin: 0;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-order-timeline time {
  display: block;
  margin-top: 0.35rem;
  color: #94a3b8;
  font-size: 0.75rem;
}

.admin-order-prep-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.admin-order-prep-stats > div {
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.admin-order-prep-stats span {
  display: block;
  color: #94a3b8;
  font-size: 0.72rem;
}

.admin-order-prep-stats strong {
  display: block;
  margin-top: 0.2rem;
  color: #1e293b;
  font-size: 0.88rem;
}

.admin-order-chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.35rem 0;
}

@media (max-width: 900px) {
  .admin-order-summary-grid {
    grid-template-columns: 1fr;
  }
  .admin-order-dl,
  .admin-order-prep-stats {
    grid-template-columns: 1fr;
  }
}

/* ===== إضافات مرحلة الإنتاج: خصومات، توصيل، إجراءات الطلب ===== */

.badge-discount {
  position: absolute;
  top: 0.5rem;
  inset-inline-start: 0.5rem;
  background: #dc2626;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  z-index: 2;
}

.badge-discount--inline {
  position: static;
  display: inline-block;
  margin-inline-start: 0.4rem;
}

.price-was {
  color: #9ca3af;
  font-size: 0.85em;
  font-weight: 500;
  margin-inline-start: 0.4rem;
}

.stock-low {
  color: #b45309;
  font-weight: 700;
}

.checkout-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1.2fr 1fr;
}

.checkout-line {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.checkout-line--sum {
  border-bottom: none;
  padding-top: 0.6rem;
}

.checkout-total {
  margin-top: 0.75rem;
  font-size: 1.25rem;
  border-top: 2px solid #e5e7eb;
  padding-top: 0.75rem;
}

.checkout-hint {
  color: #6b7280;
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.product-detail-grid {
  margin: 1.25rem 0;
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 1.5rem;
}

.order-totals-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1rem;
}

.order-totals-box > div {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.order-totals-box__grand {
  border-top: 1px solid #e5e7eb;
  margin-top: 0.35rem;
  padding-top: 0.5rem !important;
  font-size: 1.05rem;
}

.order-cancel-note {
  color: #6b7280;
  font-size: 0.85rem;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #dc2626;
}

.btn-danger:hover { background: #b91c1c; }

.admin-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1rem;
}

.admin-search-form input[type="search"] { min-width: 260px; }

.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 0.6rem 0;
}

.admin-inline-form label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-province {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.admin-province summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1rem;
}

.admin-province__meta { color: #6b7280; font-size: 0.85rem; }

.admin-order-actions {
  margin-top: 1rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.75rem;
}

.admin-order-actions h4 { margin: 0 0 0.5rem; color: #1d4e89; }

.admin-side__user {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  opacity: 0.85;
}

.admin-settings-form { max-width: 640px; }

@media (max-width: 820px) {
  .checkout-grid,
  .product-detail-grid { grid-template-columns: 1fr; }
}

/* ===== تثبيت التطبيق (PWA) ===== */
.install-app-btn .install-app-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.install-app-btn.is-ready {
  border-color: var(--zm-orange);
  color: var(--zm-orange);
}

.pwa-install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 80;
}

.pwa-install-sheet {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 1.5rem));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  z-index: 90;
  padding: 1rem 1.1rem 1.15rem;
}

.pwa-install-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--zm-blue);
}

.pwa-install-close {
  border: 0;
  background: #f3f4f6;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}

.pwa-install-sheet__body {
  color: #374151;
  line-height: 1.7;
  font-size: 0.95rem;
}

.pwa-steps {
  margin: 0.5rem 0 0.75rem;
  padding-inline-start: 1.2rem;
}

.pwa-steps li { margin: 0.35rem 0; }

.pwa-note {
  color: #6b7280;
  font-size: 0.88rem;
  margin: 0;
}

.pwa-glyph {
  display: inline-block;
  min-width: 1.4em;
  text-align: center;
  font-weight: 700;
  color: var(--zm-blue);
}

body.pwa-sheet-open { overflow: hidden; }

@media (min-width: 900px) {
  .pwa-install-sheet {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/* شاشة افتتاح التطبيق المثبت */
.pwa-boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #1d4e89;
  display: grid;
  place-items: center;
  transition: opacity 0.35s ease;
}

.pwa-boot-splash img {
  width: min(72vw, 280px);
  height: auto;
  display: block;
}

.pwa-boot-splash.is-done {
  opacity: 0;
  pointer-events: none;
}
