/* MyStamps design system — sits on Bootstrap 5.3.
   Brand: indigo "ink stamp" primary, warm gold for rewards, coral accent.
   Mobile first: everything works at 360–430 px; customer column max 480,
   business column max 720, marketing full width. */
:root {
  --ms-primary: #4B32D6;
  --ms-primary-600: #3B25B8;
  --ms-primary-700: #2E1C93;
  --ms-primary-50: #EFECFE;
  --ms-primary-100: #DDD7FC;
  --ms-gold: #E9A100;
  --ms-gold-600: #C98A00;
  --ms-gold-50: #FFF6DE;
  --ms-coral: #FF6A4D;
  --ms-coral-50: #FFEDE8;
  --ms-ink: #17152B;
  --ms-muted: #6B6880;
  --ms-line: #E7E5F0;
  --ms-bg: #F6F5FB;
  --ms-card: #FFFFFF;
  --ms-success: #0F8A55;
  --ms-success-50: #E3F6EC;
  --ms-danger: #D3263F;
  --ms-danger-50: #FDEBEE;
  --ms-wa: #25D366;
  --ms-radius: 16px;
  --ms-radius-sm: 10px;
  --ms-shadow: 0 1px 2px rgba(23,21,43,.04), 0 4px 16px rgba(23,21,43,.06);
  --ms-shadow-lg: 0 10px 40px rgba(23,21,43,.12);
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ms-ink);
  --bs-body-bg: var(--ms-bg);
  --bs-primary: var(--ms-primary);
  --bs-primary-rgb: 75, 50, 214;
  --bs-link-color: var(--ms-primary);
  --bs-link-color-rgb: 75, 50, 214;
  --bs-link-hover-color: var(--ms-primary-700);
  --bs-border-color: var(--ms-line);
  --bs-secondary-color: var(--ms-muted);
}
html { -webkit-text-size-adjust: 100%; }
body { background: var(--ms-bg); color: var(--ms-ink); font-size: 1rem; overflow-x: hidden; }
h1, h2, h3, h4, .h1, .h2, .h3, .h4 { font-weight: 800; letter-spacing: -.02em; }
.text-muted, .text-secondary { color: var(--ms-muted) !important; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--ms-primary-100); outline-offset: 2px; }

/* buttons */
.btn { border-radius: 12px; font-weight: 700; padding: .6rem 1.1rem; min-height: 44px; display: inline-flex;
       align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { min-height: 36px; padding: .35rem .8rem; border-radius: 10px; font-size: .875rem; }
.btn-lg { min-height: 54px; font-size: 1.05rem; border-radius: 14px; }
.btn-primary { --bs-btn-bg: var(--ms-primary); --bs-btn-border-color: var(--ms-primary); --bs-btn-hover-bg: var(--ms-primary-600);
  --bs-btn-hover-border-color: var(--ms-primary-600); --bs-btn-active-bg: var(--ms-primary-700); --bs-btn-active-border-color: var(--ms-primary-700);
  --bs-btn-disabled-bg: var(--ms-primary); --bs-btn-disabled-border-color: var(--ms-primary); }
.btn-outline-primary { --bs-btn-color: var(--ms-primary); --bs-btn-border-color: var(--ms-primary-100); --bs-btn-hover-bg: var(--ms-primary-50);
  --bs-btn-hover-color: var(--ms-primary-700); --bs-btn-hover-border-color: var(--ms-primary-100); --bs-btn-active-bg: var(--ms-primary-100);
  --bs-btn-active-color: var(--ms-primary-700); }
.btn-soft { background: var(--ms-primary-50); color: var(--ms-primary-700); border: 0; }
.btn-soft:hover { background: var(--ms-primary-100); color: var(--ms-primary-700); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--ms-line); --bs-btn-hover-bg: #F1F0F7; --bs-btn-hover-border-color: var(--ms-line); }
.btn-approve { --bs-btn-bg: var(--ms-success); --bs-btn-border-color: var(--ms-success); --bs-btn-color: #fff; --bs-btn-hover-bg: #0B744A;
  --bs-btn-hover-border-color: #0B744A; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #095f3c; --bs-btn-active-color:#fff; }
.btn-reject { --bs-btn-color: var(--ms-danger); --bs-btn-bg: #fff; --bs-btn-border-color: #F4C3CB; --bs-btn-hover-bg: var(--ms-danger-50);
  --bs-btn-hover-color: var(--ms-danger); --bs-btn-hover-border-color: #F4C3CB; --bs-btn-active-bg: #FAD5DB; --bs-btn-active-color: var(--ms-danger); }
.btn-gold { --bs-btn-bg: var(--ms-gold); --bs-btn-border-color: var(--ms-gold); --bs-btn-color: #2B1D00; --bs-btn-hover-bg: var(--ms-gold-600);
  --bs-btn-hover-border-color: var(--ms-gold-600); --bs-btn-hover-color: #2B1D00; --bs-btn-active-bg: var(--ms-gold-600); --bs-btn-active-color:#2B1D00; }
.btn-wa { --bs-btn-bg: var(--ms-wa); --bs-btn-border-color: var(--ms-wa); --bs-btn-color: #fff; --bs-btn-hover-bg: #1EB457;
  --bs-btn-hover-border-color: #1EB457; --bs-btn-hover-color: #fff; }

/* forms */
.form-control, .form-select { border-radius: 12px; min-height: 48px; border-color: var(--ms-line); font-size: 1rem; }
.form-control:focus, .form-select:focus { border-color: var(--ms-primary); box-shadow: 0 0 0 .2rem var(--ms-primary-50); }
.form-label { font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.form-label.required::after { content: " *"; color: var(--ms-danger); }
.form-text { color: var(--ms-muted); font-size: .82rem; }
.form-check-input:checked { background-color: var(--ms-primary); border-color: var(--ms-primary); }
.form-switch .form-check-input { width: 2.6em; height: 1.4em; }
.input-group-text { border-radius: 12px; background: #F1F0F7; border-color: var(--ms-line); font-weight: 700; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* surfaces */
.ms-card { background: var(--ms-card); border-radius: var(--ms-radius); box-shadow: var(--ms-shadow); border: 1px solid rgba(23,21,43,.04); padding: 1.25rem; }
.ms-card + .ms-card { margin-top: 1rem; }
.ms-card-title { font-weight: 800; font-size: 1.1rem; margin: 0 0 .25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 800; color: var(--ms-muted); }
.ms-list > * + * { border-top: 1px solid var(--ms-line); }
.ms-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 0; }
.ms-row .grow { flex: 1; min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
        background: #F1F0F7; color: var(--ms-ink); white-space: nowrap; }
.chip-primary { background: var(--ms-primary-50); color: var(--ms-primary-700); }
.chip-gold { background: var(--ms-gold-50); color: #7A5200; }
.chip-success { background: var(--ms-success-50); color: var(--ms-success); }
.chip-danger { background: var(--ms-danger-50); color: var(--ms-danger); }
.chip-coral { background: var(--ms-coral-50); color: #B4351C; }
.chips-scroll { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip-btn { border: 1px solid var(--ms-line); background: #fff; border-radius: 999px; padding: .45rem .9rem; font-weight: 700; font-size: .875rem;
            color: var(--ms-ink); white-space: nowrap; text-decoration: none; min-height: 38px; display: inline-flex; align-items: center; }
.chip-btn.active, .chip-btn:hover { background: var(--ms-primary-50); border-color: var(--ms-primary-100); color: var(--ms-primary-700); }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
          color: #fff; font-weight: 800; background: hsl(var(--h, 250), 55%, 48%); font-size: 1rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.biz-logo { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; flex: none; background: var(--ms-primary); color: #fff;
            display: inline-flex; align-items: center; justify-content: center; font-weight: 800; overflow: hidden; }
.biz-logo img { width: 100%; height: 100%; object-fit: cover; }
.biz-logo-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.5rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ms-muted); }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--ms-primary-50); color: var(--ms-primary);
                     display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: .75rem; }
.empty h3 { font-size: 1rem; color: var(--ms-ink); margin-bottom: .25rem; }

/* stamp grid */
.stamp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px dashed #CFCBE0; background: #FAFAFD; display: flex; align-items: center;
         justify-content: center; font-size: .8rem; font-weight: 700; color: #9A97AE; position: relative; }
.stamp.filled { border: 0; background: var(--ms-primary); color: #fff; font-size: 1.25rem; }
.stamp.reward { border-color: var(--ms-gold); background: var(--ms-gold-50); color: #7A5200; font-size: 1.15rem; }
.stamp.reward.filled { background: var(--ms-gold); color: #2B1D00; border: 0; }
.stamp.pop { animation: stamp-pop .35s ease-out; }
@keyframes stamp-pop { 0% { transform: scale(.6) } 60% { transform: scale(1.12) } 100% { transform: scale(1) } }
.progress-ms { height: 8px; border-radius: 99px; background: #ECEAF4; overflow: hidden; }
.progress-ms > span { display: block; height: 100%; background: var(--ms-primary); border-radius: 99px; transition: width .4s; }

/* customer shell */
.shell-customer { max-width: 480px; margin: 0 auto; padding: 0 16px calc(88px + env(safe-area-inset-bottom)); }
.shell-plain { max-width: 480px; margin: 0 auto; padding: 0 16px 2rem; }
.app-header { position: sticky; top: 0; z-index: 1020; background: rgba(246,245,251,.92); backdrop-filter: saturate(1.4) blur(10px);
              -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.app-header .inner { display: flex; align-items: center; gap: .5rem; height: 60px; margin: 0 auto; padding: 0 16px; }
.app-header .inner.cust { max-width: 480px; }
.app-header .inner.biz { max-width: 720px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ms-ink); font-size: 1.25rem; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; background: url(/img/logo.svg) center/contain no-repeat; display: inline-block; }
.brand-word { font-weight: 600; }
.brand-word b { font-weight: 800; color: var(--ms-primary); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: inline-flex; align-items: center;
            justify-content: center; color: var(--ms-ink); font-size: 1.35rem; text-decoration: none; position: relative; }
.icon-btn:hover { background: #ECEAF4; color: var(--ms-ink); }
.switch-pill { border: 1px solid var(--ms-line); background: #fff; border-radius: 999px; padding: .35rem .8rem; font-size: .82rem; font-weight: 700;
               text-decoration: none; color: var(--ms-ink); display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--ms-line);
          padding-bottom: env(safe-area-inset-bottom); }
.tabbar .inner { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: .5rem 0 .55rem;
            text-decoration: none; color: var(--ms-muted); font-size: .72rem; font-weight: 700; min-height: 60px; }
.tabbar a i { font-size: 1.3rem; }
.tabbar a.active { color: var(--ms-primary); }
.tabbar a.scan i { width: 46px; height: 46px; border-radius: 50%; background: var(--ms-primary); color: #fff; display: flex; align-items: center;
                   justify-content: center; margin-top: -18px; box-shadow: 0 6px 16px rgba(75,50,214,.35); font-size: 1.35rem; }
.page-title { font-size: 1.5rem; font-weight: 800; margin: 1rem 0 .25rem; }
.page-sub { color: var(--ms-muted); margin-bottom: 1rem; }
.made-by { text-align: center; color: var(--ms-muted); font-size: .82rem; padding: 1.5rem 0 .5rem; }
.made-by a { color: inherit; text-decoration: none; font-weight: 700; }

/* business shell */
.shell-biz { max-width: 720px; margin: 0 auto; padding: 0 16px 3rem; }
.trial-banner { background: var(--ms-gold-50); border: 1px solid #F6E2AE; color: #5C4100; border-radius: 14px; padding: .75rem 1rem; display: flex;
                align-items: center; gap: .6rem; font-weight: 700; font-size: .9rem; margin: 1rem 0; }
.trial-banner a { margin-left: auto; color: var(--ms-primary-700); white-space: nowrap; }
.drawer .nav-link { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 12px; color: var(--ms-ink); font-weight: 700; }
.drawer .nav-link i { font-size: 1.15rem; color: var(--ms-muted); width: 1.3rem; text-align: center; }
.drawer .nav-link.active { background: var(--ms-primary-50); color: var(--ms-primary-700); }
.drawer .nav-link.active i { color: var(--ms-primary); }
.drawer .nav-link:hover { background: #F1F0F7; }
.badge-count { background: var(--ms-coral); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 800; padding: .1rem .45rem; margin-left: auto; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--ms-coral); border: 2px solid var(--ms-bg); }
.stat { background: #fff; border-radius: 14px; box-shadow: var(--ms-shadow); padding: .85rem 1rem; }
.stat .label { font-size: .78rem; color: var(--ms-muted); font-weight: 700; }
.stat .value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.live-dot { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 700; color: var(--ms-muted); }
.live-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #B9B6C9; }
.live-dot.on { color: var(--ms-success); }
.live-dot.on::before { background: var(--ms-success); box-shadow: 0 0 0 3px var(--ms-success-50); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(15,138,85,.08); } }

/* approvals */
.req-card { background: #fff; border-radius: var(--ms-radius); box-shadow: var(--ms-shadow); padding: 1rem; border: 2px solid transparent; }
.req-card + .req-card { margin-top: .85rem; }
.req-card.claim { border-color: var(--ms-gold); background: linear-gradient(180deg, #FFFBEF, #fff 60%); }
.req-card .actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: .6rem; margin-top: .9rem; }
.req-card .actions .btn { min-height: 52px; font-size: 1.05rem; }
.verify-code { font-size: 2.25rem; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--ms-ink); }
.countdown { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ms-muted); font-weight: 700; }
.countdown.low { color: var(--ms-danger); }
.toast-ms { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 2000;
            background: var(--ms-ink); color: #fff; border-radius: 14px; padding: .75rem .9rem .75rem 1.1rem; display: flex; align-items: center;
            gap: .9rem; box-shadow: var(--ms-shadow-lg); width: calc(100% - 32px); max-width: 460px; font-weight: 600; }
.toast-ms .btn { min-height: 38px; color: #fff; border: 1px solid rgba(255,255,255,.3); background: transparent; }
.toast-ms .btn:hover { background: rgba(255,255,255,.12); }

/* customer scan screens */
.wait-badge { width: 150px; height: 150px; border-radius: 50%; background: var(--ms-primary-50); display: flex; align-items: center;
              justify-content: center; margin: 1.25rem auto; position: relative; }
.wait-badge > span { width: 104px; height: 104px; border-radius: 50%; background: var(--ms-primary); color: #fff; display: flex;
                     align-items: center; justify-content: center; font-size: 2.75rem; }
.wait-badge::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--ms-primary); opacity: 0;
                     animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.75); opacity: .6 } 100% { transform: scale(1.15); opacity: 0 } }
.result-head { background: var(--ms-primary); color: #fff; padding: 1rem 1.25rem; border-radius: var(--ms-radius) var(--ms-radius) 0 0;
               display: flex; align-items: center; gap: .75rem; margin: -1.25rem -1.25rem 1rem; }
.result-head.gold { background: var(--ms-gold); color: #2B1D00; }
.result-head .ico { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: none; }

/* redeem ticket */
.ticket { background: #fff; border-radius: 22px; box-shadow: var(--ms-shadow-lg); overflow: hidden; position: relative; text-align: center; }
.ticket .top { background: linear-gradient(135deg, var(--ms-gold), #F7C548); color: #2B1D00; padding: 1.25rem 1rem 1.5rem; position: relative; overflow: hidden; }
.ticket .top::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
                      background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 2.4s linear infinite; }
@keyframes shimmer { to { transform: translateX(400%); } }
.ticket .clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; }
.ticket .code { font-size: 3.4rem; font-weight: 800; letter-spacing: .2em; font-variant-numeric: tabular-nums; line-height: 1; margin: .25rem 0; direction: ltr; }
.ticket .body { padding: 1.25rem; }
.ticket .reward-photo { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; margin: -54px auto .5rem; border: 4px solid #fff; display: block; background: #fff; position: relative; z-index: 1; }
.ticket.done .top { background: linear-gradient(135deg, var(--ms-success), #34C17F); color: #fff; }
.ticket.failed .top { background: #ECEAF4; color: var(--ms-ink); }
.ticket.failed .top::after, .ticket.done .top::after { display: none; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(23,21,43,.45); z-index: 2500; display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2501; background: #fff; border-radius: 22px 22px 0 0; padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
         max-width: 520px; margin: 0 auto; transform: translateY(110%); transition: transform .25s ease; }
.sheet.open { transform: none; }
.sheet-backdrop.open { display: block; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: #DDDAE8; margin: -.5rem auto 1rem; }

/* scanner */
.scan-box { position: relative; border-radius: 22px; overflow: hidden; background: #111; aspect-ratio: 1; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-box .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* wizard */
.steps-bar { height: 6px; background: #ECEAF4; border-radius: 9px; overflow: hidden; margin: .5rem 0 1.25rem; }
.steps-bar span { display: block; height: 100%; background: var(--ms-primary); border-radius: 9px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.cat-btn { border: 2px solid var(--ms-line); background: #fff; border-radius: 14px; padding: .8rem .25rem; display: flex; flex-direction: column;
           align-items: center; gap: .35rem; font-weight: 700; font-size: .85rem; color: var(--ms-ink); cursor: pointer; min-height: 84px; justify-content: center; }
.cat-btn i { font-size: 1.4rem; color: var(--ms-primary); }
.btn-check:checked + .cat-btn { border-color: var(--ms-primary); background: var(--ms-primary-50); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--ms-line); border-radius: 14px; background: #fff; overflow: hidden; }
.stepper button { width: 52px; height: 52px; border: 0; background: transparent; font-size: 1.4rem; font-weight: 700; color: var(--ms-primary); }
.stepper button:hover { background: var(--ms-primary-50); }
.stepper input { width: 70px; text-align: center; border: 0; font-size: 1.25rem; font-weight: 800; height: 52px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qr-frame { background: #fff; border-radius: 20px; padding: 1rem; display: inline-block; box-shadow: var(--ms-shadow); }
.qr-frame svg { display: block; max-width: 100%; height: auto; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars .bar { flex: 1; background: var(--ms-primary-100); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .bar.has { background: var(--ms-primary); }
.bars .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); background: var(--ms-ink);
                          color: #fff; font-size: .72rem; padding: .15rem .4rem; border-radius: 6px; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
