:root {
  --burgundy: #6b1d2a;
  --burgundy-deep: #4a121c;
  --burgundy-soft: #8f3342;
  --cream: #f6f0e7;
  --cream-dark: #ebe2d4;
  --charcoal: #1a1a1a;
  --ink: #2a2422;
  --muted: #6f6660;
  --line: rgba(26, 26, 26, 0.12);
  --ok: #1f6b45;
  --danger: #9b1c1c;
  --warn: #9a6b12;
  --surface: #fffdf9;
  --shadow: 0 18px 50px rgba(26, 26, 26, 0.12);
  --radius: 18px;
  --font: "Cairo", "Tahoma", sans-serif;
  --max: 1120px;
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(107, 29, 42, 0.10), transparent 55%),
    radial-gradient(900px 400px at -10% 20%, rgba(143, 51, 66, 0.08), transparent 50%),
    linear-gradient(180deg, var(--cream) 0%, #f3eee6 45%, var(--cream-dark) 100%);
  min-height: 100vh;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.topbar {
  background: var(--burgundy-deep);
  color: #f8efe8;
  font-size: 0.86rem;
  padding: 0.45rem 0;
}
.topbar-inner {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.topbar span { opacity: 0.92; }

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(246, 240, 231, 0.88);
  border-bottom: 1px solid var(--line);
  min-height: var(--nav-h);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.brand-name {
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  font-weight: 800;
  color: var(--burgundy);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--muted);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  background: var(--burgundy);
  color: #fff;
  font-weight: 700;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.btn:hover { background: var(--burgundy-soft); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: transparent;
  color: var(--burgundy);
  border-color: rgba(107, 29, 42, 0.28);
}
.btn-ghost:hover { background: rgba(107, 29, 42, 0.06); }
.btn-dark { background: var(--charcoal); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.9rem; }
.btn-block { width: 100%; }

.icon-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--burgundy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.hero {
  position: relative;
  min-height: min(78vh, 640px);
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(26, 18, 18, 0.82) 10%, rgba(74, 18, 28, 0.55) 55%, rgba(26, 18, 18, 0.35) 100%),
    radial-gradient(circle at 70% 40%, rgba(143, 51, 66, 0.35), transparent 45%),
    #2b1518;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      -18deg,
      transparent 0 14px,
      rgba(255,255,255,0.015) 14px 15px
    );
  pointer-events: none;
}
.hero-inner {
  position: relative;
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem);
  max-width: 640px;
  animation: rise .8s ease both;
}
.hero h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero p {
  margin: 0 0 1.4rem;
  font-size: 1.05rem;
  color: rgba(255,255,255,0.88);
  max-width: 36ch;
}
.hero-cta { display: flex; gap: 0.7rem; flex-wrap: wrap; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.section { padding: clamp(2.2rem, 5vw, 3.8rem) 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.3rem;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  color: var(--burgundy-deep);
}
.section-head p { margin: 0.25rem 0 0; color: var(--muted); }

.toolbar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
@media (max-width: 800px) {
  .toolbar { grid-template-columns: 1fr; }
}

.field, .select, .search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  outline: none;
}
.field:focus, .select:focus, .search:focus {
  border-color: rgba(107, 29, 42, 0.45);
  box-shadow: 0 0 0 3px rgba(107, 29, 42, 0.12);
}
label { display: block; font-size: 0.9rem; font-weight: 700; margin-bottom: 0.35rem; }

.cats {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 700;
}
.chip.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }

.product {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: rise .55s ease both;
}
.product:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-media {
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, #efe6da, #e4d7c8);
  position: relative;
  overflow: hidden;
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-media .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.pill {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(26,26,26,0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
}
.pill.out { background: rgba(155, 28, 28, 0.9); }
.product-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.product-body h3 { margin: 0; font-size: 1.02rem; line-height: 1.35; }
.product-desc { margin: 0; color: var(--muted); font-size: 0.86rem; min-height: 2.6em; }
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.price {
  font-weight: 800;
  color: var(--burgundy);
  font-size: 1.05rem;
}
.unit { color: var(--muted); font-size: 0.82rem; }
.product-actions { display: flex; gap: 0.4rem; margin-top: 0.55rem; }

.about-panel, .empty, .notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.notice.error { border-color: rgba(155,28,28,.35); color: var(--danger); }
.notice.ok { border-color: rgba(31,107,69,.35); color: var(--ok); }

.footer {
  margin-top: 2rem;
  background: var(--charcoal);
  color: #f3ebe3;
  padding: 2rem 0 1.2rem;
}
.footer a { color: #f3ebe3; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 1.2rem;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h4 { margin: 0 0 0.5rem; color: #fff; }
.footer p, .footer li { color: rgba(243,235,227,0.82); margin: 0.2rem 0; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.copy {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.85rem;
  color: rgba(243,235,227,0.65);
}

.wa-float {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1fa855;
  color: #fff;
  display: none;
  place-items: center;
  box-shadow: 0 10px 30px rgba(31,168,85,0.35);
  font-weight: 800;
  font-size: 0.78rem;
}
.wa-float.show { display: grid; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 14, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 80;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--surface);
  transform: translateX(-105%);
  transition: transform .25s ease;
  z-index: 90;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer-head, .drawer-foot {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--line); margin-top: auto; }
.drawer-body { padding: 1rem; overflow: auto; flex: 1; }
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.7rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.qty {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.qty button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,14,14,0.5);
  display: none;
  place-items: center;
  padding: 1rem;
  z-index: 100;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: var(--surface);
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 0.8rem; color: var(--burgundy-deep); }
.form-grid { display: grid; gap: 0.75rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 560px) { .form-row-2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.skeleton {
  background: linear-gradient(90deg, #ece4d8 25%, #f7f1e8 37%, #ece4d8 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: 14px;
  min-height: 220px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

[hidden] { display: none !important; }
.admin-shell:not([hidden]) { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
@media (max-width: 860px) { .admin-shell:not([hidden]) { grid-template-columns: 1fr; } }
.admin-side {
  background: var(--burgundy-deep);
  color: #f8efe8;
  padding: 1.2rem;
}
.admin-side h1 { font-size: 1.2rem; margin: 0 0 1rem; }
.admin-nav { display: grid; gap: 0.35rem; }
.admin-nav button {
  text-align: right;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}
.admin-nav button.active, .admin-nav button:hover {
  background: rgba(255,255,255,0.1);
}
.admin-main { padding: 1.2rem; }
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { color: var(--muted); font-weight: 800; }
.login-wrap {
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}
.login-wrap:not([hidden]) { display: grid; }
.login-box {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.status-new { color: var(--burgundy); font-weight: 800; }
.status-confirmed, .status-completed { color: var(--ok); font-weight: 800; }
.status-cancelled { color: var(--danger); font-weight: 800; }
.thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #eee;
}

.api-banner {
  background: #9a6b12;
  color: #fff;
  text-align: center;
  padding: 0.65rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
}
