:root {
  --bg: #fcf1f3;
  --bg-2: #f8e3e8;
  --paper: #fffafb;
  --blush: #f3cdd5;
  --rose: #d991a3;
  --rose-deep: #b8677c;
  --ink: #4a2634;
  --ink-soft: #7d5a66;
  --line: #ecd3d9;
  --ok: #5d8c6f;
  --radius: 22px;
  --shadow: 0 18px 40px -22px rgba(122, 52, 74, .45);
  --font: "Tajawal", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, #fbdde4 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #f9e6ea 0%, transparent 60%),
    var(--bg);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }

.wrap { max-width: 460px; margin: 0 auto; padding: 28px 16px 48px; }
.wrap.wide { max-width: 980px; }

.brand img { width: 170px; margin: 0 auto 8px; }
.brand.small img { width: 92px; margin: 0; }

h1 { font-size: 1.7rem; margin: 6px 0 4px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 0 0 12px; font-weight: 700; }
.lead { color: var(--ink-soft); margin: 0 0 22px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: .92rem; }
.en { font-family: var(--serif); letter-spacing: .08em; }

/* ---------- panels & forms ---------- */
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(217, 145, 163, .18); }
.field input[dir="ltr"] { text-align: right; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink-soft); margin: 4px 0 18px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--rose-deep); margin-top: 3px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 22px; font-weight: 700; cursor: pointer;
  background: var(--ink); color: #fff; transition: transform .12s, background .15s; text-decoration: none;
}
.btn:hover { background: #5e3243; }
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.rose { background: var(--rose-deep); }
.btn.rose:hover { background: #a65869; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.sm { padding: 8px 14px; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; padding: 6px; font-size: .9rem; }

.error { color: #b3384f; font-size: .9rem; min-height: 1.2em; margin: 8px 0 0; }

/* ---------- loyalty card ---------- */
.lcard {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px 22px 18px;
  background:
    radial-gradient(340px 200px at 100% 0%, rgba(255,255,255,.75), transparent 70%),
    linear-gradient(145deg, #f8d6dd 0%, #f2c2cc 55%, #eab1be 100%);
  box-shadow: 0 26px 50px -24px rgba(150, 60, 88, .6), inset 0 1px 0 rgba(255,255,255,.7);
}
.lcard::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.55) 1px, transparent 1.4px);
  background-size: 14px 14px; mask-image: linear-gradient(200deg, #000 0%, transparent 60%);
}
.lcard-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.lcard-top img { width: 84px; }
.lcard-label { font-family: var(--serif); font-size: .82rem; letter-spacing: .3em; color: var(--ink); opacity: .75; text-align: left; }
.lcard-name { position: relative; z-index: 1; font-size: 1.35rem; font-weight: 800; margin: 6px 0 14px; }

.stamps { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 1.6px dashed rgba(74, 38, 52, .35); background: rgba(255,255,255,.35);
}
.stamp.on { border: 0; background: var(--paper); box-shadow: 0 6px 14px -8px rgba(74,38,52,.6); }
.stamp svg { width: 62%; height: 62%; }
.stamp.on.pop { animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }

.lcard-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; }
.code { background: var(--ink); color: #fff; border-radius: 12px; padding: 6px 12px; font-weight: 800; letter-spacing: .2em; font-size: 1.1rem; direction: ltr; }
.code-label { font-size: .78rem; color: var(--ink); opacity: .75; }
.reward-line { font-size: .88rem; font-weight: 700; }

.status { margin: 18px 0 6px; padding: 14px 16px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); text-align: center; }
.status.done { background: #fff4d9; border-color: #f0d28c; }

.hint { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-soft); background: rgba(255,255,255,.6); border: 1px dashed var(--line); padding: 12px 14px; border-radius: 16px; margin-top: 14px; }

footer.site { text-align: center; font-size: .82rem; color: var(--ink-soft); padding: 10px 16px 30px; }
footer.site a { color: inherit; }

/* ---------- admin ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 1.35rem; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--ink-soft); }

.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 5px; border-radius: 999px; margin-bottom: 16px; width: fit-content; max-width: 100%; }
.tab { border: 0; background: none; padding: 9px 18px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.tab.active { background: var(--paper); color: var(--ink); box-shadow: 0 4px 10px -6px rgba(74,38,52,.4); }

.search { width: 100%; padding: 13px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; margin-bottom: 12px; outline: none; }
.search:focus { border-color: var(--rose); }

.clist { display: grid; gap: 10px; }
.crow { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.crow .who b { font-size: 1.05rem; }
.crow .meta { font-size: .85rem; color: var(--ink-soft); direction: ltr; text-align: right; }
.crow .tag { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-soft); margin-inline-start: 6px; vertical-align: middle; }
.crow .tag.full { background: #fff0c9; color: #8a6413; }
.mini { display: flex; gap: 4px; flex-wrap: wrap; grid-column: 1 / -1; }
.mini i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--blush); }
.mini i.on { background: var(--rose); border-color: var(--rose); }
.actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 1.15rem; font-weight: 800; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn.add { background: var(--ink); color: #fff; border-color: var(--ink); }
.icon-btn.gift { background: #f6c75e; border-color: #f6c75e; }
.empty { text-align: center; color: var(--ink-soft); padding: 34px 10px; }

.compose { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.email-preview { background: #f4eef0; border-radius: var(--radius); padding: 18px; }
.email-preview .mail { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.mail-head { background: linear-gradient(145deg, #f8d6dd, #eab1be); padding: 18px; }
.mail-head img { width: 96px; margin: 0 auto; }
.mail-body { padding: 18px 20px; white-space: pre-wrap; word-break: break-word; }
.mail-body h3 { margin: 0 0 8px; font-size: 1.15rem; }
.mail-foot { padding: 12px 20px 16px; font-size: .75rem; color: #9a8189; border-top: 1px solid #f1e4e7; }
.steps { padding-inline-start: 20px; margin: 10px 0 0; color: var(--ink-soft); font-size: .92rem; }
.steps li { margin-bottom: 6px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.notice { background: #fff; border: 1px dashed var(--rose); border-radius: 16px; padding: 12px 14px; font-size: .88rem; color: var(--ink-soft); margin-bottom: 16px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(30px); opacity: 0; background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-weight: 700; transition: .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .compose { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stat { padding: 12px 10px; }
  .stat b { font-size: 1.3rem; }
}
[hidden] { display: none !important; }
