/* =========================================================
   NIXX DATA HUB - DESIGN SYSTEM
   Customer-facing UI: landing, auth, dashboard, buy data,
   wallet, orders, profile, legal, agent shop, support widget.

   Replaces style.css + extras.css + customer.css on customer
   pages. (agent.html and /admin keep style.css untouched.)
   Class names, IDs and data-attributes are the ones the
   existing JavaScript already uses - nothing here renames them.

   Colour rules:
     blue / navy / white  -> identity, actions, selection
     green                -> success + completed only
     red                  -> errors, failures, warnings only
========================================================= */

:root {
    /* Brand */
    --navy-950: #061128;
    --navy-900: #0a1b3f;
    --navy-800: #102a5c;
    --blue-700: #0d46b8;
    --blue-600: #1459d9;
    --blue-500: #2f74f0;
    --blue-400: #5a93f5;
    --blue-100: #dbe7ff;
    --blue-50: #eef4ff;
    --sky-50: #f4f8ff;

    /* Neutrals */
    --ink: #0b1b3a;
    --ink-2: #33435f;
    --muted: #5b6b86;
    --muted-2: #8493ad;
    --line: #dde6f3;
    --line-2: #eaf0f9;
    --surface: #ffffff;
    --bg: #f3f7fe;

    /* Status */
    --success: #0f7a44;
    --success-bg: #e5f6ec;
    --success-line: #b5e3c6;
    --danger: #c42b36;
    --danger-bg: #fdeced;
    --danger-line: #f4c2c6;

    /* Legacy tokens still referenced by agent/shop inline styles */
    --surface-focus: #f8fbff;
    --border: var(--line);
    --border-focus: var(--blue-600);
    --blue: var(--blue-600);
    --teal: var(--blue-500);
    --text: var(--ink);
    --muted-dim: var(--muted-2);

    /* Shape + depth */
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-xs: 0 1px 2px rgba(11, 27, 58, 0.06);
    --shadow-sm: 0 2px 8px -2px rgba(11, 27, 58, 0.08), 0 1px 2px rgba(11, 27, 58, 0.05);
    --shadow-md: 0 12px 28px -14px rgba(13, 70, 184, 0.28), 0 2px 6px rgba(11, 27, 58, 0.05);
    --shadow-lg: 0 28px 60px -24px rgba(10, 27, 63, 0.38);
    --ring: 0 0 0 3px rgba(47, 116, 240, 0.32);

    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --nav-w: 252px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    background-image:
        radial-gradient(900px 420px at 12% -8%, rgba(47, 116, 240, 0.13), transparent 70%),
        radial-gradient(700px 360px at 100% 0%, rgba(13, 70, 184, 0.08), transparent 70%);
    background-repeat: no-repeat;
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
a { color: var(--blue-600); text-underline-offset: 3px; }
a:hover { color: var(--blue-700); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
strong { font-weight: 700; }

:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

html.cx-checking .cx-guest { visibility: hidden; }
html.cx-leaving body { opacity: 0; }
body.sheet-open, body.receipt-open { overflow: hidden; }

/* =========================================================
   LOGO LOCKUP
========================================================= */

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    animation: rise 0.45s var(--ease) both;
}

.brand-mark { width: 46px; height: 46px; flex-shrink: 0; filter: drop-shadow(0 6px 12px rgba(13, 70, 184, 0.28)); }

.brand-name h1,
.brand-name {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--navy-900);
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-name h1 { font-size: inherit; letter-spacing: inherit; display: flex; flex-direction: column; color: inherit; }

.brand-suffix {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--blue-600);
    margin-top: 3px;
}

/* =========================================================
   BUTTONS
========================================================= */

.primary-btn,
.secondary-btn,
.small-button,
.continue-button,
.wallet-button,
.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 22px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: transform 0.15s var(--ease), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.primary-btn,
.continue-button {
    background: linear-gradient(180deg, var(--blue-500), var(--blue-600) 55%, var(--blue-700));
    color: #fff;
    box-shadow: 0 10px 20px -10px rgba(13, 70, 184, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.primary-btn:hover, .continue-button:hover { color: #fff; box-shadow: 0 14px 26px -12px rgba(13, 70, 184, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.22); transform: translateY(-1px); }
.primary-btn:active, .continue-button:active { transform: translateY(1px) scale(0.99); box-shadow: 0 4px 10px -6px rgba(13, 70, 184, 0.7); }

.secondary-btn {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}
.secondary-btn:hover { border-color: var(--blue-400); color: var(--blue-700); background: var(--blue-50); }
.secondary-btn:active { transform: scale(0.99); }

.small-button {
    min-height: 44px;
    padding: 0 18px;
    font-size: 14.5px;
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-100);
}
.small-button:hover { background: var(--blue-100); color: var(--blue-700); }

.primary-btn:disabled, .continue-button:disabled, .secondary-btn:disabled, .small-button:disabled {
    opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none;
}

/* Loading: customer-auth.js sets disabled + aria-busy on the submit button */
.primary-btn[aria-busy="true"]::before,
.fund-continue[aria-busy="true"]::before {
    content: "";
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

.link-btn {
    background: none; border: none; padding: 0;
    color: var(--blue-600); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

/* =========================================================
   FORMS
========================================================= */

.input-group { margin-bottom: 18px; }

.input-group label,
.password-label label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-2);
}

.password-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.password-label a { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.password-label a:hover { text-decoration: underline; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"] {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 16px; /* >=16px stops iOS zoom */
    box-shadow: var(--shadow-xs);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

input::placeholder { color: var(--muted-2); opacity: 1; }
input:hover { border-color: #c4d3ea; }
input:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 60px #fff inset; -webkit-text-fill-color: var(--ink); }

.input-group.has-error input,
.phone-input.has-error,
.has-error > input { border-color: var(--danger); background: #fffafa; }
.input-group.has-error input:focus { box-shadow: 0 0 0 3px rgba(196, 43, 54, 0.22); }

.field-error {
    margin-top: 6px;
    min-height: 0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}
.field-error:empty { display: none; }

.cx-hint, .field-hint { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.field-hint { color: var(--danger); font-weight: 600; }

.phone-field, .phone-input {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.phone-field:focus-within, .phone-input:focus-within { border-color: var(--blue-500); box-shadow: var(--ring); }
.phone-field input, .phone-input input { border: none; box-shadow: none; border-radius: 0; background: transparent; flex: 1; min-width: 0; }
.phone-field input:focus, .phone-input input:focus { box-shadow: none; }
.phone-prefix, .phone-input > span {
    display: flex; align-items: center;
    padding: 0 14px;
    background: var(--blue-50);
    border-right: 1.5px solid var(--line);
    color: var(--blue-700);
    font-weight: 700;
    font-size: 15px;
}
.phone-input input { height: 56px; font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }

.password-field { position: relative; }
.password-field input { padding-right: 54px; }
.toggle-visibility {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 12px; background: transparent; color: var(--muted);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.toggle-visibility:hover { background: var(--blue-50); color: var(--blue-700); }
.toggle-visibility svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.cx-legal { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.55; }
.cx-legal a { font-weight: 600; }

/* ---------- Alerts / states ---------- */

.cx-alert, .cx-notice, .cx-success, .pay-message, .fund-message {
    display: block;
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}
.cx-alert::before, .pay-message::before, .fund-message::before { content: none; }

.cx-notice { border-color: var(--blue-100); background: var(--blue-50); color: var(--blue-700); }
.cx-success { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.cx-success p + p { margin-top: 8px; }
.cx-success .link-btn { color: var(--success); }

.pay-message { margin: 14px 0 0; }
.fund-message { margin: 14px 0 0; }

.cx-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    min-height: 40vh; padding: 32px 16px; text-align: center; color: var(--muted); font-weight: 600;
}
.cx-state.is-error { color: var(--danger); }
.cx-spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3.5px solid var(--blue-100); border-top-color: var(--blue-600);
    animation: spin 0.8s linear infinite;
}
.cx-state.is-error .cx-spinner { display: none; }

.cx-guest-link { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.cx-guest-link a { font-weight: 700; text-decoration: none; }
.cx-guest-link a:hover { text-decoration: underline; }
.cx-icon, .nav-icon { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================
   AUTH PAGES (login, signup, forgot, reset)
========================================================= */

.login-page, .signup-page {
    width: 100%;
    max-width: 460px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: max(32px, env(safe-area-inset-top)) 22px 28px;
}

.login-page > :not(.brand), .signup-page > :not(.brand) { animation: rise 0.5s var(--ease) both; }

.login-header, .signup-header { margin-bottom: 24px; text-align: center; }
.login-header h2, .signup-header h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px; }
.login-header p, .signup-header p { color: var(--muted); font-size: 15.5px; line-height: 1.55; }

.login-form, .signup-form {
    padding: 24px 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.login-form .primary-btn, .signup-form .primary-btn { width: 100%; margin-top: 6px; }
.cx-success { padding: 18px 18px; margin-bottom: 0; font-size: 15px; line-height: 1.55; }

.register-link, .login-link { margin-top: 20px; text-align: center; font-size: 15px; color: var(--muted); }
.register-link a, .login-link a { margin-left: 6px; font-weight: 700; text-decoration: none; }
.register-link a:hover, .login-link a:hover { text-decoration: underline; }

/* Brand panel, desktop only (markup: <aside class="auth-aside">) */
.auth-aside { display: none; }

@media (min-width: 960px) {
    .auth-aside {
        position: fixed; inset: 0 auto 0 0; width: 46%;
        display: flex; flex-direction: column; justify-content: space-between;
        padding: 56px 64px;
        color: #fff;
        background:
            radial-gradient(520px 360px at 85% 8%, rgba(90, 147, 245, 0.45), transparent 70%),
            radial-gradient(480px 380px at 0% 100%, rgba(47, 116, 240, 0.35), transparent 70%),
            linear-gradient(160deg, var(--navy-800), var(--navy-950));
        overflow: hidden;
    }
    .auth-aside::after {
        content: ""; position: absolute; right: -140px; bottom: -140px; width: 420px; height: 420px; border-radius: 50%;
        border: 60px solid rgba(255, 255, 255, 0.05);
    }
    .auth-aside .brand-name, .auth-aside .brand-name h1 { color: #fff; }
    .auth-aside .brand-suffix { color: #9fc1ff; }
    .auth-aside .brand { justify-content: flex-start; margin: 0; }
    .auth-aside h2 { color: #fff; font-size: 38px; line-height: 1.12; letter-spacing: -0.035em; font-weight: 800; max-width: 440px; }
    .auth-aside p { margin-top: 14px; color: #c3d5f5; font-size: 17px; max-width: 420px; line-height: 1.6; }
    .auth-aside ul { margin-top: 28px; list-style: none; display: grid; gap: 14px; position: relative; z-index: 1; }
    .auth-aside li { display: flex; gap: 12px; align-items: center; color: #e4edfd; font-weight: 600; font-size: 15.5px; }
    .auth-aside li::before {
        content: ""; flex: 0 0 22px; height: 22px; border-radius: 50%;
        background: rgba(255, 255, 255, 0.14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
    }
    .auth-aside small { color: #8fa9d6; font-size: 13px; position: relative; z-index: 1; }

    .login-page, .signup-page { width: 54%; max-width: none; margin: 0 0 0 46%; display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(32px, 5vw, 88px); }
    .login-page > *, .signup-page > * { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
    .login-page > .brand, .signup-page > .brand { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .login-header, .signup-header { text-align: left; }
}

/* =========================================================
   APP SHELL: bottom nav (mobile) -> sidebar (desktop)
========================================================= */

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; align-items: stretch; justify-content: space-around;
    max-width: 560px; margin: 0 auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 30px -16px rgba(11, 27, 58, 0.28);
}

.nav-brand { display: none; }

.nav-item {
    position: relative;
    flex: 1 1 0; min-width: 0; min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 6px 2px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 11.5px; font-weight: 700; text-decoration: none; letter-spacing: -0.005em;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-icon { width: 24px; height: 24px; }
.nav-item:hover { color: var(--blue-700); }
.nav-item.active { color: var(--blue-600); }
.nav-item.active::after {
    content: ""; position: absolute; top: -9px; left: 50%; width: 26px; height: 4px; margin-left: -13px;
    border-radius: 0 0 4px 4px; background: var(--blue-600);
}

.nav-item.buy-nav { color: var(--blue-700); }
.buy-icon {
    width: 46px; height: 46px; margin-top: -22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px; color: #fff;
    background: linear-gradient(160deg, var(--blue-500), var(--blue-700));
    border: 3px solid #fff;
    box-shadow: 0 10px 18px -8px rgba(13, 70, 184, 0.75);
    transition: transform 0.2s var(--ease);
}
.buy-icon .nav-icon { stroke-width: 2.4; }
.nav-item.buy-nav:hover .buy-icon { transform: translateY(-2px); }
.nav-item.buy-nav.active::after { display: none; }

/* page container shared by all signed-in pages */
.dashboard-page, .wallet-page, .orders-page, .profile-page, .data-page {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom));
    animation: rise 0.45s var(--ease) both;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 20px;
}
.page-header h1 { flex: 1; text-align: center; font-size: 19px; font-weight: 800; letter-spacing: -0.025em; }
.back-button, .back-link, .sheet-close {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--ink-2);
    box-shadow: var(--shadow-xs);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.back-button:hover, .back-link:hover, .sheet-close:hover { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-700); }
.back-button .cx-icon, .back-link svg, .sheet-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.header-space { width: 44px; flex-shrink: 0; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { font-size: 17px; font-weight: 800; }
.section-heading a { font-size: 14px; font-weight: 700; text-decoration: none; }
.section-heading a:hover { text-decoration: underline; }

@media (min-width: 900px) {
    .bottom-nav {
        top: 0; right: auto; bottom: 0; left: 0; margin: 0;
        width: var(--nav-w); max-width: none;
        flex-direction: column; justify-content: flex-start; gap: 4px;
        padding: 28px 16px 24px;
        border: none; border-right: 1px solid var(--line); border-radius: 0;
        background: var(--surface);
        -webkit-backdrop-filter: none; backdrop-filter: none;
        box-shadow: none;
    }
    .nav-brand {
        display: flex; align-items: center; gap: 11px;
        margin: 0 8px 26px; text-decoration: none; color: var(--navy-900);
    }
    .nav-brand:hover { color: var(--navy-900); }
    .nav-brand svg { width: 40px; height: 40px; flex-shrink: 0; filter: drop-shadow(0 5px 10px rgba(13, 70, 184, 0.25)); }
    .nav-brand b { display: flex; flex-direction: column; font-size: 18px; font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; }
    .nav-brand b i { font-style: normal; margin-top: 3px; font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--blue-600); }

    .nav-item { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 13px; min-height: 48px; padding: 0 14px; font-size: 15px; }
    .nav-item span { overflow: visible; }
    .nav-item:hover { background: var(--blue-50); }
    .nav-item.active { background: var(--blue-50); color: var(--blue-700); }
    .nav-item.active::after { top: 12px; bottom: 12px; left: 0; width: 4px; height: auto; margin: 0; border-radius: 0 4px 4px 0; }
    .nav-item.buy-nav { order: -1; margin-bottom: 10px; color: #fff; background: linear-gradient(160deg, var(--blue-500), var(--blue-700)); box-shadow: 0 12px 22px -12px rgba(13, 70, 184, 0.8); }
    .nav-item.buy-nav:hover, .nav-item.buy-nav.active { color: #fff; background: linear-gradient(160deg, var(--blue-500), var(--blue-700)); }
    .buy-icon { width: 24px; height: 24px; margin: 0; border: none; border-radius: 0; background: none; box-shadow: none; color: inherit; }
    .nav-brand { order: -2; }

    .dashboard-page, .wallet-page, .orders-page, .profile-page, .data-page {
        max-width: 1040px;
        padding: 36px clamp(28px, 4vw, 56px) 56px;
    }
    body:has(.bottom-nav) :is(.dashboard-page, .wallet-page, .orders-page, .profile-page, .data-page) { margin: 0 0 0 var(--nav-w); }
    .page-header { margin-bottom: 28px; }
    .page-header h1 { text-align: left; font-size: 28px; }
    .back-button { display: none; }
    .header-space { display: none; }
}

@media (min-width: 1280px) {
    body:has(.bottom-nav) :is(.dashboard-page, .wallet-page, .orders-page, .profile-page, .data-page) { margin-left: max(var(--nav-w), calc((100vw - 1040px + var(--nav-w)) / 2 - 24px)); }
}

/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.dashboard-top .welcome-text { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.dashboard-top h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.035em; overflow-wrap: anywhere; }

.profile-button {
    width: 48px; height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border-radius: 16px; color: #fff; font-weight: 800; font-size: 16px; text-decoration: none; text-transform: uppercase;
    background: linear-gradient(160deg, var(--blue-500), var(--blue-700));
    box-shadow: 0 8px 16px -8px rgba(13, 70, 184, 0.7);
    transition: transform 0.2s var(--ease);
}
.profile-button:hover { color: #fff; transform: translateY(-1px); }

.wallet-card, .wallet-balance-card {
    position: relative; overflow: hidden;
    padding: 22px 22px 22px;
    border-radius: var(--radius-xl);
    color: #fff;
    background:
        radial-gradient(360px 220px at 100% 0%, rgba(90, 147, 245, 0.55), transparent 70%),
        radial-gradient(300px 240px at 0% 120%, rgba(47, 116, 240, 0.4), transparent 70%),
        linear-gradient(150deg, var(--blue-700), var(--navy-900));
    box-shadow: var(--shadow-lg);
}
.wallet-card::after, .wallet-balance-card::after {
    content: ""; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%;
    border: 36px solid rgba(255, 255, 255, 0.06); pointer-events: none;
}
.wallet-top { display: flex; align-items: center; justify-content: space-between; color: #cfe0ff; font-size: 14px; font-weight: 700; }
.wallet-icon {
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border-radius: 11px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 16px; font-weight: 800;
}
.balance, .wallet-balance-card h2 {
    margin: 10px 0 18px; color: #fff;
    font-size: clamp(34px, 9vw, 44px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05;
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.wallet-button {
    min-height: 48px; padding: 0 22px; position: relative; z-index: 1;
    background: #fff; color: var(--blue-700);
    box-shadow: 0 10px 18px -10px rgba(0, 0, 0, 0.5);
}
.wallet-button:hover { color: var(--blue-700); transform: translateY(-1px); }

.dashboard-section { margin-top: 26px; }

.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.action-card {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    padding: 14px 4px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); color: var(--ink);
    font-size: 13px; font-weight: 700; text-decoration: none; text-align: center;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s var(--ease), box-shadow 0.2s ease, border-color 0.2s ease;
}
.action-card:hover { color: var(--ink); transform: translateY(-2px); border-color: var(--blue-100); box-shadow: var(--shadow-md); }
.action-card:active { transform: scale(0.97); }
.action-icon, .wallet-action-icon, .transaction-icon, .empty-icon {
    width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
    border-radius: 15px; background: var(--blue-50); color: var(--blue-600);
}
.action-icon .cx-icon, .wallet-action-icon .cx-icon, .transaction-icon .cx-icon, .empty-icon .cx-icon { width: 23px; height: 23px; }
.action-card:first-child .action-icon { background: linear-gradient(160deg, var(--blue-500), var(--blue-700)); color: #fff; }

.ussd-card {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--blue-100); border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--blue-50), #fff);
    box-shadow: var(--shadow-xs);
}
.ussd-label { display: inline-block; margin-bottom: 4px; color: var(--blue-600); font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.ussd-info h2 { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.ussd-info p { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ussd-info p strong { color: var(--ink); }
.ussd-access {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 10px 14px; border-radius: 14px; background: var(--navy-900); color: #bcd2fa; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.ussd-access strong { color: #fff; font-size: 20px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* recent orders on dashboard */
.orders-section .empty-orders, .orders-empty, .transaction-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 28px 20px; text-align: center;
    border: 1.5px dashed #c6d6ee; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.7);
}
.empty-icon, .transaction-icon { margin-bottom: 6px; }
.empty-orders h3, .orders-empty h2, .transaction-empty h3 { font-size: 17px; font-weight: 800; }
.empty-orders p, .orders-empty p, .transaction-empty p { max-width: 300px; margin-bottom: 8px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

.orders-section .empty-orders:has(.dashboard-order-item) {
    display: block; padding: 6px; border: 1px solid var(--line); border-style: solid; background: var(--surface); box-shadow: var(--shadow-xs);
}
.dashboard-order-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 14px; border-radius: 14px; color: var(--ink); text-decoration: none; text-align: left;
    transition: background-color 0.2s ease;
}
.dashboard-order-item + .dashboard-order-item { border-top: 1px solid var(--line-2); border-radius: 0 0 14px 14px; }
.dashboard-order-item:hover { color: var(--ink); background: var(--sky-50); }
.dashboard-order-item > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dashboard-order-item > div:last-child { text-align: right; flex-shrink: 0; }
.dashboard-order-item strong { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dashboard-order-item span { color: var(--muted); font-size: 13px; }

@media (min-width: 900px) {
    .dashboard-page [data-cx-content] { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
    .dashboard-page [data-cx-content][hidden] { display: none; }
    .dashboard-top { grid-column: 1 / -1; margin-bottom: 26px; }
    .wallet-card { grid-column: 1; grid-row: 2; }
    .dashboard-page .dashboard-section[aria-label="Quick actions"] { grid-column: 1; grid-row: 3; }
    .ussd-section { grid-column: 2; grid-row: 2; margin-top: 0; align-self: stretch; }
    .ussd-section .ussd-card { height: 100%; justify-content: center; }
    .orders-section { grid-column: 2; grid-row: 3; }
    .ussd-card { flex-direction: column; align-items: flex-start; }
    .ussd-access { flex-direction: row; gap: 10px; }
    .dashboard-top h1 { font-size: 32px; }
}

@media (max-width: 359px) {
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ussd-card { flex-direction: column; align-items: flex-start; }
    .dashboard-top h1 { font-size: 23px; }
}



/* dashboard: compact brand row (phones) + wallet card actions */
.dash-brand { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--navy-900); font-size: 14px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.dash-brand:hover { color: var(--navy-900); }
.dash-brand svg { width: 28px; height: 28px; filter: drop-shadow(0 4px 8px rgba(13, 70, 184, 0.25)); }
.wallet-card-actions { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.wallet-button-ghost { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.3); box-shadow: none; }
.wallet-button-ghost:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
@media (min-width: 900px) { .dash-brand { display: none; } }

/* =========================================================
   BUY DATA
========================================================= */

.data-section { margin-bottom: 22px; counter-increment: step; }
.data-page { counter-reset: step; }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.data-section .section-title h2 { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.data-section .section-title h2::before {
    content: counter(step);
    width: 26px; height: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border-radius: 9px; background: var(--blue-600); color: #fff; font-size: 13px; font-weight: 800;
}

.network-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.network-select {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 92px; padding: 12px 6px;
    border: 1.5px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); color: var(--ink);
    font-size: 15px; font-weight: 800; letter-spacing: -0.01em;
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s var(--ease), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.network-select:hover { border-color: var(--blue-400); transform: translateY(-1px); }
.network-select:active { transform: scale(0.97); }
.network-select.active {
    border-color: var(--blue-600); background: var(--blue-50);
    box-shadow: 0 0 0 3px rgba(47, 116, 240, 0.18), var(--shadow-sm);
}
.network-select.active::after {
    content: ""; position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--blue-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.network-letter, .package-logo {
    width: 42px; height: 42px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px; font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
}
.mtn-bg { background: #ffcb05; color: #14213d; }
.telecel-bg { background: var(--navy-900); color: #fff; }
.at-bg { background: var(--blue-100); color: var(--blue-700); box-shadow: inset 0 0 0 1.5px #b9d0ff; }

.category-tabs {
    display: flex; gap: 6px; padding: 5px; margin-bottom: 14px;
    border-radius: var(--radius-md); background: #e4ecf9; overflow-x: auto;
}
.category-tab {
    flex: 1 0 auto; min-height: 42px; padding: 0 16px; border: none; border-radius: 10px;
    background: transparent; color: var(--muted); font-size: 14.5px; font-weight: 700;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.category-tab.active { background: var(--surface); color: var(--blue-700); box-shadow: var(--shadow-sm); }

.package-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.package-card {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
    min-height: 118px; padding: 14px; text-align: left;
    border: 1.5px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); color: var(--ink);
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s var(--ease), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.package-card:hover { border-color: var(--blue-400); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.package-card:active { transform: scale(0.98); }
.package-card.selected {
    border-color: var(--blue-600); background: var(--blue-50);
    box-shadow: 0 0 0 3px rgba(47, 116, 240, 0.2), var(--shadow-sm);
}
.package-card.selected::after {
    content: ""; position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--blue-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.package-logo { width: 34px; height: 34px; border-radius: 11px; font-size: 12.5px; }
.package-info { display: flex; flex-direction: column; gap: 2px; }
.package-info strong { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.package-info span { color: var(--blue-700); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.package-card.locked, .package-card.locked:hover { background: #f1f5fb; border-color: var(--line); transform: none; box-shadow: none; cursor: not-allowed; }
.package-card.locked .package-logo { opacity: 0.45; filter: grayscale(1); }
.lock-note { display: inline-flex; align-items: center; gap: 5px; color: var(--danger) !important; font-size: 12.5px; font-weight: 700; }
.lock-note svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.package-status {
    grid-column: 1 / -1; padding: 28px 16px; text-align: center;
    border: 1.5px dashed #c6d6ee; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.7);
    color: var(--muted); font-size: 15px; font-weight: 600;
}

/* Purchase bar: floats above the nav on phones, sticky summary on desktop */
.purchase-bottom {
    position: fixed; left: 12px; right: 12px; z-index: 15;
    bottom: calc(80px + env(safe-area-inset-bottom));
    max-width: 536px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 12px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}
.selected-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.selected-info span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.selected-info strong { font-size: 15px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.continue-button { flex-shrink: 0; min-height: 50px; padding: 0 24px; }
.purchase-note { display: none; }

.data-page { padding-bottom: calc(196px + env(safe-area-inset-bottom)); }
.data-page:not(:has(.purchase-bottom)) { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

@media (min-width: 640px) {
    .package-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
    .data-page:has(.purchase-bottom) {
        display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 32px; align-content: start; padding-bottom: 56px;
    }
    .data-page:has(.purchase-bottom) > .page-header { grid-column: 1 / -1; }
    .data-page:has(.purchase-bottom) > .data-section { grid-column: 1; }
    .data-page:has(.purchase-bottom) > .purchase-bottom {
        grid-column: 2; grid-row: 2 / span 4; align-self: start;
        position: sticky; top: 28px; left: auto; right: auto; bottom: auto; max-width: none; margin: 0;
        flex-direction: column; align-items: stretch; gap: 16px; padding: 22px;
        border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-md);
        -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    .selected-info strong { font-size: 20px; }
    .continue-button { width: 100%; min-height: 54px; }
    .purchase-note { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
    .package-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
    .package-info strong { font-size: 19px; }
    .network-select { font-size: 14px; min-height: 86px; }
    .continue-button { padding: 0 16px; }
    .purchase-bottom { left: 8px; right: 8px; padding-left: 12px; }
}

/* ---------- Bottom sheets / modals (payment + fund wallet) ---------- */

.sheet-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(6, 17, 40, 0.55);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; }

.pay-sheet, .fund-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-width: 520px; max-height: 92vh; max-height: 92dvh; margin: 0 auto;
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -24px 60px -20px rgba(6, 17, 40, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s var(--ease);
}
.pay-sheet.open, .fund-sheet.open { transform: translateY(0); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 999px; background: #d3deef; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 21px; font-weight: 800; }

@media (min-width: 640px) {
    .pay-sheet, .fund-sheet {
        left: 50%; right: auto; top: 50%; bottom: auto; width: 480px; max-width: calc(100vw - 32px);
        padding: 24px 24px 24px; border-radius: var(--radius-xl);
        transform: translate(-50%, -46%); opacity: 0;
        transition: transform 0.28s var(--ease), opacity 0.2s ease;
    }
    .pay-sheet.open, .fund-sheet.open { transform: translate(-50%, -50%); opacity: 1; }
    .sheet-handle { display: none; }
}

.order-summary { display: flex; flex-direction: column; margin-bottom: 18px; padding: 4px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--sky-50); }
.order-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.order-summary > div:last-child { border-bottom: none; }
.order-summary dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.order-summary dd { text-align: right; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.order-summary .total dt { color: var(--ink); font-weight: 800; }
.order-summary .total dd { color: var(--blue-700); font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }

.pay-options { display: flex; flex-direction: column; gap: 10px; }
.pay-option {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 16px; text-align: left;
    border: 1.5px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s var(--ease), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.pay-option:hover:not(:disabled) { border-color: var(--blue-500); background: var(--blue-50); box-shadow: var(--shadow-sm); }
.pay-option:active:not(:disabled) { transform: scale(0.99); }
.pay-option:disabled { opacity: 0.55; cursor: not-allowed; }
.pay-option-icon { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--blue-50); color: var(--blue-600); }
.pay-option-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pay-option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-option-text strong { font-size: 16px; font-weight: 800; }
.pay-option-text span { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.pay-option-text span.low { color: var(--danger); font-weight: 700; }
.pay-option .arrow { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--muted-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Receipt (order confirmation) ---------- */

.receipt { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--blue-50), var(--bg)); animation: fade 0.25s ease both; }
.receipt-scroll { flex: 1; overflow-y: auto; padding: max(20px, env(safe-area-inset-top)) 16px 16px; display: flex; }
.receipt-paper {
    width: 100%; max-width: 440px; margin: auto; padding: 28px 24px 24px;
    border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg);
    animation: rise 0.4s var(--ease) both;
}
.receipt-head { text-align: center; margin-bottom: 18px; }
.receipt-mark { width: 46px; height: 46px; margin-bottom: 8px; }
.receipt-brand { display: flex; flex-direction: column; align-items: center; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: var(--navy-900); }
.receipt-brand span { margin-top: 3px; font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--blue-600); }
.receipt-kicker { margin-top: 10px; color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.receipt-status {
    display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto 18px; width: fit-content;
    padding: 8px 16px 8px 10px; border-radius: 999px; background: var(--success-bg); border: 1px solid var(--success-line);
    color: var(--success); font-size: 14.5px; font-weight: 800;
}
.receipt-check { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--success); }
.receipt-check svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.receipt-amount-label { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.receipt-amount { margin: 2px 0 20px; text-align: center; font-size: 38px; font-weight: 800; letter-spacing: -0.04em; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.receipt-rows { border-top: 1.5px dashed #cdd9ec; }
.receipt-row { display: flex; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.receipt-row dt { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.receipt-row dd { text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.receipt-foot { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.receipt-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 440px; margin: 0 auto; padding: 4px 16px calc(18px + env(safe-area-inset-bottom)); }
.receipt-actions .primary-btn, .receipt-actions .secondary-btn { width: 100%; }

/* =========================================================
   WALLET
========================================================= */

.wallet-balance-card { text-align: left; }
.wallet-balance-card p { color: #cfe0ff; font-size: 14px; font-weight: 700; }
.wallet-balance-card h2 { margin: 8px 0 6px; }
.wallet-balance-card span { color: #9fbbea; font-size: 13px; font-weight: 600; }

.wallet-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 26px; }
.wallet-action {
    display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; text-align: left;
    border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
    font-size: 15px; font-weight: 800; text-decoration: none; box-shadow: var(--shadow-xs);
    transition: transform 0.2s var(--ease), box-shadow 0.2s ease, border-color 0.2s ease;
}
.wallet-action:hover { color: var(--ink); transform: translateY(-2px); border-color: var(--blue-100); box-shadow: var(--shadow-md); }
.wallet-action:active { transform: scale(0.98); }
.wallet-action:first-child .wallet-action-icon { background: linear-gradient(160deg, var(--blue-500), var(--blue-700)); color: #fff; }
.wallet-action-icon { width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0; }

.transactions { margin-top: 4px; }
.transaction-list { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.transaction-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.transaction-row:last-child { border-bottom: none; }
.transaction-main { min-width: 0; }
.transaction-desc { font-size: 15px; font-weight: 700; }
.transaction-date { margin-top: 2px; color: var(--muted); font-size: 13px; }
.transaction-amount { flex-shrink: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.transaction-amount.is-credit { color: var(--success); }
.transaction-amount.is-debit { color: var(--ink); }

/* Fund wallet sheet */
.fund-balance-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--blue-50); color: var(--muted); font-size: 14px; font-weight: 600; }
.fund-balance-row strong { color: var(--navy-900); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fund-amount-field { position: relative; }
.fund-currency { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--blue-700); font-weight: 800; font-size: 17px; pointer-events: none; }
.fund-amount-field input { height: 62px; padding-left: 64px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fund-quick-amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.fund-quick {
    min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2);
    font-size: 14.5px; font-weight: 800; transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.fund-quick:hover { border-color: var(--blue-400); }
.fund-quick.is-active { border-color: var(--blue-600); background: var(--blue-50); color: var(--blue-700); }
.fund-actions { display: flex; gap: 10px; margin-top: 18px; }
.fund-cancel { flex: 0 0 auto; min-height: 52px; padding: 0 20px; border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-2); font-weight: 700; }
.fund-cancel:hover { background: var(--sky-50); }
.fund-continue { flex: 1; width: auto !important; margin-top: 0 !important; }

@media (min-width: 900px) {
    .wallet-page [data-cx-content] { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 0 32px; align-items: start; }
    .wallet-page [data-cx-content][hidden] { display: none; }
    .wallet-balance-card { grid-column: 1; }
    .wallet-actions { grid-column: 1; grid-template-columns: 1fr; margin-bottom: 0; }
    .transactions { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}

/* =========================================================
   ORDERS
========================================================= */

.orders-list { display: grid; gap: 12px; }
.order-card {
    padding: 16px 16px 12px; border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-xs);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.order-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue-100); }
.order-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.order-card-top h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.order-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.order-row span { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.order-row strong { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.order-reference strong { font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.order-status {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px;
    background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100);
    font-size: 12.5px; font-weight: 800; text-transform: capitalize; line-height: 1.2;
}
.order-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.order-status.is-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.order-status.is-failed { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.order-status.is-neutral { background: #eef1f6; color: var(--ink-2); border-color: #dbe1ec; }

@media (min-width: 900px) {
    .orders-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
    .orders-empty { grid-column: 1 / -1; }
}

/* =========================================================
   PROFILE
========================================================= */

.profile-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 20px; margin-bottom: 22px; text-align: center;
    border-radius: var(--radius-xl); color: #fff;
    background: radial-gradient(340px 200px at 100% 0%, rgba(90, 147, 245, 0.5), transparent 70%), linear-gradient(150deg, var(--blue-700), var(--navy-900));
    box-shadow: var(--shadow-lg);
}
.profile-avatar {
    width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
    border-radius: 24px; background: rgba(255, 255, 255, 0.16); border: 1.5px solid rgba(255, 255, 255, 0.28);
    color: #fff; font-size: 26px; font-weight: 800; text-transform: uppercase;
}
.profile-card h2 { color: #fff; font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.profile-card p { color: #c3d5f5; font-size: 14.5px; overflow-wrap: anywhere; }

.profile-section { margin-bottom: 22px; }
.profile-section h2 { margin: 0 4px 10px; color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.profile-list { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.profile-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 12px 16px;
    border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none;
    transition: background-color 0.2s ease;
}
.profile-item:last-child { border-bottom: none; }
a.profile-item:hover { background: var(--sky-50); color: var(--ink); }
.profile-item > div { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.profile-item span { color: var(--muted); font-size: 13px; font-weight: 600; }
.profile-item strong { font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; }
.profile-arrow { color: var(--muted-2); font-size: 24px; line-height: 1; }
.profile-arrow { flex-shrink: 0; }

.logout-button { width: 100%; background: var(--surface); color: var(--ink-2); border: 1.5px solid var(--line); box-shadow: var(--shadow-xs); }
.logout-button:hover { background: var(--sky-50); border-color: #c4d3ea; color: var(--ink); }
.logout-button:active { transform: scale(0.99); }
.logout-button:disabled { opacity: 0.6; cursor: not-allowed; }

@media (min-width: 900px) {
    .profile-page [data-cx-content] { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 0 32px; align-items: start; }
    .profile-page [data-cx-content][hidden] { display: none; }
    .profile-card { grid-column: 1; grid-row: 1; margin-bottom: 16px; }
    .logout-button { grid-column: 1; grid-row: 2; }
    .profile-section { grid-column: 2; }
}

/* =========================================================
   LEGAL, 404, FOOTER, TOAST, CONSENT
========================================================= */

.data-page.legal-page, .notfound-page { max-width: 720px; margin: 0 auto; }
.legal-page { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.legal-page .page-header { text-align: left; }
.legal-page .page-header h1 { text-align: center; }
.legal-updated { margin: -8px 0 22px; color: var(--muted); font-size: 13.5px; text-align: center; }
.legal-content { padding: 24px 20px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); }
.legal-content h2 { margin: 28px 0 10px; font-size: 18px; font-weight: 800; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p, .legal-content li { color: var(--ink-2); font-size: 15.5px; line-height: 1.7; }
.legal-content p { margin: 0 0 12px; }
.legal-content ul { margin: 0 0 12px; padding-left: 22px; }
.legal-content li { margin: 6px 0; }
.legal-content a { overflow-wrap: anywhere; font-weight: 600; }
.legal-content strong { color: var(--ink); }

.notfound-page { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-bottom: 24px; }
.notfound-mark { width: 84px; height: 84px; margin-bottom: 22px; filter: drop-shadow(0 12px 20px rgba(13, 70, 184, 0.3)); }
.notfound-page h1 { font-size: 28px; font-weight: 800; }
.notfound-page p { max-width: 340px; margin: 10px 0 26px; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.notfound-page .primary-btn { min-width: 220px; }

.site-footer { max-width: 560px; margin: 0 auto; padding: 8px 20px calc(28px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 22px; }
.site-footer a, .site-footer .link-btn { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.site-footer .link-btn { font-size: inherit; }
@media (min-width: 960px) {
    body:has(.auth-aside) .site-footer { width: 54%; max-width: none; margin-left: 46%; position: relative; }
}

.toast {
    position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 90;
    max-width: min(420px, calc(100vw - 32px)); padding: 13px 18px;
    border-radius: 14px; background: var(--navy-900); color: #fff; font-size: 14.5px; font-weight: 600; line-height: 1.45; text-align: center;
    box-shadow: var(--shadow-lg);
    opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { body:has(.bottom-nav) .toast { left: calc(50% + var(--nav-w) / 2); bottom: 32px; } }

.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.consent-card { max-width: 480px; margin: 0 auto; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); pointer-events: auto; }
.consent-card p { color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.consent-card a { font-weight: 700; }
.consent-actions { display: flex; gap: 10px; margin-top: 14px; }
.consent-actions .primary-btn, .consent-actions .secondary-btn { flex: 1; width: auto; min-height: 46px; margin-top: 0; font-size: 15px; }

/* =========================================================
   AGENT SHOP (shop.html shares the data-page shell)
========================================================= */

.shop-intro { margin-bottom: 8px; }
.shop-intro p { color: var(--muted); font-size: 14.5px; }
[data-shop-view][hidden] { display: none !important; }
.data-page:has([data-shop-view]) { padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
.data-page:has([data-shop-view]) .page-header h1 { text-align: center; }
@media (min-width: 900px) { .data-page:has([data-shop-view]) { max-width: 760px; margin: 0 auto; } }

/* support button clears the floating purchase bar on phones */
@media (max-width: 899px) {
    body:has(.purchase-bottom) .nixx-support { bottom: calc(166px + env(safe-area-inset-bottom)); }
}

/* =========================================================
   MOTION
========================================================= */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

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

/* =========================================================
   PRINT (receipt)
========================================================= */

@page { margin: 8mm; }
@media print {
    html, body.receipt-open { background: #fff !important; overflow: visible; }
    body.receipt-open > *:not(#receipt) { display: none !important; }
    body.receipt-open .receipt { position: static; display: block; background: #fff; animation: none; }
    body.receipt-open .receipt-scroll { overflow: visible; padding: 0; }
    body.receipt-open .receipt-paper { max-width: 105mm; margin: 0 auto; padding: 3mm 0 0; border: none; border-radius: 0; box-shadow: none; animation: none; }
    body.receipt-open .receipt-actions { display: none !important; }
    body.receipt-open .receipt-paper, body.receipt-open .receipt-paper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .site-footer, .consent, .nixx-support { display: none !important; }
}
