:root {
  --brand: #0b5ed7;
  --brand-dark: #084298;
  --brand-soft: #e7f1ff;
  --accent: #ff7a18;
  --accent-dark: #e66100;
  --accent-soft: #fff2e6;
  --grad-main: linear-gradient(135deg, #0b5ed7 0%, #1673e6 55%, #ff7a18 100%);
  --grad-bar: linear-gradient(90deg, #0b5ed7 0%, #1d7bf2 50%, #ff7a18 100%);
  --grad-orange: linear-gradient(135deg, #ff8c24 0%, #f96302 100%);
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-alt: #f8faff;
  --text: #112035;
  --muted: #607087;
  --border: #dfe7f3;
  --border-strong: #c5d4e8;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #c2410c;
  --warning-bg: #ffedd5;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0369a1;
  --info-bg: #e0f2fe;
  --whatsapp: #16a34a;
  --whatsapp-dark: #15803d;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(11, 94, 215, 0.06);
  --shadow-md: 0 10px 28px rgba(11, 94, 215, 0.12);
  --shadow-lg: 0 20px 50px rgba(17, 32, 53, 0.2);
  --font: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 24, 0.08), transparent 36%),
    radial-gradient(circle at top left, rgba(11, 94, 215, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ===== Topbar ===== */
.topbar {
  min-height: 74px;
  background: #ffffff;
  border-top: 4px solid transparent;
  border-image: var(--grad-bar) 1;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px max(24px, calc((100% - 1400px) / 2));
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(11, 94, 215, 0.06);
}

.brand {
  font-size: 24px;
  font-weight: 900;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.brand b {
  color: var(--accent);
}

.brand-tag {
  font-size: 12px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 2px 9px;
  border-radius: 999px;
  margin-inline-start: 4px;
}

.search-wrap {
  flex: 1;
  max-width: 640px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 14px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.search {
  width: 100%;
  padding: 11px 42px 11px 38px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 94, 168, 0.1);
  outline: none;
}

.search-clear {
  position: absolute;
  left: 10px;
  border: 0;
  background: #e2e8f0;
  color: var(--text);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

/* ===== Buttons ===== */
.primary,
.outline,
.whatsapp,
.danger-btn,
.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, box-shadow 0.18s, opacity 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.primary {
  background: var(--grad-main);
  color: #fff;
  border: 0;
  padding: 11px 20px;
}

.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 7px 20px rgba(11, 94, 215, 0.28);
}

.outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 9px 16px;
}

.outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.soft-btn {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cfe2ff;
  padding: 9px 14px;
}

.soft-btn:hover:not(:disabled) {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.whatsapp {
  background: var(--whatsapp);
  color: #fff;
  border: 0;
  padding: 12px 18px;
  width: 100%;
}

.whatsapp:hover:not(:disabled) {
  background: var(--whatsapp-dark);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.25);
}

.danger-btn {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 9px 14px;
}

.danger-btn:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cart-btn {
  position: relative;
  padding-inline: 16px;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

/* ===== Layout ===== */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px 48px;
}

/* ===== Hero ===== */
.hero {
  background: var(--grad-main);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(11, 94, 215, 0.22);
}

.hero::after {
  content: "";
  position: absolute;
  left: -40px;
  top: -50px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24), transparent 68%);
  pointer-events: none;
}

.hero::before {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 166, 43, 0.35), transparent 70%);
  pointer-events: none;
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.hero-eyebrow {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.25;
  font-weight: 900;
}

.hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
}

.hero-features {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

/* ===== Toolbar (Categories & Sort) ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.cat-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.cat-pill {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s;
}

.cat-pill:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.cat-pill.active {
  background: var(--grad-main);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 14px rgba(11, 94, 215, 0.25);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-select {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

/* ===== Products Grid (Compact & Vibrant) ===== */
.products {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.product {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 240px 330px;
  contain: layout style paint;
}

.product:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(11, 94, 215, 0.14);
  border-color: var(--accent);
}

.pmedia {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f5fb;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  contain: layout paint;
}

.pmedia img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.25s ease;
  padding: 0;
}

.product:hover .pmedia img {
  transform: scale(1.04);
}

.pbadges {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.badge-sale {
  background: var(--grad-orange);
  color: #fff;
  box-shadow: 0 3px 10px rgba(249, 99, 2, 0.32);
}

.badge-gallery {
  position: absolute;
  bottom: 7px;
  left: 7px;
  background: rgba(11, 94, 215, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.pbody {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 3px;
}

.pcat {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1.2;
}

.pname {
  font-weight: 800;
  font-size: 14.5px;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.pdesc {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 6px;
}

.price {
  color: var(--brand);
  font-weight: 900;
  font-size: 18px;
  line-height: 1.2;
}

.old {
  color: #94a3b8;
  text-decoration: line-through;
  font-size: 12.5px;
  font-weight: 600;
}

.pactions {
  margin-top: auto;
  display: flex;
  gap: 6px;
}

.quick-add {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 9px;
  background: var(--grad-orange);
  color: #fff;
  border: 0;
  box-shadow: 0 3px 10px rgba(255, 122, 24, 0.24);
}

.quick-add:hover:not(:disabled) {
  filter: brightness(1.06);
  background: var(--grad-orange);
  color: #fff;
  box-shadow: 0 5px 14px rgba(255, 122, 24, 0.36);
}

/* ===== Skeleton ===== */
.skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skel-box {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafd 50%, #eef2f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

.skel-img {
  aspect-ratio: 1 / 1;
}

.skel-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.skel-line {
  height: 14px;
  border-radius: 6px;
}

.skel-line.short {
  width: 55%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.status {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

/* ===== Quick View Modal ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  animation: fadeIn 0.16s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 880px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 26px;
  box-shadow: var(--shadow-lg);
}

.close {
  position: absolute;
  top: 14px;
  left: 14px;
  border: 0;
  background: #f1f5f9;
  color: var(--text);
  border-radius: 50%;
  font-size: 22px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.close:hover {
  background: #e2e8f0;
}

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

.qimage-wrap {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.qimage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qthumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.qthumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  padding: 3px;
  cursor: pointer;
  overflow: hidden;
}

.qthumb.active {
  border-color: var(--brand);
}

.qthumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qbody {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
}

.qbody h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.qdesc {
  margin: 0;
  color: #334155;
  white-space: pre-line;
  font-size: 14.5px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.qty-control button {
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.qty-control button:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand);
}

.qty-control span {
  min-width: 38px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
}

.qactions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.qactions-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.qactions-row .primary {
  flex: 1;
}

/* ===== Slide-over Cart Drawer ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.16s ease;
}

.drawer {
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.2);
  animation: slideIn 0.22s ease;
}

@keyframes slideIn {
  from { transform: translateX(-40px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-head h2 {
  margin: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-head .close {
  position: static;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.cart-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.cartline {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  object-fit: contain;
  padding: 4px;
}

.cart-info {
  min-width: 0;
}

.cart-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}

.cart-unit {
  font-size: 12.5px;
  color: var(--muted);
}

.cart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.cart-controls .qty-control button {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.cart-controls .qty-control span {
  min-width: 28px;
  font-size: 13px;
}

.cart-remove {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 6px;
}

.cart-remove:hover {
  background: var(--danger-bg);
}

.cart-summary {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14.5px;
}

.summary-row.total {
  border-top: 1px dashed var(--border-strong);
  padding-top: 8px;
  font-size: 18px;
  font-weight: 900;
  color: var(--brand);
}

.checkout-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.checkout-form h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

.field-group {
  display: grid;
  gap: 4px;
}

.field-group label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="month"],
input[type="search"],
select,
textarea,
.panel input,
.panel textarea,
.panel select,
.checkout-form input,
.checkout-form textarea,
.checkout-form select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 94, 168, 0.1);
  outline: none;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.order-success {
  text-align: center;
  padding: 20px 10px;
  display: grid;
  gap: 12px;
}

.success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.order-code {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
  font-size: 20px;
  padding: 6px 18px;
  border-radius: 999px;
}

/* ===== Footer & Floating WhatsApp ===== */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px max(24px, calc((100% - 1400px) / 2));
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}

.floating-wa {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 40;
  background: var(--whatsapp);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(22, 163, 74, 0.35);
  transition: transform 0.18s;
}

.floating-wa:hover {
  transform: translateY(-2px);
  background: var(--whatsapp-dark);
}

/* ===== Toast Notifications ===== */
.toast-wrap {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 90;
  display: grid;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.2s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--brand); }

/* ===== Admin Styles ===== */
.admin {
  max-width: 1280px;
}

.login-panel {
  max-width: 440px;
  margin: 48px auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 18px 0;
  box-shadow: var(--shadow-sm);
}

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

.panel h2 {
  margin: 0;
  font-size: 19px;
}

.panel h3 {
  margin: 18px 0 10px;
  font-size: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabs button {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s;
}

.tabs button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tabs button.active {
  background: var(--grad-main);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(11, 94, 215, 0.25);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
}

.kpi-card.accent {
  border-top: 3px solid var(--brand);
}

.kpi-card.profit {
  border-top: 3px solid var(--success);
}

.kpi-card.warn {
  border-top: 3px solid var(--accent);
}

.kpi-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.kpi-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}

.kpi-card.profit .kpi-value {
  color: var(--success);
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}

.report-controls .field-group {
  min-width: 170px;
}

.chart-bars {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.chart-row {
  display: grid;
  grid-template-columns: 110px 1fr 150px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.chart-track {
  height: 14px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.chart-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #3b82f6);
  border-radius: 999px;
  min-width: 3px;
}

.chart-fill.profit {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.chart-val {
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}

.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.formgrid .full {
  grid-column: 1 / -1;
}

.edit-banner {
  background: var(--accent-soft);
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th {
  background: var(--surface-alt);
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

td,
th {
  text-align: right;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

.inv-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #fff;
}

.pill-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.st-delivered { background: var(--success-bg); color: var(--success); }
.st-in_delivery { background: var(--info-bg); color: var(--info); }
.st-pending, .st-new { background: var(--warning-bg); color: var(--warning); }
.st-returned, .st-cancelled { background: var(--danger-bg); color: var(--danger); }

.archive-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: #fff8f8;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

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

.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.orders-toolbar input {
  flex: 1;
  min-width: 220px;
}

.orders-toolbar select {
  width: auto;
  min-width: 170px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.order-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin: 12px 0;
  font-size: 14px;
}

.order-items-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  display: grid;
  gap: 6px;
  font-size: 13.5px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 5px;
}

.order-item-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.order-actions select {
  width: auto;
  min-width: 170px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ===== Image Uploaders & Bulk SKU Publisher ===== */
.upload-box {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  display: grid;
  gap: 8px;
  place-items: center;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.upload-box strong {
  font-size: 15px;
  color: var(--brand-dark);
}

.upload-box input[type="file"] {
  display: none;
}

.upload-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.preview-tile {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  cursor: pointer;
}

.preview-tile.is-main {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 94, 168, 0.18);
}

.preview-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  left: 2px;
  background: rgba(15, 94, 168, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  border-radius: 6px;
  padding: 1px 4px;
}

.preview-del {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-name {
  font-size: 10px;
  color: var(--muted);
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  margin-top: 3px;
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bulk-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--brand-soft);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 16px 0;
  font-weight: 700;
  color: var(--brand-dark);
}

.bulk-defaults {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.bulk-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.bulk-card.exists {
  border-color: #fdba74;
  background: #fffdf9;
}

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

.bulk-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.2s ease;
}

/* ===== Manual Order Builder & Order Item Thumbnails ===== */
.manual-order-box {
  background: var(--surface-alt);
  border: 1.5px solid #bfd7f8;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.picker-results {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 8px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.picker-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.picker-row img {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--border);
}

.manual-cart-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.manual-cart-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.order-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.order-item-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

/* ===== API & Store Sync Tab ===== */
.api-note {
  background: var(--brand-soft);
  border: 1px solid #bfdbfe;
  color: var(--brand-dark);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

.api-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.api-field {
  margin-bottom: 12px;
}

.api-field:last-child {
  margin-bottom: 0;
}

.api-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-row input {
  flex: 1;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  background: #fff;
}

.code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 12px;
  overflow-x: auto;
  font-family: Consolas, Monaco, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0;
  max-height: 340px;
  text-align: left;
}

/* ===== Category Manager & Bulk Product Edit Bar ===== */
.cat-mgr-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: grid;
  gap: 10px;
}

.cat-mgr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cat-mgr-row select {
  width: auto;
  min-width: 190px;
}

.bulk-edit-bar {
  background: linear-gradient(135deg, #eef5ff 0%, #fff6ec 100%);
  border: 1.5px solid #9ec5fe;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

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

.bulk-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.bulk-edit-group {
  display: grid;
  gap: 5px;
}

.bulk-edit-group label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--brand-dark);
}

tr.row-selected td {
  background: #eff6ff;
}

.chk-cell {
  width: 38px;
  text-align: center !important;
}

.chk-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { grid-template-columns: 1fr; padding: 18px; }
}

@media (max-width: 650px) {
  .topbar {
    padding: 10px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .search-wrap {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .wrap {
    padding: 14px 12px 40px;
  }
  .hero {
    padding: 20px 18px;
  }
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .pbody {
    padding: 7px 8px 8px;
  }
  .price {
    font-size: 17px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .formgrid {
    grid-template-columns: 1fr;
  }
  .chart-row {
    grid-template-columns: 82px 1fr 110px;
    font-size: 12px;
  }
  .floating-wa span {
    display: none;
  }
  .floating-wa {
    padding: 12px;
  }
}
