/* Rewards Catalogue — one stylesheet, no build step. */
:root {
  color-scheme: light dark;
  --accent: #B8432E;
  --on-accent: #FFFFFF;
  --cream: #FFF9F1;
  --ink: #30241F;
  --ink-2: #4A3B33;
  --muted: #6B5A50;
  --line: #EFE3D6;
  --line-strong: #CDB9A8;
  --gold: #F1C561;
  --peach: #F8DFCF;
  --white: #FFFFFF;
  --danger-bg: #FBE3DA;
  --ok: #1E7A4F;
  --radius: 16px;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Derived tokens, redefined for dark mode below. */
  --accent-text: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --track: #F3E7D9;
  --disabled-bg: #F5ECE2;
  --tile: #FBEFD9;
  --tile-alt: var(--peach);
  --ok-bg: #E3F2EA;
  --ok-ink: #0E3D27;
  --error-ink: #6A1F12;
}

/* Dark mode follows the phone or browser setting. The staff screens are always dark,
   and QR codes always stay dark-on-white so they scan. */
@media (prefers-color-scheme: dark) {
  :root {
    --cream: #211C19;
    --white: #2C2521;
    --ink: #FFF5EB;
    --ink-2: #EADBCD;
    --muted: #C7B6A9;
    --line: rgba(255, 245, 235, .14);
    --line-strong: rgba(255, 245, 235, .30);
    --peach: #483027;
    --danger-bg: #4A2219;
    --accent-text: color-mix(in srgb, var(--accent) 55%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 30%, #211C19);
    --track: rgba(255, 245, 235, .16);
    --disabled-bg: #382E28;
    --tile: #E9D6BE;
    --tile-alt: #E6C6B1;
    --ok-bg: #173327;
    --ok-ink: #D3F2E2;
    --error-ink: #FFD9CF;
  }
  .member-card { box-shadow: none; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
a { color: var(--accent-text); }
img, svg { max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--cream); }
.content { flex: 1; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.push { margin-top: auto; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); letter-spacing: .06em; }
.section-title { font-size: 17px; font-weight: 700; }

/* Brand */
.logo { width: 40px; height: 40px; border-radius: 11px; background: #FFFFFF; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
/* An uploaded logo shows as itself: no tile behind it, round like most restaurant marks. */
.logo:has(img) { background: transparent; border-radius: 50%; }
.logo:has(img) img { object-fit: contain; }
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.logo.on-light { background: var(--accent); color: var(--on-accent); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; }

.hero { position: relative; background: var(--accent); color: var(--on-accent); padding: 22px 24px 50px; border-radius: 0 0 55% 45% / 0 0 34px 34px; display: flex; flex-direction: column; gap: 18px; overflow: hidden; }
.hero h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.02em; display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.hero .sprig { position: absolute; right: 18px; top: 34px; opacity: .32; }
.hero-photo { position: absolute; right: -34px; top: 46px; width: 178px; height: 178px; object-fit: contain; }
.hero-photo ~ .hero-copy { max-width: 220px; }
.hero .tagline { font-size: 16px; }
.hero .subline { font-size: 13px; opacity: .9; }

.topbar { background: var(--white); border-bottom: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar h1 { font-size: 20px; }
.back { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--ink); margin-left: -10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: 17px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-dark { background: var(--ink); color: var(--white); }
.btn-outline { background: var(--white); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn[disabled], .btn.is-disabled { background: var(--disabled-bg); color: var(--ink-2); cursor: not-allowed; }
.btn.is-dashed { background: var(--white); border: 1.5px dashed var(--line-strong); color: var(--ink-2); }
.btn-link { background: none; border: 0; padding: 8px 2px; color: var(--accent-text); font-weight: 700; text-decoration: none; cursor: pointer; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--peach); color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }

/* Panels */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-peach { background: var(--peach); border-radius: var(--radius); padding: 14px 16px; }
.pill { display: inline-block; width: fit-content; background: var(--gold); color: #30241F; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.sm { padding: 4px 10px; font-size: 12px; }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.alert-error { background: var(--danger-bg); color: var(--error-ink); border: 1px solid #F0B9A6; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid #B9DEC9; }
.progress { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.on-accent .progress { background: rgba(255,255,255,.28); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 15px; font-weight: 600; }
.input { height: 52px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font-size: 17px; background: var(--white); width: 100%; }
.input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(184,67,46,.25); }
.input.code { font-family: var(--mono); font-size: 28px; letter-spacing: .4em; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.error-text { color: #8E2A17; font-size: 14px; }

/* Rewards on the joining page */
.reward-row { display: flex; align-items: center; gap: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.reward-row .name { flex: 1; font-weight: 600; }
.food { width: 52px; height: 52px; border-radius: 12px; background: var(--tile); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.food img { width: 100%; height: 100%; object-fit: contain; }
.food.alt { background: var(--tile-alt); }


/* My Card (banner layout) */
.brand-bar { display: flex; align-items: center; gap: 12px; padding: 16px 20px 6px; }
.brand-bar .logo { border-radius: 14px; width: 42px; height: 42px; }
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.welcome { font-size: 24px; font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
.balance-card { background: var(--accent); color: var(--on-accent); border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.balance-card .progress { background: rgba(255,255,255,.25); height: 7px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.balance-chip { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.18); border-radius: 999px; padding: 4px 10px; }
.balance-amount { font-size: 38px; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.balance-label { font-size: 16px; font-weight: 500; margin-left: 8px; }
.balance-link { color: inherit; font-size: 13px; padding: 6px 0; }
.member-card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 8px 30px rgba(74,46,24,.06); text-align: center; }
.qr-link { display: block; line-height: 0; }
.qr-link svg { width: 140px; height: 140px; }
.big-code { display: none; position: fixed; inset: 0; z-index: 20; background: rgba(32,21,15,.55); align-items: center; justify-content: center; padding: 16px; }
.big-code:target { display: flex; }
.big-code-box { background: #FFFFFF; color: #30241F; border-radius: 24px; padding: 24px; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big-code-box .muted { color: #6B5A50; }
.big-code-box svg { width: 260px; height: 260px; }

/* Reward grid (Rewards Catalogue + My Card preview) */
.reward-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reward-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.reward-card.is-ready { border: 2px solid var(--accent); }
.reward-card .pic { height: 116px; background: var(--tile); display: flex; align-items: center; justify-content: center; }
.reward-card .pic.alt { background: var(--tile-alt); }
.reward-card .pic img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.reward-card .pic.sm { height: 84px; }
.reward-card .pic.xs { height: 64px; }
.reward-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.reward-card .title { font-size: 16px; font-weight: 700; }
.reward-card .desc { font-size: 12px; color: var(--muted); }
.reward-card .btn { min-height: 44px; font-size: 14px; border-radius: 12px; margin-top: auto; padding: 0 8px; }

/* Reward code screen */
.dark { background: #30241F; color: #FFFFFF; }
.dark .muted { color: #CDBFB5; }
.claim-box { background: #FFFFFF; color: #30241F; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: 0 0 0 4px var(--gold); }
.claim-box svg { width: 200px; height: 200px; }
.claim-code { font-family: var(--mono); font-size: 26px; letter-spacing: .08em; }
.timer { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.dark-note { background: #3D2F29; border: 1px solid #4A3A33; border-radius: 14px; padding: 14px 16px; font-size: 14px; color: #F1E7DF; }
.dark .btn-outline { background: transparent; color: #FFFFFF; border-color: #6B5A50; }

/* Activity */
.event { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.event .what { font-weight: 600; }
.event .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }

/* Bottom navigation */
.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; border-top: 1px solid var(--line); background: var(--white); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--accent-text); font-weight: 700; background: var(--accent-soft); }

.footer { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.footer a { color: var(--ink-2); text-decoration: none; }

/* ---------- Staff workspace: dark, high contrast ---------- */
body.staff { background: #121418; color: #F3F4F6; }
.staff .page { background: #121418; }
.staff a { color: #F3F4F6; }
.staff .muted { color: #A3A9B4; }
.staff-bar { padding: 16px 20px; border-bottom: 1px solid #2E323A; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.staff-bar .who { font-size: 14px; color: #A3A9B4; }
.staff-label { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--gold); text-transform: uppercase; }
.staff-section { font-size: 13px; font-weight: 600; color: #A3A9B4; text-transform: uppercase; letter-spacing: .06em; }
.staff .card { background: #1D2026; border-color: #2E323A; color: #F3F4F6; }
.staff .input { background: #1D2026; border-color: #3A3F48; color: #F3F4F6; }
.staff .input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(241,197,97,.3); }
.staff .input.big { height: 72px; font-size: 34px; font-weight: 700; text-align: center; border: 2px solid var(--gold); }
.staff .check input { accent-color: var(--gold); }
.staff .btn-gold { background: var(--gold); color: #16181D; }
.staff .btn-outline { background: transparent; color: #F3F4F6; border-color: #3A3F48; }
.staff .alert-error { background: #3A1E19; color: #FFD9CF; border-color: #6A2F25; }
.staff .alert-ok { background: #173327; color: #D3F2E2; border-color: #2A5C45; }
.member-strip { display: flex; align-items: center; gap: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: #2E323A; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.give-box { background: #F3F4F6; color: #16181D; border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.give-box .muted { color: #5B606B; }
.done-box { background: #7FD1A8; color: #0E2A1C; border-radius: 22px; padding: 32px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.done-box h1 { font-size: 34px; }
.recent { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #2E323A; font-size: 15px; }
.scanner { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 1 / 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 16%; right: 16%; top: 14%; bottom: 26%; border: 3px solid var(--gold); border-radius: 22px; }
.scanner-caption { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 0 16px; color: #F3F4F6; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scanner-caption strong { font-size: 18px; }
.scanner-caption span { font-size: 14px; color: #C8CCD3; }
.cancel-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; font-weight: 600; color: #C8CCD3 !important; text-decoration: none; }
.btn-xl { min-height: 64px; font-size: 19px; border-radius: 16px; font-weight: 700; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.pick-grid label { display: flex; align-items: center; justify-content: center; min-height: 60px; border-radius: 14px; border: 1.5px solid #3A3F48; background: #1D2026; font-size: 22px; font-weight: 700; cursor: pointer; }
.pick-grid input { position: absolute; opacity: 0; pointer-events: none; }
.pick-grid label:has(input:checked) { border: 3px solid var(--gold); background: #2A2415; color: var(--gold); }
.pick-grid label:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.gold-link { color: var(--gold) !important; font-weight: 600; text-decoration: none; padding: 6px 0; width: fit-content; }
.reward-status { background: #1D2026; border: 1px solid #2E323A; border-radius: 18px; overflow: hidden; }
.reward-status > div { padding: 12px 16px; border-bottom: 1px solid #2E323A; }
.reward-status > div:last-child { border-bottom: 0; }
.receipt { border-top: 1px solid #2E323A; padding-top: 12px; }
.receipt summary { cursor: pointer; color: #C8CCD3; min-height: 32px; }
body.done-screen { background: #7FD1A8; color: #0E2A1C; }
.done-page { background: #7FD1A8 !important; border: 0 !important; align-items: center; justify-content: center; gap: 14px; padding: 32px 24px; text-align: center; }
.done-page h1 { font-size: 40px; line-height: 1.1; }
.done-page .lead { font-size: 18px; font-weight: 600; }
.done-next { margin-top: 24px; background: #0E2A1C; color: #FFFFFF; }

@media (min-width: 600px) {
  .page { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .staff .page { border-color: #2E323A; }
}

/* Stamp card (stamp mode) */
.stamps { display: grid; gap: 6px; padding: 2px 0; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center; }
.stamp svg { width: 60%; height: 60%; }
.stamp.is-on { border: 0; background: #FFF9F1; color: var(--accent); }
.stamp.is-goal { border-color: var(--gold); color: var(--gold); }
.staff-stamps .stamp { border-color: #5B606B; }
.staff-stamps .stamp.is-on { background: var(--gold); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 64px; height: 72px; border-radius: 16px; border: 1.5px solid #3A3F48; background: #1D2026; color: #F3F4F6; font-size: 30px; font-weight: 600; cursor: pointer; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---------- Owner panel and platform admin (desktop-first, stacks on phones) ---------- */
:root { --chart-1: #B8432E; --chart-prev: #8A7B71; --grid: #F1E8DE; --up-bg: #E3F2EA; --up-ink: #0E5A37; --down-bg: #FBE3DA; --down-ink: #8E2A17; }
@media (prefers-color-scheme: dark) {
  :root { --chart-1: #D9624A; --chart-prev: #A8988C; --grid: rgba(255, 245, 235, .10); --up-bg: #173327; --up-ink: #9FE0BF; --down-bg: #4A2219; --down-ink: #FFC2B3; }
}
body.panel { background: var(--white); }
.panel-wrap { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.panel-nav { flex: 1 1 220px; max-width: 100%; background: var(--cream); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.panel-nav a.nav { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 10px; color: var(--ink); font-size: 14px; text-decoration: none; }
.panel-nav a.nav:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.panel-nav a.nav[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.panel-nav a.nav svg { flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.panel-nav .who { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.panel-nav .who .logo { border-radius: 50%; }
.who-name { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell { position: relative; color: var(--muted); display: inline-flex; padding: 6px; border-radius: 8px; }
.bell .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-foot { margin-top: auto; padding: 16px 10px 0; display: flex; flex-direction: column; gap: 2px; }
.nav-foot .btn-link { align-self: flex-start; padding: 4px 0; color: var(--muted); }
.panel-main { flex: 999 1 560px; min-width: 0; padding: 26px clamp(16px, 3.5vw, 48px) 48px; display: flex; flex-direction: column; gap: 24px; }
.panel-main h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.panel .card { border-color: var(--line); }
/* Overview */
.ov-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.ov-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pills { display: flex; gap: 4px; }
.pills a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.pills a:hover { background: var(--cream); }
.pills a[aria-current="page"] { background: var(--ink); color: var(--white); font-weight: 700; }
.switch-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.switch { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; transition: left .15s; }
.switch-link[aria-checked="true"] .switch { background: var(--accent); }
.switch-link[aria-checked="true"] .switch::after { left: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px; padding: 6px 0 4px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { display: flex; align-items: center; gap: 10px; }
.kpi-value strong { font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi-note strong { color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.chip.up { background: var(--up-bg); color: var(--up-ink); }
.chip.down { background: var(--down-bg); color: var(--down-ink); }
.ov-section { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
.ov-section h2 { font-size: 18px; font-weight: 800; }
.ov-section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ov-section-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; }
.key-bar { width: 12px; height: 12px; border-radius: 3px; background: var(--chart-1); }
.key-dash { width: 12px; height: 12px; border-radius: 3px; border: 1.5px dashed var(--chart-1); }
.key-line { width: 14px; height: 0; border-top: 2px solid var(--chart-1); }
.key-line.dashed { border-top: 2px dashed var(--chart-prev); }
.chart { width: 100%; height: auto; font-family: var(--font); overflow: visible; }
.chart .grid line { stroke: var(--grid); }
.chart .axis, .chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--chart-1); }
.chart .bar-prev { fill: none; stroke: var(--chart-1); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; }
.chart .bar-group:hover .hit { fill: var(--grid); }
.chart .peak { fill: var(--ink); font-size: 11px; font-weight: 700; }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; }
.chart .line-prev { fill: none; stroke: var(--chart-prev); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--chart-1); stroke: var(--white); stroke-width: 2; }
.chart .tag { fill: var(--ink); }
.chart .tag-text { fill: var(--white); font-size: 11px; font-weight: 700; }
.insight { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--cream); font-size: 13px; color: var(--ink-2); }
.insight svg { flex-shrink: 0; margin-top: 1px; color: var(--accent-text); }
.insight strong { color: var(--ink); }
.insight a { font-weight: 700; }
.ov-split { flex-direction: row; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.ov-main { flex: 3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ov-side { flex: 1 1 200px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.side-stat { border-left: 3px solid var(--line-strong); padding: 6px 0 6px 14px; display: flex; flex-direction: column; }
.side-stat.accent { border-color: var(--chart-1); }
.side-stat .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-stat strong { font-size: 26px; font-weight: 800; }
.side-stat span { font-size: 12px; }
.side-stat .good { color: var(--up-ink); font-weight: 700; }
.side-stat .bad { color: var(--down-ink); font-weight: 700; }
.empty-chart { margin: 0; padding: 28px 16px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 14px; }
.feed { display: flex; flex-direction: column; }
.feed-row { display: grid; grid-template-columns: 70px 1fr 120px 90px; gap: 12px; padding: 10px 0; border-top: 1px solid var(--grid); font-size: 14px; align-items: baseline; }
@media (max-width: 560px) { .feed-row { grid-template-columns: 56px 1fr; } .feed-row > :nth-child(n+3) { grid-column: 2; font-size: 13px; } }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.filters a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > * { flex: 1 1 340px; min-width: 0; }
.cols > .wide { flex: 2 1 440px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile-stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile-stat strong { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.table-box { background: var(--white); border: 1px solid var(--line); border-radius: 18px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 12px 10px; background: var(--white); }
.table td { padding: 12px 10px; border-top: 1px solid var(--grid); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--peach); color: var(--ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.panel .btn { min-height: 42px; font-size: 15px; border-radius: 12px; }
.panel .input { height: 44px; font-size: 15px; }
.panel textarea.input { height: auto; padding: 10px 12px; }
.panel select.input { padding: 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.setting-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-row > div:first-child { flex: 1 1 260px; }
.danger { border: 1.5px solid #E8B9AC; }
.thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--tile); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.impersonating { background: #30241F; color: #FFF9F1; padding: 10px 16px; font-size: 14px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; width: 100%; }
.impersonating button { background: none; border: 0; color: #F1C561; font-weight: 700; cursor: pointer; }
.phone-preview { border: 6px solid var(--ink); border-radius: 26px; overflow: hidden; background: var(--cream); max-width: 300px; }
/* Platform admin uses the same light sidebar as the owner panel. */
@media print { .panel-nav, .no-print { display: none !important; } }

/* ---------- Full cards, choosing a reward, and the unlocked moment ---------- */
.balance-chip.gold { background: var(--gold); color: #30241F; }
.choose-strip { display: flex; align-items: center; gap: 12px; background: var(--white); border: 2px solid var(--gold); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.choose-strip .gift { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #30241F; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.choose-go { font-weight: 700; font-size: 14px; color: var(--accent-text); white-space: nowrap; }
.notice-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.eyebrow-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.choice { display: flex; align-items: center; gap: 12px; background: var(--white); border: 1.5px solid var(--line); border-radius: 16px; padding: 8px 12px 8px 8px; cursor: pointer; }
.choice:has(input:checked) { border: 2px solid var(--accent); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice-pic { width: 58px; height: 58px; border-radius: 12px; background: var(--tile); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.choice-pic.sm { width: 40px; height: 40px; border-radius: 10px; }
.choice-pic img { width: 100%; height: 100%; object-fit: contain; }
.choice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.choice-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; }
.choice:has(input:checked) .choice-dot { border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.keep-saving summary { cursor: pointer; font-weight: 800; padding: 4px 0; }

/* Staff: card complete */
.card-complete { background: #2A2415; border: 2px solid var(--gold); border-radius: 18px; padding: 14px 16px; gap: 10px; }
.cc-title { font-size: 20px; color: var(--gold); }
.give-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-radius: 14px; background: var(--gold); color: #16181D; font-family: inherit; font-size: 20px; text-align: left; cursor: pointer; }
.give-btn > span:first-child { flex: 1; display: flex; flex-direction: column; }
.give-btn strong { font-size: 17px; }
.card-complete .stamp { animation: cc-in .4s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes cc-in { from { transform: scale(0); } to { transform: scale(1); } }

/* Stamp lands */
.stamp.pop { animation: stamp-pop .55s cubic-bezier(.3, 1.6, .5, 1); position: relative; }
.stamp.pop::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--gold); animation: stamp-ring .6s ease-out forwards; }
@keyframes stamp-pop { 0% { transform: scale(.2) rotate(-25deg); } 60% { transform: scale(1.25) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes stamp-ring { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: scale(1.6); } }
.balance-card.glow { animation: card-glow 1.2s ease-out; }
@keyframes card-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 70%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }

/* Unlocked overlay */
.unlock { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, #1A1310 72%, transparent); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .25s ease-out; }
.unlock-box { position: relative; width: min(100%, 340px); background: var(--accent); color: var(--on-accent); border-radius: 26px; padding: 34px 22px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; overflow: hidden; animation: box-in .55s cubic-bezier(.3, 1.5, .5, 1); }
.unlock-rays { position: absolute; top: -90px; left: 50%; width: 320px; height: 320px; margin-left: -160px; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.16) 0 10deg, transparent 10deg 30deg); border-radius: 50%; animation: spin 9s linear infinite; pointer-events: none; }
.unlock-gift { position: relative; width: 84px; height: 84px; border-radius: 50%; background: var(--gold); color: #30241F; display: flex; align-items: center; justify-content: center; animation: gift-in .7s .15s cubic-bezier(.3, 1.8, .5, 1) both, wiggle 1.6s 1s ease-in-out infinite; }
.unlock-gift svg { width: 44px; height: 44px; }
.unlock-eyebrow { position: relative; margin-top: 8px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.unlock-title { position: relative; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.unlock-text { position: relative; font-size: 15px; opacity: .95; margin-bottom: 10px; }
.unlock .btn-gold { background: var(--gold); color: #30241F; position: relative; }
.unlock-later { position: relative; background: none; border: 0; color: var(--on-accent); font: inherit; font-weight: 700; padding: 12px; cursor: pointer; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: translateX(40px) rotate(540deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes box-in { from { transform: scale(.6) translateY(30px); opacity: 0; } }
@keyframes gift-in { from { transform: scale(0) rotate(-30deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Staff: code read */
.scan-flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; border: 6px solid #7FD1A8; animation: flash .5s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.done-tick { width: 84px; height: 84px; border-radius: 50%; background: #1E7A4F; display: flex; align-items: center; justify-content: center; margin: 0 auto; animation: box-in .5s cubic-bezier(.3, 1.6, .5, 1); }
.done-tick path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s .25s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .stamp.pop, .stamp.pop::after, .balance-card.glow, .unlock, .unlock-box, .unlock-rays, .unlock-gift, .confetti i, .card-complete .stamp, .scan-flash, .done-tick { animation: none !important; }
  .done-tick path { stroke-dashoffset: 0; }
}

/* Billing */
.plan-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.plan-card { flex: 1 1 240px; border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.is-current { border: 2px solid var(--accent); }
.plan-card ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); flex: 1; }
.plan-card li { padding: 3px 0; }
.plan-name { font-weight: 800; font-size: 17px; }
.plan-price { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.plan-badge { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 12px; background: var(--ok-bg); color: var(--ok-ink); font-size: 14px; font-weight: 700; }
.billing-banner { background: var(--danger-bg); color: var(--error-ink); padding: 10px 16px; font-size: 14px; width: 100%; }
.billing-banner a { color: inherit; font-weight: 700; }

/* Invite link to share by hand */
.invite-share { background: var(--ok-bg); color: var(--ok-ink); border-radius: 14px; padding: 14px 16px; gap: 10px; }
.invite-share .invite-row { flex-wrap: wrap; gap: 8px; }
.invite-share .input { flex: 1 1 280px; min-width: 0; font-size: 13px; }
.invite-share .tiny { color: inherit; opacity: .8; }
