/* =============================================================================
 * SPH — style.css  (RTL, Material 3 inspired)
 * ===========================================================================*/
:root {
  --red: #c62828;
  --red-dark: #9b1a1a;
  --red-soft: #ffe6e6;
  --bg: #f7f7f9;
  --surface: #ffffff;
  --border: #eceef2;
  --text: #1c1c1e;
  --muted: #6b7280;
  --muted-2: #9aa0a6;
  --ok: #16a34a;
  --ok-soft: #d1fae5;
  --no: #6b7280;
  --no-soft: #eef0f3;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --header-h: 60px;
  --catalog-search-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { direction: rtl; }
body {
  font-family: 'Cairo', 'Noto Sans Arabic', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: 15px; }
img { display: block; max-width: 100%; }

/* =========================== Header =========================== */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
}
.header-btn {
  position: relative;
  background: transparent; border: 0; border-radius: 12px;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: background .15s;
}
.header-btn:hover { background: #f0f2f5; }
.header-btn:active { transform: scale(.96); }
.cart-badge {
  position: absolute; top: 4px; left: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}
.logo {
  font-family: 'Cairo', sans-serif;
  font-weight: 900; font-size: 26px;
  color: var(--red);
  letter-spacing: 1px;
  font-style: italic;
  transform: skewX(-6deg);
  user-select: none;
}

/* Catalog search bar (only shown on /models) */
.catalog-search-wrap {
  position: sticky; top: var(--header-h); z-index: 39;
  background: var(--bg);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.catalog-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.catalog-search input {
  flex: 1; border: 0; outline: none; background: transparent; font-size: 15px;
}
.catalog-search svg { color: var(--muted); flex-shrink: 0; }

/* Proto warning */
.proto-warn {
  background: #fff3cd; color: #856404; padding: 10px 14px;
  font-size: 13px; text-align: center;
}

/* =========================== Layout =========================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}
.page { padding: 12px 4px 40px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 8px 4px 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px; font-weight: 800; margin: 0;
}
.section-title {
  font-size: 16px; font-weight: 700; margin: 12px 0;
}
.count-chip {
  background: var(--red-soft); color: var(--red); padding: 4px 12px;
  border-radius: 999px; font-weight: 700; font-size: 13px;
}

.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; color: var(--text);
  margin-bottom: 10px;
  transition: background-color .15s, transform .15s;
}
.btn-back:hover { background: #f0f2f5; }
.btn-back:active { transform: scale(.97); }

/* =========================== Search inline (page level) =========================== */
.search-inline {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 999px;
  min-width: 200px;
}
.search-inline input { flex: 1; border: 0; outline: none; background: transparent; }
.search-inline svg { color: var(--muted); }

/* =========================== Phones grid =========================== */
.grid { display: grid; gap: 12px; }
.grid-phones {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 600px) { .grid-phones { grid-template-columns: repeat(5, minmax(0,1fr)); } }
@media (min-width: 900px) { .grid-phones { grid-template-columns: repeat(6, minmax(0,1fr)); } }
@media (min-width: 1200px){ .grid-phones { grid-template-columns: repeat(7, minmax(0,1fr)); } }

.phone-card {
  background: transparent; border: 0; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  contain: layout style;
  color: var(--text);
}
.phone-card:active .ph-img-wrap { transform: scale(.94); }
.ph-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.ph-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
}
.ph-name {
  font-size: 12.5px; font-weight: 700; text-align: center;
  line-height: 1.3; word-break: break-word;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em; width: 100%;
}

/* Brands bar */
.brands-bar {
  display: flex; gap: 10px; padding: 6px 0 12px;
  overflow-x: auto; scrollbar-width: thin;
  margin: 0 -4px;
  padding-inline: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  min-height: 72px;               /* يحجز المساحة قبل بناء الشعارات (لا قفزة) */
}
.brands-bar::-webkit-scrollbar { height: 4px; }
.brands-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.brand-chip {
  flex-shrink: 0;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: pointer; padding: 0;
  transition: border-color .15s, box-shadow .15s;
}
.brand-chip img { width: 78%; height: 78%; object-fit: contain; }
.brand-chip:hover { border-color: var(--red-soft); }
.brand-chip.is-active { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.brand-all { font-weight: 800; font-size: 13px; color: var(--red); }

/* Catalog button on home page (opens #/models) */
.btn-catalog {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  margin: 4px 0 16px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  border: 0; border-radius: 14px;
  font-weight: 800; font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(198,40,40,.28);
  transition: transform .12s, filter .12s, box-shadow .12s;
}
.btn-catalog:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(198,40,40,.34); }
.btn-catalog:active { transform: scale(.98); }
.btn-catalog svg { flex-shrink: 0; }
.btn-catalog .btn-catalog-arrow { margin-inline-start: auto; transform: scaleX(-1); opacity: .9; }

/* =========================== Product cards =========================== */
.grid-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 600px) { .grid-cards { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 900px) { .grid-cards { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (min-width: 1200px){ .grid-cards { grid-template-columns: repeat(5, minmax(0,1fr)); } }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
  box-shadow: var(--shadow);
  contain: layout style;
}
@media (hover: hover) {
  .product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
}
.product-card:active { transform: scale(.98); }

.pc-img-wrap {
  position: relative;
  aspect-ratio: 1;
  background: #f2f4f7;
  overflow: hidden;
}
.pc-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .pc-img-wrap img { transform: scale(1.05); }
.product-card.is-out .pc-img-wrap img { filter: grayscale(1) opacity(.6); }

.badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.no { background: var(--no-soft); color: var(--no); }

.fab-add {
  position: absolute; bottom: 8px; left: 8px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--red); color: #fff; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(198,40,40,.35);
  transition: transform .15s, background .15s;
}
.fab-add:hover { background: var(--red-dark); }
.fab-add:active { transform: scale(.9); }

.pc-body { padding: 10px 12px 12px; }
.pc-title {
  font-size: 14px; font-weight: 700; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  min-height: 34px;
}
.pc-meta { display: flex; align-items: center; justify-content: space-between; }
.price { font-weight: 800; color: var(--red); font-size: 14px; }
.price.muted { color: var(--muted); font-weight: 600; font-style: italic; }

/* =========================== Skeleton =========================== */
.skeleton-card { cursor: default; pointer-events: none; }
.sk-img, .sk-line {
  background: linear-gradient(90deg, #eef0f3 0%, #f8f9fb 50%, #eef0f3 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
.sk-img { aspect-ratio: 1; width: 100%; }
.sk-line { height: 12px; margin: 8px 12px; }
.sk-title { width: 80%; }
.sk-price { width: 50%; height: 10px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* =========================== Empty state =========================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state svg { color: var(--muted-2); }
.empty-state p { margin: 0; font-size: 15px; }

/* =========================== Product detail =========================== */
.page-product .product-hero {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
@media (min-width: 700px) { .page-product .product-hero { grid-template-columns: 1fr 1fr; } }
.ph-img {
  position: relative;
  aspect-ratio: 1;
  background: #f2f4f7;
  border-radius: var(--radius);
  overflow: hidden;
}
.ph-img img { width: 100%; height: 100%; object-fit: contain; }
.ph-info h1 { font-size: 22px; margin: 0 0 12px; }
.ph-price { font-size: 26px; font-weight: 900; color: var(--red); margin-bottom: 12px; }
.ph-price .muted { color: var(--muted); font-weight: 500; font-size: 18px; font-style: italic; }
.ph-meta { color: var(--muted); font-size: 14px; }

.models-list {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.model-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.model-row:last-child { border-bottom: 0; }
.mr-name { font-weight: 600; flex: 1; }
.mr-qty { display: inline-flex; align-items: center; gap: 12px; background: #f4f6f9; border-radius: 999px; padding: 4px 6px; }
.mr-qty button {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface);
  font-size: 18px; font-weight: 800; color: var(--red);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .12s;
}
.mr-qty button:hover:not(:disabled) { background: var(--red-soft); }
.mr-qty button:active:not(:disabled) { transform: scale(.9); }
.mr-qty button:disabled { opacity: .4; cursor: not-allowed; }
.mr-qty span { min-width: 20px; text-align: center; font-weight: 800; }

.single-add { margin-top: 16px; }

/* Phone detail hero */
.phone-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.phone-hero {
  width: 60px; height: 60px; border-radius: 14px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--surface);
}

/* =========================== Buttons =========================== */
.btn-primary, .btn-secondary, .btn-danger {
  border: 0; border-radius: 12px;
  padding: 12px 20px;
  font-weight: 700; font-size: 15px;
  cursor: pointer;
  transition: transform .12s, filter .12s, box-shadow .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(198,40,40,.28); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #f0f2f5; color: var(--text); }
.btn-secondary:hover { background: #e6e9ee; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-block { width: 100%; }
.btn-primary.sm, .btn-secondary.sm, .btn-danger.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
button:active:not(:disabled) { transform: scale(.97); }

/* =========================== Cart Bottom Sheet =========================== */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90;
}
.cart-overlay.show { opacity: 1; pointer-events: auto; }
.cart-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  max-height: 85vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 91;
  box-shadow: 0 -10px 30px rgba(0,0,0,.2);
}
.cart-sheet.show { transform: translateY(0); }
.cart-handle {
  width: 40px; height: 4px; background: #d1d5db;
  border-radius: 999px; margin: 8px auto;
}
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px 12px; border-bottom: 1px solid var(--border);
}
.cart-header h2 { margin: 0; font-size: 18px; }
.cart-close {
  background: transparent; border: 0; padding: 6px; border-radius: 10px; color: var(--muted);
}
.cart-close:hover { background: #f0f2f5; }
.cart-body {
  overflow-y: auto; flex: 1; padding: 12px 16px;
}
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
}
.cart-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 16px;
}
.cart-total strong { color: var(--red); font-size: 20px; }
.cart-item {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: 0; }
.ci-img {
  width: 60px; height: 60px; border-radius: 12px; object-fit: cover;
  background: #f2f4f7; flex-shrink: 0;
}
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-model { color: var(--muted); font-size: 12px; }
.ci-price { color: var(--red); font-weight: 700; font-size: 13px; margin-top: 4px; }
.ci-actions { display: flex; flex-direction: column; align-items: end; gap: 6px; }
.qty {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f4f6f9; border-radius: 999px; padding: 3px 6px;
}
.qty button {
  width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--surface);
  font-size: 15px; font-weight: 800; color: var(--red);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.qty span { min-width: 18px; text-align: center; font-weight: 700; font-size: 13px; }
.ci-remove {
  background: transparent; border: 0; padding: 4px; color: var(--muted);
  border-radius: 8px;
}
.ci-remove:hover { color: var(--red); background: #fee2e2; }

/* =========================== Checkout =========================== */
.checkout-grid {
  display: grid; gap: 16px; grid-template-columns: 1fr;
}
@media (min-width: 800px) { .checkout-grid { grid-template-columns: 3fr 2fr; } }
.checkout-form, .checkout-summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--border);
  padding: 12px 14px; border-radius: 12px; background: #fafbfc;
  outline: none; transition: border .15s, background .15s;
}
.field input:focus, .field select:focus { border-color: var(--red); background: var(--surface); }
.form-hint { color: var(--muted); font-size: 13px; text-align: center; margin: 10px 0 0; }

.summary-items { margin-bottom: 14px; }
.sum-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px;
}
.sum-row:last-child { border-bottom: 0; }
/* ➕ NEW: صورة المنتج داخل ملخّص الطلب — بنفس أسلوب صورة السلة (.ci-img) */
.sr-img {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover;
  background: #f2f4f7; flex-shrink: 0;
}
.sr-l { flex: 1; min-width: 0; }
.sr-name { font-weight: 600; font-size: 14px; }
.sr-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sr-r { font-weight: 800; color: var(--red); flex-shrink: 0; }
.summary-total {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 2px solid var(--border);
  font-size: 16px;
}
.summary-total strong { color: var(--red); font-size: 22px; }

/* =========================== Success =========================== */
.page-success { display: flex; justify-content: center; padding: 40px 12px; }
.success-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 24px; max-width: 500px; width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.success-check {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok);
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  animation: pop .4s cubic-bezier(.34,1.56,.64,1) both;
}
.success-card h1 { margin: 0 0 12px; font-size: 24px; }
.success-card p { margin: 6px 0; }
.success-card .row-actions { margin-top: 20px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* =========================== Toast =========================== */
.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1c1c1e; color: #fff;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--ok); }
.toast.error   { background: #dc2626; }
.toast.info    { background: #1c1c1e; }

/* =========================== Animations =========================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =========================== Utilities =========================== */
.muted { color: var(--muted); }
.flex-1 { flex: 1; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { background: var(--red-soft); color: var(--red); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }

/* =============================================================================
 * Dashboard
 * ===========================================================================*/
body.dashboard { background: #f4f5f7; }

.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #c62828 0%, #7a1717 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 400px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  text-align: center;
}
.login-card .logo { font-size: 36px; margin-bottom: 8px; display: inline-block; }
.login-card h1 { font-size: 20px; margin: 0 0 20px; color: var(--text); }
.login-card input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 12px; outline: none; background: #fafbfc;
}
.login-card input:focus { border-color: var(--red); background: var(--surface); }

.dash-app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: #1e1e2e; color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh; overflow-y: auto;
}
.sidebar-head {
  padding: 20px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-head .logo { color: var(--red); font-size: 26px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px; gap: 4px; }
.sidebar-nav [data-section] {
  background: transparent; border: 0; color: rgba(255,255,255,.75);
  padding: 12px 16px; border-radius: 10px;
  text-align: right; display: flex; align-items: center; gap: 10px;
  font-weight: 600;
}
.sidebar-nav [data-section]:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav [data-section].is-active { background: var(--red); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }

.dash-content { flex: 1; min-width: 0; padding: 20px; }
.dash-topbar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.dash-topbar h1 { margin: 0; font-size: 18px; }
#menuToggle { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; right: 0; height: 100vh; z-index: 100;
    transform: translateX(100%); transition: transform .3s;
  }
  .sidebar.open { transform: translateX(0); }
  #menuToggle { display: inline-flex; }
  .dash-content { padding: 12px; }
}

/* Stats grid */
.stats-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0,1fr));
  margin-bottom: 20px;
}
@media (min-width: 700px) { .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat-card {
  background: var(--surface); border-radius: 14px; padding: 16px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: ''; position: absolute; inset: 0; opacity: .07;
}
.stat-red::before    { background: linear-gradient(135deg, #c62828, transparent); }
.stat-green::before  { background: linear-gradient(135deg, #16a34a, transparent); }
.stat-blue::before   { background: linear-gradient(135deg, #2563eb, transparent); }
.stat-purple::before { background: linear-gradient(135deg, #9333ea, transparent); }
.stat-orange::before { background: linear-gradient(135deg, #ea580c, transparent); }
.sc-title { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.sc-value { font-size: 22px; font-weight: 800; color: var(--text); }

/* Dash toolbar */
.dash-toolbar {
  display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap;
}
.dash-toolbar select {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); outline: none;
}
.dash-toolbar h2 { margin: 0; font-size: 18px; }

/* Products list */
.dash-products-list { display: flex; flex-direction: column; gap: 10px; }
.prod-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: 60px 1fr;
  box-shadow: var(--shadow);
}
.pr-img { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: #f2f4f7; }
.pr-name { font-weight: 700; margin-bottom: 2px; }
.pr-key { font-size: 11px; }
.pr-controls {
  grid-column: 1 / -1;
  display: grid; gap: 8px;
  grid-template-columns: repeat(2, minmax(0,1fr));
  padding-top: 8px; border-top: 1px dashed var(--border);
}
@media (min-width: 800px) { .pr-controls { grid-template-columns: 130px 130px 90px 1fr 1fr auto; } }
.ctrl { display: flex; flex-direction: column; gap: 4px; }
.ctrl label { font-size: 11px; color: var(--muted); font-weight: 600; }
.ctrl input, .ctrl select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: #fafbfc; outline: none; font-size: 13px; width: 100%;
}
.ctrl input:focus, .ctrl select:focus { border-color: var(--red); background: var(--surface); }
.ctrl.actions { flex-direction: row; align-items: end; gap: 6px; }

.switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; position: relative; padding-top: 6px;
}
.switch input { display: none; }
.switch span {
  display: inline-block; width: 40px; height: 22px; background: #d1d5db;
  border-radius: 999px; position: relative; transition: background .2s;
}
.switch span::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s;
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(-18px); }

/* Orders */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.oc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.oc-body { display: grid; gap: 6px; font-size: 14px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 600px) { .oc-body { grid-template-columns: 1fr; } }
.oc-items { grid-column: 1 / -1; }
.oc-items ul { margin: 6px 0 0; padding-right: 20px; font-size: 13px; }

/* Settings */
.settings-grid {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 800px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow);
}
.settings-card h3 { margin: 0 0 6px; font-size: 16px; }
.settings-card p { margin: 0 0 12px; font-size: 13px; }
.settings-card input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; background: #fafbfc; outline: none;
}
.settings-card input:focus { border-color: var(--red); background: var(--surface); }

/* =========================== Product card — inline quantity counter =========================== */
.pc-counter {
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: #f4f6f9;
  border-radius: 999px;
  padding: 4px 6px;
  margin-top: 8px;
  width: 100%;
}
.pc-counter .pcc-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface);
  font-size: 18px; font-weight: 800; color: var(--red);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .12s;
  cursor: pointer;
}
.pc-counter .pcc-btn:hover:not(:disabled) { background: var(--red-soft); }
.pc-counter .pcc-btn:active:not(:disabled) { transform: scale(.9); }
.pc-counter .pcc-btn:disabled { opacity: .4; cursor: not-allowed; }
.pc-counter .pcc-num {
  min-width: 20px; text-align: center; font-weight: 800; font-size: 15px; color: #222;
}

/* ============================================================================
 * Dashboard: Bulk selection + Sync button (added by professional update)
 * ==========================================================================*/

/* Sync button in toolbar */
.btn-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.btn-sync[disabled] { opacity: .7; cursor: progress; }
.btn-sync .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: sph-spin .8s linear infinite;
}
@keyframes sph-spin { to { transform: rotate(360deg); } }

/* Bulk toolbar */
.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff5f5, #ffe8e8);
  border: 1px solid #ffb3b3;
  border-radius: 12px;
  margin: 12px 0;
  box-shadow: 0 2px 10px rgba(198, 40, 40, .08);
  animation: bulk-slide-in .18s ease-out;
}
@keyframes bulk-slide-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bulk-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.bulk-count strong { color: var(--red, #c62828); font-size: 17px; }
.btn-link {
  background: transparent;
  border: 0;
  color: var(--red, #c62828);
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
}
.btn-link:hover { opacity: .8; }
.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bulk-actions .sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* Checkboxes on product rows */
.prod-row {
  position: relative;
  transition: background-color .15s;
}
.prod-row.is-selected {
  background: rgba(198, 40, 40, .06);
  outline: 2px solid rgba(198, 40, 40, .18);
  outline-offset: -2px;
  border-radius: 10px;
}
.prod-row-head {
  padding: 10px 12px !important;
  background: #f7f8fa !important;
  border-radius: 10px !important;
  margin-bottom: 8px;
  font-size: 14px;
}
.pr-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  user-select: none;
}
.pr-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cfd6dd;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: border-color .15s, background-color .15s;
  flex-shrink: 0;
}
.pr-check input[type="checkbox"]:hover { border-color: var(--red, #c62828); }
.pr-check input[type="checkbox"]:checked {
  background: var(--red, #c62828);
  border-color: var(--red, #c62828);
}
.pr-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pr-check input[type="checkbox"]:indeterminate {
  background: var(--red, #c62828);
  border-color: var(--red, #c62828);
}
.pr-check input[type="checkbox"]:indeterminate::after {
  content: '';
  position: absolute;
  left: 3px; top: 7px;
  width: 10px; height: 2px;
  background: #fff;
}
.pr-check span { display: none; }

/* Responsive: stack bulk toolbar on small screens */
@media (max-width: 640px) {
  .bulk-toolbar { flex-direction: column; align-items: stretch; }
  .bulk-actions { justify-content: center; }
  .btn-sync span:not(.spinner) { display: none; }
  .btn-sync { padding: 8px 10px; }
}

/* =============================================================================
 * ADDITIONS v2 — Cart phone label + redesigned order card (Orders page)
 * Purely additive — does not override existing rules.
 * ===========================================================================*/

/* ---- Cart: phone name pill above product name ---- */
.ci-phone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #fff1f1, #ffe6e6);
  color: var(--red-dark);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #ffd6d6;
}

/* Checkout summary: phone name row */
.sr-phone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff1f1;
  color: var(--red-dark);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
  border: 1px solid #ffd6d6;
}

/* =============================================================================
 * Redesigned Order Card (dashboard Orders section) — v2
 * Only applies when the card has class `.order-card-v2`, so the legacy
 * `.order-card` rules (kept intact above) still work as a safe fallback.
 * ===========================================================================*/
.order-card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: 0 3px 14px rgba(0,0,0,.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s, transform .2s;
}
.order-card-v2:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

/* Top: order id + date */
.order-card-v2 .oc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.order-card-v2 .oc-id {
  font-weight: 800;
  font-size: 15px;
  color: var(--red);
  background: var(--red-soft);
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: .3px;
  direction: ltr;
}
.order-card-v2 .oc-date {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* Middle: total (left, big) + client (right) */
.order-card-v2 .oc-mid {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 2px;
}
.order-card-v2 .oc-total-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.order-card-v2 .oc-total-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.order-card-v2 .oc-total-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.3px;
}
.order-card-v2 .oc-client-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: end;
  min-width: 0;
  gap: 2px;
}
.order-card-v2 .oc-client-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.order-card-v2 .oc-client-phone {
  font-size: 12.5px;
  color: var(--muted);
  direction: ltr;
  font-weight: 600;
}

/* Product thumbnails strip */
.order-card-v2 .oc-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 0 2px;
  border-top: 1px dashed var(--border);
}
.order-card-v2 .oc-thumb {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  background: #f2f4f7;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.order-card-v2 .oc-more {
  min-width: 46px;
  height: 46px;
  padding: 0 8px;
  border-radius: 12px;
  background: #f4f6f9;
  border: 1px dashed #d3d7de;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Location row */
.order-card-v2 .oc-loc {
  font-size: 13px;
  color: var(--text);
  padding: 2px 2px 4px;
}
.order-card-v2 .oc-loc .muted { color: var(--muted); }

/* Toggle button */
.order-card-v2 .oc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: flex-start;
  background: #f4f6f9;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s, transform .15s;
}
.order-card-v2 .oc-toggle:hover { background: #eceff3; }
.order-card-v2 .oc-toggle:active { transform: scale(.97); }
.order-card-v2 .oc-toggle svg { transition: transform .2s; }
.order-card-v2 .oct-close { display: none; }
.order-card-v2.is-open .oct-open { display: none; }
.order-card-v2.is-open .oct-close { display: inline; }
.order-card-v2.is-open .oc-toggle svg { transform: rotate(180deg); }

/* Details section (collapsed by default) */
.order-card-v2 .oc-details {
  display: none;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.order-card-v2.is-open .oc-details { display: block; animation: ocFadeIn .25s ease; }
@keyframes ocFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.order-card-v2 .oc-details-title {
  font-weight: 800;
  font-size: 14px;
  margin: 8px 0 10px;
  color: var(--text);
}
.order-card-v2 .oc-items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Individual order item card in details */
.oi-card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  padding: 10px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 14px;
  align-items: center;
}
.oi-img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  background: #f2f4f7;
  border: 1px solid var(--border);
}
.oi-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.oi-phone {
  display: inline-flex;
  align-self: flex-start;
  background: #fff1f1;
  color: var(--red-dark);
  border: 1px solid #ffd6d6;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  margin-bottom: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.oi-name {
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.oi-model {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.oi-code {
  font-size: 11px;
  color: var(--muted-2);
  font-family: 'Courier New', monospace;
  direction: ltr;
}
.oi-meta {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 3px;
  text-align: end;
  white-space: nowrap;
}
.oi-qty {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  background: #eef0f3;
  padding: 2px 8px;
  border-radius: 999px;
}
.oi-price {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.oi-line {
  font-size: 14px;
  color: var(--red);
  font-weight: 800;
}

/* Responsive tweaks */
@media (max-width: 520px) {
  .order-card-v2 { padding: 12px 12px 10px; border-radius: 16px; }
  .order-card-v2 .oc-total-value { font-size: 19px; }
  .order-card-v2 .oc-thumb, .order-card-v2 .oc-more { width: 40px; height: 40px; }
  .oi-card { grid-template-columns: 50px 1fr auto; gap: 8px; padding: 8px; }
  .oi-img { width: 50px; height: 50px; }
  .oi-name { font-size: 13px; }
  .oi-line { font-size: 13px; }
}

/* =============================================================================
 * Additions (v3 update)
 * - Green product price
 * - Editable numeric quantity input (product card + cart) — same look as before
 * - Delivery method radios inside the checkout page
 * ============================================================================= */

/* --- Green price color (per-product prices only; totals keep their color) --- */
.price               { color: #16a34a; }   /* product card */
.ph-price            { color: #16a34a; }   /* product detail hero */
.ci-price            { color: #16a34a; }   /* cart line item */
/* Kept unchanged intentionally: .cart-total strong, .summary-total strong, .sr-r
   (aggregate totals stay in the app's accent color to keep the existing look). */

/* --- Inline numeric input inside the product-card counter --- */
/* Visually identical to the previous <span>: same width, weight, size, color.
   Only difference: it's now an <input> so tapping it opens the phone keypad. */
.pc-counter .pcc-num {
  /* Reset native input chrome so it matches the old span exactly */
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  width: 44px;              /* room for up to 3 digits without layout jump */
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #222;
  border-radius: 8px;
  cursor: text;
}
.pc-counter .pcc-num:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(198,40,40,.15);
}
.pc-counter .pcc-num:disabled { opacity: .5; cursor: not-allowed; }
/* Hide native number spinners */
.pc-counter .pcc-num::-webkit-outer-spin-button,
.pc-counter .pcc-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pc-counter .pcc-num { -moz-appearance: textfield; }

/* --- Inline numeric input inside the cart sheet's qty pill --- */
.qty input[data-act="num"] {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  width: 38px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-radius: 6px;
  cursor: text;
}
.qty input[data-act="num"]:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(198,40,40,.15);
}
.qty input[data-act="num"]::-webkit-outer-spin-button,
.qty input[data-act="num"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input[data-act="num"] { -moz-appearance: textfield; }

/* --- Delivery method selector (checkout page) --- */
.field-delivery > label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.delivery-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .delivery-options { grid-template-columns: 1fr; }
}
.delivery-option {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Hide the actual radio but keep it accessible */
.delivery-option > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.delivery-option .do-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .12s;
  min-height: 56px;
}
.delivery-option .do-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.delivery-option .do-text {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
}
.delivery-option:hover .do-card { border-color: var(--red-soft); }
.delivery-option > input[type="radio"]:checked + .do-card {
  border-color: var(--red);
  background: var(--red-soft);
  box-shadow: 0 0 0 2px rgba(198,40,40,.12);
}
.delivery-option > input[type="radio"]:focus-visible + .do-card {
  box-shadow: 0 0 0 3px rgba(198,40,40,.25);
}
.delivery-option:active .do-card { transform: scale(.98); }

/* --- Inline numeric input inside the product-detail models list (mr-qty) --- */
/* Same visual as the previous <span>, but tapping opens the phone keypad. */
.mr-qty input[data-act="num"] {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  width: 44px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  border-radius: 8px;
  cursor: text;
}
.mr-qty input[data-act="num"]:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(198,40,40,.15);
}
.mr-qty input[data-act="num"]:disabled { opacity: .5; cursor: not-allowed; }
.mr-qty input[data-act="num"]::-webkit-outer-spin-button,
.mr-qty input[data-act="num"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mr-qty input[data-act="num"] { -moz-appearance: textfield; }
/* =============================================================================
 * ADDITIONS v3 — Customer side menu, Account, Orders, Contact, Customers dash
 * Purely additive — does not override existing rules. Uses existing CSS vars.
 * ===========================================================================*/

/* ---- Customer side drawer (store front) ---- */
.side-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  z-index: 140;
}
.side-overlay.show { opacity: 1; pointer-events: auto; }

.side-sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 85vw);
  background: var(--surface);
  z-index: 141;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 30px rgba(0,0,0,.18);
  max-height: 100dvh;
}
.side-sheet.show { transform: translateX(0); }

.side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.side-head .sh-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--red-soft); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; flex-shrink: 0;
}
.side-head .sh-name { font-weight: 800; font-size: 16px; }
.side-head .sh-sub  { color: var(--muted); font-size: 12px; }
.side-close {
  margin-inline-start: auto;
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-close:hover { background: #f0f2f5; color: var(--text); }

.side-nav { padding: 10px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 15px;
  transition: background .15s, transform .12s;
}
.side-nav a:hover { background: #f4f6f9; }
.side-nav a:active { transform: scale(.98); }
.side-nav a .si-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--red-soft); color: var(--red);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.side-nav a[data-nav="contact"] .si-icon { background: var(--ok-soft); color: var(--ok); }

.side-sep {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 6px; font-size: 11.5px; font-weight: 800;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}
.side-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.side-cats { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 10px; }
.side-cats a {
  display: block; padding: 9px 14px 9px 14px;
  border-radius: 10px; color: var(--text);
  text-decoration: none; font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.side-cats a:hover { background: #f4f6f9; }

.side-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px; color: var(--muted); font-size: 12px; text-align: center;
}

/* Hamburger button next to the cart in the store header */
.side-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: var(--red); color: #fff; cursor: pointer;
  box-shadow: 0 4px 12px rgba(198,40,40,.3);
  transition: transform .12s, filter .12s;
  flex-shrink: 0;
}
.side-trigger:hover { background: var(--red-dark); }
.side-trigger:active { transform: scale(.92); }

/* Customer account / orders pages */
.account-card, .myorder-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow); max-width: 640px; width: 100%;
}
.myorder-card { max-width: 760px; }
.account-title, .myorders-title {
  font-size: 20px; font-weight: 900; margin: 0 0 4px;
}
.account-sub, .myorders-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.account-status {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f4f6f9; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700;
  margin-bottom: 14px;
}
.account-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); }
.account-status.is-approved .dot { background: var(--ok); }
.account-status.is-pending   .dot { background: #f59e0b; }
.account-status.is-price { background: #eef7ee; color: #15803d; }
.account-price-tag {
  display: block; margin-top: 10px;
  background: #eef7ee; border: 1px solid #bbddbb; border-radius: 12px;
  padding: 10px 14px; color: #15803d; font-size: 13.5px; font-weight: 700;
}

/* My orders list (store front) reuses .orders-list / .order-card-v2 styles */
.myorders-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.myorder-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
}
.myorder-status-pill.pending { background: #fff4e5; color: #b45309; }
.myorder-status-pill.done    { background: #eef7ee; color: #15803d; }

/* Contact page cards */
.contact-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
  text-decoration: none; color: var(--text); font-weight: 700;
  box-shadow: var(--shadow); transition: background .15s;
}
.contact-card:hover { background: #f8f9fb; }
.contact-card .cc-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-soft); color: var(--red); font-size: 18px;
}
.contact-card .cc-body { min-width: 0; }
.contact-card .cc-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.contact-card .cc-value { direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.contact-note { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }

/* =============================================================================
 * Dashboard: Customers section (reuses dashboard CSS vars, switch, bulk-toolbar,
 * search-inline from settings/search patterns)
 * ===========================================================================*/
.cust-toolbar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.search-inline {
  display: flex; align-items: center; gap: 8px;
  background: #fafbfc; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px;
}
.search-inline input {
  flex: 1; border: 0; background: transparent; padding: 10px 0;
  outline: none; font-size: 14px; min-width: 0;
}
.cust-toolbar select {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); outline: none; font-size: 13.5px; font-weight: 600;
}
.cust-toolbar .flex-1 { min-width: 180px; }

.customers-list { display: flex; flex-direction: column; gap: 10px; }
.cust-row {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: auto 1fr;
  box-shadow: var(--shadow);
  transition: background .15s, outline .15s;
}
.cust-row.is-selected {
  background: rgba(198,40,40,.05);
  outline: 2px solid rgba(198,40,40,.18); outline-offset: -2px;
}
.cust-check {
  display: inline-flex; align-items: center; justify-content: center; padding: 8px; cursor: pointer; user-select: none;
}
.cust-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; border: 2px solid #cfd6dd; border-radius: 5px;
  background: #fff; cursor: pointer; position: relative; margin: 0;
  transition: border-color .15s, background-color .15s; flex-shrink: 0;
}
.cust-check input[type="checkbox"]:checked { background: var(--red); border-color: var(--red); }
.cust-check input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cust-info { min-width: 0; }
.cust-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-meta { font-size: 12.5px; margin-top: 2px; color: var(--text); }
.cust-meta .muted, .cust-meta.muted { color: var(--muted); }
.cust-status { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.cust-price {
  display: flex; align-items: center; gap: 6px;
}
.cust-price-inp {
  width: 92px; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: #fafbfc; outline: none; font-size: 13.5px; text-align: center;
}
.cust-price-inp:focus { border-color: var(--red); background: var(--surface); }
.cust-price .btn-secondary { white-space: nowrap; }

@media (min-width: 800px) {
  .cust-row { grid-template-columns: auto 1.4fr auto auto; }
}

/* =============================================================================
 * Dashboard: Contact links settings card (inside Settings, additive)
 * ===========================================================================*/
.contact-links-grid {
  display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}
.cl-row {
  display: flex; align-items: center; gap: 10px;
  background: #fafbfc; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.cl-row .cl-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.cl-row .cl-label { font-size: 13px; font-weight: 700; width: 74px; flex-shrink: 0; }
.cl-row input[type="text"] {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; outline: none; font-size: 13px;
  direction: ltr;
}
.cl-row input[type="text"]:focus { border-color: var(--red); }
.cl-row .switch { padding-top: 0; }
.cl-save-area { display: flex; justify-content: flex-end; margin-top: 12px; }


/* =============================================================================
 * v4 — أداء + سلاسة + تحسينات تصميم (لا تغيير في الهوية)
 * ===========================================================================*/

/* أنيميشن الظهور الأول فقط (opacity خفيفة) — تُزال الفئة بعد الانتهاء من JS */
.phone-card.is-new, .product-card.is-new { animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* الصور: خلفية حتى تُحمَّل + لا قفزة في التخطيط */
.ph-img-wrap { background: #f2f4f7; }
.ph-img-wrap img, .pc-img-wrap img { background: #f2f4f7; }

/* لمس أفضل على الجوال */
button, a, .brand-chip, .phone-card, .product-card { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
.brand-chip { min-width: 60px; }
.btn-primary, .btn-secondary, .btn-catalog { min-height: 44px; }

/* مناطق الأمان (الهواتف ذات الحواف) */
.app-header { padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); }
.container { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

/* منع تقلّص الصفحة المفاجئ عند التبديل */
#view { min-height: 60vh; }

/* شريط "تحديث متوفر" */
.update-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; align-items: center; gap: 10px;
  background: #1c1c1e; color: #fff; padding: 10px 14px; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: 14px;
  animation: fadeIn .25s ease both;
}
.update-bar span { flex: 1; }
.update-bar button { border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; }
.update-bar #updateNow { background: var(--red); color: #fff; }
.update-bar #updateLater { background: transparent; color: #fff; padding: 8px; opacity: .7; }

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

.catalog-search-wrap { top: calc(var(--header-h) + env(safe-area-inset-top)); }
