/* ==========================================
   Stamply - Custom CSS
   ========================================== */

/* -- CSS variables (branding override) -- */
:root {
  --color-primary:   #6366f1;
  --color-secondary: #8b5cf6;
  --color-accent:    #f59e0b;
  --font-heading:    'Sora', sans-serif;
  --font-body:       'Inter', sans-serif;
}

/* -- Base -- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { font-family: var(--font-heading); }

/* -- Scrollbar -- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }

/* -- Animations -- */
@keyframes slide-in {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0%   { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.animate-slide-in { animation: slide-in 0.25s ease-out; }
.animate-fade-up  { animation: fade-up  0.3s  ease-out; }

/* -- Sidebar transitions -- */
#sidebar[data-expanded="false"] { width: 4.5rem; }
#sidebar[data-expanded="false"] .sidebar-label { display: none; }
#sidebar[data-expanded="false"] nav a { justify-content: center; }
#sidebar[data-expanded="false"] nav a div { display: none; }

/* -- QR scanner overlay -- */
#qr-reader video { border-radius: 1rem; }
#qr-reader { border: none !important; }
#qr-reader__scan_region { border-radius: 1rem; overflow: hidden; }
#qr-reader__dashboard { padding: 0.5rem !important; }
#qr-reader__dashboard_section_csr button {
  background: #6366f1 !important;
  border-radius: 0.75rem !important;
  border: none !important;
  padding: 0.5rem 1rem !important;
  color: white !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

/* -- Card hover -- */
.card-hover { transition: box-shadow 0.2s, transform 0.2s; }
.card-hover:hover {
  box-shadow: 0 8px 30px -8px rgba(99,102,241,0.15);
  transform: translateY(-1px);
}

/* -- Gradient text -- */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* -- Points badge -- */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* -- Safe area (PWA) -- */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0.5rem); }
.pb-safe { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

/* -- Toggle switch -- */
.toggle-input:checked + .toggle-track { background: #10b981; }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(1.25rem); }

/* -- Skeleton loader -- */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* -- Toast notifications -- */
#toast-container {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  pointer-events: none;
  width: max-content;
}
.toast {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  border-radius: .875rem;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  pointer-events: auto;
  white-space: nowrap;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity .25s ease;
  white-space: normal;
}
.toast.show { opacity: 1; }
.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.toast-msg  { flex: 1; min-width: 0; word-break: break-word; }
.toast-close { flex-shrink: 0; opacity: .6; cursor: pointer; }
.toast-close:hover { opacity: 1; }

/* -- Input focus glow -- */
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* -- iOS Safari zooms the page when a focused input/textarea/select has a
   computed font-size below 16px. Mobile-only (desktop sizing untouched);
   !important is needed here because Tailwind's inline text-size utility
   classes (text-sm, text-xs, ...) have higher specificity than a plain
   element selector and would otherwise still win. -- */
@media (max-width: 640px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* -- Responsive table -- */
@media (max-width: 640px) {
  table thead { display: none; }
  table tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
  }
  .dark table tbody tr { border-color: #374151; }
  table tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    margin-right: 1rem;
  }
}

/* -- Line clamp -- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -- Chart placeholder -- */
.chart-placeholder {
  display: flex;
  align-items: flex-end;
  gap: 0.375rem;
  height: 5rem;
}
.chart-bar {
  flex: 1;
  border-radius: 0.375rem 0.375rem 0 0;
  background: linear-gradient(to top, #6366f1, #8b5cf6);
  opacity: 0.7;
  transition: opacity 0.2s;
  min-height: 4px;
}
.chart-bar:hover { opacity: 1; }

/* -- Emoji picker styles -- */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
}
.emoji-btn {
  font-size: 1.25rem;
  padding: 0.375rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.1s;
  text-align: center;
}
.emoji-btn:hover { background: #f3f4f6; }
.dark .emoji-btn:hover { background: #374151; }

/* -- Print QR -- */
@media print {
  nav, header, aside, button, .no-print { display: none !important; }
  #qr-img { width: 100%; max-width: 300px; }
}

/* -----------------------------------------------------------------------
   Visual Loyalty Cards (v1.6.9 base + v1.6.9a premium redesign)
   All colors derive from existing CSS variables or template accent colors --
   no hardcoded white/black. Premium feel via depth, soft gradients, glass
   overlays, refined spacing -- never loud.
   ----------------------------------------------------------------------- */

.loyalty-card {
  --lc-bg: var(--bg-card, #fff);
  --lc-border: var(--border, #e5e7eb);
  --lc-text-1: var(--text-1, #111827);
  --lc-text-2: var(--text-2, #6b7280);
  --lc-text-3: var(--text-3, #9ca3af);
  --lc-accent: #6366f1;
  --lc-accent-soft: #eef0fd;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--lc-accent) 7%, var(--lc-bg)) 0%, var(--lc-bg) 55%);
  border: 1px solid var(--lc-border);
  border-radius: 1.5rem;
  padding: 1.375rem;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,.04),
    0 8px 24px -8px color-mix(in srgb, var(--lc-accent) 25%, transparent),
    0 0 0 1px color-mix(in srgb, var(--lc-accent) 6%, transparent) inset;
  transition: box-shadow .3s ease, transform .3s ease;
}
.dark .loyalty-card:not([style*="--bg-card"]) {
  --lc-bg: #1c1c1c;
  --lc-border: #2d2d2d;
  --lc-text-1: #f0f0f0;
  --lc-text-2: #a0a0a0;
  --lc-text-3: #6b6b6b;
}

/* Glass sheen overlay -- subtle, top-left to bottom-right */
.loyalty-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 35%);
  pointer-events: none;
}
/* Faint noise texture for premium tactility (inline SVG, no asset request) */
.loyalty-card::after {
  content: '';
  position: absolute; inset: 0;
  opacity: .025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Reward-progress section (display mode "both"): sits between stamp grid
   and reward strip. Reuses the same bar gradient as the classic progress_bar
   mode. The lc-overall-progress name is retired; these selectors are new. */
.lc-reward-progress {
  margin-top: .875rem; position: relative; z-index: 1;
}
.lc-reward-progress-label {
  font-size: .7rem; font-weight: 600; color: #4b5563; text-transform: uppercase; letter-spacing: .04em;
}
.lc-reward-progress-track {
  height: .375rem; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--lc-accent) 10%, transparent);
  margin-top: .375rem;
}
.lc-reward-progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--lc-accent), color-mix(in srgb, var(--lc-accent) 70%, white));
  width: 0%; animation: barGrow .9s cubic-bezier(.22,1,.36,1) both; animation-delay: 400ms;
  transition: width .4s cubic-bezier(.22,1,.36,1);
}
/* Reward name + CTA row beneath the bar in mode "both" */
.lc-reward-progress-reward {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
  font-size: .75rem; color: #4b5563;
}
/* v2.0: dark mode's existing --lc-text-2/--lc-text-3-based colors already
   have good contrast against the dark card background (confirmed fine) --
   restored here unchanged, only the light-mode default above was too pale. */
.dark .lc-reward-progress-label,
.dark .lc-reward-progress-reward { color: var(--lc-text-2); }
.lc-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 1.125rem; gap: .5rem; position: relative; z-index: 1; }
.lc-title { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; color: var(--lc-text-1); }
.lc-count {
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
  color: var(--lc-accent); background: var(--lc-accent-soft);
  padding: .25rem .625rem; border-radius: 999px; white-space: nowrap;
}

.lc-slots {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: relative; z-index: 1;
}
.lc-slots::-webkit-scrollbar { display: none; }
/* One full grid of N rows = one slide */
.lc-slots-grid {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  scroll-snap-align: start;
  padding: .25rem;
}
.lc-slots-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .625rem;
}
/* Grid navigation dots */
.lc-grid-dots { display:flex; align-items:center; justify-content:center; gap:.4rem; margin-top:.625rem; }
.lc-grid-dot {
  width: .4375rem; height: .4375rem; border-radius: 50%;
  background: color-mix(in srgb, var(--lc-accent) 25%, transparent);
  cursor: pointer; transition: background .2s, transform .2s;
}
.lc-grid-dot.active { background: var(--lc-accent); transform: scale(1.3); }

.lc-slot {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Empty slot variants -- premium: soft dashed ring with subtle inner shadow */
.lc-empty-outline {
  border: 1.5px dashed color-mix(in srgb, var(--lc-accent) 30%, var(--lc-border));
  background: color-mix(in srgb, var(--lc-accent) 3%, transparent);
}
.lc-empty-lightgray  { border: none; background: color-mix(in srgb, var(--lc-text-3) 10%, transparent); box-shadow: inset 0 1px 2px rgba(0,0,0,.04); }
.lc-empty-transparent{ border: none; background: transparent; }

/* Filled slot -- premium depth with soft shadow under each stamp */
.lc-filled {
  background: linear-gradient(155deg, var(--lc-accent), color-mix(in srgb, var(--lc-accent) 75%, black));
  color: #fff;
  box-shadow:
    0 3px 10px -2px color-mix(in srgb, var(--lc-accent) 55%, transparent),
    0 1px 0 rgba(255,255,255,.25) inset;
}
.lc-fill-icon { width: 50%; height: 50%; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.lc-fill-initials { font-weight: 800; font-size: .85rem; }
/* Logo shape is overridden per stamp-shape below */
.lc-fill-logo { width: 72%; height: 72%; object-fit: contain; border-radius: 25%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.lc-fill-emoji { font-size: 1.1rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.1)); }

/* Logo shape adapts to the active stamp shape */
.loyalty-card .lc-stamp-round    .lc-fill-logo { border-radius: 50%; }
.loyalty-card .lc-stamp-default  .lc-fill-logo { border-radius: 35%; }
/* Stamp: logo white+75% in dark mode, black+75% in light mode */
.loyalty-card .lc-stamp-stamp    .lc-fill-logo { background: transparent; box-shadow: none; border-radius: 20%; filter: brightness(0) invert(1) opacity(0.75); }
:root:not(.dark) .loyalty-card .lc-stamp-stamp .lc-fill-logo { filter: brightness(0) invert(0) opacity(0.75); }

/* Card container shape: permanently 'grid' since v1.7.0k.
   The old circle/ticket/wallet variants were removed as a merchant setting.
   This rule sets the DEFAULT slot radius for the standard shape; all
   lc-stamp-* rules below override it where needed. It MUST appear before
   the stamp design system block so the cascade order is correct. */
.lc-shape-grid { border-radius: 1.5rem; }
.lc-shape-grid .lc-slot { border-radius: .85rem; }

/* =============================================================
   STAMP SHAPE DESIGN SYSTEM (v1.7.0t)
   All four shapes use .loyalty-card .lc-slot specificity to
   override the base .lc-shape-grid .lc-slot { border-radius }
   without !important. Pseudo-elements handle all decorative
   details so the component stays a single renderer.
   ============================================================= */

/* STANDAARD -- rounded square, inherits from .lc-shape-grid .lc-slot */
.loyalty-card .lc-stamp-default { /* inherits .85rem radius */ }

/* ROND -- perfect circle, guaranteed by both border-radius and
   explicit width/height set via aspect-ratio:1 on .lc-slot.
   Removed any competing value from the base slot rule. */
.loyalty-card .lc-stamp-round {
  border-radius: 50%;
}

/* STICKER -- rounded square with a crisp white border ring that
   is rendered as a real CSS border (not box-shadow) so it shows
   identically in both the live preview phone frame and on the
   production card. The outer shadow gives the lifted-off-surface
   feel. Filled slots get the accent background; empty slots keep
   the border ring visible over the card background. */
.loyalty-card .lc-stamp-sticker {
  border-radius: .625rem;
  outline: 2.5px solid rgba(255,255,255,.85);
  outline-offset: -1px;
  box-shadow: 0 3px 8px rgba(0,0,0,.22);
}
.loyalty-card .lc-stamp-sticker.lc-empty-outline,
.loyalty-card .lc-stamp-sticker.lc-empty-lightgray,
.loyalty-card .lc-stamp-sticker.lc-empty-transparent {
  outline-color: rgba(0,0,0,.12);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* STEMPEL -- harmonized rubber stamp */
.loyalty-card .lc-stamp-stamp {
  border-radius: .5rem;
  border: none;
  background: transparent;
  overflow: hidden;
  outline: 1.5px solid color-mix(in srgb, var(--lc-accent) 30%, var(--lc-border));
  outline-offset: -1px;
}
.loyalty-card .lc-stamp-stamp.lc-filled { outline-color: color-mix(in srgb, var(--lc-accent) 40%, transparent); }
.loyalty-card .lc-stamp-stamp::before { content: none; }
.loyalty-card .lc-stamp-stamp.lc-filled::before { content: none; }
/* Wider grid gap when stamp shape is active */
.loyalty-card:has(.lc-stamp-stamp) .lc-slots-grid { gap: 1rem; }

/* ZEGEL -- classic postage stamp / perforated seal edge.
   clip-path polygon with alternating inward/outward points creates
   a crisp scalloped border that fills the full slot area with no
   interior holes and no padding overhead. 16 points = 4 notches
   per side, tuned for the ~40px slot size on mobile. */
.loyalty-card .lc-stamp-seal {
  border-radius: 0;
  clip-path: polygon(
    /* top edge: 4 notches */
    0% 4%,  4% 0%,  8% 4%,
    17% 4%, 21% 0%, 25% 4%,
    33% 4%, 37% 0%, 41% 4%,
    50% 4%, 54% 0%, 58% 4%,
    66% 4%, 70% 0%, 75% 4%,
    83% 4%, 87% 0%, 92% 4%,
    100% 4%,
    /* right edge: 4 notches */
    96% 8%,  100% 12%, 96% 17%,
    96% 25%, 100% 29%, 96% 33%,
    96% 42%, 100% 46%, 96% 50%,
    96% 58%, 100% 62%, 96% 67%,
    96% 75%, 100% 79%, 96% 83%,
    96% 92%, 100% 96%, 96% 100%,
    /* bottom edge: 4 notches */
    92% 96%, 87% 100%, 83% 96%,
    75% 96%, 70% 100%, 66% 96%,
    58% 96%, 54% 100%, 50% 96%,
    41% 96%, 37% 100%, 33% 96%,
    25% 96%, 21% 100%, 17% 96%,
    8% 96%,  4% 100%,  0% 96%,
    /* left edge: 4 notches */
    4% 92%,  0% 87%,  4% 83%,
    4% 75%,  0% 70%,  4% 66%,
    4% 58%,  0% 54%,  4% 50%,
    4% 42%,  0% 37%,  4% 33%,
    4% 25%,  0% 21%,  4% 17%,
    4% 8%,   0% 4%,   4% 0%
  );
}
.loyalty-card .lc-stamp-seal.lc-filled { /* no glow */ }
.loyalty-card .lc-stamp-seal.lc-filled::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.4);
  pointer-events: none;
}

/* Completed card -- glow ring + celebratory state */
.lc-complete {
  box-shadow:
    0 0 0 2px var(--lc-accent),
    0 12px 32px -8px color-mix(in srgb, var(--lc-accent) 45%, transparent);
}
.lc-complete-badge {
  display:flex; align-items:center; gap:.4rem; margin-top: 1rem;
  font-size: .8rem; font-weight: 700; color: var(--lc-accent);
  position: relative; z-index: 1;
}
.lc-complete-badge svg { filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--lc-accent) 40%, transparent)); }

/* Reward integrated into card footer (premium: feels like one object) */
.lc-reward-strip {
  margin-top: 1.125rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--lc-accent) 12%, var(--lc-border));
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  position: relative; z-index: 1;
}
.lc-reward-info { display:flex; align-items:center; gap:.625rem; min-width:0; }
.lc-reward-icon {
  width: 2.25rem; height: 2.25rem; border-radius: .875rem; flex-shrink: 0;
  display:flex; align-items:center; justify-content:center; font-size: 1.1rem;
  background: var(--lc-accent-soft);
}
.lc-reward-name { font-size: .8rem; font-weight: 700; color: var(--lc-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-reward-sub  { font-size: .7rem; color: var(--lc-text-3); }
.lc-reward-cta {
  flex-shrink: 0; font-size: .7rem; font-weight: 700; padding: .5rem .875rem;
  border-radius: 999px; background: var(--lc-accent); color: #fff;
  white-space: nowrap;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), filter .15s ease;
}
.lc-reward-cta:hover, .lc-reward-cta:focus-visible { transform: translateY(-1px) scale(1.02); filter: brightness(1.06); }
.lc-reward-pending { font-size: .7rem; font-weight: 600; color: var(--lc-text-3); }

/* -- Branch decoration motif: large faded icon, cropped in the bottom-right
   corner. Works identically for every template -- no per-branch CSS needed,
   so future templates inherit the same modern signature automatically. -- */
.lc-decor-icon {
  position: absolute;
  bottom: -1.25rem;
  right: -1.25rem;
  font-size: 6.5rem;
  line-height: 1;
  opacity: .14;
  filter: blur(.5px) saturate(1.3);
  pointer-events: none;
  z-index: 0;
  transform: rotate(-8deg);
  user-select: none;
}
.dark .lc-decor-icon { opacity: .1; }

/* -- v2.0: full-card pattern background (card_style='pattern'). Same
   layering position as the emoji corner decoration above (z-index 0, sits
   behind the header/slots/reward content which are all in normal flow) --
   the two are mutually exclusive per card, never rendered together. -- */
.lc-pattern-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .05;
  pointer-events: none;
  overflow: hidden;
}
.dark .lc-pattern-bg { opacity: .07; }
.lc-pattern-bg svg { width: 100%; height: 100%; display: block; }

/* -- Animations (CSS only, no JS) -- */
@media (prefers-reduced-motion: no-preference) {
  .lc-anim-pop.lc-newest     { animation: lcPop .45s cubic-bezier(.34,1.56,.64,1) both; }
  .lc-anim-stamp.lc-newest   { animation: lcStamp .4s ease-out both; }
  .lc-anim-sticker.lc-newest { animation: lcSticker .5s cubic-bezier(.22,1,.36,1) both; }
  .lc-complete { animation: lcCompletePulse 1.1s ease-out 1; }
  .loyalty-card { animation: lcCardEnter .4s cubic-bezier(.22,1,.36,1) both; }
  .loyalty-card:hover { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 16px 32px -10px color-mix(in srgb, var(--lc-accent) 32%, transparent); }
}
@keyframes lcPop {
  0%   { transform: scale(0); opacity: 0; }
  65%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes lcStamp {
  0%   { transform: scale(1.7) rotate(-10deg); opacity: 0; }
  55%  { transform: scale(.9) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
@keyframes lcSticker {
  0%   { transform: scale(.25) rotate(-24deg) translateY(-14px); opacity: 0; }
  100% { transform: scale(1) rotate(0) translateY(0); opacity: 1; }
}
@keyframes lcCompletePulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--lc-accent), 0 12px 32px -8px color-mix(in srgb, var(--lc-accent) 45%, transparent); }
  40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--lc-accent) 35%, transparent), 0 16px 40px -8px color-mix(in srgb, var(--lc-accent) 60%, transparent); }
}
@keyframes lcCardEnter {
  0%   { opacity: 0; transform: translateY(8px) scale(.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Light confetti burst on completion (pure CSS, tiny DOM, optional .lc-confetti wrapper) */
.lc-confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 2; }
.lc-confetti span {
  position: absolute; top: 40%; left: 50%; width: 6px; height: 10px; border-radius: 1px;
  background: var(--lc-accent); opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .lc-confetti.lc-burst span { animation: lcConfettiFall .9s ease-out forwards; }
  .lc-confetti span:nth-child(1) { background: var(--lc-accent); transform: rotate(10deg); animation-delay: 0s; left: 30%; }
  .lc-confetti span:nth-child(2) { background: #fbbf24; transform: rotate(-15deg); animation-delay: .04s; left: 45%; }
  .lc-confetti span:nth-child(3) { background: var(--lc-accent); transform: rotate(20deg); animation-delay: .08s; left: 60%; }
  .lc-confetti span:nth-child(4) { background: #34d399; transform: rotate(-8deg); animation-delay: .02s; left: 70%; }
  .lc-confetti span:nth-child(5) { background: #fbbf24; transform: rotate(12deg); animation-delay: .1s; left: 38%; }
  .lc-confetti span:nth-child(6) { background: var(--lc-accent); transform: rotate(-20deg); animation-delay: .06s; left: 55%; }
}
@keyframes lcConfettiFall {
  0%   { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(70px) rotate(180deg); }
}

/* -- Swiper / Album (native CSS scroll-snap, no external dependency) -- */



/* Reduced motion: never animate */
@media (prefers-reduced-motion: reduce) {
  .lc-anim-pop.lc-newest, .lc-anim-stamp.lc-newest, .lc-anim-sticker.lc-newest,
  .lc-complete, .loyalty-card, .lc-confetti.lc-burst span,
  .lc-reward-progress-bar { animation: none !important; }
  .loyalty-card:hover { transform: none; }
}

/* Mobile compactness */
@media (max-width: 480px) {
  .loyalty-card { padding: 1.125rem; border-radius: 1.25rem; }
  .lc-slots-grid { gap: .5rem; }
  .lc-slots-row { gap: .5rem; }
  .lc-title { font-size: .9rem; }
  .lc-reward-icon { width: 2rem; height: 2rem; }
}

/* -- Mini-phone preview frame (merchant settings live preview) -- */
.lc-phone-frame {
  width: 100%; margin: 0 auto;
  border-radius: 2.25rem; padding: .625rem;
  background: linear-gradient(160deg, #1f2937, #0f172a);
  box-shadow: 0 20px 50px -15px rgba(0,0,0,.45);
}
.dark .lc-phone-frame { background: linear-gradient(160deg, #111111, #000); }
.lc-phone-notch { width: 35%; height: 18px; background: #0f172a; border-radius: 0 0 12px 12px; margin: 0 auto; position: relative; z-index: 2; }
.dark .lc-phone-notch { background: #000; }
.lc-phone-screen {
  background: var(--bg-page, #f9fafb); border-radius: 1.625rem; padding: 1.125rem .875rem;
  margin-top: -18px; min-height: 320px;
}
.dark .lc-phone-screen { background: var(--bg-page, #0a0a0a); }

/* Merchant settings: branch template picker buttons */
.lc-tpl-btn {
  cursor: pointer;
  background: transparent;
}
.lc-tpl-btn:disabled { opacity: .4; cursor: not-allowed; }
.lc-tpl-btn.lc-tpl-active { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* v2.0: merchant/scan.php numeric keypad buttons */
.lc-scan-key {
  padding: .75rem 0;
  border-radius: 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--bg-card, #fff);
  color: var(--text-1, #111827);
  font-weight: 600;
  font-size: 1.125rem;
  min-height: 44px;
  -webkit-user-select: none; user-select: none;
  transition: background-color .15s ease, transform .1s ease;
}
.lc-scan-key:hover { background: var(--bg-page, #f9fafb); }
.lc-scan-key:active { transform: scale(.95); }
.lc-scan-key-utility {
  font-size: .8rem;
  color: var(--text-3, #9ca3af);
  background: var(--bg-page, #f9fafb);
}
.dark .lc-scan-key { background: #1c1c1c; border-color: rgba(99,102,241,.3); color: #f0f0f0; }
.dark .lc-scan-key:hover { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.5); }
.dark .lc-scan-key-utility { color: #a5b4fc; background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.2); }
.dark .lc-scan-key-utility:hover { background: rgba(99,102,241,.16); }
