:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --ink: #134e4a;
  --bg: #f6f7f6;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 42, 40, .08), 0 4px 14px rgba(16, 42, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
[dir="rtl"] body, body[dir="rtl"] { font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', system-ui, sans-serif; }

.topbar {
  background: var(--brand);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
.langbtn {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 14px 90px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: var(--ink); }
input[type=text], input[type=tel], input[type=url], input[type=number], textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid #d8dee0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fbfdfd;
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 64px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #eef4f3; color: var(--ink); }
.btn-ghost:hover { background: #e2ecea; }
.btn-wa { background: #25d366; color: #fff; width: 100%; }
.btn-wa:hover { background: #1eb85a; }
.btn-danger { background: #fee2e2; color: var(--danger); padding: 7px 12px; font-size: 13px; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btnrow { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; min-width: 120px; }

.prod-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eef1f1;
}
.prod-item:last-child { border-bottom: none; }
.prod-item .thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); flex-shrink: 0; }
.prod-item .ph {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 19px;
}
.prod-item .info { flex: 1; min-width: 0; }
.prod-item .info .n { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-item .info .p { color: var(--brand); font-weight: 700; font-size: 13.5px; }
.prod-item .acts { display: flex; gap: 6px; }

.linkbox {
  width: 100%;
  direction: ltr;
  text-align: left;
  font-size: 12px !important;
  background: #f0f5f4 !important;
  word-break: break-all;
}
.lenmeter { font-size: 12px; color: var(--muted); margin-top: 6px; }
.lenmeter.warn { color: #b45309; font-weight: 600; }
.note { font-size: 12.5px; color: var(--muted); background: #f2f7f6; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }

/* Storefront */
.storehead { text-align: center; padding: 26px 16px 18px; }
.storehead .logo {
  width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 800; box-shadow: var(--shadow);
}
.storehead h1 { margin: 0; font-size: 21px; color: var(--ink); }
.storehead .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 14px 110px; max-width: 560px; margin: 0 auto; }
.pcard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pcard .imgwrap { width: 100%; aspect-ratio: 1; background: var(--brand-soft); position: relative; }
.pcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .phbig { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 44px; font-weight: 800; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .n { font-weight: 700; font-size: 14px; }
.pcard .d { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .p { color: var(--brand); font-weight: 800; font-size: 14.5px; margin-top: auto; }
.pcard .add {
  margin-top: 6px; background: var(--brand); color: #fff; border: none; border-radius: 9px;
  padding: 8px; font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.pcard .add:hover { background: var(--brand-dark); }

.cartfab {
  position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 30;
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 13px 20px; font-size: 15px; font-weight: 800; font-family: inherit;
  box-shadow: 0 6px 20px rgba(15,118,110,.4); cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.cartfab .count { background: #fff; color: var(--brand); border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; padding: 0 6px; }

.sheet-bg { position: fixed; inset: 0; background: rgba(10,25,24,.45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #fff; border-radius: 20px 20px 0 0; padding: 18px 16px 26px;
  max-width: 560px; margin: 0 auto; max-height: 82vh; overflow-y: auto;
}
.sheet h3 { margin: 0 0 10px; color: var(--ink); font-size: 17px; }
.cline { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f2f2; font-size: 14px; }
.cline .qn { flex: 1; }
.cline .qty { display: flex; align-items: center; gap: 8px; }
.cline .qty button { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid #d8dee0; background: #fff; font-size: 15px; cursor: pointer; color: var(--ink); font-weight: 700; }
.total { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; padding: 12px 2px 4px; color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.errcard { max-width: 420px; margin: 60px auto; text-align: center; }
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: #134e4a; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 60; box-shadow: var(--shadow);
}
.footer-note { text-align: center; color: var(--muted); font-size: 11.5px; padding: 18px 0 30px; }
@media (min-width: 480px) { .grid { grid-template-columns: 1fr 1fr 1fr; } .wrap, .grid, .sheet { max-width: 640px; } }
