/* ============================================================
   Biscuit Shop — التصميم
   ============================================================ */

:root {
  --brand: #7b3f1d;
  --brand-dark: #5d2f14;
  --brand-mid: #a85c2a;
  --accent: #f0a93b;
  --accent-dark: #d98b1f;
  --bg: #fbf7f3;
  --surface: #ffffff;
  --surface-2: #fff6ec;
  --ink: #2b1d14;
  --muted: #8c7a6d;
  --line: #ecdfd2;
  --ok: #1f9d63;
  --danger: #d64545;
  --shadow-sm: 0 2px 8px rgba(90, 50, 20, .07);
  --shadow-md: 0 12px 30px rgba(90, 50, 20, .12);
  --shadow-lg: 0 26px 60px rgba(60, 30, 10, .22);
  --radius: 18px;
  --font: "Segoe UI", "Tahoma", "Noto Kufi Arabic", "Cairo", system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 800; }

::selection { background: var(--accent); color: #3a2410; }

.container {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: -60px;
  inset-inline-start: 16px;
  z-index: 200;
  background: var(--brand);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 12px 12px;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ---------- أزرار ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: .98rem;
  transition: transform .15s, box-shadow .2s, background .2s, color .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-mid), var(--brand));
  color: #fff;
  box-shadow: 0 8px 20px rgba(123, 63, 29, .28);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(123, 63, 29, .36); transform: translateY(-1px); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #3a2410;
  box-shadow: 0 8px 20px rgba(217, 139, 31, .3);
}
.btn-accent:hover { transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--brand);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-whatsapp {
  background: #25d366;
  color: #06381b;
  box-shadow: 0 8px 22px rgba(37, 211, 102, .32);
}
.btn-whatsapp:hover { background: #1fc35c; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-icon { padding: 10px; border-radius: 12px; }

.icon-btn {
  border: none;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }

/* ---------- الهيدر ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding-block: 10px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 4px 8px rgba(123, 63, 29, .25)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.08rem; color: var(--brand); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.main-nav { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  color: #5f4a3c;
  transition: background .2s, color .2s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--brand); }
.main-nav .nav-admin {
  border: 1.5px solid var(--line);
  color: var(--brand);
}

.cart-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--brand);
  transition: background .2s, border-color .2s;
}
.cart-toggle:hover { background: var(--surface-2); border-color: #e2cdb8; }
.cart-toggle svg { width: 22px; height: 22px; }

.cart-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 21px;
  height: 21px;
  padding-inline: 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ---------- الهيرو ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 220, 170, .18), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(255, 200, 130, .16), transparent 40%),
    linear-gradient(140deg, #6f3817 0%, #8c4620 45%, #b26a34 100%);
  color: #fff;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: .6;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 40px;
  padding-block: 72px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 18px;
  backdrop-filter: blur(6px);
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  margin-bottom: 14px;
  text-wrap: balance;
}

.hero p {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: rgba(255, 255, 255, .88);
  max-width: 46ch;
  margin-bottom: 28px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }

.hero-badges { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: .86rem; color: rgba(255, 255, 255, .85); }
.hero-badges span { display: inline-flex; align-items: center; gap: 7px; }
.hero-badges b { color: var(--accent); }

.hero-art { position: relative; display: flex; justify-content: center; }
.hero-art img {
  width: min(340px, 100%);
  border-radius: 50%;
  box-shadow: 0 30px 60px rgba(40, 18, 5, .4);
  border: 8px solid rgba(255, 255, 255, .14);
  animation: float 6s ease-in-out infinite;
}
.hero-art .hero-tag {
  position: absolute;
  bottom: 4%;
  inset-inline-start: 0;
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-tag .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(31, 157, 99, .18); }
.hero-tag.is-closed { color: #8f3b3b; }
.hero-tag.is-closed .dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(214, 69, 69, .18); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ---------- شريط الأدوات ---------- */

.toolbar {
  position: sticky;
  top: 72px;
  z-index: 40;
  background: rgba(251, 247, 243, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-block: 14px;
}

.toolbar-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.search-field {
  position: relative;
  flex: 1 1 240px;
  max-width: 340px;
}
.search-field svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-field input {
  width: 100%;
  padding: 11px 42px 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  outline: none;
  font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-field input:focus { border-color: #d8b391; box-shadow: 0 0 0 4px rgba(217, 139, 31, .13); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-block: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: #6b5647;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all .18s;
}
.chip:hover { border-color: #ddbfa2; color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.sort-field { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.sort-field select {
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 9px 12px;
  border-radius: 12px;
  outline: none;
  font-size: .86rem;
  color: #5f4a3c;
}

/* ---------- المنتجات ---------- */

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); color: var(--brand); }
.section-head p { color: var(--muted); font-size: .93rem; margin-top: 4px; }

.products-section { padding-block: 52px 60px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .22s, box-shadow .22s, border-color .22s;
  animation: cardIn .35s ease both;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: #e6d2be; }

@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }

.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.05); }

.card-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: var(--danger);
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(214, 69, 69, .3);
}

.card-body { padding: 16px 16px 0; display: flex; flex-direction: column; flex: 1; }
.card-cat { font-size: .72rem; font-weight: 700; color: var(--brand-mid); background: var(--surface-2); border-radius: 999px; padding: 3px 10px; align-self: flex-start; margin-bottom: 8px; }
.card-title { font-size: 1.05rem; margin-bottom: 4px; }
.card-desc { font-size: .82rem; color: var(--muted); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-foot { margin-top: auto; padding: 14px 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price-block { display: flex; flex-direction: column; line-height: 1.25; }
.price-now { font-weight: 800; font-size: 1.06rem; color: var(--brand); }
.price-old { font-size: .78rem; color: var(--muted); text-decoration: line-through; }
.price-unit { font-size: .72rem; color: var(--muted); font-weight: 500; }

.add-btn {
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 12px;
  padding: 10px 18px;
  min-height: 42px;
  font-weight: 700;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .18s, transform .15s, box-shadow .18s;
}
.add-btn:hover { background: var(--brand-dark); box-shadow: 0 6px 16px rgba(123, 63, 29, .3); }
.add-btn:active { transform: scale(.97); }
.add-btn:disabled { background: #d9cec5; box-shadow: none; cursor: not-allowed; }
.add-btn .plus { font-size: 1.05rem; line-height: 1; }

.card.is-soldout .card-media img { filter: grayscale(.7); opacity: .65; }
.soldout-flag {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(43, 29, 20, .35);
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .5px;
}

/* ---------- حالة فراغ ---------- */

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state .big { font-size: 2.6rem; display: block; margin-bottom: 10px; }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: .92rem; margin-bottom: 18px; }

/* ---------- تواصل ---------- */

.contact { padding-block: 20px 70px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }

.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow .2s, transform .2s;
}
.info-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.info-card .ico {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--surface-2); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}
.info-card h3 { font-size: 1rem; margin-bottom: 6px; }
.info-card p { font-size: .88rem; color: var(--muted); white-space: pre-line; }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(31, 157, 99, .1);
  color: var(--ok);
  font-size: .78rem;
  font-weight: 800;
}
.status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-line.is-closed { background: rgba(214, 69, 69, .1); color: var(--danger); }
.status-line.is-closed .dot { animation: none; }

/* ---------- الفوتر ---------- */

.site-footer {
  background: #2a1b12;
  color: rgba(255, 255, 255, .72);
  padding-block: 40px 30px;
  font-size: .88rem;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; }
.footer-brand img { width: 34px; height: 34px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--accent); }
.footer-note { text-align: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .78rem; color: rgba(255, 255, 255, .45); }

/* ---------- السلة الجانبية ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 20, 10, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 90;
}
.overlay.show { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  height: 100%;
  width: min(420px, 94vw);
  background: var(--surface);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), visibility .3s;
  box-shadow: var(--shadow-lg);
  visibility: hidden;
}
html[dir="rtl"] .cart-drawer { transform: translateX(105%); }
html[dir="rtl"] .cart-drawer.open,
.cart-drawer.open { transform: translateX(0); visibility: visible; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }

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

.cart-item { display: flex; gap: 12px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: none; }
.ci-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: none; background: var(--surface-2); }
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ci-main strong { font-size: .9rem; line-height: 1.35; }
.ci-price { font-size: .8rem; color: var(--muted); }

.qty { display: inline-flex; align-items: center; gap: 2px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; align-self: flex-start; margin-top: 4px; }
.qty button {
  width: 28px; height: 28px; border: none; background: #fff;
  color: var(--brand); font-weight: 800; font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.qty button:hover { background: var(--surface-2); }
.qty span { min-width: 30px; text-align: center; font-size: .85rem; font-weight: 700; }

.ci-end { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.ci-end strong { color: var(--brand); font-size: .9rem; white-space: nowrap; }
.ci-remove { border: none; background: none; color: var(--muted); font-size: .76rem; padding: 4px; }
.ci-remove:hover { color: var(--danger); text-decoration: underline; }

.drawer-foot { border-top: 1px solid var(--line); padding: 18px 20px; background: #fffdfa; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: .95rem; color: var(--muted); }
.cart-summary strong { font-size: 1.2rem; color: var(--brand); }
.cart-note { font-size: .76rem; color: var(--muted); margin-bottom: 14px; }
.drawer-foot .btn { margin-top: 8px; }

/* ---------- المودال ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98);
  transition: transform .25s;
}
.modal.open .modal-card { transform: none; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 0 24px 24px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: .84rem; font-weight: 700; margin-bottom: 6px; color: #5f4a3c; }
.field label .req { color: var(--danger); }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  outline: none;
  font-size: .93rem;
  transition: border-color .18s, box-shadow .18s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #d8b391; box-shadow: 0 0 0 4px rgba(217, 139, 31, .13); }
.field .hint { font-size: .74rem; color: var(--muted); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checkout-summary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: .86rem;
}
.checkout-summary .row { display: flex; justify-content: space-between; gap: 10px; padding-block: 3px; }
.checkout-summary .row span:first-child { color: var(--muted); }
.checkout-summary .total { border-top: 1px dashed #e2cdb8; margin-top: 6px; padding-top: 8px; font-weight: 800; color: var(--brand); }

.form-alert {
  display: none;
  background: #fdecea;
  color: #b03a2e;
  border: 1px solid #f5c6c2;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .82rem;
  margin-bottom: 12px;
}
.form-alert.show { display: block; }

/* ---------- التوست ---------- */

.toast-wrap {
  position: fixed;
  top: 18px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
html[dir="rtl"] .toast-wrap { transform: translateX(50%); }
.toast {
  background: #26301f;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease both;
  max-width: 100%;
  text-align: center;
}
.toast.ok { background: #1e6b45; }
.toast.err { background: #a53030; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- شريط الموبايل ---------- */

.mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 70;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(90, 50, 20, .1);
}
.mobile-bar .mb-inner { display: flex; align-items: center; gap: 14px; }
.mobile-bar .mb-info { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.mobile-bar .mb-info span { font-size: .74rem; color: var(--muted); }
.mobile-bar .mb-info strong { font-size: .95rem; color: var(--brand); }
.mobile-bar .btn { flex: 1; }

/* ============================================================
   لوحة التحكم
   ============================================================ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(240, 169, 59, .12), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(123, 63, 29, .12), transparent 45%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.login-card img { width: 64px; height: 64px; margin: 0 auto 14px; }
.login-card h1 { font-size: 1.3rem; color: var(--brand); margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: .87rem; margin-bottom: 22px; }
.login-card input {
  width: 100%;
  text-align: center;
  letter-spacing: 6px;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: #d8b391; box-shadow: 0 0 0 4px rgba(217, 139, 31, .13); }
.login-card small { display: block; margin-top: 16px; color: var(--muted); font-size: .74rem; }
.login-err { color: var(--danger); font-size: .8rem; margin-bottom: 10px; min-height: 18px; }
.shake { animation: shake .4s; }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar .inner { display: flex; align-items: center; gap: 14px; min-height: 66px; }
.admin-title { font-weight: 800; color: var(--brand); font-size: 1rem; display: flex; align-items: center; gap: 9px; }
.admin-title img { width: 34px; height: 34px; }
.admin-topbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: .86rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.tab-btn:hover { color: var(--brand); background: var(--surface-2); }
.tab-btn.active { background: var(--brand); color: #fff; }

.admin-main { padding-block: 26px 70px; }
.admin-panel { display: none; animation: fadeIn .25s ease; }
.admin-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff6e5;
  border: 1px solid #f2d9a8;
  color: #7a5312;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: .87rem;
  margin-bottom: 18px;
}
.banner b { font-weight: 800; }
.banner .btn { margin-inline-start: auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .label { font-size: .78rem; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 1.55rem; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat .value small { font-size: .72rem; font-weight: 600; color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 1rem; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 18px 20px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 660px; font-size: .88rem; }
.data-table th {
  text-align: start;
  font-size: .76rem;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 14px;
  background: #fdfaf6;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fffdfa; }

.cell-product { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.cell-product img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.cell-product .meta { display: flex; flex-direction: column; line-height: 1.35; }
.cell-product .meta small { color: var(--muted); font-size: .74rem; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: .74rem;
  font-weight: 700;
}
.status-pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #ddd2c7; border-radius: 999px;
  transition: background .2s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; inset-inline-start: 3px; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(-18px); }
html[dir="ltr"] .switch input:checked + .track::after { transform: translateX(18px); }

.order-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; background: #fff; }
.order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.order-code { font-weight: 800; color: var(--brand); }
.order-date { font-size: .76rem; color: var(--muted); }
.order-head .spacer { flex: 1; }
.order-total { font-weight: 800; color: var(--brand); }

.order-items { list-style: none; font-size: .85rem; border-block: 1px dashed var(--line); padding-block: 8px; margin-bottom: 10px; }
.order-items li { display: flex; justify-content: space-between; gap: 10px; padding-block: 2px; }
.order-items li span:first-child { color: #5f4a3c; }
.order-customer { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.order-customer b { color: var(--ink); font-weight: 700; }
.order-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.order-foot select {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 10px;
  font-size: .8rem; background: #fff; outline: none;
}

.mini-empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: .88rem; }
.mini-empty .big { font-size: 1.8rem; display: block; margin-bottom: 6px; }

.image-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.image-preview {
  width: 92px; height: 92px; border-radius: 12px; object-fit: cover;
  border: 1.5px dashed #dcc4ad; background: var(--surface-2); flex: none;
}
.image-picker .controls { flex: 1; min-width: 200px; }
.image-picker .controls .btn { margin-bottom: 6px; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.danger-zone { border-color: #f3c9c9; }
.danger-zone .panel-head h2 { color: var(--danger); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.settings-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- استجابة ---------- */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding-block: 52px; text-align: center; }
  .hero p { margin-inline: auto; }
  .hero-actions, .hero-badges { justify-content: center; }
  .hero-art { order: -1; }
  .hero-art img { width: min(230px, 62vw); }
  .hero-art .hero-tag { inset-inline-start: 50%; transform: translateX(50%); bottom: -6px; }
  html[dir="rtl"] .hero-art .hero-tag { transform: translateX(50%); }
  .main-nav a:not(.nav-admin) { display: none; }
  .brand-text small { display: none; }
  .sort-field { margin-inline-start: 0; }
}

@media (max-width: 640px) {
  .container { width: calc(100% - 28px); }
  .toolbar { top: 64px; }
  .header-inner { min-height: 64px; gap: 10px; }
  .brand-logo { width: 38px; height: 38px; }
  .brand-text strong { font-size: .95rem; }
  .main-nav { display: none; }
  .cart-toggle { width: 42px; height: 42px; margin-inline-start: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-body { padding: 12px 12px 0; }
  .card-title { font-size: .92rem; }
  .card-desc { font-size: .76rem; display: none; }
  .card-foot { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0 12px; }
  .add-btn { justify-content: center; width: 100%; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .mobile-bar { display: block; }
  body { padding-bottom: 76px; }
  .drawer-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .settings-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .admin-topbar .inner { flex-wrap: wrap; padding-block: 8px; }
  .admin-title { font-size: .9rem; }
  .tabs { order: 3; width: 100%; }
  .hero-actions .btn { flex: 1 1 auto; }
  .data-table { min-width: 560px; }
}

/* بطاقات الأصناف على الجوال بدل الجدول العريض */
@media (max-width: 640px) {
  .add-btn { min-height: 44px; padding: 11px 14px; }

  #panel-products .table-wrap { overflow: visible; padding: 12px; }
  #panel-products .data-table { min-width: 0; }
  #panel-products .data-table thead { display: none; }
  #panel-products .data-table,
  #panel-products .data-table tbody,
  #panel-products .data-table tr,
  #panel-products .data-table td { display: block; width: 100%; }

  #panel-products .data-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin: 0 0 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }
  #panel-products .data-table tr:hover td { background: transparent; }
  #panel-products .data-table td { padding: 0; border: 0; }
  #panel-products .data-table td:first-child { grid-column: 1 / -1; }
  #panel-products .data-table .cell-product { min-width: 0; }
  #panel-products .data-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .7rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 2px;
  }
  #panel-products .data-table td[data-label="متوفر"] { display: flex; align-items: center; gap: 10px; }
  #panel-products .data-table td[data-label="متوفر"]::before { margin: 0; }
  #panel-products .data-table td:last-child {
    grid-column: 1 / -1;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
  }
  #panel-products .data-table .row-actions { justify-content: flex-end; }
  #panel-products .data-table tr.empty-row {
    display: block;
    border: 0;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 400px) {
  .brand-text strong { font-size: .88rem; }
  .grid { grid-template-columns: 1fr 1fr; }
  .price-now { font-size: .95rem; }
  .add-btn { padding: 9px 10px; font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- الطباعة ---------- */

@media print {
  .site-header, .toolbar, .site-footer, .cart-drawer, .overlay,
  .mobile-bar, .admin-topbar, .no-print { display: none !important; }
  body { background: #fff; }
}
