/* Noto Kufi Arabic (OFL), self-hosted: one variable file per script covers weights 400–700 */
@font-face { font-family: "Kufi"; src: url("/fonts/kufi-arabic.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Kufi"; src: url("/fonts/kufi-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
/* amplefy frame (fixed for every shop) + merchant slot (--m, --m-on, --m-ui set per shop from app.js).
   Spacing 4/8/12/16/24/32/48/64, type 12/14/16/20/24/32, square corners (only shop logos are round). Colours from the amplefy brand guide. */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 24px; --fs-2xl: 32px;
  --radius: 0;
  --pill: 0;
  --tap: 44px;

  --bg: #f0f0f0;           /* amplefy off-white */
  --card: #ffffff;
  --ink: #0d0c33;          /* Maastricht Blue */
  --muted: #5d5c78;        /* 5.6:1 on --bg */
  --line: #e2e2e6;
  --soft: #f6f6f8;
  --empty: #9291a6;        /* empty stamp outline, 3.1:1 on white */

  --green: #00aa89;        /* Light Sea Green: button fill, always with navy text (6.4:1) */
  --green-hover: #009a7c;
  --primary: #006e58;      /* green for text/links on light backgrounds, 5.5:1 */
  --primary-dark: #0d0c33;
  --primary-soft: #e6f6f2;
  --accent: #9e3a0b;
  --accent-soft: #fdf2e3;
  --danger: #b91c1c;
  --danger-soft: #fdeaea;

  --m: #0d0c33; --m-on: #ffffff; --m-ui: #0d0c33;
  --act: #2f8466; --act-on: #ffffff;   /* action colour before a shop colour applies: AmpleGuard's green, deepened so white text passes AA (4.55:1) */

  --shadow: none;
  font-family: "Kufi", "Geeza Pro", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: var(--fs-md); line-height: 1.6; }
:lang(en) body, html[lang="en"] body { line-height: 1.5; }
h1 { font-size: var(--fs-xl); line-height: 1.3; margin: 0; }
h2 { font-size: var(--fs-lg); line-height: 1.3; margin: 0; }
h3 { font-size: var(--fs-md); margin: 0 0 var(--s3); }
p { margin: 0 0 var(--s3); }
a { color: var(--primary); text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: var(--s5); }
.loading { padding: var(--s7); color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #fff; border-inline-end: 1px solid var(--line); color: var(--ink); display: flex; flex-direction: column; padding: var(--s5) var(--s3); gap: var(--s4); position: sticky; top: 0; height: 100vh; }
.product { display: flex; align-items: center; gap: 10px; }
.product span { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.3px; line-height: 1; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
.side .product { padding: 0 var(--s2); }
.biz-card { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s4); border-bottom: 1px solid var(--line); }
.biz-card .m-mark { width: 48px; height: 48px; font-size: var(--fs-lg); }
.biz-card b { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-card > div { min-width: 0; }
.side nav { display: flex; flex-direction: column; gap: var(--s1); }
.side nav a { color: var(--muted); min-height: var(--tap); padding: 0 var(--s3); border-radius: var(--radius); display: flex; align-items: center; border-inline-start: 3px solid transparent; }
.side nav a:hover { background: var(--soft); color: var(--ink); }
.side nav a.active { color: var(--ink); font-weight: 700; background: var(--soft); border-inline-start-color: var(--act);   }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s1); align-items: flex-start; padding: 0 var(--s2); }
.side-foot .who { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s2); margin-inline-start: calc(-1 * var(--s2)); border-inline-start: 3px solid transparent; }
.side-foot .who:hover, .side-foot .who.active { background: var(--soft); }
.side-foot .who.active { border-inline-start-color: var(--act); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s3) var(--s5); margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.side-foot .link { color: var(--muted); font-weight: 500; font-size: var(--fs-sm); min-height: 32px; }
.side-sign { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); width: 100%; display: flex; }
.side-sign .product { padding: 0 var(--s2); gap: 6px; width: fit-content; }
.side-sign .product img { width: 16px; height: 16px; }
.side-sign .product span { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; color: var(--muted); }
.sig { font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: var(--s1); }
.sig b { color: var(--ink); font-weight: 600; }
.main { padding: var(--s5) var(--s6) var(--s8); min-width: 0; }
.page { max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }

/* ---------- layout helpers ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow); margin-bottom: var(--s4); min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin-bottom: var(--s4); }
.grid2 > .card, .grid3 > .card, .stack > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack.tight { gap: var(--s2); margin-top: var(--s3); }
.row { display: flex; gap: var(--s3); align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; margin-top: var(--s4); }
.row.wrap { flex-wrap: wrap; }
.narrow { max-width: 680px; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s3); }
label.inline { flex-direction: row; align-items: center; gap: var(--s2); margin: 0; }
label.check { flex-direction: row; align-items: flex-start; gap: var(--s3); color: var(--ink); min-height: var(--tap); }
label.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; min-height: 0; }
input, select, textarea { font: inherit; color: var(--ink); min-height: var(--tap); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.row > input, .row > select { flex: 1; }
/* our own arrow instead of the browser's: same weight as the text, at the end of the field in both directions */
select { appearance: none; -webkit-appearance: none; cursor: pointer; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230d0c33' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px 8px; background-position: right 14px center; padding-inline-end: 40px; }
[dir="rtl"] select { background-position: left 14px center; }
.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 0 var(--s4); border-radius: var(--radius); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--act); color: var(--act-on); border-color: var(--act); font-weight: 700; }
.btn.primary:hover { filter: brightness(.92); }
.btn.big { min-height: 52px; padding: 0 var(--s5); font-size: var(--fs-md); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; min-height: var(--tap); display: inline-flex; align-items: center; color: var(--primary); cursor: pointer; font: inherit; font-weight: 600; }
.link.danger { color: var(--danger); }
.login-card .forgot { display: flex; margin: var(--s2) auto 0; color: var(--muted); font-weight: 500; font-size: var(--fs-sm); }

/* ---------- badges & chips ---------- */
.badge { display: inline-block; padding: 0 var(--s2); line-height: 24px; border-radius: var(--pill); font-size: var(--fs-xs); font-weight: 600; background: #eef1f5; color: #475569; white-space: nowrap; }
.badge.ok { background: var(--soft); color: var(--ink); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.tier-bronze { background: #eef1f5; color: #475569; }
.tier-silver { background: #dfe5ec; color: #334155; }
.tier-gold { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: var(--pill); min-height: var(--tap); padding: 0 var(--s4); cursor: pointer; font: inherit; font-size: var(--fs-sm); color: var(--ink); }
.chip.on { background: var(--act); color: var(--act-on); border-color: var(--act); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th { text-align: start; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
td.pos { color: var(--primary); font-weight: 600; }
td.neg { color: var(--accent); font-weight: 600; }
.msg-cell { max-width: 460px; }
.search { max-width: 320px; }

/* ---------- cashier ---------- */
.search-card label { font-size: var(--fs-md); color: var(--ink); font-weight: 600; }
.phone-input { font-size: var(--fs-xl); letter-spacing: 1px; min-height: 52px; direction: ltr; text-align: center; }
.big-balance { border-inline-start: 4px solid var(--m-ui); padding: var(--s1) var(--s4); margin: var(--s4) 0; display: flex; flex-direction: column; }
.big-balance small { color: var(--muted); font-size: var(--fs-sm); }
.big-balance b { font-size: var(--fs-2xl); line-height: 1.2; color: var(--ink); }
.stamps { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.stamp { width: 28px; height: 28px; border-radius: 0; border: 1.5px solid var(--empty); }
.stamp.on { background: var(--m-ui); border-color: var(--m-ui); }
.ready { color: var(--primary); font-weight: 700; }
.m-progress { margin: var(--s5) 0 var(--s3); }
.m-progress p { margin: 0; font-size: var(--fs-sm); }
.m-progress p b { font-size: var(--fs-lg); }
.facts { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 var(--s2); }
.facts b { color: var(--ink); font-weight: 600; }

/* ---------- merchant card: the shop's slot inside the amplefy frame ---------- */
.mcard { padding: 0; overflow: hidden; }
.mcard .inner { padding: var(--s4) var(--s5) var(--s4); }
.mcard .inner .top { align-items: flex-start; }
.mcard h2 { font-size: var(--fs-xl); }
.m-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.m-cover { height: 132px; background-size: cover; background-position: center; position: relative; display: flex; align-items: flex-end; padding: var(--s4) var(--s5); }
.m-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 9, 20, .78), rgba(10, 9, 20, .05) 75%); }
.m-id { display: flex; align-items: center; gap: var(--s2); position: relative; min-width: 0; }
.m-id b { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-cover .m-id b { color: #fff; }
.m-mark { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--m); color: var(--m-on); font-weight: 700; font-size: var(--fs-md); border: 1px solid var(--line); }
.m-cover .m-mark { border: 2px solid #fff; }
.m-mark img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.biz-card .m-mark { border-color: transparent; }

.reward-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.btn.reward { flex-direction: column; gap: 0; padding: var(--s3); min-height: 64px; border: 1px solid var(--line); white-space: normal; }
.btn.reward small { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.btn.reward:not(:disabled):hover { border-color: var(--primary); }
.new-cust { border: 2px dashed var(--empty); }
.otp-input { font-size: var(--fs-2xl); letter-spacing: 12px; text-align: center; direction: ltr; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; }
.kpi { padding: var(--s4) var(--s5); border-inline-start: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-inline-start: 0; }
.kpi small { color: var(--muted); font-size: var(--fs-sm); }
.kpi b { display: block; font-size: var(--fs-2xl); line-height: 1.2; margin-top: var(--s1); }
.kpi .sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s1); }
.kpi .sub .link { min-height: 0; font-size: var(--fs-sm); }
.kpi.warn b { color: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; margin-bottom: var(--s2); }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: var(--m-ui); border-radius: 0; min-height: 2px; }
.bar:hover .bar-fill { background: var(--act); }
.tier-row { display: grid; grid-template-columns: 80px 1fr 48px; gap: var(--s3); align-items: center; margin-bottom: var(--s3); }
.meter { height: 12px; background: #eef1f5; border-radius: var(--pill); overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--pill); }
.meter-fill.tier-bronze { background: #94a3b8; }
.meter-fill.tier-silver { background: #475569; }
.meter-fill.tier-gold { background: #d97706; }

/* ---------- settings ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.color-field { flex-direction: row; align-items: center; justify-content: space-between; color: var(--ink); font-weight: 600; }
.color-field input { width: 64px; padding: var(--s1); cursor: pointer; flex: none; }
.img-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.img-thumb { width: 56px; height: 56px; flex: none; border-radius: 50%; background: var(--soft); border: 1px dashed var(--empty); overflow: hidden; }
.img-thumb.cover { width: 88px; border-radius: var(--radius); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.img-meta small { font-size: var(--fs-xs); }
.img-actions { display: flex; align-items: center; gap: var(--s2); }
label.file-btn { flex-direction: row; margin: 0; color: var(--ink); font-size: var(--fs-sm); }
label.file-btn:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.preview-title { color: var(--muted); font-size: var(--fs-sm); }
.plan-card { display: flex; gap: var(--s3); align-items: baseline; flex-wrap: wrap; }
.radio-row { display: flex; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.radio-card { flex-direction: row; align-items: center; gap: var(--s2); border: 1px solid var(--line); min-height: var(--tap); padding: 0 var(--s3); border-radius: var(--radius); color: var(--ink); margin: 0; cursor: pointer; }
.radio-card input { width: auto; min-height: 0; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); min-height: var(--tap); border-bottom: 1px solid var(--line); }
.note { background: var(--soft); border: 1px solid var(--line); padding: var(--s3); border-radius: var(--radius); font-size: var(--fs-sm); }
.upsell { text-align: center; padding: var(--s7) var(--s5); }
.msg-list { display: flex; flex-direction: column; gap: var(--s2); max-height: 360px; overflow: auto; }
.msg { background: var(--soft); border-radius: var(--radius); padding: var(--s2) var(--s3); }
.msg-body { white-space: pre-wrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); padding: 72px var(--s5) 96px; position: relative; }
.login-card { width: 100%; max-width: 452px; padding: 40px 36px 36px; margin: 0; }
.login-card .product { flex-direction: column; gap: var(--s4); margin-bottom: 40px; }
.login-card .product img { width: 64px; height: 64px; }
.login-card .product span { font-size: 32px; letter-spacing: -0.6px; }
.login-card h1 { font-size: var(--fs-xl); margin-bottom: var(--s5); }
.login-card label { color: var(--ink); font-size: var(--fs-md); }
.login-card input { min-height: 52px; }
.login-card .btn { margin-top: var(--s5); min-height: 52px; }
.lang-btn { position: absolute; top: var(--s4); inset-inline-end: var(--s4); }
.login-foot { position: absolute; bottom: var(--s5); display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.login .sig { color: var(--muted); }
.login-foot nav { display: flex; gap: var(--s4); font-size: var(--fs-xs); }
.login-foot a { color: var(--muted); }
/* amplefy logo: lowercase wordmark + stepped squares, as in the brand guide */
.amplefy-logo { display: inline-flex; align-items: flex-start; gap: 3px; direction: ltr; color: var(--ink); font: 600 16px/1 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; letter-spacing: -0.3px; }
.amplefy-logo svg { width: 10px; height: 10px; margin-top: -1px; }

/* ---------- modal / toast / whatsapp simulation ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: var(--s5); }
.modal { background: #fff; border-radius: var(--radius); padding: var(--s5); width: 100%; max-width: 420px; box-shadow: 0 16px 40px rgba(0,0,0,.2); }
#toasts { position: fixed; top: var(--s4); inset-inline-end: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: var(--s3) var(--s4); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 360px; animation: pop .15s ease-out; }
.toast.err { background: var(--danger); }
#wa { position: fixed; bottom: var(--s4); inset-inline-start: 256px; display: flex; flex-direction: column; gap: var(--s2); z-index: 55; width: 330px; max-width: calc(100vw - 32px); }
/* WhatsApp colours here mimic the real app on purpose: it previews what the customer receives. */
.wa-bubble { background: #ece5dd; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; cursor: pointer; animation: pop .15s ease-out; }
.wa-head { background: #075e54; color: #fff; padding: var(--s2) var(--s3); font-size: var(--fs-xs); display: flex; align-items: center; gap: var(--s2); }
.wa-dot { width: 8px; height: 8px; border-radius: var(--pill); background: #25d366; }
.wa-body { background: #dcf8c6; margin: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--radius); white-space: pre-wrap; font-size: var(--fs-sm); }
.wa-foot { font-size: var(--fs-xs); color: #54656f; padding: 0 var(--s3) var(--s2); text-align: end; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  /* phone: one row with logo + language + sign out, then the menu as a single scrollable row */
  .side { position: sticky; top: 0; z-index: 30; height: auto; min-width: 0; align-content: flex-start; flex-direction: row; flex-wrap: wrap; align-items: center; padding: var(--s2) var(--s3); gap: var(--s2); }
  .side nav { order: 3; width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a { white-space: nowrap; flex: none; border-inline-start: 0; border-bottom: 3px solid transparent; border-radius: 0; }
  .side nav a.active { background: none; border-bottom-color: var(--act); }
  .side-foot { margin: 0; margin-inline-start: auto; flex-direction: row; align-items: center; gap: var(--s4); }
  .side-foot .who { margin: 0; padding: 0; border: 0; }
  .side-foot .who span { display: none; }
  .side-foot .who.active { background: none; color: var(--act); }
  .biz-card { padding: 0; border: 0; }
  .biz-card .m-mark { width: 36px; height: 36px; }
  .side { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .side-sign { display: none; }
  .side .sig { display: none; }
  .side-foot .link { white-space: nowrap; }
  .main { padding: var(--s4); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-inline-start: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  #wa { inset-inline-start: var(--s4); }
}

/* campaigns: pick a group, write, see it as the customer will */
.camp { display: grid; gap: var(--s4); align-items: start; max-width: 960px; }
@media (min-width: 961px) { .camp { grid-template-columns: minmax(0, 1fr) 300px; } }
.camp-form { display: flex; flex-direction: column; gap: var(--s3); }
.camp fieldset { border: 0; padding: 0; margin: 0 0 var(--s2); min-width: 0; }
.camp legend { font-weight: 700; margin-bottom: var(--s3); padding: 0; }
.auds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.aud { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); text-align: start; min-height: 56px; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.aud b { font-size: var(--fs-md); }
.aud[aria-checked="true"] { border-color: var(--act); box-shadow: inset 0 0 0 1px var(--act); }
.aud[aria-checked="true"] b { color: var(--act); }
.aud:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.msg-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.msg-head .chip { min-height: 36px; }
.camp-form .btn.big { align-self: flex-start; }
.camp-form .btn:disabled { opacity: .45; cursor: not-allowed; }
.camp-preview { display: flex; flex-direction: column; gap: var(--s2); }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 0;  padding: var(--s3); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
@media (max-width: 600px) { .auds { grid-template-columns: minmax(0, 1fr); } .camp-form .btn.big { align-self: stretch; } }

/* list rows: replace tables so nothing wraps into three lines on a phone */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 56px; }
.list > :last-child, .list > :last-child .li { border-bottom: 0; }
a.li:hover { background: var(--soft); }
a.li:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li small { color: var(--muted); font-size: var(--fs-sm); }
.li-mid { display: none; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; align-items: center; gap: var(--s1); }
.li-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; flex: none; }
.li-end b { font-weight: 700; white-space: nowrap; }
.warn-text { color: var(--accent); font-weight: 600; }
@media (min-width: 700px) { .li-mid { display: flex; } }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.li-msg summary { list-style: none; cursor: pointer; }
.li-msg summary::-webkit-details-marker { display: none; }
.li-msg > .msg-body { background: var(--soft); border-radius: var(--radius); padding: var(--s3); margin: 0 0 var(--s3); }
.li-msg .li-end { flex-direction: row-reverse; align-items: center; gap: var(--s2); }
.msg-link { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-preview .stamps { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); max-width: calc(var(--cols, 5) * 44px); }
.page-preview .stamp { width: auto; height: auto; aspect-ratio: 1; }
.program-now { padding: var(--s3); background: var(--soft); border-radius: var(--radius); margin-bottom: var(--s3); align-items: center; }
.radio-col { display: flex; flex-direction: column; gap: var(--s2); }
.radio-col .radio-card { min-height: 52px; }
.radio-card:has(input:disabled) { cursor: default; background: var(--soft); }
.note.warn { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.pv-rewards { display: flex; flex-direction: column; gap: var(--s3); }
.pv-reward { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s3); font-weight: 600; }
.pv-reward small { font-weight: 400; }
.pv-reward > i { grid-column: 1 / -1; height: 6px; background: var(--soft); border-radius: 0; overflow: hidden; display: block; }
.pv-reward > i > i { display: block; height: 100%; background: var(--m-ui); }

/* icons */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }
[dir="rtl"] .ic-flip { transform: scaleX(-1); }
.btn.icon-only { padding: 0; width: var(--tap); }
.field-ic { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.field-ic .ic { position: absolute; inset-inline-start: var(--s3); color: var(--muted); pointer-events: none; }
.field-ic input { padding-inline-start: 40px; }
/* units inside the field instead of a sentence under it */
.affix { display: flex; align-items: stretch; border: 1px solid var(--line); background: #fff; }
.affix:focus-within { outline: 2px solid var(--ink); }
.affix input { border: 0; outline: 0; flex: 1; }
.affix input:focus { outline: 0; }
.affix span { display: flex; align-items: center; padding: 0 var(--s3); color: var(--muted); font-size: var(--fs-sm); background: var(--soft); white-space: nowrap; }
.ic-title { display: flex; align-items: center; gap: var(--s2); }
.ic-title .muted { font-weight: 400; margin-inline-start: auto; }
.side nav a { gap: var(--s3); }
.side nav a .ic { color: var(--muted); }
.side nav a.active .ic { color: var(--act); }
.link { display: inline-flex; align-items: center; gap: var(--s1); }
.link .ic { width: 16px; height: 16px; }
.side-foot .link .ic { width: 18px; height: 18px; }
.chip { display: inline-flex; align-items: center; gap: var(--s1); }
.chip .ic { width: 16px; height: 16px; }
.btn.danger { color: var(--danger, #b42318); }
.btn.danger:hover { border-color: currentColor; }
@media (max-width: 960px) { .side nav a { gap: 6px; padding: 0 var(--s2); } .side nav a .ic { width: 18px; height: 18px; } }

/* WhatsApp preview in campaigns: looks like the customer's phone (WhatsApp light theme) */
.wa-phone { border: 1px solid var(--line); background: #efeae2; display: flex; flex-direction: column; min-height: 420px; overflow: hidden;
  font-family: -apple-system, "SF Arabic", "Segoe UI", Roboto, "Geeza Pro", sans-serif; }
.wa-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #008069; color: #fff; }
.wa-top img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.wa-who { display: flex; flex-direction: column; line-height: 1.25; }
.wa-who b { font-size: 16px; font-weight: 600; text-align: right; }
.wa-who small { font-size: 12px; opacity: .85; }
.wa-chat { flex: 1; padding: 12px 10px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  background-color: #efeae2; background-image: radial-gradient(rgba(0, 0, 0, .045) 1px, transparent 1px); background-size: 14px 14px; }
.wa-day { align-self: center; background: #fff; color: #54656f; font-size: 12px; padding: 4px 10px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.wa-in { position: relative; max-width: 88%; background: #fff; color: #111b21; padding: 6px 9px 8px; border-radius: 7.5px; border-start-start-radius: 0;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 14.5px; line-height: 1.55; }
.wa-in::before { content: ""; position: absolute; top: 0; inset-inline-start: -8px; border-top: 0 solid transparent; border-inline-end: 8px solid #fff; border-bottom: 10px solid transparent; }
.wa-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-time { display: block; text-align: end; font-size: 11px; color: #667781; margin-top: 2px; direction: ltr; }
[dir="rtl"] .wa-time { text-align: left; }
.wa-bar { background: #f0f2f5; padding: 8px 10px; }
.wa-bar span { display: block; background: #fff; border-radius: 20px; padding: 8px 14px; color: #8696a0; font-size: 14px; }
@media (max-width: 960px) { .wa-phone { min-height: 300px; } }

/* integration page: keys + API docs */
.code { background: var(--ink); color: #e8e8f0; padding: var(--s3); margin: 0; overflow-x: auto; font: 13px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; text-align: left; white-space: pre; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
.key-box { display: flex; align-items: center; gap: var(--s2); border: 1px solid var(--line); background: var(--soft); padding-inline-start: var(--s3); min-width: 0; }
.key-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; direction: ltr; text-align: left; }
.key-box .btn { border: 0; border-inline-start: 1px solid var(--line); flex: none; }
.key-prefix { color: var(--muted); }
.key-new { margin-top: var(--s3); }
.key-new input { flex: 1; min-width: 0; }
.api-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s3) var(--s4); align-items: center; margin: 0; }
.api-dl dt { color: var(--muted); font-size: var(--fs-sm); }
.api-dl dd { margin: 0; min-width: 0; }
.api-dl dd > code { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.method { font: 700 11px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: 5px 6px; letter-spacing: 0.5px; background: var(--soft); color: var(--ink); border: 1px solid var(--line); flex: none; }
.method.post { background: var(--act); color: var(--act-on); border-color: var(--act); }
.ep-index { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.ep-index a { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s3); background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: var(--fs-sm); }
.ep-index a:hover { border-color: var(--ink); }
.ep { scroll-margin-top: var(--s4); }
.ep-head { display: flex; align-items: center; gap: var(--s2); justify-content: flex-end; margin-bottom: var(--s2); min-width: 0; }
html[dir="ltr"] .ep-head { justify-content: flex-start; }
.ep-head code { font-size: var(--fs-sm); overflow-wrap: anywhere; min-width: 0; }
.ep h3 { margin-bottom: var(--s1); }
.ep-desc { color: var(--muted); margin: 0 0 var(--s3); }
.params { border-top: 1px solid var(--line); margin: var(--s3) 0; }
.param { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); align-items: start; }
.param-k { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.param-k small { color: var(--muted); font-size: var(--fs-xs); }
.param-v { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; font-size: var(--fs-sm); }
.ep-code { margin: 0; }
.ep-code > div { min-width: 0; }
.code-label { display: block; color: var(--muted); font-size: var(--fs-xs); margin-bottom: var(--s1); }
@media (max-width: 600px) {
  .param { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .api-dl { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .api-dl dd { margin-bottom: var(--s2); }
}
.li-end.row { flex-direction: row; align-items: center; gap: var(--s3); }
.badge.req { background: var(--ink); color: #fff; }
.badge.opt { background: none; color: var(--muted); border: 1px solid var(--line); line-height: 22px; }
.modal:has(.key-box) { max-width: 520px; width: calc(100vw - 32px); }
.key-accept { display: flex; gap: var(--s2); align-items: flex-start; margin-bottom: var(--s3); font-size: var(--fs-sm); }
.key-accept input { margin-top: 4px; flex: none; width: 18px; height: 18px; min-height: 0; }
.li-void .li-main b, .li-void .li-end b { text-decoration: line-through; color: var(--muted); }
.li > .btn.icon-only { flex: none; margin-inline-start: var(--s2); }
