/* =====================================================================
 *  Joy Victoria — mobile-first PWA stylesheet (Baby Blue light theme)
 * ===================================================================== */

:root {
    /* Surfaces & text (light) */
    --c-bg-0: #f4f8fb;          /* page base + input bg + voucher notch */
    --c-bg-1: #e3f1fb;          /* soft baby-blue tint */
    --c-surface: #ffffff;       /* cards, modals */
    --c-surface-2: #f1f7fd;
    --c-border: rgba(13, 70, 120, 0.12);

    /* Brand — Joy Victoria cyan (sampled from the logo: #06afef) */
    --c-primary: #06afef;       /* brand cyan: accents, focus, brand mark */
    --c-primary-600: #0578ad;   /* button gradient top — white text AA (4.9:1) */
    --c-primary-700: #045f89;   /* deepest brand cyan — white text AA (7:1) */
    --c-primary-300: #0577a8;   /* link / text accent on white — AA (5:1) */
    --c-baby: #bfe6fb;          /* soft baby blue */
    --c-baby-2: #89cff0;        /* baby blue */
    --c-accent: #f5a623;        /* warm amber accent */

    --c-text: #2b2f36;          /* dominant dark text (~#333) */
    --c-muted: #67707b;         /* muted grey (AA on white) */
    --c-success: #15a34a;
    --c-error: #d92d20;
    --c-info: #0578ad;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 12px 30px rgba(18, 70, 120, 0.12);
    --shadow-soft: 0 6px 18px rgba(18, 70, 120, 0.08);
    --maxw: 480px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--c-text);
    /* Soft Baby-Blue gradient — cards/surfaces stay white for contrast. */
    background: linear-gradient(180deg, #EAF9FF 0%, #BCE8FB 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

.app-shell {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    /* Baby-Blue gradient on the main container too (not just the header). */
    background: linear-gradient(180deg, #EAF9FF 0%, #BCE8FB 100%);
    background-attachment: fixed;
    padding:
        calc(var(--safe-top) + 0px) 16px
        calc(var(--safe-bottom) + 24px);
    display: flex;
    flex-direction: column;
}

/* ---- Top bar --------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 0 -16px 8px;                 /* bleed to the app-shell edges */
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(232, 248, 255, 0.82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-name { font-weight: 700; letter-spacing: 0.2px; color: var(--c-text); }
.topbar-action {
    color: var(--c-primary-300);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    background: #fff;
    border: 1px solid var(--c-border);
    padding: 7px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}
.topbar-action:active { transform: scale(0.97); }

/* Icon-only logout button — transparent, borderless, blends with the header */
.topbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #1e293b;            /* solid near-black — high contrast on Baby Blue */
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.topbar-icon svg { width: 24px; height: 24px; display: block; fill: #1e293b; }
.topbar-icon:hover { background: rgba(13, 70, 120, 0.07); }
.topbar-icon:hover svg { fill: var(--c-primary-700); }
.topbar-icon:active { transform: scale(0.92); }
.topbar-icon:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }

/* ---- Flash messages -------------------------------------------------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    box-shadow: var(--shadow-soft);
    animation: flash-in 0.25s ease;
}
.flash-error   { border-color: rgba(217,45,32,0.35);  background: #fdecea; color: #8a1c14; }
.flash-success { border-color: rgba(21,163,74,0.35);  background: #e7f6ed; color: #0f5f2e; }
.flash-info    { border-color: rgba(5,120,173,0.30); background: #e6f4fb; color: #045f89; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Auth screens ---------------------------------------------------- */
.screen-auth .app-shell { justify-content: center; }
.auth-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px 22px 24px;
    margin: auto 0;
}
.brand-hero { text-align: center; margin-bottom: 22px; }
.brand-hero.compact { margin-bottom: 16px; }
.brand-title { font-size: 1.5rem; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.3px; color: var(--c-text); }
.brand-sub { margin: 0; color: var(--c-muted); font-size: 0.95rem; }

/* ---- Forms ----------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.82rem; color: var(--c-muted); font-weight: 600; padding-left: 2px; }
.field-input {
    width: 100%;
    padding: 14px 14px;
    font-size: 1rem;
    color: var(--c-text);
    background: var(--c-bg-0);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.field-input::placeholder { color: #7e8894; }
.field-input:focus {
    /* -600 (not the bright accent) so the focus border clears WCAG 1.4.11 3:1
       against the pale input fill (~4.4:1); ring reinforces the state. */
    border-color: var(--c-primary-600);
    box-shadow: 0 0 0 3px rgba(5, 120, 173, 0.22);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 0.8rem; color: var(--c-primary-300); margin: 2px 0 0; padding-left: 2px; }
/* Read-only "verified data" fields (e.g. auto-filled No HP / Nama on registration). */
.field-input:disabled {
    background: var(--c-surface-2);
    color: var(--c-muted);
    -webkit-text-fill-color: var(--c-muted);   /* keep text legible on iOS (no fade) */
    opacity: 1;
    cursor: not-allowed;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    font-size: 1rem; font-weight: 700;
    padding: 14px 18px;
    border: none; border-radius: var(--radius-sm);
    cursor: pointer;
    color: #fff;
    transition: transform 0.08s ease, filter 0.15s ease;
    text-decoration: none;
}
.btn:active { transform: scale(0.985); }
.btn-primary {
    /* Bright logo-cyan sheen up top, deepening to AA cyan where the label sits
       (glyphs land ~38-60% height, below the 28% bright stop → white stays AA). */
    background: linear-gradient(180deg, #06afef 0%, var(--c-primary-600) 28%, var(--c-primary-700) 100%);
    box-shadow: 0 8px 20px rgba(5, 120, 173, 0.32);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    box-shadow: 0 8px 20px rgba(234, 88, 12, 0.30);
    color: #2a1206;
}
.btn-warning:hover { filter: brightness(1.05); }
.btn-outline {
    background: #fff;
    border: 1.5px solid var(--c-border);
    color: var(--c-text);
}
.btn-outline:hover { border-color: var(--c-primary); }
.btn-ghost {
    background: none;
    border: 1px solid var(--c-border);
    color: var(--c-muted);
}
.btn-ghost:hover { color: var(--c-text); }
.btn-block { width: 100%; margin-top: 4px; }
.btn-sm { padding: 9px 14px; font-size: 0.85rem; min-height: 40px; }

/* Subtle text-link button (e.g. "Lupa PIN?") */
.link-btn {
    align-self: flex-end;
    background: none;
    border: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-primary-300);
    padding: 2px 2px;
    margin: -6px 0 -2px;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; border-radius: 4px; }

.auth-foot { text-align: center; margin: 18px 0 0; color: var(--c-muted); font-size: 0.92rem; }
.auth-foot a { color: var(--c-primary-300); font-weight: 700; text-decoration: none; }
.muted { color: var(--c-muted); }

/* ---- Login: "Ingat saya" + change-account link ---------------------- */
.remember {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: -4px 0 -2px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.remember-box {
    width: 18px; height: 18px;
    flex: 0 0 auto;
    accent-color: var(--c-primary-600);   /* cyan tick, CSP-safe (no JS) */
    cursor: pointer;
}
.remember-box:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }
.remember-text { font-size: 0.9rem; color: var(--c-muted); font-weight: 600; }

/* One-time birthday consent checkbox (birthday.php) — a prominent, tappable row. */
.consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin: 2px 0;
    background: var(--c-surface-2);
    border: 1px solid rgba(6, 175, 239, 0.28);
    border-radius: var(--radius-sm);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.consent-box {
    width: 20px; height: 20px;
    flex: 0 0 auto;
    margin-top: 1px;
    accent-color: var(--c-primary-600);   /* cyan tick, CSP-safe (no JS) */
    cursor: pointer;
}
.consent-box:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }
.consent-text { font-size: 0.88rem; color: var(--c-text); line-height: 1.45; }
.link-forget {
    display: block;
    text-align: center;
    margin: 12px 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-primary-300);
    text-decoration: none;
}
.link-forget:hover { text-decoration: underline; }
.link-forget:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; border-radius: 4px; }

/* ---- Dashboard ------------------------------------------------------- */
.dashboard { display: flex; flex-direction: column; gap: 18px; padding-top: 6px; }

.greeting { padding: 4px 4px 0; }
.greeting-hello { margin: 0; color: var(--c-muted); font-size: 0.95rem; }
.greeting-name { margin: 2px 0 4px; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.4px; color: var(--c-text); }
.greeting-code { margin: 0; color: var(--c-muted); font-size: 0.85rem; }
.greeting-code strong { color: var(--c-primary-300); letter-spacing: 1px; }

.section-title { font-size: 1rem; font-weight: 700; margin: 0 0 12px; color: var(--c-text); }

/* Points hero card */
.points-card {
    background:
        radial-gradient(600px 200px at 100% 0%, rgba(255,255,255,0.18), transparent 60%),
        linear-gradient(150deg, var(--c-primary-600) 0%, var(--c-primary-700) 55%, #044a6c 100%);
    border-radius: var(--radius);
    padding: 22px 20px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    color: #fff;
}
.points-label { margin: 0; font-size: 0.85rem; color: rgba(255,255,255,0.95); font-weight: 600; }
.points-value { margin: 2px 0 0; font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.points-unit { margin: 2px 0 16px; color: rgba(255,255,255,0.9); font-size: 0.9rem; }

.reward-progress { margin-top: 6px; }
.reward-progress-head {
    display: flex; justify-content: space-between;
    font-size: 0.82rem; color: rgba(255,255,255,0.9);
    margin-bottom: 6px; font-weight: 600;
}
.progress-track {
    height: 10px;
    background: rgba(0,0,0,0.22);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--c-accent), #ffba49);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(.22,1,.36,1);
}
.reward-progress-foot { margin: 8px 0 0; font-size: 0.82rem; color: rgba(255,255,255,0.92); }

/* Points expiry footnote on the points card */
.points-expiry {
    margin: 10px 0 0;
    font-size: 0.72rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

/* Fase B: "pending" (maturing, not-yet-active) points — clearly SEPARATE from
   the big claimable number so it can't be mistaken for spendable points. */
.points-pending {
    margin: 12px 0 0;
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.20);
    padding: 6px 12px; border-radius: 999px;
}
.points-pending-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    background: #ffd166; box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.25);
}
.points-empty {
    margin: 12px 0 0; font-size: 0.85rem; line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

/* Birthday banner */
.birthday-banner {
    position: relative;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(135deg, #ff5d8f 0%, #ff8a5b 45%, #ffd166 100%);
    color: #3a0a23;
    box-shadow: 0 12px 30px rgba(255,93,143,0.32);
    animation: pop-in 0.4s cubic-bezier(.22,1,.36,1);
}
/* One-shot glow (fades in once) — no infinite spin, and reduced-motion
   neutralises it below. */
.birthday-glow {
    position: absolute; inset: -40%;
    background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.5), transparent 55%);
    animation: birthday-glow-in 1.6s ease-out both;
    pointer-events: none;
}
/* Gentle baby-blue-white sheen sweeping across once on arrival. */
.birthday-banner::after {
    content: ""; position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(115deg, transparent 34%, rgba(189,230,251,0.55) 50%, transparent 66%);
    transform: translateX(-120%);
    animation: birthday-sheen 1.5s ease-out 0.25s both;
    pointer-events: none;
}
.birthday-content { position: relative; z-index: 1; }
.birthday-emoji { font-size: 1.6rem; letter-spacing: 4px; }
.birthday-title { margin: 8px 0 6px; font-size: 1.25rem; font-weight: 800; }
.birthday-text { margin: 0 0 14px; font-size: 0.92rem; }
.birthday-barcode {
    width: 100%; max-width: 300px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 14px 18px;                 /* extra side padding = quiet zone */
    display: grid; place-items: center;
    box-shadow: var(--shadow-soft);
    overflow: visible;
}
.birthday-barcode svg { display: block; width: 100%; height: auto; }
.birthday-barcode.code-fallback { color: #0d2b45; }
@keyframes birthday-glow-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes birthday-sheen { to { transform: translateX(120%); } }
.birthday-code {
    margin: 12px 0 0;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 2px;
    background: rgba(58,10,35,0.12);
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Digital member card -------------------------------------------- */
.member-digital { display: flex; flex-direction: column; gap: 8px; }
.memcard {
    position: relative;
    border-radius: 20px;
    padding: 20px;
    min-height: 196px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    isolation: isolate;
    box-shadow: var(--shadow);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
/* Glass highlight on top */
.memcard::before {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(135deg, rgba(255,255,255,0.30), rgba(255,255,255,0) 46%);
}
.memcard-sheen {
    position: absolute; top: -60%; left: -10%;
    width: 50%; height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
    transform: rotate(20deg);
    pointer-events: none;
}
/* Tier gradients */
.memcard-gold     { background: linear-gradient(135deg, #f3cd6b 0%, #c79412 55%, #9c7410 100%); }
.memcard-platinum { background: linear-gradient(135deg, #aab8c6 0%, #6b7c90 55%, #46566a 100%); }
.memcard-diamond  { background: linear-gradient(135deg, #89cff0 0%, #06afef 52%, #045f89 100%); }

.memcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.memcard-brand { font-weight: 800; font-size: 1.05rem; letter-spacing: 0.3px; }
.memcard-tier {
    font-size: 0.66rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
    background: rgba(255,255,255,0.26);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
}
.memcard-id { margin: 16px 0; }
.memcard-id-label { display: block; font-size: 0.64rem; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.82); }
.memcard-id-value {
    display: block; margin-top: 2px;
    font-size: 1.7rem; font-weight: 800; letter-spacing: 3px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.memcard-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.memcard-holder { min-width: 0; }
.memcard-holder-label { display: block; font-size: 0.6rem; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.memcard-holder-name {
    display: block; margin-top: 2px; font-weight: 700; font-size: 1rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Cosmetic-only card barcode: no white box — the dark bars sit straight on the
   card so it feels engraved, not stuck-on. (The SCANNED barcode is the big one in
   the tap-to-open modal, which keeps its white background — untouched.) A soft
   light halo keeps the dark bars crisp over the gold gradient. */
.memcard-code {
    flex-shrink: 0;
    width: 118px; max-width: 48%;
    display: grid; place-items: center;
}
.memcard-code svg {
    display: block; width: 100%; height: auto;
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.55));
}
.loyalty-hint { margin: 0; color: var(--c-muted); font-size: 0.85rem; text-align: center; }
.code-fallback {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--c-text); font-weight: 700; word-break: break-all;
    font-size: 0.85rem; padding: 6px; letter-spacing: 1px;
}
.memcard-code.code-fallback { color: #0d2b45; font-size: 0.72rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow-soft);
}
.stat-value { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.3px; color: var(--c-text); }
.stat-label { margin: 4px 0 0; font-size: 0.72rem; color: var(--c-muted); }

/* Rewards list */
.reward-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reward-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    box-shadow: var(--shadow-soft);
}
.reward-item.is-unlocked { border-color: rgba(21,163,74,0.40); background: #eafaf0; }
.reward-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reward-item-name { font-weight: 700; font-size: 0.96rem; color: var(--c-text); }
.reward-item-desc { font-size: 0.8rem; color: var(--c-muted); }
.reward-item-side { text-align: right; flex-shrink: 0; }
.reward-item-points { display: block; font-weight: 700; font-size: 0.9rem; color: var(--c-primary-600); }
.reward-item-badge { display: inline-block; margin-top: 4px; font-size: 0.68rem; color: var(--c-muted); }
.reward-item.is-unlocked .reward-item-badge { color: var(--c-success); font-weight: 700; }

/* History */
.history-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
}
.history-icon {
    width: 34px; height: 34px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 10px;
    font-weight: 800;
}
.history-icon.earn { background: rgba(21,163,74,0.12); color: var(--c-success); }
.history-icon.redeem { background: rgba(217,45,32,0.12); color: var(--c-error); }
.history-main { flex: 1; min-width: 0; }
.history-desc {
    display: block; font-weight: 600; font-size: 0.92rem; color: var(--c-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-meta { display: block; font-size: 0.76rem; color: var(--c-muted); margin-top: 2px; }
.history-points { font-weight: 800; font-size: 1rem; flex-shrink: 0; }
.history-points.pos { color: var(--c-success); }
.history-points.neg { color: var(--c-error); }

/* History — "Lihat Semua" toggle + month filter panel (Opsi C).
   Premium cyan look: soft baby-cyan pill button, rotating chevron, styled month
   <select>, and a gentle fade/slide open — one piece with the rest of the card UI. */
.history-toggle {
    width: 100%; margin-top: 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 12px 20px;
    background: var(--c-bg-1);                       /* soft baby-cyan #e3f1fb */
    border: 1.5px solid rgba(6, 175, 239, 0.35);    /* brand-cyan tinted border */
    border-radius: 999px;                            /* pill */
    color: var(--c-primary-700);
    font-size: 0.9rem; font-weight: 700; letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.08s ease;
}
.history-toggle:hover { background: #d6ecfb; border-color: var(--c-primary); box-shadow: 0 4px 14px rgba(6, 175, 239, 0.18); }
.history-toggle:active { transform: scale(0.99); }
.history-toggle:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }
.history-toggle-caret { flex-shrink: 0; color: var(--c-primary-600); transition: transform 0.28s ease; }
.history-toggle[aria-expanded="true"] .history-toggle-caret { transform: rotate(180deg); }

.history-panel {
    margin-top: 12px;
    display: flex; flex-direction: column; gap: 12px;
    opacity: 0; transform: translateY(-6px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}
.history-panel.is-open { opacity: 1; transform: translateY(0); }
/* `hidden` must win over the `display:flex` above (an author rule beats the UA
   `[hidden]{display:none}` in the cascade) — same pattern as `.modal[hidden]`. */
.history-panel[hidden],
.history-items[hidden] { display: none; }

.history-filter-row { display: flex; flex-direction: column; gap: 6px; }
.history-filter-label { font-size: 0.78rem; font-weight: 700; color: var(--c-muted); padding-left: 2px; }

/* Custom month dropdown (themeable listbox) — replaces the native <select> so
   the OPEN list is fully on-theme (no OS blue highlight). */
.month-select { position: relative; }
.month-select-btn {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 15px;
    background: var(--c-surface);
    border: 1.5px solid rgba(6, 175, 239, 0.35);
    border-radius: var(--radius-sm);
    color: var(--c-text);
    font-size: 0.92rem; font-weight: 600;
    text-align: left; cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.month-select-btn:hover { border-color: var(--c-primary); }
.month-select-btn:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; border-color: var(--c-primary); }
.month-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-select-caret { flex-shrink: 0; color: var(--c-primary-600); transition: transform 0.26s ease; }
.month-select-btn[aria-expanded="true"] .month-select-caret { transform: rotate(180deg); }

.month-select-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
    margin: 0; padding: 6px; list-style: none;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 264px; overflow-y: auto;
    opacity: 0; transform: translateY(-6px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}
.month-select-list.is-open { opacity: 1; transform: translateY(0); }
.month-select-list[hidden] { display: none; }        /* beat any author display rule */
.month-select-list:focus { outline: none; }
.month-select-opt {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 0.9rem; font-weight: 600; color: var(--c-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.month-select-opt + .month-select-opt { margin-top: 2px; }
/* Soft brand-cyan hover / keyboard-active — never the harsh browser blue. */
.month-select-opt:hover,
.month-select-opt.is-active { background: var(--c-bg-1); }
.month-select-opt.is-selected { background: #dcf0fc; color: var(--c-primary-700); }
.month-select-check { flex-shrink: 0; color: var(--c-primary-600); opacity: 0; }
.month-select-opt.is-selected .month-select-check { opacity: 1; }

.history-note { font-size: 0.76rem; color: var(--c-muted); text-align: center; margin: 2px 0 0; }

/* Registration email: [username] @ [domain ▾] combo — reuses .month-select for
   the domain picker so it matches the cyan history dropdown exactly. */
.email-combo-field { display: flex; flex-direction: column; gap: 6px; }
.email-combo { display: flex; align-items: stretch; gap: 8px; }
.email-combo-user { flex: 1 1 auto; min-width: 0; }
.email-combo-at { display: inline-flex; align-items: center; color: var(--c-muted); font-weight: 700; flex: 0 0 auto; }
.email-combo-domain { flex: 0 0 44%; max-width: 190px; }
.email-combo-domain .month-select-btn { height: 100%; padding: 12px 12px; gap: 6px; font-size: 0.88rem; }
.email-combo-other { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
/* `hidden` must beat the flex displays above (author rule > UA [hidden]{display:none}). */
.email-combo-field[hidden],
[data-email-plain][hidden],
[data-email-other][hidden] { display: none; }
@media (max-width: 360px) {
    .email-combo-domain { flex-basis: 50%; }
}

@media (prefers-reduced-motion: reduce) {
    /* No fade/slide/rotate — panel & dropdown just appear/hide instantly. */
    .history-panel { transition: none; opacity: 1; transform: none; }
    .history-toggle-caret { transition: none; }
    .month-select-list { transition: none; opacity: 1; transform: none; }
    .month-select-caret { transition: none; }
}

.empty-state {
    text-align: center; color: var(--c-muted); font-size: 0.9rem;
    padding: 18px; background: var(--c-surface); border: 1px dashed var(--c-border);
    border-radius: var(--radius-sm); margin: 0;
}

.dash-foot { text-align: center; padding: 8px 0 4px; font-size: 0.78rem; }

/* ---- Admin ----------------------------------------------------------- */
.admin-shell { max-width: 560px; }
.admin-topbar-right { display: flex; align-items: center; gap: 10px; }
.admin-who { font-size: 0.82rem; color: var(--c-muted); }
.inline-form { margin: 0; }
.admin-main { display: flex; flex-direction: column; gap: 18px; padding-top: 8px; }
.admin-search .inline-search { flex-direction: row; gap: 8px; }
.inline-search .field-input { flex: 1; }
.inline-search .btn { white-space: nowrap; }

.member-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}
.member-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.member-name { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--c-text); }
.member-meta { margin: 4px 0 0; font-size: 0.82rem; color: var(--c-muted); }
.member-balance { text-align: right; flex-shrink: 0; }
.member-balance-value { font-size: 1.6rem; font-weight: 800; color: var(--c-primary-600); }
.member-balance-label { display: block; font-size: 0.72rem; color: var(--c-muted); }
.member-birthday {
    margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
    background: rgba(245,166,35,0.14); color: #8a5a00;
    font-size: 0.86rem; font-weight: 600;
}
.credit-form { margin-top: 16px; }
.credit-hint { margin: 0; font-size: 0.8rem; color: var(--c-muted); }

/* Admin: active vouchers + redeem */
.admin-voucher-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-voucher {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
}
.admin-voucher-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-voucher-name { font-weight: 700; font-size: 0.95rem; color: var(--c-text); }
.admin-voucher-meta { font-size: 0.78rem; color: var(--c-muted); }
.admin-voucher .inline-form { flex-shrink: 0; }

/* Admin extra action forms share the divided spacing of the reset form */
.segment-form,
.voucher-give-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--c-border); }

/* Native select styled like .field-input (custom chevron via data URI) */
select.field-input {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2367707b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
}

/* ---- Admin: reset PIN block ----------------------------------------- */
.reset-pin-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}
.reset-hint {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: var(--c-muted);
    text-align: center;
}

/* ---- Accent (gold) button — "Berikan Voucher" ----------------------- */
.btn-accent {
    background: linear-gradient(135deg, var(--c-accent) 0%, #ffba49 100%);
    color: #3a2606;
    box-shadow: 0 8px 20px rgba(245, 166, 35, 0.30);
}
.btn-accent:hover { filter: brightness(1.03); }

/* ---- Grosir badge ---------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    vertical-align: middle;
    white-space: nowrap;
}
.badge-grosir {
    background: linear-gradient(135deg, #ffd166, #f5a623);
    color: #3a2606;
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.30);
}

/* ---- Account settings block ----------------------------------------- */
.account-actions { display: flex; flex-direction: column; }

/* ---- Voucher wallet — ticket / coupon UI (Baby Blue) ---------------- */
.voucher-wallet { display: flex; flex-direction: column; }
.voucher-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.voucher {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: 14px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #0aa3e6 0%, #0578ad 55%, #045f89 100%);
    box-shadow: var(--shadow-soft);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.voucher-stub {
    flex-shrink: 0;
    width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.16);
    border-right: 2px dashed rgba(255, 255, 255, 0.6);
}
.voucher-stub-pct { font-size: 1.5rem; font-weight: 800; line-height: 1; color: #fff; }
.voucher-stub-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 2px; color: rgba(255, 255, 255, 0.9); }
/* Punched notches over the perforation line */
.voucher::before,
.voucher::after {
    content: "";
    position: absolute;
    left: 80px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-bg-0);
}
.voucher::before { top: -8px; }
.voucher::after { bottom: -8px; }
.voucher-body { flex: 1; min-width: 0; padding: 14px 16px; }
.voucher-name { margin: 0; font-weight: 800; font-size: 1rem; }
.voucher-desc { margin: 4px 0 0; font-size: 0.82rem; color: rgba(255, 255, 255, 0.9); }
.voucher-expiry { margin: 8px 0 0; font-size: 0.78rem; color: rgba(255, 255, 255, 0.92); }
.voucher-expiry strong { color: #ffe6a8; }

/* ---- Install prompt (STATIC, in flow: below the card, above the footer) */
.install-slot {
    margin: 16px 0 0;                          /* sits just under the content card */
    display: flex;
    justify-content: center;
}
.install-slot:empty { display: none; }         /* takes NO space when there is no button */

.install-fab {
    position: relative;                        /* for the sheen ::after — NOT fixed */
    display: flex;
    align-items: stretch;
    width: 100%;                               /* full width, matches the content card */
    background: linear-gradient(180deg, #06afef 0%, var(--c-primary-600) 28%, var(--c-primary-700) 100%);
    border-radius: var(--radius-sm);           /* 12px — same family as other buttons */
    box-shadow: 0 8px 20px rgba(5, 120, 173, 0.32);
    overflow: hidden;
    animation: install-in 0.3s ease both;      /* fade + gentle slide-up on appear */
}
/* Calm recurring sheen to draw the eye — transform/opacity only, never resizes. */
.install-fab::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transform: translateX(-160%);
    opacity: 0;
    pointer-events: none;
    animation: install-sheen 4.2s ease-in-out infinite;
}
.install-fab-action {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;                            /* full-width label area */
    border: none;
    background: transparent;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 16px;
    min-height: 44px;                          /* comfortable touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.install-fab-icon {
    display: inline-block;
    animation: install-bob 1.9s ease-in-out infinite;   /* gentle up/down nudge */
}
.install-fab-close {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.15rem;
    line-height: 1;
    min-width: 44px;                           /* >= 40x40 touch target */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.install-fab-close:hover { color: #fff; }
.install-fab-action:focus-visible,
.install-fab-close:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.install-fab-short { display: none; }          /* full label by default */

/* Narrow screens (<380px): shorten the label so it never clips. */
@media (max-width: 379px) {
    .install-fab-full  { display: none; }
    .install-fab-short { display: inline; }
}

@keyframes install-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes install-sheen {
    0%   { transform: translateX(-160%); opacity: 0; }
    16%  { opacity: 0.55; }
    32%  { transform: translateX(280%); opacity: 0; }
    100% { transform: translateX(280%); opacity: 0; }
}
@keyframes install-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(2px); }
}

/* Reduced-motion: kill every looping/entrance animation — shown, but perfectly still. */
@media (prefers-reduced-motion: reduce) {
    .install-fab { animation: none; }
    .install-fab::after { display: none; animation: none; }
    .install-fab-icon { animation: none; }
}

/* ---- Modal (Lupa PIN? / Ganti PIN) ---------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 35, 65, 0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal-card {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 26px 22px;
    text-align: center;
    animation: pop-in 0.25s cubic-bezier(.22,1,.36,1);
}
.modal-icon { font-size: 2rem; }
.modal-title { margin: 10px 0 8px; font-size: 1.2rem; font-weight: 800; color: var(--c-text); }
.modal-text { margin: 0 0 18px; color: var(--c-muted); font-size: 0.95rem; }
/* Forms inside the (centered) modal card align left for readability. */
.modal .form { text-align: left; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; margin-top: 0; }

/* ---- Offline --------------------------------------------------------- */
.offline-card { text-align: center; }
.offline-text { color: var(--c-muted); font-size: 0.95rem; margin: 0 0 18px; }

/* ---- Admin nav (Kasir / Kelola Katalog) ----------------------------- */
.admin-nav {
    display: flex;
    gap: 8px;
    margin: 0 -16px 10px;
    padding: 8px 16px 12px;
    overflow-x: auto;                    /* scroll when the owner has 4+ tabs */
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(232, 248, 255, 0.82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.admin-nav-link {
    flex: 1 0 auto;
    white-space: nowrap;
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--c-primary-300);
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    padding: 9px 12px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}
.admin-nav-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700));
    border-color: transparent;
}

/* ---- Smart recommendations (customer dashboard) --------------------- */
.reco { display: flex; flex-direction: column; }
.reco .section-title { margin-bottom: 4px; }
.reco-sub { margin: 0 0 12px; font-size: 0.85rem; color: var(--c-muted); }
.reco-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.reco-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    box-shadow: var(--shadow-soft);
}
.reco-card-icon {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 12px;
    font-weight: 800; font-size: 1.1rem; color: #fff;
    /* Dark stops so the white initial keeps AA contrast (~4.9-7:1). */
    background: linear-gradient(135deg, var(--c-primary-600) 0%, var(--c-primary-700) 100%);
    box-shadow: 0 4px 12px rgba(5, 120, 173, 0.28);
}
.reco-card-name {
    font-weight: 700; font-size: 0.86rem; color: var(--c-text); line-height: 1.25;
}
.reco-card-cat {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px;
    color: var(--c-primary-700);
    background: var(--c-bg-1);
    padding: 2px 9px; border-radius: 999px;
}

/* ---- Cashier "Search & Select" item autocomplete -------------------- */
.item-search { position: relative; }
.item-search-input { width: 100%; }
.item-search-hint { margin: 6px 0 0; font-size: 0.76rem; color: var(--c-muted); }
.item-suggest {
    list-style: none; margin: 6px 0 0; padding: 6px;
    position: absolute; left: 0; right: 0; top: 100%;
    z-index: 60;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 240px; overflow-y: auto;
}
.item-suggest-opt {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.item-suggest-opt:hover,
.item-suggest-opt.is-active { background: var(--c-bg-1); }
.item-suggest-name { font-weight: 600; font-size: 0.9rem; color: var(--c-text); }
.item-suggest-cat {
    flex-shrink: 0; font-size: 0.7rem; font-weight: 700;
    color: var(--c-primary-700); background: var(--c-surface-2);
    padding: 2px 8px; border-radius: 999px;
}
.item-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.item-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--c-bg-1);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    padding: 6px 6px 6px 12px;
    font-size: 0.85rem; font-weight: 600; color: var(--c-text);
}
.item-chip-x {
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 999px;
    background: rgba(13, 70, 120, 0.10); color: var(--c-primary-700);
    font-size: 1rem; line-height: 1; cursor: pointer;
}
.item-chip-x:hover { background: var(--c-error); color: #fff; }

/* ---- Admin: Kelola Katalog ------------------------------------------ */
.catalog-bulk { resize: vertical; min-height: 96px; font-family: inherit; line-height: 1.5; }
.catalog-import { padding-top: 16px; border-top: 1px solid var(--c-border); }
.catalog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.catalog-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-primary);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    box-shadow: var(--shadow-soft);
}
.catalog-item-name { font-weight: 700; font-size: 0.92rem; color: var(--c-text); }
.catalog-item-cat {
    flex-shrink: 0; font-size: 0.72rem; font-weight: 700;
    color: var(--c-primary-700); background: var(--c-bg-1);
    padding: 3px 10px; border-radius: 999px;
}

/* ---- Interactive member card (tap to open scan modal) --------------- */
.memcard-tappable {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(.22,1,.36,1), box-shadow 0.3s ease;
}
.memcard-tappable:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(18,70,120,0.18); }
.memcard-tappable:active { transform: scale(0.985); }
.memcard-tappable:focus-visible { outline: 3px solid var(--c-primary-600); outline-offset: 3px; }

/* ---- Tier gallery (Gold -> Platinum -> Diamond) --------------------- */
.tier-gallery { margin-top: 16px; }
.tier-track {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: relative;
}
.tier-track::before {
    content: ""; position: absolute; top: 26px; left: 18%; right: 18%;
    height: 2px; background: var(--c-border); z-index: 0;
}
.tier-node {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.tier-badge {
    position: relative;
    width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 32%, #ffffff 0%, #e4f1fc 100%);
    border: 1px solid rgba(6, 175, 239, 0.18);
    box-shadow: 0 6px 16px rgba(18, 70, 120, 0.10);
    transition: filter 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}
.tier-gem { width: 30px; height: 30px; display: block; }
/* Per-tier gem colour — one baby-blue family, increasing vibrancy up the tiers. */
.tier-node.tier-gold     .tier-gem { color: #79c6ee; }   /* baby blue muda  */
.tier-node.tier-platinum .tier-gem { color: #2f9fe0; }   /* baby blue sedang */
.tier-node.tier-diamond  .tier-gem { color: #06afef; filter: drop-shadow(0 0 2.5px rgba(6, 175, 239, 0.55)); } /* paling terang + kilau */
/* Locked: the SAME tier gem, greyscale + lock overlay (peek at the reward). */
.tier-node.is-locked .tier-badge {
    filter: grayscale(1) opacity(0.72);
    box-shadow: none;
    border-color: rgba(0, 0, 0, 0.08);
}
.tier-node.is-locked .tier-gem { filter: none; }
.tier-lock {
    position: absolute; right: -2px; bottom: -2px;
    width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff; color: #67707b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.tier-lock svg { width: 11px; height: 11px; display: block; }
.tier-name { font-size: 0.82rem; font-weight: 800; color: var(--c-text); }
.tier-node.is-locked .tier-name { color: var(--c-muted); }
.tier-state { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }
.tier-node.is-achieved .tier-state { color: var(--c-primary-700); }
.tier-node.is-locked .tier-state { color: #98a2ad; }
.tier-progress { margin: 16px 0 0; text-align: center; font-size: 0.85rem; color: var(--c-muted); }
.tier-progress strong { color: var(--c-primary-700); font-weight: 800; }
.tier-progress-max { color: var(--c-primary-700); font-weight: 700; }

/* ---- Smart Scan modal (Barcode only) -------------------------------- */
/* Above the birthday burst (205) & confetti (200) so the cashier barcode is
   never visually crossed by celebration layers while the modal is open. */
.scan-modal { opacity: 0; z-index: 220; transition: opacity 0.32s ease; }
.scan-modal.is-open { opacity: 1; }
.scan-card {
    position: relative;
    width: 100%; max-width: 360px;
    background: var(--c-surface);
    border-radius: 26px;
    box-shadow: 0 30px 70px rgba(18,70,120,0.28);
    padding: 30px 26px 26px;
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.36s cubic-bezier(.22,1,.36,1);
}
.scan-modal.is-open .scan-card { transform: scale(1); }
.scan-close {
    position: absolute; top: 14px; right: 14px;
    width: 38px; height: 38px; border-radius: 50%;
    border: none; cursor: pointer;
    background: var(--c-bg-1); color: var(--c-primary-700);
    display: grid; place-items: center;
    transition: background 0.2s ease;
}
.scan-close svg { width: 16px; height: 16px; display: block; }
.scan-close:hover { background: #d6e9f8; }
.scan-title { margin: 2px 0 18px; font-size: 1.2rem; font-weight: 800; color: var(--c-text); }

.scan-stage { display: grid; place-items: center; min-height: 172px; margin-bottom: 18px; }
.scan-code {
    display: grid; place-items: center;
    width: 100%;
    padding: 18px 14px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}
.scan-code-barcode svg { display: block; width: 100%; height: auto; max-width: 300px; }
.scan-name { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--c-text); }
.scan-id {
    margin: 4px 0 0; font-size: 0.95rem; letter-spacing: 2px; font-weight: 700;
    color: var(--c-primary-700);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---- Tier-up confetti (subtle, one-shot canvas overlay) ------------- */
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 200; }

/* ---- Monthly spend summary (calm, Apple-Card style) ----------------- */
.month-summary {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 22px 22px 20px;
    box-shadow: var(--shadow-soft);
    animation: soft-fade 0.4s ease both;
}
.month-label {
    margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.4px;
    text-transform: uppercase; color: var(--c-muted);
}
.month-total {
    margin: 8px 0 0; font-size: 2.3rem; font-weight: 800; letter-spacing: -1px;
    color: var(--c-text); line-height: 1.05;
}
/* Muted comparison — same calm treatment whether spend rose or fell. */
.month-compare {
    margin: 12px 0 0; font-size: 0.85rem; color: var(--c-muted);
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.month-arrow {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--c-bg-1); color: var(--c-primary-700);
    font-size: 0.78rem; font-weight: 800;
}
.month-sep { color: var(--c-border); }
.month-insight { margin: 12px 0 0; font-size: 0.92rem; color: var(--c-text); }

@keyframes soft-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Most-loved products -------------------------------------------- */
.loved { display: flex; flex-direction: column; }
.loved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.loved-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
    animation: soft-fade 0.4s ease both;
}
.loved-thumb {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px; object-fit: cover;
    display: grid; place-items: center;
}
.loved-thumb-ph {
    background: linear-gradient(135deg, var(--c-baby) 0%, var(--c-baby-2) 100%);
    color: #fff; font-weight: 800; font-size: 1.15rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.loved-name {
    flex: 1; min-width: 0; font-weight: 700; font-size: 0.95rem; color: var(--c-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loved-count { flex-shrink: 0; font-size: 0.78rem; color: var(--c-muted); font-weight: 600; }

/* ---- Owner insights (Phase 9) --------------------------------------- */
.insights-head { margin-bottom: 2px; }
.insights-sub { margin: 4px 0 0; color: var(--c-muted); font-size: 0.85rem; }

.insights-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.insight-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(13, 70, 120, 0.05);
    display: flex; flex-direction: column; gap: 6px;
}
.insight-card-label {
    margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--c-muted);
}
.insight-card-value {
    margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.4px;
    color: var(--c-text); word-break: break-word;
}
.insight-card-foot { margin: 0; font-size: 0.76rem; color: var(--c-muted); }
.insight-card-foot-2 { margin-top: 2px; }
.insight-card-foot strong { color: var(--c-primary-700); }
.insight-chip {
    display: inline-block; font-weight: 800; color: var(--c-primary-700);
    background: var(--c-bg-1); border-radius: 999px; padding: 1px 7px; font-size: 0.74rem;
}

/* tier distribution mini-list inside a summary card */
.tier-dist { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tier-dist-item { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.tier-dist-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tier-dist-name { color: var(--c-text); font-weight: 600; }
.tier-dist-count { margin-left: auto; font-weight: 800; color: var(--c-text); }
.tier-dist.tier-gold .tier-dist-dot,
.tier-dist-item.tier-gold     .tier-dist-dot { background: #79c6ee; }
.tier-dist-item.tier-platinum .tier-dist-dot { background: #2f9fe0; }
.tier-dist-item.tier-diamond  .tier-dist-dot { background: #06afef; box-shadow: 0 0 0 2px rgba(6, 175, 239, 0.18); }

/* actionable lists + tables */
.insights-list {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    padding: 16px;
}
.section-note { font-weight: 500; font-size: 0.78rem; color: var(--c-muted); }
.insights-list-hint {
    margin: -4px 0 12px; font-size: 0.8rem; color: var(--c-muted); line-height: 1.5;
}
.insights-list-hint em { color: var(--c-primary-300); font-style: normal; font-weight: 700; }

.table-wrap { overflow-x: auto; }
.insights-table {
    width: 100%; border-collapse: collapse; font-size: 0.86rem;
    white-space: nowrap;
}
.insights-table thead th {
    text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--c-muted);
    padding: 0 10px 8px; border-bottom: 1.5px solid var(--c-border);
}
.insights-table td {
    padding: 10px; border-bottom: 1px solid var(--c-border); vertical-align: middle;
    color: var(--c-text);
}
.insights-table tbody tr:last-child td { border-bottom: none; }
.insights-table tbody tr:nth-child(even) { background: var(--c-surface-2); }
.col-num { text-align: right; font-variant-numeric: tabular-nums; }
.col-rank { width: 1%; color: var(--c-muted); font-weight: 700; }
.cell-name { display: block; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.cell-code { display: block; font-size: 0.72rem; color: var(--c-muted); letter-spacing: 0.5px; margin-top: 1px; }
.cell-strong { font-weight: 800; }

.tier-pill {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.tier-pill.tier-gold     { background: rgba(121, 198, 238, 0.18); color: #0a6cc0; }
.tier-pill.tier-platinum { background: rgba(47, 159, 224, 0.18);  color: var(--c-primary-600); }
.tier-pill.tier-diamond  { background: rgba(6, 175, 239, 0.16);  color: var(--c-primary-700); }
.near-remaining { font-weight: 700; color: var(--c-primary-700); }

/* ---- Auth: PIN visibility toggle, inline errors, temp-PIN (Phase 10) - */
.pw-wrap { position: relative; display: block; }
.pw-wrap .field-input { padding-right: 46px; width: 100%; }
.pw-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; margin: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--c-muted); border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
}
.pw-toggle:hover { color: var(--c-primary-700); }
.pw-toggle:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }

.field-error {
    display: block; margin-top: 6px; padding-left: 2px;
    color: var(--c-error); font-size: 0.8rem; font-weight: 600;
}

.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-size: 0.9rem; line-height: 1.5; }
.notice-info  { background: var(--c-bg-1); color: var(--c-primary-700); border: 1px solid var(--c-border); }
.notice-error { background: rgba(217, 45, 32, 0.08); color: var(--c-error); border: 1px solid rgba(217, 45, 32, 0.25); }

/* The "Lupa PIN?" modal lock icon (inline SVG, currentColor). */
.modal-icon { color: var(--c-primary); }

/* Cashier one-time temporary-PIN reveal (shown once after a reset). */
.pin-reset-result {
    background: linear-gradient(135deg, var(--c-primary-600) 0%, var(--c-primary-700) 100%);
    color: #fff; border-radius: 18px; padding: 18px 20px; text-align: center;
    box-shadow: 0 10px 26px rgba(13, 90, 158, 0.3);
}
.pin-reset-eyebrow {
    margin: 0 0 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.8px;
    text-transform: uppercase; color: rgba(255, 255, 255, 0.85);
}
.pin-reset-code {
    margin: 0; font-size: 2.3rem; font-weight: 800; letter-spacing: 6px;
    font-variant-numeric: tabular-nums;
}
.pin-reset-note { margin: 10px 0 0; font-size: 0.82rem; line-height: 1.5; color: rgba(255, 255, 255, 0.92); }
.pin-reset-note strong { color: #fff; }

/* ---- Misc ------------------------------------------------------------ */
@media (max-width: 360px) {
    .field-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .reco-grid { grid-template-columns: 1fr 1fr; }
    .points-value { font-size: 2.6rem; }
}

/* ---- Brand logo (replaces the old star/gear/emoji marks) -------------
 * Every logo has an EXPLICIT max-height + max-width and object-fit:contain so
 * it can never stretch to fill its container (and the <img> tags also carry
 * width/height attributes as a no-CSS fallback). The form stays the hero. */
.brand-logo {
    display: block;
    height: 56px; width: auto;
    max-height: 56px; max-width: 190px;
    object-fit: contain;
    margin: 0 auto 14px;
}
.brand-hero.compact .brand-logo { height: 44px; max-height: 44px; margin-bottom: 10px; }
/* Header — the full official logo, scaled proportionally (contain, never cropped). */
.topbar-logo-img {
    height: 34px; width: auto;
    max-height: 34px; max-width: 150px;
    object-fit: contain; display: block;
}
/* Member card: the official CYAN logo (unaltered, full PNG) sits transparent —
   directly on the card, no box — for an exclusive look. A soft shadow lifts it
   off the gold gradient so it stays legible without any background chip. */
.memcard-logo {
    height: 26px; width: auto;
    max-height: 26px; max-width: 150px;
    object-fit: contain; display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.30)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.25));
}

/* ---- Birthday (Option A): first-open burst + all-day gentle ambience --
 * Ambient balloons sit on a fixed layer BEHIND the app content (z-index:-1
 * within the .app-shell stacking context) and are pointer-events:none, so
 * they can never cover or block the barcode, buttons or any tap target.
 * The first-open burst is a transient, pointer-events:none overlay that
 * fades itself out (~2.8s) — taps pass straight through to the card.
 * ------------------------------------------------------------------- */
.app-shell { position: relative; z-index: 0; }   /* stacking context for the ambient layer */

.bday-ambient {
    position: fixed; inset: 0;
    z-index: -1;                 /* behind content, above the shell gradient */
    pointer-events: none;
    overflow: hidden;
}
.bday-balloon {
    position: absolute;
    bottom: -18vh;
    /* size + peak opacity vary per balloon (set in JS) for an elegant, layered
       feel; kept translucent so nothing behind is obscured. */
    width: var(--w, 32px); height: calc(var(--w, 32px) * 1.32);
    border-radius: 50% 50% 49% 49% / 45% 45% 55% 55%;
    background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.72), var(--balloon, #89cff0) 66%);
    opacity: 0;
    will-change: transform, opacity;
    animation: bday-float var(--dur, 20s) ease-in-out var(--delay, 0s) infinite;
}
.bday-balloon::after {           /* balloon string */
    content: ""; position: absolute; left: 50%; top: 100%;
    width: 1px; height: calc(var(--w, 32px) * 0.7); background: rgba(120, 170, 210, 0.4);
    transform: translateX(-50%);
}
@keyframes bday-float {
    0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    14%  { opacity: var(--op, 0.4); }
    86%  { opacity: var(--op, 0.4); }
    100% { transform: translateY(-132vh) translateX(-8px) rotate(-3deg); opacity: 0; }
}

/* First-open celebration overlay (transient, non-interactive). */
.bday-burst { position: fixed; inset: 0; z-index: 205; pointer-events: none; overflow: hidden; }
.bday-burst-balloon {
    position: absolute; bottom: -18vh;
    width: 46px; height: 58px;
    border-radius: 50% 50% 49% 49% / 45% 45% 55% 55%;
    background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), var(--balloon, #89cff0) 62%);
    opacity: 0;
    animation: bday-rise var(--dur, 2.5s) cubic-bezier(.22, .7, .3, 1) var(--delay, 0s) forwards;
}
.bday-burst-balloon::after {
    content: ""; position: absolute; left: 50%; top: 100%;
    width: 1px; height: 30px; background: rgba(255, 255, 255, 0.6);
    transform: translateX(-50%);
}
@keyframes bday-rise {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    14%  { opacity: 0.95; }
    100% { transform: translateY(-124vh) rotate(6deg); opacity: 0; }
}
.bday-greet {
    position: absolute; left: 50%; top: 40%;
    transform: translate(-50%, -50%) scale(0.7);
    text-align: center; opacity: 0; width: 90%; max-width: 420px;
    animation: bday-greet 2.8s ease-out forwards;
}
.bday-greet-emoji { display: block; font-size: 2.6rem; letter-spacing: 6px; }
.bday-greet-text {
    display: block; margin-top: 8px;
    font-size: 1.9rem; font-weight: 800; letter-spacing: -0.4px;
    color: var(--c-primary-700);
    text-shadow: 0 2px 12px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(255, 255, 255, 0.9);
}
@keyframes bday-greet {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
    30%  { transform: translate(-50%, -50%) scale(1); }
    78%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .birthday-glow { animation: none; }
    /* Belt-and-suspenders: no floating/burst decoration at all (JS also skips it). */
    .bday-ambient, .bday-burst { display: none !important; }
}

/* =========================================================================
 *  Admin member viewer (Fase B) — read-only, cyan, cashier-efficient.
 *  Clarity over decoration: no extra motion, high-contrast text, roomy taps.
 * ===================================================================== */
.admin-search-sub {
    margin: -4px 0 12px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--c-muted);
}
.admin-readonly-note {
    margin: 12px 0 0;
    padding: 10px 12px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--c-primary-700);
    background: var(--c-bg-1);
    border: 1px solid rgba(6, 175, 239, 0.28);
    border-radius: 12px;
}
.admin-readonly-note strong { color: var(--c-primary-700); }
.admin-readonly-note .ro-lock { margin-right: 6px; }

/* Admin topbar: extra actions (name · Ubah Password · Keluar) wrap instead of
   overflowing on a narrow phone, so nothing is clipped off the right edge. */
.admin-topbar { flex-wrap: wrap; gap: 8px 10px; }
.admin-topbar-right { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 460px) {
    .admin-who { display: none; }   /* redundant on tiny screens; actions remain */
}

/* Identity header */
.member-view {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(13, 70, 120, 0.04);
}
.member-view-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.member-view .member-name { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--c-text); }
.member-facts {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}
.member-facts li {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 10px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 0.82rem;
}
.member-facts .fact-k { color: var(--c-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; }
.member-facts .fact-v { color: var(--c-text); font-weight: 700; }
.member-tier-badge {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #6b4e05;
    background: linear-gradient(180deg, #f3cd6b 0%, #d9a521 100%);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.member-note {
    margin: 12px 0 0;
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--c-muted);
    background: var(--c-surface-2);
    border-radius: 10px;
}
.member-birthday {
    margin: 12px 0 0;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-primary-700);
    background: var(--c-bg-1);
    border-radius: 10px;
}

/* Compact points card for the cashier view (reuses .points-card visuals) */
.points-card-admin { padding: 18px 18px 16px; }
.points-card-admin .points-value { font-size: 2.4rem; }

/* Search results pick-list */
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pick-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.pick-link:hover,
.pick-link:focus-visible {
    border-color: var(--c-primary);
    background: var(--c-bg-1);
    outline: none;
}
.pick-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-name { font-weight: 700; color: var(--c-text); }
.pick-meta { font-size: 0.8rem; color: var(--c-muted); }
.pick-go { flex-shrink: 0; font-size: 1.4rem; line-height: 1; color: var(--c-primary-600); font-weight: 700; }

/* --- Member source badges + branch info (admin viewer) ------------------- */
.member-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.member-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1.4;
    border: 1px solid transparent;
}
.member-badge.is-crm    { color: #075985; background: #e0f2fe; border-color: #bae6fd; }
.member-badge.is-pos    { color: #14532d; background: #dcfce7; border-color: #bbf7d0; }
.member-badge.is-master { color: #7c2d12; background: #ffedd5; border-color: #fed7aa; }
.member-badge.is-nolink { color: #3f3f46; background: #f4f4f5; border-color: #e4e4e7; }

.member-branch {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 560px) { .member-branch { grid-template-columns: 1fr 1fr; } }
.branch-block {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 12px 14px;
}
.branch-label {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--c-muted);
}
.branch-origin { margin: 0; font-size: 1rem; font-weight: 800; color: var(--c-text); }
.branch-empty  { margin: 0; font-size: 0.9rem; color: var(--c-muted); }
.branch-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.branch-table th, .branch-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--c-border); }
.branch-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.3px; color: var(--c-muted); font-weight: 700; }
.branch-table th.num, .branch-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.branch-table td { color: var(--c-text); font-weight: 600; }
.branch-table tbody tr:last-child td { border-bottom: 0; }

/* =========================================================================
 *  Admin analytics profile (Fase B) — point breakdown, spend analysis,
 *  top items, expandable history. Calm, cyan, work-tool clarity.
 * ===================================================================== */

/* A. Point breakdown tiles */
.pts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pts-tile {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
}
.pts-value { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.3px; color: var(--c-text); }
.pts-label { margin: 3px 0 0; font-size: 0.74rem; color: var(--c-muted); font-weight: 600; }
.pts-note { margin: 10px 2px 0; font-size: 0.76rem; line-height: 1.45; color: var(--c-muted); }
.pts-note strong { color: var(--c-primary-700); }
.pts-note-extra {
    margin: 10px 0 0; padding: 8px 10px;
    font-size: 0.78rem; color: var(--c-primary-700);
    background: var(--c-bg-1); border-radius: 10px;
}

/* B. Shopping analysis */
.stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
.stat-value-sm { font-size: 0.98rem; }
.trend { margin-top: 14px; }
.trend-caption { margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; color: var(--c-muted); }
.trend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.trend-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; }
.trend-month { font-size: 0.8rem; color: var(--c-text); font-weight: 600; }
.trend-bar-wrap { height: 8px; background: var(--c-surface-2); border-radius: 999px; overflow: hidden; }
.trend-bar { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7cc6ee, var(--c-primary)); }
.trend-amt { font-size: 0.8rem; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.trend-arrow { margin-left: 2px; font-weight: 800; }
.trend-arrow.trend-up { color: var(--c-success); }
.trend-arrow.trend-down,
.trend-arrow.trend-equal { color: var(--c-muted); }   /* muted — gentle, not an alarm */

/* C. Top items period tabs */
.top-items-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.top-items-head .section-title { margin: 0; }
.period-tabs { display: inline-flex; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 999px; padding: 3px; gap: 2px; }
.period-tab { padding: 5px 14px; font-size: 0.8rem; font-weight: 700; color: var(--c-muted); text-decoration: none; border-radius: 999px; }
.period-tab.is-active { background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700)); color: #fff; }
.period-tab:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }

/* D. Expandable nota rows (history) */
.history-item-exp { padding: 0; display: block; overflow: hidden; }
.history-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}
.history-row:hover { background: var(--c-bg-1); }
.history-row:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: -2px; }
.history-row .history-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nota-caret { flex-shrink: 0; color: var(--c-muted); transition: transform 0.2s ease; }
.history-row[aria-expanded="true"] .nota-caret { transform: rotate(180deg); }
.nota-items {
    list-style: none; margin: 0;
    padding: 2px 14px 12px 50px;
    display: flex; flex-direction: column; gap: 7px;
}
.nota-items[hidden] { display: none; }   /* author display:flex must not beat [hidden] */
.nota-item { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline; font-size: 0.82rem; }
.nota-item-name { color: var(--c-text); min-width: 0; }
.nota-item-qty { color: var(--c-muted); font-weight: 600; white-space: nowrap; }
.nota-item-sub { color: var(--c-text); font-weight: 700; white-space: nowrap; }
.nota-item-empty { color: var(--c-muted); }
.history-hint { margin: 0 2px 10px; font-size: 0.78rem; color: var(--c-muted); }
.admin-history .history-filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.admin-history .history-filter-label { font-size: 0.82rem; color: var(--c-muted); font-weight: 600; }

/* Shared branded footer (customer + admin) */
.app-footer {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 24px; padding: 18px 0 22px;
    color: var(--c-muted); font-size: 0.8rem;
}
.app-footer-logo { height: 22px; width: auto; object-fit: contain; opacity: 0.9; }
.app-footer-copy { font-weight: 600; }

/* =========================================================================
 *  Multi-step registration wizard (POS-gated, email-activated).
 * ===================================================================== */
.reg-steps { display: flex; list-style: none; margin: 0 0 20px; padding: 0; gap: 6px; }
.reg-step { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 700; color: var(--c-muted); }
.reg-step span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 999px; flex-shrink: 0;
    background: var(--c-surface-2); border: 1.5px solid var(--c-border);
    color: var(--c-muted); font-size: 0.8rem;
}
.reg-step.is-current { color: var(--c-primary-700); }
.reg-step.is-current span { background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700)); border-color: transparent; color: #fff; }
.reg-step.is-done { color: var(--c-primary-700); }
.reg-step.is-done span { background: var(--c-primary-700); border-color: transparent; color: #fff; }

.reg-notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-size: 0.88rem; line-height: 1.5; }
.reg-notice p { margin: 0; }
.reg-notice-info { background: var(--c-bg-1); color: var(--c-primary-700); border: 1px solid rgba(6, 175, 239, 0.28); }
.reg-notice-warn { background: rgba(245, 166, 35, 0.10); color: #8a5a00; border: 1px solid rgba(245, 166, 35, 0.35); }
/* Registration 403 (store-IP reject): a compact, fully-centred card — logo + title
   (already centred) plus the notice and IP chip, proportionate on any width. */
.auth-card-reject {
    width: 100%;                 /* track the container so a narrow phone never overflows */
    max-width: 380px;            /* …but stay compact/centred on wide screens */
    margin-left: auto; margin-right: auto;
    text-align: center;
    padding-top: 34px; padding-bottom: 30px;
}
.auth-card-reject .reg-notice { text-align: center; margin-bottom: 0; }
.auth-card-reject .reg-ip { margin-top: 8px; }

/* Visitor IP chip on the register 403 page — monospace + cyan, easy to read/copy
   during whitelist setup. Value is client_ip()+normalize_client_ip(), escaped via e(). */
.reg-ip {
    display: inline-block;
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem; font-weight: 700; letter-spacing: 0.02em;
    color: var(--c-primary-700); background: var(--c-bg-1);
    border: 1px solid rgba(6, 175, 239, 0.35); border-radius: 8px; padding: 1px 8px;
    -webkit-user-select: all; user-select: all;   /* one click selects the whole IP for easy copy */
}
.reg-notice-ok {
    display: flex; align-items: center; gap: 10px;
    background: rgba(21, 163, 74, 0.09); color: #0f7a37; border: 1px solid rgba(21, 163, 74, 0.28);
}
.reg-ok-check {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 999px; background: var(--c-success); color: #fff;
    font-weight: 800; font-size: 0.9rem;
}
.reg-notice-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.reg-help { margin: -4px 0 14px; font-size: 0.82rem; line-height: 1.45; color: var(--c-muted); }
.reg-pin-status { margin: 2px 0 12px; min-height: 1.1em; font-size: 0.85rem; font-weight: 700; }
.reg-pin-status.is-ok { color: #0f7a37; }
.reg-pin-status.is-warn { color: var(--c-accent); }

.link-btn-inline {
    background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
    color: var(--c-primary-300); font-weight: 700; text-decoration: none;
}
.link-btn-inline:hover { text-decoration: underline; }
.link-btn-inline:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; border-radius: 4px; }

/* Step-3 "check your email" confirmation */
.reg-done { text-align: center; padding: 8px 0 4px; }
.reg-done-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }
.reg-done-title { margin: 0 0 8px; font-size: 1.3rem; font-weight: 800; color: var(--c-text); }
.reg-done-text { margin: 0 0 12px; line-height: 1.55; color: var(--c-text); }
.reg-done-hint { margin: 0 0 18px; font-size: 0.82rem; line-height: 1.45; color: var(--c-muted); }

/* Verification-channel choice + email/WhatsApp status screens (self-registration).
   Channel buttons are left-aligned cards (label + masked destination); an
   unavailable channel is shown DISABLED with a reason, never hidden. */
.verify { padding: 4px 0 2px; }
.verify-title { margin: 0 0 6px; font-size: 1.2rem; font-weight: 800; color: var(--c-text); text-align: center; }
.verify-dest-line { margin: 0 0 12px; text-align: center; color: var(--c-text); }
.verify-list { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 10px; }
.verify-item { margin: 0; }
.verify-channel {
    display: flex; align-items: center; gap: 14px; width: 100%;
    text-align: left; padding: 14px 16px;
    background: #fff; border: 1.5px solid var(--c-border); border-radius: var(--radius-sm);
    color: var(--c-text); cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}
.verify-channel:hover { border-color: var(--c-primary); box-shadow: 0 6px 16px rgba(5, 120, 173, 0.12); }
.verify-channel:active { transform: scale(0.99); }
.verify-channel:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: 2px; }
.verify-channel.is-off, .verify-channel:disabled {
    opacity: 0.55; cursor: not-allowed; box-shadow: none; border-color: var(--c-border);
}
.verify-channel-ico { flex: 0 0 auto; font-size: 1.5rem; line-height: 1; }
.verify-channel-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.verify-channel-title { font-weight: 800; }
.verify-channel-dest { font-size: 0.86rem; color: var(--c-muted); font-variant-numeric: tabular-nums; word-break: break-all; }
.verify-channel-reason { margin: 4px 0 0; padding-left: 2px; font-size: 0.8rem; color: var(--c-accent); }
.verify-countdown { margin: 2px 0 12px; font-size: 0.9rem; font-weight: 700; color: var(--c-text); text-align: center; font-variant-numeric: tabular-nums; }
.verify-resend-note { margin: 4px 0 12px; min-height: 1em; font-size: 0.8rem; color: var(--c-muted); text-align: center; font-variant-numeric: tabular-nums; }
