@import url("https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Cairo:wght@400;500;600;700;800;900&display=swap");

:root {
  --purple: #9333ea;
  --purple-dark: #7e22ce;
  --purple-soft: #f3e8ff;
  --navy: #1c205f;
  --amber: #f59e0b;
  --green: #16a34a;
  --green-2: #22c55e;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #e11d48;
  --bg: #f9f7f6;
  --card: #ffffff;
  --ink: #030711;
  --muted: #71717a;
  --line: #e5e7eb;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.16);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Almarai", "Cairo", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  min-height: 100vh;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Cairo", sans-serif;
  font-weight: 800;
  letter-spacing: -0.025em;
}

button {
  font-family: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

.hidden { display: none !important; }
.mobile-only { display: block; }
.desktop-only { display: none; }

/* ============ Toast ============ */
#toast {
  position: fixed;
  z-index: 9999;
  bottom: 90px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #0d8a3d;
  color: #fff;
  border-radius: 14px;
  padding: 11px 20px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  max-width: 90vw;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.error { background: #dc2626; }

/* ============ Desktop header ============ */
.desktop-header {
  display: none;
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 60;
  background: #fff;
  border-bottom: 1px solid rgba(228, 228, 231, 0.4);
  box-shadow: var(--shadow-sm);
}

.desktop-header .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.desktop-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #f4f4f5;
}

.brand-logo {
  height: 40px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

.d-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-nav .nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: 0.2s;
  white-space: nowrap;
}

.d-nav .nav-btn:hover { background: #f4f4f5; }
.d-nav .nav-btn.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 0 15px rgba(28, 32, 95, 0.35);
}
.d-nav .nav-btn.pages {
  border: 1px solid #e9d5ff;
  color: var(--purple);
}
.d-nav .nav-btn.pages:hover { background: #faf5ff; }

.d-search {
  position: relative;
  flex: 1;
  max-width: 360px;
  margin: 0 16px;
}

.d-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0 40px 0 14px;
  outline: none;
  font-family: "Cairo", sans-serif;
  transition: 0.2s;
}

.d-search input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12);
}

.d-search .icon {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  color: var(--muted);
}

.d-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.d-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.d-icon-btn:hover { background: #f4f4f5; }

.d-icon-btn .badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ============ Mobile header ============ */
.mobile-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 16px 16px 24px;
  border-radius: 0 0 40px 40px;
  border-bottom: 1px solid rgba(228, 228, 231, 0.5);
  box-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.1);
}

.m-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.m-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.m-user-icon {
  width: 40px;
  height: 40px;
  border-radius: 16px;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 18px rgba(147, 51, 234, 0.35);
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.m-user-txt {
  display: flex;
  flex-direction: column;
}

.m-hello {
  font-size: 10px;
  color: #a1a1aa;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.m-name {
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  color: #09090b;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(to top right, #059669, #4ade80);
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: "Cairo", sans-serif;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  transition: transform 0.15s;
}

.m-balance:active { transform: scale(0.95); }

.m-search-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.m-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.m-search input {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  background: #fff;
  border: 2px solid rgba(147, 51, 234, 0.3);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  outline: none;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  transition: 0.2s;
}

.m-search input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12);
}

.m-search input::placeholder { color: #a1a1aa; }

.m-search .icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  color: var(--purple);
}

.m-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.m-icon-btn:active { transform: scale(0.9); }
.m-icon-btn .icon { width: 20px; height: 20px; color: #09090b; }

.m-icon-btn .dot {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  border: 1px solid #fff;
}

/* ============ Main ============ */
main {
  padding-top: 150px;
  padding-bottom: 96px;
  min-height: 100vh;
}

.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.container-page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============ Hero ============ */
.hero {
  position: relative;
  height: 144px;
  margin: 0 4px;
  border-radius: 16px;
  overflow: hidden;
  border: 4px solid #fff;
  background: #111827;
  box-shadow: var(--shadow-sm);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}

.hero-slide.active { opacity: 1; pointer-events: auto; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }

.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: 0.2s;
}

.hero-arrow:hover { background: rgba(255, 255, 255, 0.35); }
.hero-arrow.prev { inset-inline-end: 10px; }
.hero-arrow.next { inset-inline-start: 10px; }
.hero-arrow .icon { width: 16px; }

.hero-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}

.hero-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  transition: 0.3s;
}

.hero-dots i.active { width: 22px; background: #fff; }

.hero-cards {
  display: none;
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  gap: 10px;
  z-index: 4;
}

.hero-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--purple);
  color: #fff;
  padding: 10px 14px;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.hero-user-card .txt { text-align: start; }
.hero-user-card small { display: block; font-size: 10px; opacity: 0.9; line-height: 1.2; }
.hero-user-card strong { font-family: "Cairo", sans-serif; font-size: 14px; font-weight: 900; }
.hero-user-card .circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-balance-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-2);
  color: #fff;
  padding: 10px 16px;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.hero-balance-card small { display: block; font-size: 10px; opacity: 0.95; line-height: 1.2; }
.hero-balance-card strong { font-family: "Cairo", sans-serif; font-size: 18px; font-weight: 900; line-height: 1.1; }

/* ============ KPI ============ */
.kpi-section { display: none; padding: 32px 24px 8px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 20px;
}

.kpi {
  border-radius: 24px;
  padding: 18px 20px;
  color: #fff;
  min-height: 134px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}

.kpi .kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.kpi .kpi-icon .icon { width: 14px; height: 14px; }
.kpi b { font-family: "Cairo", sans-serif; font-size: 28px; line-height: 1; font-weight: 900; }
.kpi span { font-size: 12px; font-weight: 700; opacity: 0.95; }

.kpi.wait { background: linear-gradient(145deg, #f59e0b, #d97706); }
.kpi.prep { background: linear-gradient(145deg, #3b82f6, #2563eb); }
.kpi.ship { background: linear-gradient(145deg, #8b5cf6, #6d28d9); }
.kpi.delivering { background: linear-gradient(145deg, #06b6d4, #0891b2); }
.kpi.delivered { background: linear-gradient(145deg, #10b981, #059669); }
.kpi.partial { background: linear-gradient(145deg, #a855f7, #7c3aed); }
.kpi.returned { background: linear-gradient(145deg, #f43f5e, #e11d48); }
.kpi.cancelled { background: linear-gradient(145deg, #64748b, #475569); }

/* ============ Categories ============ */
.cat-section {
  background: #fff;
  border-radius: 24px;
  margin: 14px 16px 0;
  padding: 14px 0 12px;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(228, 228, 231, 0.6);
  overflow: hidden;
}

.cat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
  font-family: "Cairo", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #18181b;
}

.cat-title .icon { color: #10b981; }

.cats-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cats-row::-webkit-scrollbar { display: none; }

.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: none;
  cursor: pointer;
}

.cat-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(228, 228, 231, 0.5);
  transition: 0.35s;
  background: #f4f4f5;
}

.cat-circle img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.cat:hover .cat-circle img { transform: scale(1.1); }
.cat:hover .cat-circle { border-color: #fcd34d; }

.cat.active .cat-circle {
  background: #252a56;
  border-color: #252a56;
  color: #fff;
  box-shadow: 0 8px 20px rgba(28, 32, 95, 0.25);
  transform: scale(1.04);
}

.cat-label {
  font-family: "Cairo", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #71717a;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: 0.3s;
}

.cat.active .cat-label {
  background: var(--amber);
  color: #fff;
  font-weight: 800;
}

/* ============ Products ============ */
.products-section {
  padding: 18px 0 30px;
}

.products-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.products-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.products-title .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #18181b;
  color: #fff;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
}

.products-title .pill .icon { color: #34d399; width: 16px; }

.products-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.mobile-products {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-card {
  display: flex;
  flex-direction: row;
  height: 128px;
  background: #fff;
  border: 1px solid rgba(228, 228, 231, 0.45);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
}

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

.m-card-img {
  position: relative;
  width: 128px;
  flex: none;
  background: #f9fafb;
  overflow: hidden;
  cursor: pointer;
}

.m-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s;
}

.m-card:hover .m-card-img img { transform: scale(1.08); }

.m-fav {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  box-shadow: var(--shadow-sm);
  z-index: 2;
  transition: 0.2s;
}

.m-fav .icon { width: 14px; height: 14px; }
.m-fav.active { color: #e11d48; }
.m-fav.active .icon { fill: currentColor; }

.m-stock {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  background: #22c55e;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 2;
  white-space: nowrap;
}

.m-card-body {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-inline-start: 1px solid #f9fafb;
  background: #fff;
}

.m-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.m-card-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: start; }

.m-card-title {
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-card:hover .m-card-title { color: var(--purple); }

.stars { display: flex; align-items: center; gap: 2px; direction: ltr; }
.m-card-body .stars { justify-content: flex-end; }
.stars .icon { width: 14px; height: 14px; stroke: #e4e4e7; fill: #f4f4f5; stroke-width: 2; }
.stars .on { stroke: #f59e0b; fill: #f59e0b; }

.m-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #4f46e5;
  font-family: "Cairo", sans-serif;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 4px;
  flex: none;
}

.m-brand .icon { width: 13px; height: 13px; }
.m-brand span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

.m-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-top: auto;
}

.price-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 3px 7px;
  min-width: 54px;
  box-shadow: var(--shadow-sm);
}

.price-box small { font-size: 8px; color: var(--blue-dark); font-weight: 700; line-height: 1.2; }

.price-line { display: flex; align-items: baseline; gap: 2px; }

.price-line b { font-family: "Cairo", sans-serif; font-size: 14px; color: var(--blue-dark); line-height: 1; }
.price-line em { font-style: normal; font-size: 8px; color: var(--blue); font-weight: 500; }
.price-old { font-size: 8px; color: #a1a1aa; text-decoration: line-through; }

.comm-pill {
  background: #f97316;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  margin: 0;
}

.add-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(to top right, #059669, #22c55e, #059669);
  box-shadow: var(--shadow-md);
  flex: none;
  transition: 0.18s;
}

.add-btn:hover { background: linear-gradient(to top right, #10b981, #4ade80); }
.add-btn:active { transform: scale(0.93); }
.add-btn .icon { width: 19px; height: 19px; }
.add-btn.added { background: linear-gradient(to top right, #7e22ce, #a855f7); }

/* Desktop products */
.desktop-products { display: none; }

.table-head {
  display: none;
  grid-template-columns: 150px 1.9fr 0.85fr 1.2fr 0.95fr 1fr 1.1fr 200px;
  gap: 20px;
  align-items: center;
  padding: 14px 20px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(to right, #18181b, #27272a, #18181b);
  border: 1px solid rgba(228, 228, 231, 0.4);
  box-shadow: var(--shadow-sm);
  color: #fff;
  font-family: "Cairo", sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.d-card {
  display: grid;
  grid-template-columns: 150px 1.9fr 0.85fr 1.2fr 0.95fr 1fr 1.1fr 200px;
  gap: 20px;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(228, 228, 231, 0.45);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
  margin-bottom: 26px;
  transition: box-shadow 0.3s;
}

.d-card:hover { box-shadow: var(--shadow-md); z-index: 2; }

.d-thumb {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #f9fafb;
  margin: 0 auto;
  cursor: pointer;
}

.d-thumb img { width: 100%; height: 100%; object-fit: cover; transition: 0.7s; }
.d-card:hover .d-thumb img { transform: scale(1.1); }

.d-thumb .m-fav { opacity: 0; transition: 0.3s; }
.d-card:hover .m-fav { opacity: 1; }

.d-name {
  font-family: "Cairo", sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.6;
  text-align: center;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.d-card:hover .d-name { color: var(--purple); }

.d-price { text-align: center; color: var(--blue-dark); }
.d-price b { font-family: "Cairo", sans-serif; font-size: 20px; font-weight: 900; line-height: 1; display: block; }
.d-price span { font-family: "Cairo", sans-serif; font-size: 14px; font-weight: 800; display: block; margin-top: 2px; }

.d-rating { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.d-rating .stars .icon { width: 16px; height: 16px; }
.d-rating small { font-size: 10px; color: var(--muted); font-weight: 700; }

.d-comm {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 12px;
  background: #f97316;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  max-width: 120px;
  margin: 0 auto;
  width: 100%;
}

.d-stock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  max-width: 120px;
  margin: 0 auto;
  width: 100%;
}

.d-seller { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.d-seller .icon { width: 16px; height: 16px; color: #4f46e5; }
.d-seller span { font-family: "Cairo", sans-serif; font-size: 12px; font-weight: 700; color: #4f46e5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.d-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.d-actions .add-btn {
  width: auto;
  height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  gap: 8px;
  font-family: "Cairo", sans-serif;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.d-actions .add-btn .icon { width: 18px; height: 18px; }
.d-actions .fav-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: #71717a; background: #fff; }
.d-actions .fav-btn .icon { width: 18px; }
.d-actions .fav-btn.active { color: #e11d48; border-color: #fecdd3; background: #fff1f2; }
.d-actions .fav-btn.active .icon { fill: currentColor; }

.empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .icon { width: 52px; height: 52px; margin: 0 auto 14px; color: #d4d4d8; }
.empty h3 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 13px; margin-bottom: 16px; }

/* ============ Buttons / forms ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 800;
  transition: 0.2s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 8px 20px -8px rgba(147, 51, 234, 0.6); }
.btn-primary:hover { background: var(--purple-dark); }
.btn-green { background: linear-gradient(to top right, #059669, #22c55e); color: #fff; }
.btn-green:hover { filter: brightness(1.06); }
.btn-dark { background: #18181b; color: #fff; }
.btn-outline { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-outline:hover { background: #fafafa; }
.btn-soft { background: var(--purple-soft); color: var(--purple-dark); }
.btn-danger { background: #fff1f2; color: #e11d48; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 12px; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 800; color: #3f3f46; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  outline: none;
  transition: 0.2s;
}
.field textarea { height: 90px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12);
}

/* ============ Inner pages ============ */
.inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4px 16px 40px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 18px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: 0.2s;
}

.back-btn:hover { background: #fafafa; }
.page-head h1 { font-size: 21px; }
.page-head p { font-size: 12px; color: var(--muted); font-weight: 700; }

.panel {
  background: #fff;
  border: 1px solid rgba(228, 228, 231, 0.7);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.panel + .panel { margin-top: 14px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; }

/* Product detail */
.product-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }

.gallery {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.gallery .m-fav { top: 12px; inset-inline-end: 12px; width: 38px; height: 38px; background: #fff; opacity: 1; }

.product-detail .cat-chip {
  display: inline-block;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.product-detail h1 { font-size: 21px; line-height: 1.5; margin-bottom: 8px; }

.rating-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 12px; }

.price-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 6px; }
.price-row b { font-family: "Cairo", sans-serif; font-size: 30px; color: var(--blue-dark); line-height: 1; }
.price-row .cur { font-size: 14px; color: var(--blue); font-weight: 700; }
.price-row .old { font-size: 14px; color: #a1a1aa; text-decoration: line-through; }
.price-row .off { background: #fee2e2; color: #dc2626; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }

.stock-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 800; }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.orange { background: #ffedd5; color: #c2410c; }
.tag.blue { background: #dbeafe; color: #1d4ed8; }

.opt-group { margin-bottom: 16px; }
.opt-group > span { display: block; font-size: 12px; font-weight: 800; color: #3f3f46; margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }

.opt {
  min-width: 44px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: 0.2s;
}

.opt.on { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-dark); box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.12); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.qty button { width: 40px; height: 42px; display: flex; align-items: center; justify-content: center; color: #3f3f46; }
.qty button:hover { background: #fafafa; }
.qty b { min-width: 40px; text-align: center; font-family: "Cairo", sans-serif; }

.commission-area { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.sell-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }

.base-info span,
.sell-field > span { display: block; font-size: 12px; font-weight: 800; color: #3f3f46; margin-bottom: 6px; }

.base-info b { font-family: "Cairo", sans-serif; font-size: 20px; font-weight: 900; color: var(--ink); line-height: 1.2; }
.base-info b em { font-style: normal; font-size: 12px; font-weight: 800; margin-inline-start: 2px; }

.sell-field { display: flex; flex-direction: column; }
.sell-field input {
  width: 100%;
  height: 42px;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #f4f4f5;
  padding: 0 12px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  direction: ltr;
  outline: none;
  transition: 0.2s;
}
.sell-field input::placeholder { color: #a1a1aa; font-weight: 600; }
.sell-field input:focus { background: #fff; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12); }

.qty-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.qty-line > span { font-size: 12px; font-weight: 800; color: #3f3f46; }

.commission-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f4f4f5;
  border: 1px solid #ececef;
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 14px;
}
.commission-total > span { font-size: 13px; font-weight: 800; color: #3f3f46; }
.commission-total b { font-family: "Cairo", sans-serif; font-size: 22px; font-weight: 900; color: var(--blue-dark); }
.commission-total b em { font-style: normal; font-size: 12px; font-weight: 800; margin-inline-start: 2px; }

.commission-hint { display: none; color: #e11d48; font-size: 11px; font-weight: 700; margin-top: 8px; }

.buy-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.buy-row .btn { flex: 1 1 140px; min-width: 0; padding: 0 12px; font-size: 13px; }
.buy-row .btn[disabled] {
  opacity: 1;
  background: #ececef !important;
  border: 1px solid #e4e4e7;
  color: #a1a1aa;
  box-shadow: none;
  filter: none;
}
.buy-row .fav-btn { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: #fff; color: #71717a; flex: none; }
.buy-row .fav-btn .icon { width: 20px; }
.buy-row .fav-btn.active { color: #e11d48; background: #fff1f2; border-color: #fecdd3; }
.buy-row .fav-btn.active .icon { fill: currentColor; }

.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.perk { background: #fafafa; border-radius: 12px; padding: 10px 6px; text-align: center; font-size: 10px; font-weight: 700; color: #52525b; }
.perk .icon { width: 18px; height: 18px; margin: 0 auto 4px; color: var(--purple); }

.desc { font-size: 13px; line-height: 1.9; color: #52525b; white-space: pre-line; }

.related { margin-top: 28px; }
.related h2 { font-size: 17px; margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.mini-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: 0.2s; }
.mini-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mini-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.mini-card .mini-body { padding: 10px; }
.mini-card h4 { font-size: 12px; line-height: 1.5; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-card .mini-price { margin-top: 6px; font-family: "Cairo", sans-serif; font-weight: 900; color: var(--blue-dark); font-size: 14px; }

/* Cart */
.cart-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  margin-bottom: 10px;
}

.cart-item img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; background: #f4f4f5; }
.cart-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cart-item-body h4 { font-size: 13px; line-height: 1.5; }
.cart-item-body .price { font-family: "Cairo", sans-serif; font-weight: 900; color: var(--blue-dark); }
.cart-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.remove-btn { color: #e11d48; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.remove-btn:hover { background: #fff1f2; }

.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13px; color: #52525b; font-weight: 700; }
.summary-row.total { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 14px; font-size: 16px; color: var(--ink); }
.summary-row.total b { font-family: "Cairo", sans-serif; font-size: 22px; color: var(--blue-dark); }

.checkout-form { display: grid; gap: 12px; }
.checkout-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pay-method {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--purple);
  background: #faf5ff;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
}

.pay-method .icon { color: var(--purple); }

/* Orders */
.order-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.order-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.order-id { font-family: "Cairo", sans-serif; font-weight: 900; font-size: 14px; }
.order-date { font-size: 11px; color: var(--muted); font-weight: 700; }
.status-pill { font-size: 11px; font-weight: 800; padding: 5px 12px; border-radius: 999px; }
.status-pill.wait { background: #fef3c7; color: #b45309; }
.status-pill.proc { background: #dbeafe; color: #1d4ed8; }
.status-pill.ship { background: #ede9fe; color: #6d28d9; }
.status-pill.delivering { background: #cffafe; color: #0e7490; }
.status-pill.done { background: #dcfce7; color: #15803d; }
.status-pill.partial { background: #f3e8ff; color: #7e22ce; }
.status-pill.returned { background: #ffe4e6; color: #be123c; }
.status-pill.cancel { background: #f4f4f5; color: #52525b; }

.order-items { display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.order-item img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.order-item .nm { flex: 1; min-width: 0; }
.order-item .nm b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-item .nm span { color: var(--muted); font-size: 11px; }
.order-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.order-foot b { color: var(--blue-dark); font-family: "Cairo", sans-serif; font-size: 16px; }

.timeline { display: flex; align-items: flex-start; justify-content: space-between; margin: 16px 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; top: 11px; inset-inline: 12%; height: 2px; background: #e4e4e7; }
.timeline .step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 9px; font-weight: 700; color: #a1a1aa; flex: 1; text-align: center; }
.timeline .dot { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid #e4e4e7; display: flex; align-items: center; justify-content: center; }
.timeline .dot .icon { width: 12px; height: 12px; }
.timeline .step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.timeline .step.done { color: #15803d; }

.track-row { display: flex; gap: 8px; }
.track-row input { flex: 1; height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; outline: none; }

/* Favorites grid */
.fav-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* Wallet */
.wallet-hero {
  background: linear-gradient(135deg, #6d28d9, #9333ea 45%, #c084fc);
  color: #fff;
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 40px -20px rgba(147, 51, 234, 0.7);
  position: relative;
  overflow: hidden;
}

.wallet-hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); top: -70px; inset-inline-start: -50px; }
.wallet-hero small { font-size: 12px; opacity: 0.9; font-weight: 700; }
.wallet-hero .amount { font-family: "Cairo", sans-serif; font-size: 34px; font-weight: 900; margin: 6px 0 16px; }
.wallet-hero .amount span { font-size: 15px; font-weight: 700; }
.wallet-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.wallet-stats div { background: rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 10px; text-align: center; }
.wallet-stats b { display: block; font-family: "Cairo", sans-serif; font-size: 15px; }
.wallet-stats span { font-size: 9px; opacity: 0.9; }

.ref-box { display: flex; gap: 8px; }
.ref-box input { flex: 1; height: 44px; border: 1px dashed var(--purple); background: #faf5ff; border-radius: 10px; padding: 0 12px; color: var(--purple-dark); font-weight: 700; outline: none; }

/* Account */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 62px; height: 62px; border-radius: 20px; background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "Cairo", sans-serif; font-size: 26px; font-weight: 900; flex: none; }
.profile-head h2 { font-size: 19px; }
.profile-head p { font-size: 12px; color: var(--muted); font-weight: 700; }

.menu-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid #f4f4f5; font-size: 13px; font-weight: 700; cursor: pointer; width: 100%; text-align: start; }
.menu-item:last-child { border-bottom: 0; }
.menu-item .ico { width: 36px; height: 36px; border-radius: 10px; background: #faf5ff; color: var(--purple); display: flex; align-items: center; justify-content: center; flex: none; }
.menu-item .chev { margin-inline-start: auto; color: #d4d4d8; }
.menu-item.danger { color: #e11d48; }
.menu-item.danger .ico { background: #fff1f2; color: #e11d48; }

.auth-tabs { display: flex; background: #f4f4f5; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; height: 36px; border-radius: 9px; font-size: 12px; font-weight: 800; color: var(--muted); }
.auth-tabs button.on { background: #fff; color: var(--purple-dark); box-shadow: var(--shadow-sm); }

/* Affiliate */
.aff-hero { background: linear-gradient(135deg, #18181b, #3b0764); color: #fff; border-radius: 22px; padding: 24px; }
.aff-hero h2 { font-size: 22px; margin-bottom: 6px; }
.aff-hero p { font-size: 13px; color: rgba(255, 255, 255, 0.75); line-height: 1.8; }
.steps { display: grid; gap: 10px; margin-top: 14px; }
.step-card { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); font-family: "Cairo", sans-serif; font-weight: 900; display: flex; align-items: center; justify-content: center; flex: none; }
.step-card h4 { font-size: 13px; margin-bottom: 2px; }
.step-card p { font-size: 11px; color: var(--muted); line-height: 1.7; }

/* ============ Bottom nav ============ */
.bottom-nav {
  display: block;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 55;
  background: #fff;
  border-top: 1px solid #f3f4f6;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.03);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 4px;
  position: relative;
}

.nav-side { flex: 1; display: flex; justify-content: space-evenly; align-items: center; }

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px;
  border-radius: 12px;
  color: #0f172a;
  transition: 0.2s;
}

.nav-item .icon { width: 20px; height: 20px; margin-bottom: 2px; }
.nav-item span { font-family: "Cairo", sans-serif; font-size: 8px; font-weight: 900; }
.nav-item.active { color: var(--purple); }
.nav-item .badge {
  position: absolute;
  top: -2px;
  inset-inline-end: 8px;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.nav-center {
  flex: 0.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -32px;
}

.nav-center .home-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #9333ea;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(147, 51, 234, 0.35);
  transform: scale(1.1);
  transition: 0.2s;
}

.nav-center .home-circle .icon { width: 24px; height: 24px; }
.nav-center span { font-family: "Cairo", sans-serif; font-size: 9px; font-weight: 900; color: var(--purple); margin-top: 4px; }

/* ============ Floating ============ */
.wa-float {
  position: fixed;
  bottom: 146px;
  left: 24px;
  right: auto;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
  transition: 0.3s;
}

.wa-float:hover { transform: scale(1.08); background: #1d4ed8; }

.install-card {
  position: fixed;
  bottom: 120px;
  inset-inline-end: 24px;
  inset-inline-start: 24px;
  z-index: 9998;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  transition: 0.3s;
}

.install-card.hide { opacity: 0; visibility: hidden; transform: translateY(20px); }
.install-close { position: absolute; top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; border-radius: 50%; color: #a1a1aa; display: flex; align-items: center; justify-content: center; }
.install-close:hover { background: #f4f4f5; }
.install-icon { width: 64px; height: 64px; border-radius: 18px; background: #dbeafe; color: #2563eb; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.install-icon .icon { width: 32px; height: 32px; }
.install-card h4 { font-size: 16px; margin-bottom: 4px; }
.install-card p { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.install-card .btn { height: 44px; background: linear-gradient(to top right, #1d4ed8, #3b82f6); color: #fff; box-shadow: 0 8px 20px -8px rgba(37, 99, 235, 0.6); }
.install-card .btn .icon { width: 16px; }

/* ============ Desktop ============ */
@media (min-width: 1024px) {
  .desktop-header { display: block; }
  .mobile-header { display: none; }
  .bottom-nav { display: none; }
  .install-card {
    inset-inline-start: 32px;
    inset-inline-end: auto;
    bottom: 32px;
    width: 335px;
    text-align: center;
  }
  .wa-float { bottom: 40px; left: 28px; right: auto; width: 52px; height: 52px; display: flex; }
  .wa-float .icon { width: 26px; height: 26px; }
  main { padding-top: 108px; padding-bottom: 60px; }
  .container-page { max-width: 1339px; padding: 0 4px; }
  #toast { bottom: 32px; }

  .hidden-desktop { display: none !important; }
  .desktop-only { display: block; }
  .table-head { display: grid; }
  .mobile-only { display: none !important; }

  .hero { height: 292px; border-width: 4px; border-radius: 40px; margin: 0; }
  .hero-cards { display: flex; inset-inline: 22px; top: 22px; justify-content: space-between; }
  .hero-user-card, .hero-balance-card { padding: 12px 18px; }

  .kpi-section { display: block; padding: 56px 0 8px; margin: 0 -4px; }
  .cat-section { max-width: 584px; margin: 26px auto 0; padding: 24px 10px 20px; border-radius: 30px; }
  .cat-title { display: none; }
  .cats-row { justify-content: center; gap: 34px; padding: 0 10px; }
  .cat-circle { width: 80px; height: 80px; }
  .cat-label { font-size: 13px; font-weight: 900; max-width: 140px; }
  .cat.active .cat-label { font-size: 13px; }
  .cat.active .cat-circle { width: 80px; height: 80px; background: #252a56; border-color: #252a56; box-shadow: 0 10px 24px rgba(28, 32, 95, 0.2); }
  .cat.active .cat-label { background: var(--amber); }

  .products-section {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 40px;
    padding: 28px 24px 34px;
    position: relative;
    overflow: hidden;
  }
  .products-section::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 16px;
    background: linear-gradient(to right, #10b981, #4ade80, #059669);
  }
  .products-head { margin-bottom: 26px; }
  .products-title { font-size: 14px; }
  .products-title .pill { padding: 11px 22px; border-radius: 14px; }
  .mobile-products { display: none; }
  .desktop-products { display: block; }

  .product-layout { grid-template-columns: 420px 1fr; gap: 26px; align-items: start; }
  .gallery { position: sticky; top: 100px; }
  .product-detail h1 { font-size: 26px; }
  .related-grid { grid-template-columns: repeat(4, 1fr); }
  .fav-grid { grid-template-columns: repeat(4, 1fr); }
  .cart-layout { grid-template-columns: 1fr 380px; align-items: start; }
  .cart-summary { position: sticky; top: 100px; }
  .checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
  .perks { grid-template-columns: repeat(3, 1fr); }
  .inner { padding-bottom: 70px; }
  .page-head h1 { font-size: 24px; }
  .wallet-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
  .wallet-stats div { padding: 14px; }
  .menu-item { padding: 15px 8px; font-size: 14px; }
  .aff-hero { padding: 36px; }
  .aff-hero h2 { font-size: 30px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .products-section { padding-inline: 24px; }
}

@media (max-width: 380px) {
  .m-card-img { width: 112px; }
  .m-card { height: 122px; }
  .price-box { min-width: 44px; padding: 3px 6px; }
  .comm-pill { font-size: 8px; padding: 2px 6px; }
  .add-btn { width: 32px; height: 32px; }
  .m-name { max-width: 90px; }
}

/* Dark mode (optional) */
body.dark {
  --bg: #09090b;
  --card: #18181b;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --line: #27272a;
  background-color: #09090b;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

body.dark .desktop-header,
body.dark .mobile-header,
body.dark .cat-section,
body.dark .m-card,
body.dark .m-card-body,
body.dark .d-card,
body.dark .panel,
body.dark .cart-item,
body.dark .order-card,
body.dark .mini-card,
body.dark .step-card,
body.dark .install-card,
body.dark .bottom-nav,
body.dark .products-section,
body.dark .back-btn,
body.dark .qty,
body.dark .opt,
body.dark .field input,
body.dark .field select,
body.dark .field textarea,
body.dark .track-row input,
body.dark .d-actions .fav-btn,
body.dark .buy-row .fav-btn {
  background-color: #18181b;
  color: var(--ink);
}

body.dark .mobile-header { background: rgba(24, 24, 27, 0.95); }
body.dark .desktop-header { background: #18181b; }
body.dark .m-card-body { border-color: #27272a; }
body.dark .m-card-title, body.dark .d-name, body.dark .m-name { color: #fafafa; }
body.dark .cat-label { color: #a1a1aa; }
body.dark .products-section { border-color: #27272a; }
body.dark .m-search input { background: #09090b; color: #fafafa; }
body.dark .table-head { background: linear-gradient(to right, #18181b, #3f3f46, #18181b); }
body.dark .summary-row { color: #a1a1aa; }
body.dark .summary-row.total { color: #fafafa; }
body.dark .pay-method { background: #2e1065; }
body.dark .ref-box input { background: #2e1065; }
body.dark .auth-tabs { background: #27272a; }
body.dark .auth-tabs button.on { background: #3f3f46; }
body.dark .empty { background: #18181b; }
body.dark .cart-item, body.dark .order-card, body.dark .panel { border-color: #27272a; }
body.dark .m-card-img, body.dark .d-thumb { background: #27272a; }
body.dark .sell-field input,
body.dark .commission-total { background: #27272a; border-color: #3f3f46; color: #fafafa; }
body.dark .sell-field > span,
body.dark .base-info span,
body.dark .qty-line > span,
body.dark .commission-total > span { color: #a1a1aa; }
body.dark .base-info b,
body.dark .commission-total b { color: #93c5fd; }
body.dark .buy-row .btn[disabled] { background: #27272a !important; border-color: #3f3f46; color: #71717a; }


/* ============ Profile page (redesigned) ============ */
.prof-banner {
  display: flex; justify-content: flex-start; align-items: center;
  margin-inline: calc(50% - 50vw); margin-block: 0 24px;
  padding: 18px max(16px, calc(50vw - 574px));
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: 0 16px 30px -20px rgba(22, 163, 74, 0.9);
}
.prof-banner-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: #111827; border-radius: 999px;
  padding: 12px 20px; font-size: 13px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.4);
}
.prof-banner-ico {
  width: 44px; height: 44px; border-radius: 12px; margin-inline-end: 8px;
  background: rgba(255, 255, 255, 0.22); color: #fff; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.prof-banner-ico .icon { width: 22px; height: 22px; }

.prof-wrap { max-width: 700px; margin: 0 auto; }

.prof-card {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #1c205f, #2a2f6b);
  border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-md);
}
.prof-card::after {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(147, 51, 234, 0.25); top: -100px; inset-inline-end: -80px;
}
.prof-card::before {
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05); bottom: -70px; inset-inline-start: -40px;
}
.prof-top { display: flex; align-items: center; gap: 13px; position: relative; }
.prof-avatar {
  width: 62px; height: 62px; border-radius: 50%; flex: none;
  background: #fff; color: var(--navy);
  border: 2px solid #f59e0b;
  display: flex; align-items: center; justify-content: center;
  font-family: Cairo, sans-serif; font-size: 24px; font-weight: 900;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}
.prof-id { flex: 1; min-width: 0; }
.prof-avatar .icon { width: 28px; height: 28px; }
.prof-name-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.prof-top h2 { font-size: 17px; line-height: 1.3; }
.prof-top p { font-size: 11.5px; color: rgba(255, 255, 255, 0.68); margin-top: 4px; direction: ltr; text-align: right; }
.prof-gold {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #422006;
  font-size: 9.5px; font-weight: 900; border-radius: 999px; padding: 4px 9px;
}
.prof-gold .icon { width: 11px; height: 11px; }
.prof-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-top: 16px; position: relative;
}
.prof-stat {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px; padding: 9px 14px;
}
.prof-stat small { display: block; font-size: 10.5px; color: rgba(255, 255, 255, 0.7); font-weight: 700; }
.prof-stat b { display: block; font-family: Cairo, sans-serif; font-size: 17px; margin-top: 2px; }
.prof-stat b em { font-style: normal; font-size: 10.5px; font-weight: 700; margin-inline-start: 3px; }

.prof-tabs {
  display: flex; gap: 4px; margin: 14px 0; padding: 5px;
  background: #f4f4f5; border-radius: 12px;
}
.prof-tabs button {
  flex: 1; height: 38px; border-radius: 9px; font-size: 12.5px; font-weight: 800;
  color: var(--muted); transition: 0.18s;
}
.prof-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.prof-panel { display: none; }
.prof-panel.on { display: block; animation: fadeIn 0.22s ease; }

.prof-form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.prof-form-grid .field input[disabled] { background: #f4f4f5; color: var(--muted); }

.pay-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pay-card {
  display: block; padding: 13px 14px 14px;
  border: 1px solid var(--line); border-top-width: 4px; border-top-style: solid;
  border-radius: 6px 6px 14px 14px; background: #fff;
  box-shadow: 0 6px 16px -12px rgba(0, 0, 0, 0.3); transition: 0.18s;
}
.pay-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.pay-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.pay-head b { font-size: 13px; }
.pay-card .pc-ico {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.pay-card .pc-ico .icon { width: 15px; height: 15px; }
.pay-form { display: flex; gap: 7px; }
.pay-input { position: relative; flex: 1; min-width: 0; }
.pay-input input {
  width: 100%; height: 38px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 0 32px 0 12px; font-size: 12px; font-family: inherit; direction: ltr; text-align: left;
}
.pay-input .icon {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted); pointer-events: none;
}
.pay-input input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1); }
.pay-form button {
  min-width: 62px; height: 38px; border-radius: 7px; color: #fff;
  font-size: 12px; font-weight: 900; transition: 0.16s; flex: none;
}
.pay-form button:hover { filter: brightness(1.08); }
.pay-card.vodafone { border-top-color: #e11d48; }
.pay-card.vodafone .pc-ico, .pay-card.vodafone .pay-form button { background: #e11d48; }
.pay-card.etisalat { border-top-color: #84cc16; }
.pay-card.etisalat .pc-ico, .pay-card.etisalat .pay-form button { background: #84cc16; }
.pay-card.orange { border-top-color: #f59e0b; }
.pay-card.orange .pc-ico, .pay-card.orange .pay-form button { background: #f59e0b; }
.pay-card.we { border-top-color: #6d28d9; }
.pay-card.we .pc-ico, .pay-card.we .pay-form button { background: #6d28d9; }

.prof-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 12px;
  background: var(--purple-soft); border-radius: 14px; padding: 12px 14px;
  font-size: 11.5px; font-weight: 700; color: var(--purple-dark); line-height: 1.8;
}
.prof-note .icon { width: 17px; height: 17px; flex: none; margin-top: 2px; }

.secure-row {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
}
.secure-row + .secure-row { margin-top: 10px; }
.secure-row .sr-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple-soft); color: var(--purple-dark);
}
.secure-row > div { flex: 1; min-width: 0; }
.secure-row b { display: block; font-size: 13px; }
.secure-row span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.secure-row .ok {
  background: #ecfdf5; color: #047857; font-size: 10.5px; font-weight: 900;
  border-radius: 999px; padding: 5px 11px; display: inline-flex; align-items: center; gap: 4px;
}
.secure-row .ok .icon { width: 13px; height: 13px; }

/* ============ Orders page (redesigned) ============ */
.ord-hero { margin: 6px 0 16px; }
.ord-hero-top { display: flex; align-items: center; gap: 12px; }
.ord-hero h1 { font-size: 25px; }
.ord-hero p { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.ord-search { position: relative; margin-top: 14px; }
.ord-search .icon {
  position: absolute; inset-inline-start: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted);
}
.ord-search input {
  width: 100%; height: 50px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; padding: 0 16px 0 44px; font-size: 13px; box-shadow: var(--shadow-sm);
  font-family: inherit; color: var(--ink);
}
.ord-search input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12); }

.ord-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 16px; }
.ord-tile {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 6px 11px; text-align: center; box-shadow: var(--shadow-sm);
  transition: 0.16s; cursor: pointer;
}
.ord-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.ord-tile .ot-ico {
  width: 34px; height: 34px; border-radius: 11px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.ord-tile .ot-ico .icon { width: 17px; height: 17px; }
.ord-tile b { display: block; font-family: Cairo, sans-serif; font-size: 19px; line-height: 1; }
.ord-tile span { display: block; font-size: 10px; font-weight: 800; color: var(--muted); margin-top: 5px; }
.ord-tile.on { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.14); }
.t-wait .ot-ico { background: linear-gradient(145deg, #fbbf24, #f59e0b); }
.t-prep .ot-ico { background: linear-gradient(145deg, #60a5fa, #2563eb); }
.t-ship .ot-ico { background: linear-gradient(145deg, #a855f7, #7e22ce); }
.t-delivering .ot-ico { background: linear-gradient(145deg, #22d3ee, #0891b2); }
.t-delivered .ot-ico { background: linear-gradient(145deg, #22c55e, #16a34a); }
.t-partial .ot-ico { background: linear-gradient(145deg, #fb923c, #ea580c); }
.t-returned .ot-ico { background: linear-gradient(145deg, #f43f5e, #e11d48); }
.t-cancelled .ot-ico { background: linear-gradient(145deg, #a1a1aa, #71717a); }

.ord-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ord-pill {
  height: 40px; padding: 0 17px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  background: #fff; border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-sm);
  transition: 0.16s; white-space: nowrap;
}
.ord-pill:hover { color: var(--purple-dark); border-color: var(--purple); }
.ord-pill.on { background: var(--purple); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px rgba(147, 51, 234, 0.95); }

.ord-card-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.ord-scroll { overflow-x: auto; }
.ord-table { width: 100%; border-collapse: collapse; min-width: 940px; }
.ord-table thead th {
  background: linear-gradient(135deg, #7e22ce, #a855f7); color: #fff;
  font-size: 11.5px; font-weight: 900; padding: 14px 13px; text-align: start; white-space: nowrap;
}
.ord-table thead th:first-child { border-start-start-radius: 0; }
.ord-table td { padding: 14px 13px; font-size: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ord-table tbody tr:last-child td { border-bottom: 0; }
.ord-table tbody tr:hover { background: #faf5ff; }
.ord-id { font-family: Cairo, sans-serif; font-weight: 900; font-size: 12.5px; }
.ord-sub { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.ord-prod { display: flex; align-items: center; gap: 9px; }
.ord-prod img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.ord-prod b { display: block; font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-price { font-family: Cairo, sans-serif; font-weight: 900; color: var(--blue-dark); }
.ord-comm { font-family: Cairo, sans-serif; font-weight: 900; color: var(--purple-dark); }
.ord-act { display: flex; gap: 6px; }
.ord-act button {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple-soft); color: var(--purple-dark); transition: 0.16s;
}
.ord-act button:hover { background: var(--purple); color: #fff; }
.ord-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-top: 1px solid var(--line); }
.ord-foot span { font-size: 11.5px; color: var(--muted); font-weight: 700; }

body.dark .prof-tabs, body.dark .ord-tile, body.dark .ord-pill,
body.dark .ord-card-wrap, body.dark .pay-card, body.dark .secure-row {
  background: #18181b; border-color: #27272a;
}
body.dark .ord-search input { background: #18181b; border-color: #27272a; color: var(--ink); }
body.dark .ord-table td { border-color: #27272a; }
body.dark .ord-table tbody tr:hover { background: #27272a; }
body.dark .prof-form-grid .field input[disabled] { background: #27272a; }
body.dark .ord-foot { border-color: #27272a; }

@media (max-width: 560px) {
  .ord-hero h1 { font-size: 22px; }
  .prof-card { padding: 18px; }
  .prof-avatar { width: 54px; height: 54px; border-radius: 16px; font-size: 21px; }
  .pay-grid { grid-template-columns: 1fr; }
  .ord-tiles { gap: 7px; }
  .ord-tile { padding: 11px 4px 9px; border-radius: 13px; }
  .ord-tile .ot-ico { width: 30px; height: 30px; border-radius: 9px; margin-bottom: 6px; }
  .ord-tile .ot-ico .icon { width: 15px; height: 15px; }
  .ord-tile b { font-size: 17px; }
  .ord-tile span { font-size: 9px; }
  .prof-stats { grid-template-columns: repeat(2, 1fr); }
}
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { filter: brightness(1.12); }

.admin-link-mobile {
  display: none; align-items: center; justify-content: center; gap: 8px;
  margin-top: 14px; height: 46px; border-radius: 14px; background: #fff;
  border: 1px dashed var(--line); color: var(--muted);
  font-size: 12px; font-weight: 800; box-shadow: var(--shadow-sm);
}
.admin-link-mobile .icon { width: 17px; height: 17px; }
@media (max-width: 1023px) { .admin-link-mobile { display: flex; } }
body.dark .admin-link-mobile { background: #18181b; border-color: #3f3f46; }
body.dark .pay-input input { background: #27272a; border-color: #3f3f46; color: #fafafa; }
body.dark .pay-card.vodafone { border-top-color: #e11d48; }
body.dark .pay-card.etisalat { border-top-color: #84cc16; }
body.dark .pay-card.orange { border-top-color: #f59e0b; }
body.dark .pay-card.we { border-top-color: #6d28d9; }
@media (max-width: 560px) {
  .prof-banner { padding: 14px 16px; margin-block: 0 18px; }
  .prof-banner-pill { font-size: 11.5px; padding: 10px 14px; white-space: normal; line-height: 1.6; }
  .prof-banner-ico { width: 38px; height: 38px; border-radius: 10px; }
  .prof-banner-ico .icon { width: 19px; height: 19px; }
  .prof-stats { gap: 9px; }
  .pay-grid { gap: 10px; }
}
body.dark .prof-tabs button.on { background: #fafafa; color: #18181b; }
body.dark .prof-banner-pill { color: #111827; }