:root {
  --burgundy: #7A1522;
  --burgundy-deep: #4A0C14;
  --burgundy-soft: #9B2433;
  --red: #8E1B28;
  --gold: #D4AF37;
  --gold-light: #F3E2A0;
  --gold-pale: #F8EFC8;
  --gold-dark: #8A6A1A;
  --cream: #FBF4E6;
  --cream-2: #F3E6C8;
  --cream-3: #EAD8B0;
  --ink: #2C1A14;
  --ink-soft: #6B5348;
  --wa: #075E54;
  --wa-bar: #054C44;
  --wa-bg: #E6DED3;
  --wa-in: #ffffff;
  --wa-out: #DCF8C6;
  --ok: #0F7B5A;
  --danger: #B91C1C;
  --shadow: 0 18px 50px rgba(74, 12, 20, .18);
  --font-ar: "Noto Sans Arabic", "Noto Naskh Arabic", "Segoe UI", sans-serif;
  --font-display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --font-lux: "Cinzel", "Cormorant Garamond", serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
html { background: var(--burgundy-deep); }
body {
  font-family: var(--font-ar);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(212, 175, 55, .22), transparent 55%),
    var(--cream);
  line-height: 1.55;
  min-height: 100dvh;
}
.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

img { display: block; max-width: 100%; }
button, input { font-family: inherit; }
button { cursor: pointer; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ===== Demo banner ===== */
.demo-banner {
  background: linear-gradient(90deg, var(--burgundy-deep), var(--burgundy), var(--burgundy-deep));
  color: var(--gold-pale);
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 7px 12px 8px;
  border-bottom: 1px solid rgba(212, 175, 55, .45);
  position: sticky;
  top: 0;
  z-index: 40;
}
.demo-banner span { color: #fff; font-weight: 800; }

/* ===== Brand header ===== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 6px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.45), rgba(251,244,230,.2)),
    var(--cream);
}
.brand-mark {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--burgundy-soft), var(--burgundy-deep));
  border: 1.5px solid var(--gold);
  box-shadow: 0 4px 12px rgba(122, 21, 34, .25), inset 0 0 0 2px rgba(212,175,55,.2);
  display: grid; place-items: center;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand h1 {
  font-family: var(--font-lux);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--burgundy);
  line-height: 1.15;
}
.brand h1 small {
  display: block;
  font-family: var(--font-ar);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}
.brand p {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 12px 4px;
}
.step {
  background: #fff;
  border: 1px solid var(--cream-3);
  border-radius: 12px;
  padding: 8px 8px 9px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.step .n {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--burgundy); color: var(--gold-light);
  font-size: 10px; font-weight: 800; margin-bottom: 4px;
}
.step p { font-size: 10.5px; color: var(--ink); line-height: 1.35; font-weight: 600; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  background: var(--cream);
}
.tabs button {
  flex: 1;
  border: 1px solid var(--cream-3);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(44,26,20,.04);
}
.tabs button.active {
  background: linear-gradient(135deg, var(--burgundy), var(--burgundy-deep));
  color: var(--gold-pale);
  border-color: var(--gold-dark);
  box-shadow: 0 6px 16px rgba(122, 21, 34, .28);
}

.panel { display: none; padding: 0 12px 16px; }
.panel.show { display: block; }
#panel-client .demo-actions {
  margin: 8px auto 0;
  max-width: 420px;
  width: 100%;
  padding: 0 2px;
}

.note {
  font-size: 11.5px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px dashed var(--cream-3);
  border-radius: 12px;
  padding: 6px 10px;
  margin: 0 0 8px;
}
.note strong { color: var(--burgundy); }
.note.warn {
  background: #FFF6E8;
  border-style: solid;
  border-color: var(--gold);
  color: var(--ink);
}
.note.warn strong { color: var(--burgundy-deep); }

/* ===== Phone (WhatsApp-like) ===== */
.phone {
  background: #111;
  border-radius: 28px;
  padding: 10px 8px 14px;
  box-shadow: var(--shadow), inset 0 0 0 2px #2a2a2a;
  max-width: 420px;
  margin: 0 auto;
}
.phone-notch {
  width: 92px; height: 8px; border-radius: 8px;
  background: #000; margin: 0 auto 8px;
}
.chat {
  background: var(--wa-bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 300px);
  min-height: 500px;
  max-height: 680px;
  position: relative;
}
.chat::before {
  content: "";
  position: absolute; inset: 52px 0 0;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><path d='M10 40c10-18 30-18 40 0' fill='none' stroke='%232C1A14' stroke-width='2'/><circle cx='64' cy='16' r='6' fill='none' stroke='%232C1A14' stroke-width='2'/></svg>");
}

.wa-head {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, var(--wa), var(--wa-bar));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 54px;
}
.wa-back { opacity: .85; display: grid; }
.wa-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--burgundy));
  border: 1.5px solid var(--gold);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.wa-avatar svg { width: 22px; height: 22px; }
.wa-id { flex: 1; min-width: 0; }
.wa-id h2 { font-size: 15px; font-weight: 800; line-height: 1.2; }
.wa-id p { font-size: 11px; opacity: .85; }
.wa-clock { font-size: 10px; opacity: .8; text-align: center; line-height: 1.3; display: flex; flex-direction: column; align-items: flex-start; }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  direction: ltr;
  position: relative;
  z-index: 1;
  -webkit-overflow-scrolling: touch;
}
.daychip {
  align-self: center;
  background: rgba(225, 212, 186, .95);
  color: #4A3B32;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  direction: rtl;
  margin: 4px 0 6px;
}
.bubble {
  max-width: 86%;
  padding: 8px 10px 6px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
  direction: rtl;
  text-align: right;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.in {
  align-self: flex-start;
  background: var(--wa-in);
  border-top-left-radius: 3px;
}
.bubble.out {
  align-self: flex-end;
  background: var(--wa-out);
  border-top-right-radius: 3px;
}
.bubble .meta {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  direction: ltr;
  margin-top: 3px;
  font-size: 10px;
  color: #667;
}
.bubble .ticks { color: #53bdeb; letter-spacing: -1px; }
.bubble.card-wrap {
  max-width: 100%;
  width: 100%;
  background: transparent;
  box-shadow: none;
  padding: 2px 0 6px;
  white-space: normal;
}
.fcard, .fcard * { white-space: normal; }
.typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 12px;
  border-top-left-radius: 3px;
  padding: 8px 12px;
  display: none;
  gap: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.typing.show { display: flex; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #999;
  animation: typ 1s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typ {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.compose {
  position: relative;
  z-index: 2;
  background: #F0F0F0;
  padding: 6px 8px 5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.chips { display: flex; gap: 6px; direction: rtl; flex-wrap: wrap; }
.chip {
  border: 0;
  background: #fff;
  color: var(--burgundy);
  border: 1px solid #E5D5C0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
}
.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  direction: rtl;
}
#chat-input {
  flex: 1;
  border: 0;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  min-height: 40px;
  background: #fff;
  outline: none;
  color: var(--ink);
}
#chat-send {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--wa); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.demo-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 2px 4px;
  direction: rtl;
}
.btn-gold, .btn-ghost, .btn-ok, .btn-cancel, .btn-send {
  border: 0; border-radius: 12px; padding: 10px 12px;
  font-weight: 800; font-size: 13px;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 40%, var(--gold-dark));
  color: var(--burgundy-deep);
  box-shadow: 0 3px 0 var(--gold-dark);
}
.btn-gold:active { transform: translateY(1px); box-shadow: none; }
.btn-gold:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--cream-3); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-cancel { background: #FEE2E2; color: var(--danger); }
.btn-send {
  background: linear-gradient(135deg, var(--burgundy-soft), var(--burgundy-deep));
  color: var(--gold-pale);
  border: 1px solid var(--gold);
}
.hint { font-size: 10.5px; color: #6B5E54; text-align: center; }

/* ===== Loyalty card ===== */
.fcard {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  color: var(--gold-pale);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(212,175,55,.28), transparent 50%),
    radial-gradient(80% 60% at 0% 100%, rgba(0,0,0,.25), transparent 50%),
    linear-gradient(160deg, #9B2433 0%, #6B1320 48%, #3F0B12 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 8px 18px rgba(74, 12, 20, .28), inset 0 0 0 1px rgba(243, 226, 160, .28);
  padding: 8px 10px 7px;
  direction: rtl;
}
.fcard::before, .fcard::after {
  content: "";
  position: absolute;
  width: 42px; height: 42px;
  border: 1.5px solid rgba(243, 226, 160, .55);
  pointer-events: none;
}
.fcard::before { top: 7px; right: 7px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.fcard::after { bottom: 7px; left: 7px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.fcard-head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(243, 226, 160, .28);
  margin-bottom: 6px;
}
.fcard-head .crown { width: 22px; height: 22px; flex-shrink: 0; }
.fcard-head .titles { flex: 1; min-width: 0; }
.fcard-head .titles .fr {
  font-family: var(--font-lux);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-light);
  line-height: 1.2;
}
.fcard-head .titles .ar {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.fcard-head .tag {
  font-size: 9.5px;
  font-weight: 800;
  background: rgba(212,175,55,.18);
  border: 1px solid rgba(243,226,160,.4);
  color: var(--gold-light);
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}
.fcard .who {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px; gap: 8px;
}
.fcard .who .nm { font-weight: 800; font-size: 14px; color: #fff; }
.fcard .who .score {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--gold-light);
  font-weight: 700;
  direction: ltr;
}
.stamps {
  display: grid;
  grid-template-columns: repeat(5, 38px);
  justify-content: center;
  gap: 6px 8px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border-radius: 11px;
  padding: 8px 6px;
  border: 1px solid rgba(212,175,55,.45);
  margin-bottom: 6px;
}
.stamp {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px dashed rgba(138, 106, 26, .45);
  background: rgba(255,255,255,.55);
  position: relative;
  transition: transform .35s ease, background .35s ease, border-color .35s ease;
}
.stamp svg { width: 58%; height: 58%; opacity: .22; }
.stamp.on {
  background: radial-gradient(circle at 30% 25%, var(--gold-light), var(--gold) 45%, var(--gold-dark));
  border: 1.5px solid var(--gold-dark);
  box-shadow: 0 2px 0 rgba(138,106,26,.35), inset 0 1px 0 rgba(255,255,255,.5);
}
.stamp.on svg { opacity: 1; }
.stamp.fresh { animation: pop .55s ease; }
@keyframes pop {
  0% { transform: scale(.4); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.stamp .num {
  position: absolute; bottom: -1px; left: 50%;
  transform: translateX(-50%);
  font-size: 8px; font-weight: 800; color: var(--gold-dark);
  display: none;
}
.offer {
  text-align: center;
  padding: 1px 4px 4px;
}
.offer .big {
  font-family: var(--font-lux);
  letter-spacing: .12em;
  font-size: 12px;
  color: var(--gold-light);
  font-weight: 700;
}
.offer .sub { font-size: 10.5px; color: rgba(248,239,200,.9); line-height: 1.35; }
.offer.ready .big { color: #fff; text-shadow: 0 0 12px rgba(212,175,55,.7); }
.icons {
  display: flex; justify-content: space-between; gap: 3px;
  padding: 4px 0 3px;
  border-top: 1px solid rgba(243,226,160,.2);
}
.icons figure { flex: 1; text-align: center; margin: 0; }
.icons svg { width: 14px; height: 14px; margin: 0 auto 1px; }
.icons figcaption {
  font-size: 7px;
  line-height: 1.2;
  color: rgba(248,239,200,.85);
  font-weight: 600;
}
.fcard-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 8.5px;
  color: rgba(248,239,200,.85);
  direction: ltr;
  padding-top: 1px;
  line-height: 1.3;
}
.fcard-foot .ig { text-align: right; }

/* ===== Tablet ===== */
.tablet {
  background: #F3EBE0;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--cream-3);
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 0 auto;
}
.tab-top {
  background: linear-gradient(135deg, #2C2420, #3D2E28);
  color: var(--cream);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tab-top .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(145deg, var(--gold), var(--burgundy-soft));
  display: grid; place-items: center;
  border: 1px solid var(--gold-light);
}
.tab-top h2 { font-size: 16px; font-weight: 800; }
.tab-top .sub { font-size: 11px; color: rgba(232,213,163,.9); }
.stats { margin-inline-start: auto; display: flex; gap: 6px; }
.stat-pill {
  background: rgba(255,255,255,.08);
  border-radius: 10px; padding: 5px 8px; text-align: center; min-width: 58px;
}
.stat-pill .n { font-size: 15px; font-weight: 800; color: var(--gold); }
.stat-pill .l { font-size: 9px; opacity: .75; }
.nav-fake {
  display: flex; gap: 6px; padding: 8px 10px;
  background: #fff; border-bottom: 1px solid rgba(201,168,76,.25);
}
.nav-fake span {
  flex: 1; text-align: center;
  border-radius: 10px; padding: 7px 4px;
  font-size: 11.5px; font-weight: 800;
  background: #FBF7F2; color: #8A7E74;
}
.nav-fake span.on { background: #2C2420; color: #FBF7F2; }

.tools {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; background: #fff;
  border-bottom: 1px solid #F0E6D8;
  flex-wrap: wrap;
}
.tools .hint { flex: 1; min-width: 0; }
.tools label { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.tools select, .tools input[type="search"] {
  border: 1.5px solid #E8DCCF; border-radius: 10px;
  padding: 7px 10px; font-size: 13px; background: #FFFcf8; color: var(--ink);
}
.tools input[type="search"] { flex: 1; min-width: 120px; }

.clist { padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 8px; background: #F3EBE0; }
.crow {
  background: #fff;
  border-radius: 14px;
  padding: 10px 10px 9px;
  border: 1px solid #F0E6D8;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px 10px;
  align-items: center;
}
.crow.hot { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.2); }
.crow.gone { border-color: #E8D5A3; background: #FFFCF5; }
.av {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--burgundy-soft));
  color: #2C2420; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.cinfo { min-width: 0; }
.cinfo .nm { font-weight: 800; font-size: 13.5px; }
.cinfo .meta { font-size: 11px; color: var(--ink-soft); }
.mini-stamps { display: flex; gap: 2px; margin-top: 4px; flex-wrap: wrap; }
.mini-stamps i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #EAD8B0; display: inline-block;
}
.mini-stamps i.on { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); }
.cacts { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.cacts button { padding: 7px 10px; font-size: 11.5px; border-radius: 10px; white-space: nowrap; }
.badge {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  background: #FEF3C7; color: #92400E;
  border-radius: 6px; padding: 1px 6px; margin-inline-start: 4px;
}
.badge.ok { background: #D1FAE5; color: #065F46; }
.badge.love { background: #FCE7F3; color: #9D174D; }

/* Winback preview */
.preview {
  grid-column: 1 / -1;
  background: #ECE5DD;
  border-radius: 10px;
  padding: 8px;
  margin-top: 2px;
}
.preview .bubble {
  max-width: 100%;
  font-size: 12.5px;
}

/* Modal + toast */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(20,14,10,.55);
  z-index: 80;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-bg.show { display: flex; }
.modal {
  background: #FFFCF8;
  border-radius: 18px;
  width: 100%; max-width: 420px;
  max-height: 90vh; overflow: auto;
  border: 1px solid var(--cream-3);
  direction: rtl;
}
.modal header {
  padding: 14px 16px;
  border-bottom: 1px solid #F0E6D8;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800;
}
.modal .body { padding: 14px 16px; font-size: 14px; }
.modal .body .quote {
  background: #ECE5DD; border-radius: 12px; padding: 10px 12px;
  margin: 10px 0; font-size: 13.5px;
}
.modal footer {
  padding: 0 16px 16px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.modal footer button { flex: 1; min-width: 110px; }
.toast {
  position: fixed; bottom: calc(20px + var(--safe-b)); left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #2C2420; color: #FBF7F2;
  padding: 10px 16px; border-radius: 18px;
  font-size: 12.5px; z-index: 90; opacity: 0; transition: .3s;
  max-width: 88%; text-align: center; direction: rtl;
  line-height: 1.4;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot {
  text-align: center;
  padding: 8px 16px calc(20px + var(--safe-b));
  font-size: 11px; color: var(--ink-soft);
}
.ex {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  background: #FEF3C7; color: #92400E;
  border-radius: 6px; padding: 0 6px; margin-inline-start: 4px;
  vertical-align: 1px;
}

@media (min-width: 720px) {
  .tabs { top: 31px; }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.fresh, .toast, .typing i { animation: none; transition: none; }
}
