:root {
  --ink: #14201f;
  --muted: #6b7b79;
  --brand: #0f766e;
  --brand-dark: #0b5750;
  --accent: #e8a33d;
  --bg: #fbf8f3;
  --card: #ffffff;
  --line: #e7e0d6;
  --danger: #b42318;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Cairo", "Tajawal", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 620px; margin: 0 auto; padding: 18px 16px 56px; }
.wide { max-width: 900px; }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.35; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
a { color: var(--brand); }

.muted { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.brand .dot {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 18px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  min-height: 52px;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.plain { background: #f2ede5; color: var(--ink); }
.btn.small { width: auto; padding: 9px 14px; min-height: 40px; font-size: 0.92rem; border-radius: 11px; }
.btn.tiny { width: auto; padding: 6px 10px; min-height: 34px; font-size: 0.85rem; border-radius: 9px; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f0c6c1; }

label { display: block; font-weight: 700; font-size: 0.95rem; margin: 0 0 6px; }
input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
  min-height: 50px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid #b7d8d4; border-color: var(--brand); }
.field { margin-bottom: 14px; }

.note {
  background: #fff8ea;
  border: 1px solid #f3e0bb;
  color: #6b4b12;
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.err {
  background: #fdf1f0;
  border: 1px solid #f3cbc7;
  color: var(--danger);
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 0.92rem;
  margin-bottom: 14px;
  display: none;
}
.err.show { display: block; }
.ok { background: #eef7f1; border: 1px solid #c9e6d3; color: #14532d; border-radius: 13px; padding: 11px 13px; font-size: 0.92rem; margin-bottom: 14px; }

.card {
  position: relative;
  border-radius: 22px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-dark) 70%);
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
  overflow: hidden;
  margin-bottom: 16px;
}
.card::after {
  content: "";
  position: absolute; inset: auto -40px -70px auto;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.card .shopname { font-size: 1.35rem; font-weight: 800; margin: 0; }
.card .shoptag { font-size: 0.88rem; opacity: 0.85; margin: 2px 0 0; }
.card .who { margin-top: 14px; font-size: 0.92rem; opacity: 0.92; }
.stamps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 16px 0 10px;
  position: relative;
  z-index: 1;
}
.stamp {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.45);
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
}
.stamp.on { border-style: solid; border-color: #fff; background: rgba(255,255,255,0.16); }
.card .reward { font-size: 0.92rem; opacity: 0.95; position: relative; z-index: 1; }
.card .ready {
  margin-top: 12px;
  background: var(--accent);
  color: #3a2708;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 0.95rem;
  text-align: center;
  position: relative; z-index: 1;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; color: var(--brand); }
.stat span { font-size: 0.78rem; color: var(--muted); }

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: 0; }
.member .info { flex: 1; min-width: 0; }
.member .name { font-weight: 700; }
.member .sub { font-size: 0.82rem; color: var(--muted); }
.member .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-block;
  background: #eef4f3;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.pill.gold { background: #fdf2dd; color: #8a5a08; }

.msg { border-bottom: 1px solid var(--line); padding: 12px 0; }
.msg:last-child { border-bottom: 0; }
.msg b { display: block; }
.msg .when { font-size: 0.76rem; color: var(--muted); }

.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .num {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.qrbox { text-align: center; }
.qrbox canvas, .qrbox img { width: 220px; height: 220px; image-rendering: pixelated; background: #fff; border-radius: 12px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

.footer { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 26px; }
.footer a { color: var(--muted); }
.hide { display: none !important; }
