:root {
  --bg: #FAFAFC;
  --bg-soft: #F1F1F7;
  --surface: #FFFFFF;
  --surface-2: #FAFAFC;
  --border: rgba(17,17,20,0.07);
  --border-strong: rgba(17,17,20,0.14);
  --text: #0D0D12;
  --muted: #5B5B67;
  --muted-2: #8A8A94;

  --primary: #4347A2;
  --primary-bright: #4347A2;
  --primary-dim: #2E3175;
  --primary-soft: rgba(67,71,162,0.08);
  --primary-border: rgba(67,71,162,0.16);

  --success: #1F9D6B;
  --success-bg: rgba(31,157,107,0.1);
  --danger: #D64545;
  --danger-bg: rgba(214,69,69,0.08);
  --warn: #B4791F;
  --warn-bg: rgba(185,121,27,0.1);
  --info: #4347A2;
  --info-bg: rgba(67,71,162,0.08);

  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --glow: 0 20px 60px -34px rgba(17,17,20,0.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0B0F;
    --bg-soft: #15151C;
    --surface: #141419;
    --surface-2: #0F0F14;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.16);
    --text: #F5F5F7;
    --muted: #B7B7C3;
    --muted-2: #8C8C99;

    --primary: #8489DE;
    --primary-bright: #8489DE;
    --primary-dim: #A6AAE8;
    --primary-soft: rgba(132,137,222,0.16);
    --primary-border: rgba(132,137,222,0.3);

    --success-bg: rgba(31,157,107,0.16);
    --danger-bg: rgba(214,69,69,0.16);
    --warn-bg: rgba(185,121,27,0.18);
    --info-bg: rgba(132,137,222,0.16);
    --info: #8489DE;
    --glow: 0 20px 60px -30px rgba(0,0,0,0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #0B0B0F;
  --bg-soft: #15151C;
  --surface: #141419;
  --surface-2: #0F0F14;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #F5F5F7;
  --muted: #B7B7C3;
  --muted-2: #8C8C99;

  --primary: #8489DE;
  --primary-bright: #8489DE;
  --primary-dim: #A6AAE8;
  --primary-soft: rgba(132,137,222,0.16);
  --primary-border: rgba(132,137,222,0.3);

  --success-bg: rgba(31,157,107,0.16);
  --danger-bg: rgba(214,69,69,0.16);
  --warn-bg: rgba(185,121,27,0.18);
  --info-bg: rgba(132,137,222,0.16);
  --info: #8489DE;
  --glow: 0 20px 60px -30px rgba(0,0,0,0.6);
}

html, body { transition: background-color .25s var(--ease), color .25s var(--ease); }

/* The off-canvas nav drawer is a position:fixed element hidden via
   transform: translateX(). transform is paint-only and does not remove
   the element from the document's scrollable-overflow calculation, so
   without this the whole page gains ~320px of horizontal scroll room
   (the drawer's own width) even while it's visually off-screen - this
   is the root cause of the page shifting left/right while scrolling on
   mobile. overflow-x:hidden on the root scroller is the standard fix
   for this exact off-canvas-drawer + transform interaction. */
html, body { overflow-x: hidden; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary-border); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
a, button, .btn { -webkit-touch-callout: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(1100px 620px at 15% -18%, rgba(67,71,162,0.13), transparent 60%),
    radial-gradient(900px 560px at 105% 8%, rgba(67,71,162,0.08), transparent 58%),
    radial-gradient(700px 420px at 50% 110%, rgba(67,71,162,0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  position: relative;
  transition: color .25s ease;
}

/* Smooth light/dark toggle instead of an instant snap - scoped to the
   elements whose background is a plain solid token (cards, inputs,
   surfaces), not body's own layered gradient background, which browsers
   can't cleanly interpolate between anyway. */
.kv, header.topbar, .nav-drawer, .promo-bar,
table, th, td, .badge, .receipt-thumb-doc {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-dim); }

::selection { background: rgba(67,71,162,0.18); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Promo bar (admin-configurable, above the header, every page) ---- */
.promo-bar {
  display: block;
  overflow: hidden;
  padding-block: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.promo-bar:hover { color: #fff; }
.promo-bar-track {
  display: inline-flex;
  white-space: nowrap;
  animation: promo-scroll 14s linear infinite;
}
.promo-bar-text { padding-inline-end: 64px; white-space: nowrap; }
/* Hold still (readable) - scroll across - hold again at the wrap point,
   which is visually identical to the start since the text is duplicated
   in the markup (translateX(-50%) = exactly one copy's width), so the
   loop never "disappears" mid-cycle, it settles back into place. */
@keyframes promo-scroll {
  0%, 22% { transform: translateX(0); }
  85%, 100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .promo-bar-track { animation: none; display: block; text-align: center; }
  .promo-bar-track .promo-bar-text:last-child { display: none; }
  .promo-bar-text { padding-inline-end: 0; white-space: normal; }
}

/* ---- Header ---- */
header.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: env(safe-area-inset-top) 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(68px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 50;
}

header.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  /* The menu trigger sits at the reading-start side in both languages
     (right in Arabic/RTL, left in English/LTR) - order swaps the two
     topbar children regardless of DOM position so this holds under
     both directions without per-language CSS branching. */
  order: 2;
}
header.topbar .brand svg { width: 24px; height: 24px; color: var(--primary); }
header.topbar .brand:hover { color: var(--text); }

.topbar-actions { display: flex; align-items: center; gap: 8px; order: 1; }

.nav-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.nav-menu-btn:hover { color: var(--primary); border-color: var(--primary-border); }
.nav-menu-btn svg { width: 19px; height: 19px; }

.cart-link { min-width: 44px; min-height: 44px; text-decoration: none; }
.cart-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,14,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  z-index: 90;
}
.nav-backdrop.is-open { opacity: 1; pointer-events: auto; }

.nav-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: min(320px, 85vw);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  box-shadow: var(--glow);
  z-index: 91;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  padding-inline-start: calc(20px + env(safe-area-inset-left));
  padding-inline-end: calc(20px + env(safe-area-inset-right));
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s var(--ease);
}
[dir="rtl"] .nav-drawer { transform: translateX(100%); }
.nav-drawer.is-open { transform: translateX(0); }

.nav-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.nav-drawer-title { font-size: 16px; font-weight: 700; }

.nav-drawer-section { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-top: 1px solid var(--border); }
.nav-drawer-section:first-of-type { border-top: none; }
.nav-drawer-section a {
  color: var(--text);
  padding: 12px 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-drawer-section a:hover { color: var(--primary); background: rgba(17,17,20,0.045); }
.nav-drawer-section span.role-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
  background: rgba(17,17,20,0.02);
}
.lang-switch a {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}
.lang-switch a.active {
  background: var(--primary);
  color: #fff;
}
.lang-switch a:hover:not(.active) { color: var(--text); background: transparent; }

/* ---- Layout ---- */
main.container {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
  min-height: calc(100dvh - 68px - 250px);
}
main.container.wide { max-width: 1200px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--glow);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .25s ease, color .25s ease;
}
.card:hover { border-color: var(--border-strong); }

/* Reserved for cards that represent a single clickable/orderable thing
   (product cards) - not applied to .card generally, since most cards on
   this site are plain content containers (forms, stat tiles) where a lift
   on hover would read as a stray, meaningless animation. */
.card-interactive { transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease), background-color .25s ease, color .25s ease; }
.card-interactive:hover { transform: translateY(-3px); box-shadow: 0 22px 46px -28px rgba(17,17,20,0.22); }
:root[data-theme="dark"] .card-interactive:hover { box-shadow: 0 22px 46px -26px rgba(0,0,0,0.55); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card-interactive:hover { box-shadow: 0 22px 46px -26px rgba(0,0,0,0.55); }
}

h1 { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin-top: 0; color: var(--text); text-wrap: balance; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }

/* ---- Hero (homepage) — Direction A: structured editorial, dividers over glow ---- */
.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 56px 40px 0;
  margin: 24px 0 0;
  text-align: center;
}
.hero .eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 22px;
}
.hero .eyebrow::before { content: ""; display: inline-block; width: 22px; height: 2px; background: var(--primary); }
.hero h1 {
  position: relative;
  font-size: 40px;
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}
.hero p.lead { position: relative; font-size: 16.5px; color: var(--muted); max-width: 520px; margin: 0 auto 30px; }
.hero .actions { position: relative; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 40px; }
.hero .actions .btn:not(.btn-secondary) { border-radius: 12px; }
.hero .btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border-strong); padding: 12px 20px; box-shadow: none; }
.hero .btn-secondary:hover { color: var(--primary); border-color: var(--primary-border); background: transparent; box-shadow: none; }

/* Structured stat row - qualitative trust markers, dividers, no glow. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1.5px solid var(--border-strong);
  margin-top: 8px;
}
.stat-row .stat {
  padding: 20px 14px;
  border-inline-start: 1px solid var(--border);
  text-align: center;
}
.stat-row .stat:first-child { border-inline-start: none; }
.stat-row .stat .stat-value { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.stat-row .stat .stat-label { font-size: 11.5px; color: var(--muted-2); font-weight: 500; }
@media (max-width: 560px) { .hero { padding: 44px 22px 0; } .hero h1 { font-size: 30px; } .stat-row { grid-template-columns: 1fr; } .stat-row .stat { border-inline-start: none; border-top: 1px solid var(--border); } .stat-row .stat:first-child { border-top: none; } }

/* ---- "How it works" — the one section keeping Direction B's connected-journey treatment ---- */
.journey { position: relative; max-width: 640px; margin: 0 auto; padding: 8px 0; }
.journey::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 26px;
  inset-inline-start: 25px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), transparent);
}
.journey-step { position: relative; display: flex; align-items: flex-start; gap: 20px; padding: 20px 0; text-align: start; }
.journey-step .step-num {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 16px 30px -10px rgba(67,71,162,0.5);
}
.journey-step.is-upcoming .step-num { background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--muted); box-shadow: none; }
.journey-step .step-body { padding-top: 8px; }
.journey-step h2 { margin: 0 0 6px; text-align: start; }
.journey-step p { margin: 0; color: var(--muted); text-align: start; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
@media (max-width: 760px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-grid .card { margin-bottom: 0; text-align: center; }
.feature-grid .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  color: var(--primary-border);
  font-weight: 300; font-size: 34px; margin-bottom: 6px;
  font-family: 'Tajawal', sans-serif;
}
.feature-grid h2 { text-align: center; }
.feature-grid p { text-align: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease), color .2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; }
small.hint { color: var(--muted-2); display: block; margin-top: 5px; }

textarea[name="codes"] { direction: ltr; text-align: left; font-family: "SF Mono", Menlo, Consolas, monospace; }
input[type=email], input[type=password], input[type=number] { direction: ltr; }

.phone-field { display: flex; align-items: stretch; gap: 8px; }
.phone-field .phone-prefix {
  display: flex; align-items: center; justify-content: center;
  padding: 0 14px; border-radius: 13px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}
.phone-field .phone-prefix-plus {
  display: flex; align-items: center; justify-content: center;
  width: 20px; color: var(--muted); font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.phone-field .phone-prefix-input {
  width: 56px; flex: 0 0 56px; min-height: 44px;
  padding: 0 6px; text-align: center; direction: ltr;
}
.phone-field input:not(.phone-prefix-input) { flex: 1; min-width: 0; direction: ltr; text-align: right; margin: 0; min-height: 44px; }

/* ---- Homepage affiliation line — above the hero, distinct from the eyebrow ---- */
.affiliation-line {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 14px 12px;
  margin-top: 8px;
  border-bottom: 1px solid var(--border);
}
.affiliation-line a { color: var(--primary); font-weight: 600; }

.captcha-row { display: flex; gap: 10px; margin-bottom: 12px; direction: ltr; }
.captcha-chip {
  width: 44px; height: 48px;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  user-select: none;
}

/* ---- Buttons ---- */
button, .btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 12px 26px -12px rgba(67,71,162,0.55);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .15s var(--ease), background-color .2s ease, color .2s ease, border-color .2s ease;
}
button:hover, .btn:hover { box-shadow: 0 16px 30px -10px rgba(67,71,162,0.6); text-decoration: none; transform: translateY(-1px); color: #fff; }
button:active, .btn:active { transform: translateY(0); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); box-shadow: none; }
.btn-secondary:hover { background: rgba(17,17,20,0.03); box-shadow: none; color: var(--text); }
.btn-danger { background: var(--danger); box-shadow: 0 12px 26px -12px rgba(214,69,69,0.4); }
.btn-danger:hover { box-shadow: 0 16px 30px -10px rgba(214,69,69,0.5); }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

/* Data tables collapse into stacked cards below 700px instead of forcing
   horizontal scroll - every admin/customer table view carries class
   "responsive" and a data-label on each <td> for this to apply. */
@media (max-width: 700px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    padding: 2px 14px;
  }
  table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 11px 0;
    border-top: 1px solid var(--border);
    min-height: 22px;
  }
  table.responsive td:first-child { border-top: none; }
  table.responsive td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted-2);
    flex-shrink: 0;
  }
  table.responsive td > form { flex: 1; justify-content: flex-end; }
}

/* Comfortable tap targets on touch-sized screens. */
@media (max-width: 700px) {
  button, .btn, .btn-sm, input[type=submit] { min-height: 44px; }
  .btn-sm { padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  a { min-height: 1em; }
}
th, td { text-align: start; padding: 13px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted-2); font-weight: 650; font-size: 11.5px; letter-spacing: 0.03em; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: rgba(67,71,162,0.025); }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 13px; border-radius: 999px; font-size: 11.5px; font-weight: 650; border: 1px solid transparent; }
.badge svg { width: 11px; height: 11px; flex-shrink: 0; }
.badge-pending_payment { background: var(--warn-bg); color: var(--warn); border-color: rgba(185,121,27,0.2); }
.badge-under_review { background: var(--info-bg); color: var(--info); border-color: rgba(67,71,162,0.2); }
.badge-approved { background: var(--success-bg); color: var(--success); border-color: rgba(31,157,107,0.2); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); border-color: rgba(214,69,69,0.2); }
.badge-cancelled { background: rgba(17,17,20,0.06); color: var(--muted); border-color: var(--border-strong); }
.badge-refunded { background: var(--danger-bg); color: var(--danger); border-color: rgba(214,69,69,0.2); }

/* ---- Flash & errors ---- */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); color: var(--success); border-color: rgba(31,157,107,0.2); }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(214,69,69,0.2); }
.flash-info { background: var(--info-bg); color: var(--info); border-color: rgba(67,71,162,0.2); }

.errors { background: var(--danger-bg); color: var(--danger); padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid rgba(214,69,69,0.2); }
.errors ul { margin: 0; padding-inline-start: 18px; }

/* ---- Utility ---- */
.muted { color: var(--muted); }
.text-end { text-align: end; }
.mt-0 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* Product catalog card: hero image pinned to the physical left with
   float:left (a physical, not logical, direction) so it lands on the same
   side regardless of the page's RTL/LTR text direction. */
.product-card { display: flow-root; }
.product-hero-img {
  float: left;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 14px;
  margin-inline-end: 14px;
  margin-bottom: 8px;
}
.reduced-qty-note {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  padding: 5px 10px;
  display: inline-block;
  margin: 0 0 10px;
}

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 550; text-align: end; }

.copy-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; cursor: pointer; margin-inline-start: 8px;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.copy-btn:hover { color: var(--primary); border-color: var(--primary-border); }
.copy-btn svg { width: 12px; height: 12px; }
.copy-btn .copy-btn-label-copied { display: none; }
.copy-btn.is-copied { background: var(--success-bg); color: var(--success); border-color: transparent; }
.copy-btn.is-copied .copy-btn-label-default { display: none; }
.copy-btn.is-copied .copy-btn-label-copied { display: inline; }

.receipt-thumb {
  display: block; width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border-strong);
}
.receipt-thumb-doc {
  display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg-soft);
}
.receipt-thumb-doc svg { width: 18px; height: 18px; }

/* ---- Order status timeline (customer order-detail) ---- */
.order-timeline { display: flex; flex-direction: column; }
.order-timeline-step { display: flex; gap: 14px; }
.order-timeline-step:last-child .order-timeline-line { display: none; }
.order-timeline-marker { display: flex; flex-direction: column; align-items: center; }
.order-timeline-dot {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--muted-2); border: 2px solid var(--border-strong); flex-shrink: 0;
}
.order-timeline-dot svg { width: 13px; height: 13px; }
.order-timeline-step.is-done .order-timeline-dot { background: var(--success); border-color: var(--success); color: #fff; }
.order-timeline-step.is-danger .order-timeline-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.order-timeline-step.is-current .order-timeline-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.order-timeline-line { width: 2px; flex: 1; min-height: 22px; background: var(--border-strong); margin: 2px 0; }
.order-timeline-step.is-done .order-timeline-line { background: var(--success); }
.order-timeline-body { padding-bottom: 22px; }
.order-timeline-title { font-size: 13.5px; font-weight: 650; }
.order-timeline-step.is-done .order-timeline-title,
.order-timeline-step.is-danger .order-timeline-title,
.order-timeline-step.is-current .order-timeline-title { color: var(--text); }
.order-timeline-step:not(.is-done):not(.is-danger):not(.is-current) .order-timeline-title { color: var(--muted); }
.order-timeline-time { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/* ---- FAQ accordion ---- */
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  cursor: pointer; font-weight: 650; font-size: 14.5px; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 18px; font-weight: 400; color: var(--muted); flex-shrink: 0;
  transition: transform .15s var(--ease);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin: 12px 0 0; font-size: 14px; color: var(--muted); line-height: 1.75; }

.codes-box {
  background: var(--surface-2);
  color: var(--text);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  padding: 18px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 14px;
  line-height: 1.8;
  border: 1px solid var(--border);
  direction: ltr;
  text-align: left;
}

/* ---- Empty / coming-soon state ---- */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--primary-border); }
.empty-state p { color: var(--muted); margin: 0; }

/* ---- Personal greeting (home, logged-in customers only) ---- */
.greeting-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; margin-bottom: 16px;
}
.greeting-text { font-size: 24px; font-weight: 700; color: var(--text); }
.greeting-tier {
  display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700;
  padding: 8px 18px; border-radius: 999px;
  background: linear-gradient(135deg, var(--tier-grad-a, var(--primary)), var(--tier-grad-b, var(--primary-dim)));
  color: var(--tier-ink, #fff);
  box-shadow: 0 8px 20px -10px var(--tier-grad-a, var(--primary));
  letter-spacing: .2px;
}
.greeting-tier svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ---- Promo banner (home) - fixed placement + size, mobile then desktop ---- */
.promo-banner {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(120deg, var(--primary), #6367C7);
  color: #fff;
  text-decoration: none;
  padding: 24px 26px;
  margin-bottom: 24px;
  height: 152px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
}
.promo-banner:hover { color: #fff; }
.promo-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px 220px at 90% 0%, rgba(255,255,255,0.14), transparent 60%);
}
.promo-banner.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(13,13,18,0.55), rgba(13,13,18,0.05) 55%);
}
.promo-banner .promo-title { position: relative; font-size: 16px; font-weight: 650; margin-bottom: 4px; z-index: 1; }
.promo-banner .promo-text { position: relative; font-size: 12.5px; opacity: 0.85; z-index: 1; }
.promo-banner .promo-cta {
  position: relative; z-index: 1; display: inline-block; margin-top: 10px;
  font-size: 12px; font-weight: 700; background: rgba(255,255,255,0.18);
  padding: 6px 14px; border-radius: 999px;
}
@media (min-width: 720px) {
  .promo-banner { height: 200px; padding: 0 40px; }
}

/* ---- Admin: banners list ---- */
.banner-row { display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--border); }
.banner-row:first-child { border-top: none; padding-top: 0; }
.banner-row-preview { height: auto; min-height: 90px; margin-bottom: 0; padding: 14px; }
.banner-row-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-row-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
.banner-row-form .form-group { margin-bottom: 0; }
.banner-row-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 700px) {
  .banner-row { grid-template-columns: 1fr; }
  .banner-row-form { grid-template-columns: 1fr; }
}

/* ---- Code vault ---- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.stat-num { font-size: 21px; font-weight: 700; }
.stat-label { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }

.codes-filter-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.codes-filter-bar input[type=text] { flex: 1; min-width: 180px; margin: 0; }
.codes-filter-bar select { margin: 0; width: auto; }

.folder-chips { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.folder-chip {
  flex-shrink: 0; padding: 8px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface);
  cursor: pointer; white-space: nowrap;
}
.folder-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.folder-chip-add { color: var(--primary); border-style: dashed; }
.new-folder-form { display: none; gap: 8px; margin-bottom: 16px; }
.new-folder-form.open { display: flex; }
.new-folder-form input { flex: 1; margin: 0; }

.codes-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.codes-select-all { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; }
.codes-toolbar-actions { display: flex; gap: 8px; }

.badge-status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.badge-status svg { width: 10px; height: 10px; }
.badge-status-used { background: var(--success-bg); color: var(--success); }
.badge-status-unused { background: rgba(17,17,20,0.05); color: var(--muted); }
:root[data-theme="dark"] .badge-status-unused { background: rgba(255,255,255,0.08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-status-unused { background: rgba(255,255,255,0.08); }
}

.bulk-bar {
  position: sticky; bottom: 16px; margin-top: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 12px 18px; box-shadow: var(--glow); z-index: 20;
}
.bulk-bar span#bulk-count { font-size: 13px; font-weight: 600; }
.bulk-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.copy-toast {
  /* Sits clear above the FAB (58px circle + ~7px glow ring, from the same
     24px bottom offset) instead of directly behind/on top of it - both
     were anchored at the identical bottom-center spot before this fix. */
  position: fixed; bottom: calc(100px + env(safe-area-inset-bottom)); inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 12.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 16px 30px -10px rgba(0,0,0,0.35);
  white-space: nowrap; z-index: 60;
}
[dir="rtl"] .copy-toast { transform: translateX(50%); }

/* ---- Floating order button ---- */
.fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  box-shadow: 0 16px 32px -8px rgba(67,71,162,0.55), 0 0 0 7px var(--primary-soft);
  z-index: 40;
  transition: transform .2s var(--ease);
}
[dir="rtl"] .fab { transform: translateX(50%); }
.fab:hover { transform: translateX(-50%) translateY(-2px); color: #fff; }
[dir="rtl"] .fab:hover { transform: translateX(50%) translateY(-2px); }

footer.site-footer { text-align: center; color: var(--muted-2); font-size: 12px; padding: 44px 0 calc(90px + env(safe-area-inset-bottom)); position: relative; z-index: 1; }
footer.site-footer .footer-tagline { margin-bottom: 14px; }
footer.site-footer .footer-links { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
footer.site-footer .footer-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 500; font-size: 12px;
  padding: 8px 14px; border-radius: 11px; border: 1px solid var(--border);
}
footer.site-footer .footer-links a:hover { color: var(--primary); border-color: var(--primary-border); }
footer.site-footer .footer-links svg { width: 13px; height: 13px; }

/* ---- Membership ---- */
/* ---- Per-tier theme: distinct accent/icon by RANK (tier.themeIndex - its
   position among the others), not by name, so a renamed or re-sorted tier
   keeps the right visual "step up". Only 3 looks defined - views clamp
   themeIndex to [0,2], so a 4th+ tier just reuses the top look. ---- */
.tier-theme-0 { --tier-grad-a: #9CA3AF; --tier-grad-b: #D1D5DB; --tier-ink: #3F3F46; }
.tier-theme-1 { --tier-grad-a: var(--primary); --tier-grad-b: var(--primary-dim); --tier-ink: #fff; }
.tier-theme-2 { --tier-grad-a: #D4AF37; --tier-grad-b: #F1C84B; --tier-ink: #4A3B06; }

.membership-hero {
  background: linear-gradient(135deg, var(--tier-grad-a, var(--primary)), var(--tier-grad-b, var(--primary-dim)));
  border-radius: var(--radius);
  padding: 26px 28px;
  color: var(--tier-ink, #fff);
  margin-bottom: 24px;
  transition: background .3s var(--ease);
}
.membership-hero-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.membership-hero-label { font-size: 12px; opacity: .85; }
.membership-hero-badge { font-size: 13px; font-weight: 700; background: rgba(255,255,255,0.28); padding: 6px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.membership-hero-badge svg { width: 14px; height: 14px; }
.membership-progress { margin-bottom: 14px; }
.membership-progress-row { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .92; margin-bottom: 6px; }
.progress-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.22); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: currentColor; transition: width .3s var(--ease); }
.membership-hint { font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.14); border-radius: 12px; padding: 11px 14px; text-align: center; margin-top: 16px; }

.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tier-card {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--tier-grad-a, var(--border-strong));
  border-radius: var(--radius); padding: 20px 22px; position: relative;
}
.tier-theme-2.tier-card { box-shadow: 0 14px 32px -22px rgba(212,175,55,0.55); }
.tier-card-active { box-shadow: 0 0 0 2px var(--primary) inset; }
.tier-card-tag {
  position: absolute; top: -11px; inset-inline-start: 20px;
  background: var(--text); color: var(--bg); font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.tier-card-icon {
  width: 34px; height: 34px; border-radius: 10px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tier-grad-a, var(--primary-soft)), var(--tier-grad-b, var(--primary-soft)));
  color: var(--tier-ink, var(--primary));
}
.tier-card-icon svg { width: 18px; height: 18px; }
.tier-card-row { display: flex; align-items: center; justify-content: space-between; }
.tier-card-name { font-size: 15.5px; font-weight: 700; }
.tier-card-pct { font-size: 19px; font-weight: 700; color: var(--tier-grad-a, var(--primary)); }
.tier-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px;
  background: linear-gradient(135deg, var(--tier-grad-a, var(--primary)), var(--tier-grad-b, var(--primary-dim)));
  vertical-align: middle;
}

/* ---- Pricing engine: product/duration tabs, quantity chips/stepper, gift banner ---- */
.duration-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.duration-tab {
  padding: 8px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface); cursor: pointer;
}
.duration-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.qty-chip {
  min-width: 56px; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); cursor: pointer;
}
.qty-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-stepper { display: flex; align-items: center; gap: 12px; }
.qty-stepper button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--primary); font-size: 18px; cursor: pointer;
}
.qty-stepper input {
  width: 90px; text-align: center; font-size: 16px; font-weight: 700; padding: 9px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.gift-banner {
  display: flex; align-items: center; gap: 8px; background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--primary); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  margin: 14px 0;
}

/* ---- Printable order receipt (order-print.ejs) ---- */
@media print {
  header.topbar, .nav-drawer, .nav-backdrop, .promo-bar, .fab, footer.site-footer, .no-print {
    display: none !important;
  }
  body { background: #fff; }
  .print-receipt { border: none; box-shadow: none; padding: 0; }
}

/* ---- Order-approved celebration banner (code vault, filtered to one order) ---- */
.approved-banner {
  display: flex; align-items: center; gap: 10px; background: var(--success-bg); color: var(--success);
  border: 1px solid rgba(31,157,107,0.2); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 13.5px; font-weight: 650; margin-bottom: 16px;
}
.approved-check { width: 24px; height: 24px; flex-shrink: 0; animation: approved-pop .4s var(--ease) both; }
.approved-check-mark {
  stroke-dasharray: 20; stroke-dashoffset: 20;
  animation: approved-draw .35s ease-out .25s forwards;
}
@keyframes approved-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes approved-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .approved-check, .approved-check-mark { animation: none; stroke-dashoffset: 0; }
}

/* ---- Membership tier-upgrade celebration (one-time per upgrade) ---- */
.tier-upgrade-banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, var(--tier-grad-a, var(--primary)), var(--tier-grad-b, var(--primary-dim)));
  color: var(--tier-ink, #fff);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px;
  font-size: 14.5px; font-weight: 650;
  animation: tier-upgrade-in .5s var(--ease) both;
}
.tier-upgrade-banner svg { width: 26px; height: 26px; flex-shrink: 0; }
@keyframes tier-upgrade-in {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .tier-upgrade-banner { animation: none; } }

/* ---- "You got a gift" popup (admin/gifts) ---- */
.gift-popup-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8,8,14,0.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: gift-fade-in .25s var(--ease) both;
}
.gift-popup {
  position: relative; width: 100%; max-width: 380px;
  background: var(--surface); border-radius: 22px;
  padding: 34px 26px 26px; text-align: center;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.45);
  overflow: hidden;
  animation: gift-pop-in .45s cubic-bezier(.26,1.4,.44,1) both;
}
.gift-popup-close-form { position: absolute; top: 10px; inset-inline-end: 10px; margin: 0; }
.gift-popup-x {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--bg-soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.gift-popup-x:hover { background: var(--danger-bg); color: var(--danger); }
.gift-popup-x svg { width: 15px; height: 15px; }
.gift-popup-icon {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  color: #fff; box-shadow: 0 14px 28px -10px var(--primary);
  animation: gift-icon-bounce 1.1s var(--ease) .2s both;
}
.gift-popup-icon svg { width: 34px; height: 34px; }
.gift-popup-title { margin: 0 0 6px; font-size: 21px; font-weight: 800; }
.gift-popup-lead { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); }
.gift-popup-items { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gift-popup-items li {
  background: var(--bg-soft); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-weight: 600;
}
.gift-popup-items li strong { color: var(--primary); font-size: 16px; }
.gift-popup-cta { width: 100%; font-size: 15px; padding: 13px; }
.gift-popup-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.gift-popup-confetti span {
  position: absolute; top: -12px; width: 8px; height: 8px; border-radius: 2px;
  animation: gift-confetti-fall 1.8s ease-in both;
}
.gift-popup-confetti span:nth-child(1) { inset-inline-start: 8%;  background: var(--primary); animation-delay: .05s; }
.gift-popup-confetti span:nth-child(2) { inset-inline-start: 20%; background: #D4AF37; animation-delay: .2s; }
.gift-popup-confetti span:nth-child(3) { inset-inline-start: 34%; background: var(--success); animation-delay: 0s; }
.gift-popup-confetti span:nth-child(4) { inset-inline-start: 48%; background: var(--primary-bright); animation-delay: .3s; }
.gift-popup-confetti span:nth-child(5) { inset-inline-start: 60%; background: #D4AF37; animation-delay: .1s; }
.gift-popup-confetti span:nth-child(6) { inset-inline-start: 72%; background: var(--success); animation-delay: .25s; }
.gift-popup-confetti span:nth-child(7) { inset-inline-start: 85%; background: var(--primary); animation-delay: .15s; }
.gift-popup-confetti span:nth-child(8) { inset-inline-start: 93%; background: #D4AF37; animation-delay: .35s; }
@keyframes gift-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes gift-pop-in {
  from { opacity: 0; transform: scale(.82) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes gift-icon-bounce {
  0% { transform: scale(.4) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes gift-confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(240px) rotate(280deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gift-popup-backdrop, .gift-popup, .gift-popup-icon, .gift-popup-confetti span { animation: none; }
}
